title: Confused about configure script and Makefile.in
body: <p>I'm currently learning how to use the <code>autoconf</code>/<code>automake</code> toolchain.  I seem to have a general understanding of the workflow here - basically you have a <code>configure.ac</code> script which generates an executable <code>configure</code> file.  The generated <code>configure</code> script is then executed by the end user to generate <code>Makefile</code>s, so the program can be built/installed.</p>
  
  <p>So the installation for a typical end-user is basically:</p>
  
  <pre><code>./configure
  make
  make install
  make clean
  </code></pre>
  
  <p>Okay, now here's where I'm confused:</p>
  
  <p>As a developer, I've noticed that the auto-generated configure script sometimes won't run, and will error with:</p>
  
  <pre><code>config.status: error: cannot find input file: `somedir/Makefile.in' 
  </code></pre>
  
  <p>This confuses me, because I thought the configure script is supposed to <em>generate</em> the <code>Makefile.in</code>.  So Googling around for some answers, I've discovered that this can be fixed with an <code>autogen.sh</code> script, which basically "resets" the state of the <code>autoconf</code> environment.  A typical <code>autogen.sh</code> script would be something like:</p>
  
  <pre><code>aclocal \
  &amp;&amp; automake --add-missing \
  &amp;&amp; autoconf
  </code></pre>
  
  <p>Okay fine.  But as an end-user who's downloaded countless tarballs throughout my life, I've <em>never</em> had to use an <code>autogen.sh</code> script.  All I did was uncompress the tarball, and do the usual configure/make/make install/make clean routine.</p>
  
  <p>But as a developer who's now <em>using</em> <code>autoconf</code>, it seems that <code>configure</code> doesn't actually run unless you run <code>autogen.sh</code> first.  So I find this very confusing, because I thought the end-user shouldn't have to run <code>autogen.sh</code>. </p>
  
  <p>So why do I have to run <code>autogen.sh</code> first - in order for the configure script to find <code>Makefile.in</code>?  Why doesn't the configure script simply generate it?</p>