summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in2
-rw-r--r--build/apr_threads.m489
-rw-r--r--configure.in6
3 files changed, 48 insertions, 49 deletions
diff --git a/Makefile.in b/Makefile.in
index 6402e79ce..0c1bdc174 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -100,7 +100,7 @@ install: $(TARGET_LIB)
$(TARGET_LIB):
@for i in $(SUBDIRS); do objects="$$objects $$i/*.@so_ext@"; done ; \
- tmpcmd="$(LINK) @lib_target@ @lib_target_libs@"; \
+ tmpcmd="$(LINK) @lib_target@ $(ALL_LIBS)"; \
echo $$tmpcmd; \
$$tmpcmd && touch $@
diff --git a/build/apr_threads.m4 b/build/apr_threads.m4
index 83462d99e..fe38290e6 100644
--- a/build/apr_threads.m4
+++ b/build/apr_threads.m4
@@ -70,11 +70,12 @@ fi
dnl
-dnl APR_PTHREADS_CHECK_COMPILE
+dnl APR_PTHREADS_TRY_RUN(actions-if-success)
dnl
-dnl Check whether the current setup can use POSIX threads calls
+dnl Try running a program which uses pthreads, executing the
+dnl actions-if-success commands on success.
dnl
-AC_DEFUN(APR_PTHREADS_CHECK_COMPILE, [
+AC_DEFUN(APR_PTHREADS_TRY_RUN, [
AC_TRY_RUN( [
#include <pthread.h>
#include <stddef.h>
@@ -90,61 +91,65 @@ int main() {
int data = 1;
pthread_mutexattr_init(&mattr);
return pthread_create(&thd, NULL, thread_routine, &data);
-} ], [
- pthreads_working="yes"
- ], [
- pthreads_working="no"
- ], pthreads_working="no" )
+} ], [apr_p_t_r=yes], [apr_p_t_r=no], [apr_p_t_r=no])
+
+if test $apr_p_t_r = yes; then
+ $1
+fi
+
])dnl
dnl
dnl APR_PTHREADS_CHECK()
dnl
-dnl Try to find a way to enable POSIX threads
+dnl Try to find a way to enable POSIX threads. Sets the
+dnl pthreads_working variable to "yes" on success.
dnl
AC_DEFUN(APR_PTHREADS_CHECK,[
-if test -n "$ac_cv_pthreads_lib"; then
- LIBS="$LIBS -l$ac_cv_pthreads_lib"
-fi
-if test -n "$ac_cv_pthreads_cflags"; then
- CFLAGS="$CFLAGS $ac_cv_pthreads_cflags"
+AC_CACHE_CHECK([for CFLAGS needed for pthreads], [apr_cv_pthreads_cflags],
+[apr_ptc_cflags=$CFLAGS
+ for flag in none -kthread -pthread -pthreads -mthreads -Kthread -threads; do
+ CFLAGS=$apr_ptc_cflags
+ test "x$flag" != "xnone" && CFLAGS="$CFLAGS $flag"
+ APR_PTHREADS_TRY_RUN([
+ apr_cv_pthreads_cflags="$flag"
+ break
+ ])
+ done
+ CFLAGS=$apr_ptc_cflags
+])
+
+if test -n "$apr_cv_pthreads_cflags"; then
+ pthreads_working=yes
+ if test "x$apr_cv_pthreads_cflags" != "xnone"; then
+ APR_ADDTO(CFLAGS,[$apr_cv_pthreads_cflags])
+ fi
fi
-APR_PTHREADS_CHECK_COMPILE
-
-AC_CACHE_CHECK(for pthreads_cflags,ac_cv_pthreads_cflags,[
-ac_cv_pthreads_cflags=""
-if test "$pthreads_working" != "yes"; then
- for flag in -kthread -pthread -pthreads -mthreads -Kthread -threads; do
- ac_save="$CFLAGS"
- CFLAGS="$CFLAGS $flag"
- APR_PTHREADS_CHECK_COMPILE
- if test "$pthreads_working" = "yes"; then
- ac_cv_pthreads_cflags="$flag"
+# The CFLAGS may or may not be sufficient to ensure that libapr
+# depends on the pthreads library: some versions of libtool
+# drop -pthread when passed on the link line; some versions of
+# gcc ignore -pthread when linking a shared object. So always
+# try and add the relevant library to LIBS too.
+
+AC_CACHE_CHECK([for LIBS needed for pthreads], [apr_cv_pthreads_lib], [
+ apr_ptc_libs=$LIBS
+ for lib in -lpthread -lpthreads -lc_r; do
+ LIBS="$apr_ptc_libs $lib"
+ APR_PTHREADS_TRY_RUN([
+ apr_cv_pthreads_lib=$lib
break
- fi
- CFLAGS="$ac_save"
+ ])
done
-fi
+ LIBS=$apr_ptc_libs
])
-AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[
-ac_cv_pthreads_lib=""
-if test "$pthreads_working" != "yes"; then
- for lib in pthread pthreads c_r; do
- ac_save="$LIBS"
- LIBS="$LIBS -l$lib"
- APR_PTHREADS_CHECK_COMPILE
- if test "$pthreads_working" = "yes"; then
- ac_cv_pthreads_lib="$lib"
- break
- fi
- LIBS="$ac_save"
- done
+if test -n "$apr_cv_pthreads_lib"; then
+ pthreads_working=yes
+ APR_ADDTO(LIBS,[$apr_cv_pthreads_lib])
fi
-])
if test "$pthreads_working" = "yes"; then
threads_result="POSIX Threads found"
diff --git a/configure.in b/configure.in
index 273feaffa..b89a7afe0 100644
--- a/configure.in
+++ b/configure.in
@@ -186,12 +186,7 @@ else
export_lib_target=''
fi
-# On AIX, libraries need to be specified on the link of lib_target
-lib_target_libs=""
case $host in
- *aix*)
- lib_target_libs="\$(EXTRA_LIBS)";
- ;;
*-solaris2*)
apr_platform_runtime_link_flag="-R"
;;
@@ -207,7 +202,6 @@ AC_SUBST(export_lib_target)
AC_SUBST(shlibpath_var)
AC_SUBST(LTFLAGS)
AC_SUBST(LT_LDFLAGS)
-AC_SUBST(lib_target_libs)
dnl ----------------------------- Checks for compiler flags
nl='