[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Checking libraries in multiple places -- frusturated by the cache
From: |
Lars Hecking |
Subject: |
Re: Checking libraries in multiple places -- frusturated by the cache |
Date: |
Sun, 25 Feb 2001 19:24:42 +0000 |
User-agent: |
Mutt/1.3.15i |
Robert A. Knop Jr. writes:
> I'm fairly new to autoconf, so this may be a clueless question.
>
> What I'm trying to do is check a few standard places for a library
> and then set a variable (*not* LIBS, but my own) based on where this
> library was found. To this end, I have the following code in
> configure.in:
>
> for i in '' -L$prefix/lib -L$prefix/pgsql/lib; do
> found=''
> AC_MSG_RESULT("Looking for Postgres library in $i")
> AC_CHECK_LIB(pq, PQconnectdb, found=1, found='', $i)
> if test $found; then
> pgsql_lib=$i
> break
> fi
> done
> if test $found; then
> AC_MSG_RESULT("Postgres library found: $pgsql_lib")
> else
> AC_MSG_ERROR("Postgres library not found!")
> fi
>
> The problem I'm having is that after the first test fails, the generated
> configure script never really tests the other places I'm looking for the
> library-- because the failure of the first test is cached, so it thinks it
> doesn't need to do the test again!
>
> Is there some way I can tell configure to throw out the previous cached
> value of this test before tryiing the AC_CHECK_LIB test again? I haven't
> found anything in the documentation which would indicate how one does
> this.
>
> I don't want to include the result of the test in LIBS, I want to set a
> different value; this is why I don't just use AC_SEARCH_LIBS. (In any
> event, AC_SEARCH_LIBS says it sets -lsomething, not -Lsomething.)
I have been doing something very similar for gnuplot: two macros, one
for headers, one for libs, with a for loop around non-caching and silent
versions of the resp. autoconf macros. See attached. I think I wrote
this stuff before AC_SEARCH_LIBS became part of autoconf.
path-hdr.m4
Description: Text document
path-lib.m4
Description: Text document