user1417: [FEN "8/8/b7/8/8/8/8/4K2R w - - 0 1 "]

In this case White hasn't moved his King yet. Is castling allowed?

user924: It's not possible to castle, because the f1 square is attacked.
See the Laws of Chess; article 3.8 (King moves), b(2):

Castling is prevented temporarily:

if the square on which the king stands, or the square which it must cross, or the square which it is to occupy, is attacked by one or more of the opponent's pieces, or
if there is any piece between the king and the rook with which castling is to be effected. 



1417: <pre><code>[FEN "8/8/b7/8/8/8/8/4K2R w - - 0 1 "]
</code></pre>

<p>In this case White hasn't moved his King yet. Is castling allowed?</p>
 924: <p>It's not possible to castle, because the <code>f1</code> square is attacked.</p>

<p>See the <a href="http://www.fide.com/fide/handbook.html?id=124&amp;view=article" rel="noreferrer">Laws of Chess</a>; article 3.8 (King moves), b(2):</p>

<blockquote>
  <p>Castling is prevented temporarily:</p>
  
  <ul>
  <li>if the square on which the king stands, <strong>or the square which it must cross</strong>, or the square which it is to occupy, is attacked by one or more of the opponent's pieces, or</li>
  <li>if there is any piece between the king and the rook with which castling is to be effected. </li>
  </ul>
</blockquote>
