From 0a64e17a49719acdf60bdc50c74e8a1a83ecd0ba Mon Sep 17 00:00:00 2001 From: Christoph Hohmann Date: Mon, 9 Aug 2004 15:38:23 +0000 Subject: [PATCH] pthread is now used by LDAP and OpenSSL so we should only have 1 test for pthread support in configure.ac --- configure.ac | 40 +++++++++++++++++++++++++++++----------- src/Makefile.am | 1 + src/common/Makefile.am | 3 ++- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 7b8f78955..274e5014b 100644 --- a/configure.ac +++ b/configure.ac @@ -339,13 +339,40 @@ else AC_MSG_RESULT(no) fi +dnl check for pthread support +AC_ARG_ENABLE(pthread, + [ --disable-pthread Disable pthread support], + [ac_cv_enable_pthread=$enableval], [ac_cv_enable_pthread=yes]) +AC_MSG_CHECKING([whether to use pthread]) +if test x$ac_cv_enable_pthread = xno; then + AC_MSG_RESULT(no) +else + AC_MSG_RESULT(yes) + + AC_CHECK_LIB(pthread, pthread_create, :, ac_cv_enable_pthread=no) + AC_CHECK_HEADERS(pthread.h, :, ac_cv_enable_pthread=no) + + if test x$ac_cv_enable_pthread = xyes; then + AC_DEFINE(USE_PTHREAD, 1, Define if you have pthread) + PTHREAD_LIBS="-lpthread" + fi + +fi +AC_SUBST(PTHREAD_LIBS) + dnl for LDAP support in addressbook dnl no check for libraries; dynamically loaded AC_ARG_ENABLE(ldap, [ --enable-ldap Enable LDAP support [default=no]], [ac_cv_enable_ldap=$enableval], [ac_cv_enable_ldap=no]) AC_MSG_CHECKING([whether to use LDAP]) -if test "$ac_cv_enable_ldap" = yes; then +if test x"$ac_cv_enable_ldap" = xno; then + AC_MSG_RESULT(no) +elif test x"$ac_cv_enable_ldap" = xyes -a x"$ac_cv_enable_pthread" = xno; then + AC_MSG_RESULT(no - LDAP support needs pthread support) + + ac_cv_enable_ldap=no +else AC_MSG_RESULT(yes) dnl check for available libraries, and pull them in @@ -355,11 +382,7 @@ if test "$ac_cv_enable_ldap" = yes; then AC_CHECK_LIB(lber, ber_get_tag, LDAP_LIBS="$LDAP_LIBS -llber",, $LDAP_LIBS) - dnl we need libpthread for sylpheed ldap, until we find - dnl a better way to handle ldap requests asynchronously... - AC_CHECK_LIB(pthread, pthread_create, LDAP_LIBS="$LDAP_LIBS -lpthread") - - AC_CHECK_HEADERS(ldap.h lber.h pthread.h, + AC_CHECK_HEADERS(ldap.h lber.h, [ ac_cv_enable_ldap=yes ], [ ac_cv_enable_ldap=no ]) @@ -390,8 +413,6 @@ if test "$ac_cv_enable_ldap" = yes; then AC_DEFINE(USE_LDAP_TLS, 1, Define if you want LDAP TLS support in addressbook.) fi fi -else - AC_MSG_RESULT(no) fi dnl for JPilot support in addressbook @@ -555,9 +576,6 @@ fi AC_SUBST(CLAMAV_LIBS) AM_CONDITIONAL(BUILD_CLAMAV_PLUGIN, test x"$ac_cv_enable_clamav_plugin" = xyes) -AC_CHECK_LIB(pthread, pthread_create, - [ OPENSSL_LIBS="$OPENSSL_LIBS -lpthread" AC_DEFINE(USE_PTHREAD, 1, Define if you have lpthread) ]) - dnl **************************** dnl ** Final configure output ** dnl **************************** diff --git a/src/Makefile.am b/src/Makefile.am index 69fc31f82..7eafec7bf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -372,6 +372,7 @@ sylpheed_LDADD = \ $(OPENSSL_LIBS) \ $(COMPFACE_LIBS) \ $(JPILOT_LIBS) \ + $(PTHREAD_LIBS) \ $(LIBICONV) AM_CPPFLAGS = \ diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 5a7ff1e69..759273cdd 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -69,7 +69,8 @@ AM_CPPFLAGS = \ libsylpheedcommon_la_LIBADD = \ $(GLIB_LIBS) \ $(OPENSSL_LIBS) \ - $(CRYPT_LIBS) + $(CRYPT_LIBS) \ + $(PTHREAD_LIBS) EXTRA_DIST = \ version.h.in -- 2.25.1