diff options
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 147 |
1 files changed, 72 insertions, 75 deletions
diff --git a/configure.in b/configure.in index b43c8ec016..143e667ce2 100644 --- a/configure.in +++ b/configure.in @@ -947,54 +947,6 @@ program to use during the build.]) fi fi -# -# Pthreads -# -# For each platform, we need to know about any special compile and link -# libraries, and whether the normal C function names are thread-safe. -# See the comment at the top of src/port/thread.c for more information. -# WIN32 doesn't need the pthread tests; it always uses threads -# -# These tests are run before the library-tests, because linking with the -# other libraries can pull in the pthread functions as a side-effect. We -# want to use the -pthread or similar flags directly, and not rely on -# the side-effects of linking with some other library. -if test "$enable_thread_safety" = yes -a "$PORTNAME" != "win32"; then -AX_PTHREAD # set thread flags - -# Some platforms use these, so just define them. They can't hurt if they -# are not supported. For example, on Solaris -D_POSIX_PTHREAD_SEMANTICS -# enables 5-arg getpwuid_r, among other things. -PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS" - -# Check for *_r functions -_CFLAGS="$CFLAGS" -_LIBS="$LIBS" -CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -LIBS="$LIBS $PTHREAD_LIBS" - -if test "$PORTNAME" != "win32"; then -AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([ -pthread.h not found; use --disable-thread-safety to disable thread safety])]) -fi - -AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r]) - -# Do test here with the proper thread flags -PGAC_FUNC_STRERROR_R_INT - -CFLAGS="$_CFLAGS" -LIBS="$_LIBS" - -else -# do not use values from template file -PTHREAD_CFLAGS= -PTHREAD_LIBS= -fi - -AC_SUBST(PTHREAD_CFLAGS) -AC_SUBST(PTHREAD_LIBS) - ## ## Libraries @@ -1095,33 +1047,6 @@ if test "$with_libxslt" = yes ; then AC_CHECK_LIB(xslt, xsltCleanupGlobals, [], [AC_MSG_ERROR([library 'xslt' is required for XSLT support])]) fi -# Note: We can test for libldap_r only after we know PTHREAD_LIBS -if test "$with_ldap" = yes ; then - _LIBS="$LIBS" - if test "$PORTNAME" != "win32"; then - AC_CHECK_LIB(ldap, ldap_bind, [], - [AC_MSG_ERROR([library 'ldap' is required for LDAP])], - [$EXTRA_LDAP_LIBS]) - LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS" - if test "$enable_thread_safety" = yes; then - # on some platforms ldap_r fails to link without PTHREAD_LIBS - AC_CHECK_LIB(ldap_r, ldap_simple_bind, [], - [AC_MSG_ERROR([library 'ldap_r' is required for LDAP])], - [$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS]) - LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS" - else - LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS" - fi - else - AC_CHECK_LIB(wldap32, ldap_bind, [], [AC_MSG_ERROR([library 'wldap32' is required for LDAP])]) - LDAP_LIBS_FE="-lwldap32" - LDAP_LIBS_BE="-lwldap32" - fi - LIBS="$_LIBS" -fi -AC_SUBST(LDAP_LIBS_FE) -AC_SUBST(LDAP_LIBS_BE) - # for contrib/sepgsql if test "$with_selinux" = yes; then AC_CHECK_LIB(selinux, security_compute_create_name, [], @@ -1638,6 +1563,78 @@ if test "$with_readline" = yes; then fi +# +# Pthreads +# +# For each platform, we need to know about any special compile and link +# libraries, and whether the normal C function names are thread-safe. +# See the comment at the top of src/port/thread.c for more information. +# WIN32 doesn't need the pthread tests; it always uses threads +if test "$enable_thread_safety" = yes -a "$PORTNAME" != "win32"; then +ACX_PTHREAD # set thread flags + +# Some platforms use these, so just define them. They can't hurt if they +# are not supported. For example, on Solaris -D_POSIX_PTHREAD_SEMANTICS +# enables 5-arg getpwuid_r, among other things. +PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS" + +# Check for *_r functions +_CFLAGS="$CFLAGS" +_LIBS="$LIBS" +CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +LIBS="$LIBS $PTHREAD_LIBS" + +if test "$PORTNAME" != "win32"; then +AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([ +pthread.h not found; use --disable-thread-safety to disable thread safety])]) +fi + +AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r]) + +# Do test here with the proper thread flags +PGAC_FUNC_STRERROR_R_INT + +CFLAGS="$_CFLAGS" +LIBS="$_LIBS" + +else +# do not use values from template file +PTHREAD_CFLAGS= +PTHREAD_LIBS= +fi + +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_LIBS) + + +# We can test for libldap_r only after we know PTHREAD_LIBS +if test "$with_ldap" = yes ; then + _LIBS="$LIBS" + if test "$PORTNAME" != "win32"; then + AC_CHECK_LIB(ldap, ldap_bind, [], + [AC_MSG_ERROR([library 'ldap' is required for LDAP])], + [$EXTRA_LDAP_LIBS]) + LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS" + if test "$enable_thread_safety" = yes; then + # on some platforms ldap_r fails to link without PTHREAD_LIBS + AC_CHECK_LIB(ldap_r, ldap_simple_bind, [], + [AC_MSG_ERROR([library 'ldap_r' is required for LDAP])], + [$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS]) + LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS" + else + LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS" + fi + else + AC_CHECK_LIB(wldap32, ldap_bind, [], [AC_MSG_ERROR([library 'wldap32' is required for LDAP])]) + LDAP_LIBS_FE="-lwldap32" + LDAP_LIBS_BE="-lwldap32" + fi + LIBS="$_LIBS" +fi +AC_SUBST(LDAP_LIBS_FE) +AC_SUBST(LDAP_LIBS_BE) + + # This test makes sure that run tests work at all. Sometimes a shared # library is found by the linker, but the runtime linker can't find it. # This check should come after all modifications of compiler or linker |