You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Martin Kraemer <Ma...@Fujitsu-Siemens.com> on 2001/08/20 09:09:39 UTC

checking for main in -ldb ...

The current CVS tree for httpd-2.0 breaks on FreeBSD during configure:

> checking whether to enable mod_auth_db... checking dependencies
> checking for db.h... yes
> checking for main in -ldb... no
> checking whether to enable mod_auth_db... configure: error: mod_auth_db has been requested but can not be built due to prerequisite failures

Of course, the check for -ldb is not really necessary if the db*
functions are (as in FreeBSD) part of libc.

Also, I wondered why -ldb should contain a "main()" and had a look
at the config.log:

> configure:3178: checking for main in -ldb
> configure:3193: gcc -o conftest -g -O2 -Wall -D_REENTRANT -D_THREAD_SAFE -L/usr/local/ssl/lib conftest.c -ldb  -lm -lcrypt  1>&5
> /usr/libexec/elf/ld: cannot find -ldb
> configure: failed program was:
> #line 3186 "configure"
> #include "confdefs.h"
>
> int main() {
> main()
> ; return 0; }
> configure:3223: checking whether to enable mod_auth_db

What is the main() { main(); } supposed to do? Simply check for the
existence of a lib? IMHO that is not a "clean" way to do it, as its
output (for "human consumption") is totally misleading regarding
what is currently checked for.

Doesn't autoconf provide a better way to check for libs?
I committed a (temporary?) fix which
a) checks for dbopen() instead of main()
b) checks for dbopen in libc first, and only checks for dbopen in libdb
   if the first test fails.

I did not do it m4-like, though. I am not good enough at using AC_*
macros yet. Probably there was a ifelse() construct which I could have
used...

   Martin
-- 
<Ma...@Fujitsu-Siemens.com>    |       Fujitsu Siemens
       <ma...@apache.org>              |   81730  Munich,  Germany

Re: checking for main in -ldb ...

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Mon, Aug 20, 2001 at 09:09:39AM +0200, Martin Kraemer wrote:
> What is the main() { main(); } supposed to do? Simply check for the
> existence of a lib? IMHO that is not a "clean" way to do it, as its
> output (for "human consumption") is totally misleading regarding
> what is currently checked for.
> 
> Doesn't autoconf provide a better way to check for libs?
> I committed a (temporary?) fix which
> a) checks for dbopen() instead of main()
> b) checks for dbopen in libc first, and only checks for dbopen in libdb
>    if the first test fails.
> 
> I did not do it m4-like, though. I am not good enough at using AC_*
> macros yet. Probably there was a ifelse() construct which I could have
> used...

Thanks for the catch/commit.  To make it a bit cleaner, I will switch 
it to:

AC_SEARCH_LIBS(dbopen,[c db],,enable_auth_db=no)

This will do what you intended in one line.  However, the libc check is
superfluous with this macro because it will first check for the dbopen
function without any additional libraries (libc should be present
already).  However, I will leave the libc check there just to make it
a bit more explicit.  If someone wants to, they can remove it...

I just checked this on Solaris (no DB whatsoever), FreeBSD (libc has
it), and Linux (libdb has it).  Please double check that it still
works for you.

I'll also be fixing the mod_auth_digest breakage while I'm at it.  
-- justin