You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Victor J. Orlikowski" <vj...@duke.edu> on 2000/06/16 01:13:46 UTC

[PATCH] AIX proper diagnosis and pthread usage

In 2.0, we use autoconf.
All well and good, but our hints.m4 doesn't handle the AIX versions
presented by /usr/bin/oslevel.
This patch fixes that, as well as adding a workaround for AIX to use
threading in APR when compiling with gcc, since AIX has a broken pthread.h

Index: src/lib/apr/configure.in
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/configure.in,v
retrieving revision 1.113
diff -u -r1.113 configure.in
--- configure.in 2000/06/15 13:12:12 1.113
+++ configure.in 2000/06/15 23:07:29
@@ -201,7 +201,7 @@
 AC_CHECK_FUNCS(strcasecmp stricmp setsid nl_langinfo)
 AC_CHECK_FUNCS(sigaction, [ have_sigaction="1" ], [ have_sigaction="0" ])
 AC_CHECK_FUNCS(writev)
-AC_CHECK_FUNCS(sendfile, [ sendfile="1" ], [ sendfile="0" ])
+AC_CHECK_FUNCS(sendfile send_file, [ sendfile="1" ], [ sendfile="0" ])
 AC_CHECK_FUNCS(fork, [ fork="1" ], [ fork="0" ])
 AC_CHECK_FUNCS(getpass)
 AC_CHECK_FUNC(inet_addr, [ inet_addr="1" ], [ inet_addr="0" ])
@@ -431,9 +431,8 @@
   [ AC_ARG_ENABLE(threads,
     [  --enable-threads        Enable threading support in APR.],
     [ ac_cv_enable_threads=$enableval] ,
-    [ AC_CHECK_HEADERS(pthread.h,
-                   [ ac_cv_enable_threads="pthread" ] ,
-                   [ ac_cv_enable_threads="no" ] ) ] ) ] )
+    [ CHECK_PTHREADS_H([ ac_cv_enable_threads="pthread" ] ,
+                       [ ac_cv_enable_threads="no" ] ) ] ) ] )

 if test "$ac_cv_enable_threads" = "no"; then
 echo "Don't enable threads"
@@ -445,7 +444,7 @@
 # We have specified pthreads for our threading library, just make sure
 # that we have everything we need
       PTHREADS_CHECK
-      AC_CHECK_HEADERS(pthread.h, [
+      CHECK_PTHREADS_H([
           threads="1"
           pthreadh="1"
           AC_DEFINE(USE_THREADS) ], [
@@ -459,7 +458,7 @@
 # them.  In this case, just look for pthreads.  In the future, we can check
 # for other threading libraries as well.
       PTHREADS_CHECK
-      AC_CHECK_HEADERS(pthread.h, [
+      CHECK_PTHREADS_H([
           threads="1"
           pthreadh="1"
           AC_DEFINE(USE_THREADS) ], [
Index: src/lib/apr/hints.m4
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/hints.m4,v
retrieving revision 1.10
diff -u -r1.10 hints.m4
--- hints.m4 2000/06/03 15:56:00 1.10
+++ hints.m4 2000/06/15 23:07:29
@@ -89,14 +89,25 @@
     *-ibm-aix4.1)
  APR_SETIFNULL(CFLAGS, [-DAIX=41 -DNEED_RLIM_T -U__STR__])
  ;;
+    *-ibm-aix4.1.*)
+        APR_SETIFNULL(CFLAGS, [-DAIX=41 -DNEED_RLIM_T -U__STR__])
+        ;;
     *-ibm-aix4.2)
  APR_SETIFNULL(CFLAGS, [-DAIX=42 -U__STR__])
  APR_SETIFNULL(LDFLAGS, [-lm])
  ;;
+    *-ibm-aix4.2.*)
+        APR_SETIFNULL(CFLAGS, [-DAIX=42 -U__STR__])
+        APR_SETIFNULL(LDFLAGS, [-lm])
+        ;;
     *-ibm-aix4.3)
  APR_SETIFNULL(CFLAGS, [-DAIX=43 -U__STR__])
  APR_SETIFNULL(LDFLAGS, [-lm])
  ;;
+    *-ibm-aix4.3.*)
+        APR_SETIFNULL(CFLAGS, [-DAIX=43 -U__STR__])
+        APR_SETIFNULL(LDFLAGS, [-lm])
+        ;;
     *-ibm-aix*)
  APR_SETIFNULL(CFLAGS, [-DAIX=1 -U__STR__])
  APR_SETIFNULL(LDFLAGS, [-lm])
Index: src/lib/apr/threads.m4
===================================================================
RCS file: /cvs/apache/apache-2.0/src/lib/apr/threads.m4,v
retrieving revision 1.10
diff -u -r1.10 threads.m4
--- threads.m4 2000/06/11 11:48:02 1.10
+++ threads.m4 2000/06/15 23:07:29
@@ -34,6 +34,14 @@
   fi
 ])dnl

