[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: issue with AC_CHECK_LIB...

From: Ossama Othman
Subject: Re: issue with AC_CHECK_LIB...
Date: 30 Jun 2004 16:21:09 -0700

Hi Bob and Chris,

On Wed, 2004-06-30 at 15:52, Bob Friesenhahn wrote:
> I was going to suggest using AC_TRY_LINK but for some reason I can't 
> find it in the Autoconf documentation anymore.  Instead I see a 
> AC_LINK_IFELSE macro which must be used in conjunction with 
> AC_LANG_PROGRAM.  Maybe AC_TRY_LINK has been retired.

Yep.  From what I recall the AC_*_IFELSE macros provide more
uniform/consistent interfaces than their deprecated AC_TRY_*
counterparts.  Perhaps Akim can confirm this.

> Unfortunately, I do not have time to write an example.  I think that 
> almost any compilable code fragment which lacks a main routine will 
> serve as a test.  You would temporarily add the library to be tested 
> to LIBS.  If you have a successful link, then a main() routine was 
> found somewhere.

Here's an example from the ACE configure script:

dnl Use a more comprehensive test for shm_open() since the prototype
dnl may not be visible on all platforms without enabling POSIX.1b
dnl support (e.g. when the user defines _POSIX_C_SOURCE > 2).
AC_MSG_CHECKING([for shm_open])
# include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
           const char name[] = "Foo";
           const int oflag = O_RDONLY;
           const mode_t mode = 0400;  /* Whatever */
           const int fd = shm_open (name, oflag, mode);

You'll of course have to add the library you're testing for to $LIBS
before you run the link-time test, and remove it if the test fails.

Ossama Othman <ossama @ dre . vanderbilt . edu>
1024D/F7A394A8 - 84ED AA0B 1203 99E4 1068  70E6 5EB7 5E71 F7A3 94A8

reply via email to

[Prev in Thread] Current Thread [Next in Thread]