You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2003/11/16 00:42:33 UTC

cvs commit: apr/build apr_threads.m4

jorton      2003/11/15 15:42:33

  Modified:    .        Tag: APR_0_9_BRANCH Makefile.in configure.in
               build    Tag: APR_0_9_BRANCH apr_threads.m4
  Log:
  Backport from HEAD:
  
  * configure.in: Remove lib_target_libs setting for AIX.
  
  * Makefile.in ($(TARGET_LIB)): Use ALL_LIBS instead of
  configured lib_target_libs value in $(LINK) line.
  
  * build/apr_threads.m4 (APR_PTHREAD_TRY_RUN): Rename macro from
  APR_PTHREAD_CHECK_COMPILE; take an actions argument.
  (APR_PTHREADS_CHECK): Rewrite to use APR_PTHREAD_TRY_RUN, fix broken
  use of caching, and always try looking for a library to add to LIBS as
  well as a flag for CFLAGS.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.87.2.1  +1 -1      apr/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apr/Makefile.in,v
  retrieving revision 1.87
  retrieving revision 1.87.2.1
  diff -u -u -r1.87 -r1.87.2.1
  --- Makefile.in	30 Apr 2003 17:28:25 -0000	1.87
  +++ Makefile.in	15 Nov 2003 23:42:33 -0000	1.87.2.1
  @@ -100,7 +100,7 @@
   
   $(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 $@
   
  
  
  
  1.535.2.2 +0 -6      apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.535.2.1
  retrieving revision 1.535.2.2
  diff -u -u -r1.535.2.1 -r1.535.2.2
  --- configure.in	16 Oct 2003 22:13:01 -0000	1.535.2.1
  +++ configure.in	15 Nov 2003 23:42:33 -0000	1.535.2.2
  @@ -186,12 +186,7 @@
         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(shlibpath_var)
   AC_SUBST(LTFLAGS)
   AC_SUBST(LT_LDFLAGS)
  -AC_SUBST(lib_target_libs)
   
   dnl ----------------------------- Checks for compiler flags
   nl='
  
  
  
  No                   revision
  No                   revision
  1.8.2.1   +47 -42    apr/build/apr_threads.m4
  
  Index: apr_threads.m4
  ===================================================================
  RCS file: /home/cvs/apr/build/apr_threads.m4,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -u -r1.8 -r1.8.2.1
  --- apr_threads.m4	1 Apr 2003 00:15:04 -0000	1.8
  +++ apr_threads.m4	15 Nov 2003 23:42:33 -0000	1.8.2.1
  @@ -70,11 +70,12 @@
   
   
   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 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"
  -fi
  +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
  +])
   
  -APR_PTHREADS_CHECK_COMPILE
  +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
   
  -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"