+dnl Need this for silly broken AIX header files
+AC_DEFUN(CHECK_PTHREADS_H, [
+SAVE_FL="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS -w"
+AC_CHECK_HEADERS(pthread.h, [ $1 ] , [ $2 ] )
+CPPFLAGS="$SAVE_FL"
+])dnl
+
 AC_DEFUN(APR_CHECK_PTHREAD_GETSPECIFIC_TWO_ARGS, [
 AC_CACHE_CHECK(whether pthread_getspecific takes two arguments,
ac_cv_pthread_getspecific_two_args,[
 AC_TRY_COMPILE([



Re: [PATCH] AIX proper diagnosis and pthread usage

Posted by "Victor J. Orlikowski" <vj...@duke.edu>.
Please change the comment on the patch to threads.m4 to read....

dnl gcc issues warnings when parsing AIX 4.3.3's pthread.h.
dnl Turn off warnings if we're using gcc.

:)
Don't want to make anyone unhappy.... 

Victor


Re: [PATCH] AIX proper diagnosis and pthread usage

Posted by Jeff Trawick <tr...@ibm.net>.
> Date: Thu, 15 Jun 2000 22:43:09 -0400 (EDT)
> From: "Victor J. Orlikowski" <vj...@duke.edu>
> 
> Actually, it's more specific than even an AIX 4.3.3 problem.
> It's an AIX 4.3.3 and GCC problem; this does not happen when using
> xlc.

With xlc you won't fail the normal check and thus you won't go into
the let's-see-if-this-is-AIX-4.3.3 logic.

> Compromise: How about I put a check for GCC, which does support -w as an
> option for the cpp, and have that take care of it?

That should do it too.  It will deviate from the norm on more
platforms, though I don't think it will have any negative effects.

Anybody out there that knows what they're doing with autoconf care to
speak up?

(hmmm...  I got this e-mail at trawick@ibm.net 'cause he sent it there
in addition to new-httpd...  I haven't gotten it via new-httpd even at
my subscription on locus and I don't see it in the archive)

-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Re: [PATCH] AIX proper diagnosis and pthread usage

Posted by "Victor J. Orlikowski" <vj...@duke.edu>.
Actually, it's more specific than even an AIX 4.3.3 problem.
It's an AIX 4.3.3 and GCC problem; this does not happen when using xlc.
Compromise: How about I put a check for GCC, which does support -w as an
option for the cpp, and have that take care of it?

Victor
-- 
Victor Orlikowski            vjo@duke.edu


Re: [PATCH] AIX proper diagnosis and pthread usage

Posted by "Jeff Trawick (httpd)" <tr...@ibm.net>.
> From: "Victor J. Orlikowski" <vj...@duke.edu>
> Date: Thu, 15 Jun 2000 19:13:46 -0400
...
> This patch fixes that, as well as adding a workaround for AIX to use
> threading in APR when compiling with gcc, since AIX has a broken
> pthread.h
...
> Index: src/lib/apr/threads.m4
> ===================================================================
> RCS file: /cvs/apache/apache-2.0/src/lib/apr/threads.m4,v
> retrieving revision 1.10
> diff -u -r1.10 threads.m4
> --- threads.m4 2000/06/11 11:48:02 1.10
> +++ threads.m4 2000/06/15 23:07:29
> @@ -34,6 +34,14 @@
>    fi
>  ])dnl
> 
> +dnl Need this for silly broken AIX header files
> +AC_DEFUN(CHECK_PTHREADS_H, [
> +SAVE_FL="$CPPFLAGS"
> +CPPFLAGS="$CPPFLAGS -w"
> +AC_CHECK_HEADERS(pthread.h, [ $1 ] , [ $2 ] )
> +CPPFLAGS="$SAVE_FL"
> +])dnl
> +

This is goodness for anyone with AIX 4.3.3 (they won't have to edit
their system header file) and it shouldn't hurt anyone, other than
being an eyesore when you look at the source.  But...

I don't think you can assume that any c preprocessor will support -w,
or that -w will do what you want it to do if it isn't ignored.

As far as Google can tell me, this pthreads.h problem is limited to
AIX 4.3.3.  Why not do the standard check inside your CHECK_PTHREADS_H
and if it fails and we're AIX 4.3.3, pretend that it worked.  This
seems completely safe.  We don't have to assume anything about any
other systems.

Have fun,

Jeff
(.signature on summer recess)

Re: [PATCH] AIX proper diagnosis and pthread usage

Posted by Bill Stoddard <re...@attglobal.net>.
Actually I think it's gcc lameness.

Bill

> "Victor J. Orlikowski" wrote:
> > 
> > as well as adding a workaround for AIX to use threading in APR when
> > compiling with gcc, since AIX has a broken pthread.h
> 
> Oh, save me.  :-)  What, does the AIX team subscribe to the
> 'always insert a deliberate flaw' school or something? <grin>
> -- 
> #ken    P-)}
> 
> Ken Coar                    <http://Golux.Com/coar/>
> Apache Software Foundation  <http://www.apache.org/>
> "Apache Server for Dummies" <http://Apache-Server.Com/>
> "Apache Server Unleashed"   <http://ApacheUnleashed.Com/>
> 


Re: [PATCH] AIX proper diagnosis and pthread usage

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
"Victor J. Orlikowski" wrote:
> 
> as well as adding a workaround for AIX to use threading in APR when
> compiling with gcc, since AIX has a broken pthread.h

Oh, save me.  :-)  What, does the AIX team subscribe to the
'always insert a deliberate flaw' school or something? <grin>
-- 
#ken    P-)}

Ken Coar                    <http://Golux.Com/coar/>
Apache Software Foundation  <http://www.apache.org/>
"Apache Server for Dummies" <http://Apache-Server.Com/>
"Apache Server Unleashed"   <http://ApacheUnleashed.Com/>