You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Jeff Trawick <tr...@bellsouth.net> on 2001/06/04 14:01:31 UTC

Re: cvs commit: apr configure.in

jerenkrantz@apache.org writes:

> jerenkrantz    01/05/31 19:58:32
> 
>   Modified:    .        configure.in
>   Log:
>   Detect the wacky Linux-specific condition where pthread_rwlock_init is
>   defined, but the declaration of pthread_rwlock_t requires extra
>   #defines.

this is glibc-specific, not Linux-specific, right?

>   Index: configure.in
>   ===================================================================
>   RCS file: /home/cvs/apr/configure.in,v
>   retrieving revision 1.310
>   retrieving revision 1.311
>   diff -u -r1.310 -r1.311
>   --- configure.in	2001/05/31 03:29:51	1.310
>   +++ configure.in	2001/06/01 02:58:31	1.311
>   @@ -281,6 +281,31 @@
>            APR_CHECK_PTHREAD_GETSPECIFIC_TWO_ARGS
>            APR_CHECK_PTHREAD_ATTR_GETDETACHSTATE_ONE_ARG
>            AC_CHECK_FUNCS(pthread_key_delete pthread_rwlock_init)
>   +
>   +        if test "$ac_cv_func_pthread_rwlock_init" = "yes"; then
>   +            dnl #----------------------------- Checking for pthread_rwlock_t
>   +            dnl # Linux is silly as it has pthread_rwlock_init defined
>   +            dnl # but keeps the pthread_rwlock_t structure hidden unless 
>   +            dnl # special things are defined.
>   +            AC_CACHE_CHECK([for pthread_rwlock_t], ac_cv_struct_pthread_rw,
>   +                [AC_TRY_COMPILE([#include <sys/types.h>
>   +                #include <pthread.h>], 
>   +                [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
>   +                ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)])
>   +            if test "$ac_cv_struct_pthread_rw" = "no"; then
>   +                AC_TRY_COMPILE([#define _XOPEN_SOURCE 500
>   +                    #define _BSD_SOURCE
>   +                    #define _SVID_SOURCE
>   +                    #include <sys/types.h>
>   +                    #include <pthread.h>], 
>   +                    [pthread_rwlock_t rwlock=PTHREAD_RWLOCK_INITIALIZER;],
>   +                    ac_cv_struct_pthread_rw=yes, ac_cv_struct_pthread_rw=no)
>   +                if test "$ac_cv_struct_pthread_rw" = "yes"; then
>   +                    APR_ADDTO(CPPFLAGS, [-D_XOPEN_SOURCE=500 -D_BSD_SOURCE])
>   +                    APR_ADDTO(CPPFLAGS, [-D_SVID_SOURCE])

Why are we turning on _BSD_SOURCE and _SVID_SOURCE here?  What do they
have to do with pthread_rwlock_t?  Only _XOPEN_SOURCE=500 is needed
for pthread_rwlock_t IIRC.  _BSD_SOURCE is related to the combination
of _XOPEN_SOURCE=500 and either S_ISLINK or S_ISSOCK.  I forget what
_SVID_SOURCE is for.

It seems to me that we have very specific information about a certain
libc's requirements but we're ashamed to admit it and so we're
dressing it up in autoconf for political correctness.  Unfortunately,
the resulting code risks turning on unnecessary or undesirable flags
on platforms we don't know about.

(I'll shut up now on this issue.  I promise :) )
-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...


Re: cvs commit: apr configure.in

Posted by "Victor J. Orlikowski" <v....@gte.net>.
 > this is glibc-specific, not Linux-specific, right?

Yes.

 > Why are we turning on _BSD_SOURCE and _SVID_SOURCE here?  What do they
 > have to do with pthread_rwlock_t?  Only _XOPEN_SOURCE=500 is needed
 > for pthread_rwlock_t IIRC.  _BSD_SOURCE is related to the combination
 > of _XOPEN_SOURCE=500 and either S_ISLINK or S_ISSOCK.  I forget what
 > _SVID_SOURCE is for.
 > 

We need to turn on _BSD_SOURCE and _SVID_SOURCE, since they are
normally on by default in glibc (check /usr/include/features.h), but
setting _XOPEN_SOURCE=500 turns them off.

Victor
-- 
Victor J. Orlikowski
======================
v.j.orlikowski@gte.net
orlikowski@apache.org
vjo@us.ibm.com