title: Packaging a library with Autotools
body: <p>I'm starting out with Autotools, and I'm trying to package a library (a generic stack implementation for learning purposes) along with some usage examples.</p>
  
  <p>The library source lives in <code>src</code> and the example in <code>examples</code>.</p>
  
  <p>I have the following <code>Makefile.am</code>:</p>
  
  <pre><code>lib_LTLIBRARIES = libstack.la
  libstack_la_SOURCES = src/stack.c    
  
  check_PROGRAMS = example/stack
  example_stack_SOURCES = example/stack.c
  example_stack_LDADD = libstack.la
  </code></pre>
  
  <p>As long as my understanding goes, I need to specify a header for <code>libstack.la</code>, and include that from my example, but I get the following error when running <code>autoreconf</code> after adding <code>libstack_la_HEADERS = src/stack.h</code> to <code>Makefile.am</code>:</p>
  
  <pre><code>$ autoreconf -iv
  ... (omiting irrelevant parts)
  Makefile.am:3: error: 'libstack_la_HEADERS' is used but 'libstack_ladir' is undefined
  autoreconf: automake failed with exit status: 1
  </code></pre>
  
  <p>I couldn't find any information related to the <code>dir</code> prefix.</p>
  
  <p>What am I missing here?</p>