[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
`CHECK_LIB', `CHECK_FUNC' and macros
From: |
Ludovic Courtès |
Subject: |
`CHECK_LIB', `CHECK_FUNC' and macros |
Date: |
Fri, 28 May 2004 12:03:11 +0200 |
User-agent: |
Mutt/1.5.4i [Guile enabled] |
Hi again,
Both `AC_CHECK_LIB' and `AC_CHECK_FUNC' check whether a *symbol* can be
found in the given library (or in one of `$LIBS'). However, on Tru64
UNIX 5.1 (aka. Digital UNIX, OSF1, ...) <pthread.h> does the following:
#define pthread_create __pthread_create
Therefore, `AC_CHECK_LIB([pthread], [pthread_create])' won't work (link
fails) because symbol `pthread_create' does not exist in `libpthread'
(`__pthread_create' does).
As a work around, I did the following:
AC_CHECK_HEADER([pthread.h],
[have_pthread_h="yes"
AC_DEFINE([HAVE_PTHREAD_H], [1],
[Define to 1 if <pthread.h> is available.])],
[have_pthread_h="no"])
if test "x$have_pthread_h" = "xyes"; then
AC_MSG_CHECKING([for pthread_create in -lpthread with pthread.h])
the_old_libs="$LIBS"
LIBS="-lpthread $LIBS"
AC_TRY_LINK([#include <pthread.h>],
[pthread_create (0, 0, 0, 0);],
[have_lib_pthread="yes"],
[have_lib_pthread="no"])
if test "x$have_lib_pthread" = "xyes"; then
SYSLIBS="-lpthread $SYSLIBS"
AC_MSG_RESULT([yes])
else
LIBS="$the_old_libs"
AC_MSG_RESULT([no])
fi
fi
The same problem might very well arise with other headers/libraries,
unless some standard defines which symbols are mandatory. What do
people think about it?
Thanks,
Ludovic.
- `CHECK_LIB', `CHECK_FUNC' and macros,
Ludovic Courtès <=