title: AC_CHECK_LIB does not find library but compilation runs anyway
body: <p>I am adding autotool support to a library project. It relies on another self-written library which is not necessarily in a default library path. So I will set LDFLAGS when configuring.</p>
  
  <p>Nevertheless, I want to check for the library in order to warn the user to set LDFLAGS correctly. Therefore I put in this line:</p>
  
  <pre><code>AC_CHECK_LIB([foo], [foo_func],
           [AC_DEFINE([HAVE_FOO, [1],
                       [Define if you have libfoo])],
           [AC_MSG_WARN([libfoo not found.])])
  </code></pre>
  
  <p>Now, if I do not set LDFLAGS, the check fails as expected and the warning is printed. BUT: When I run <code>make</code>, the code compiles nevertheless, because I have the library path set in the environment variable <code>LD_LIBRARY_PATH</code>. I find this confusing... I would want either the check to fail <strong>and</strong> the code not to compile or the check does not fail <strong>and</strong> the code compiles.</p>
  
  <p>Am I misunderstanding what AC_CHECK_LIB means or what am I doing wrong?  </p>