EX_CHECK_STATE=NO
ex_check_save_LIBS=${LIBS}
ex_check_save_CPPFLAGS=${CPPFLAGS}
- ex_check_save_LDFLAGS=${LDPFLAGS}
+ ex_check_save_LDFLAGS=${LDFLAGS}
if test "x$7" != "x"; then
- CPPFLAGS="-I$7 $CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS -I$7"
fi
dnl try compiling naked first
AC_CHECK_LIB($1,$2, [
LIBS=${LIBS}" "`$PKGCONFIG --libs-only-l $4`
dnl remove the cached value and test again
unset ac_cv_lib_$1_$2
- AC_CHECK_LIB($1,$2,[ AC_CHECK_HEADER($3,[EX_CHECK_STATE=YES],[])],[])
+ AC_CHECK_LIB($1,$2,[
+ unset ac_cv_header_`echo $3 | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+ AC_CHECK_HEADER($3,[EX_CHECK_STATE=YES],[])
+ ],[])
else
AC_MSG_WARN([
----------------------------------------------------------------------------
case "${host_cpu}-${host_os}" in
*-aix* | *-freebsd* | *-darwin*) x_rflag="-D_THREAD_SAFE";;
*solaris* | *-osf* | *-hpux*) x_rflag="-D_REENTRANT";;
+ *-linux*)
+ if test x"$PTHREAD_CFLAGS" = "x-pthread"; then
+ # For Linux/gcc "-pthread" implies "-lpthread". We need, however, to make this explicit
+ # in PTHREAD_LIBS such that a shared library to be built properly depends on libpthread.
+ PTHREAD_LIBS="-lpthread $PTHREAD_LIBS"
+ fi;;
esac
AC_MSG_RESULT(${x_rflag})
if test "x$x_rflag" != xno; then