This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[libgomp] patch for -pthread on Tru64


Hi all,

libgomp currently doesn't configure well on Tru64 (PR
bootstrap/26161), because the configury is testing the usability of
pthread.h system headers, while on Tru64 this can only work when the
compiler is used with the -pthread option.

While this flag could be added on a per-target basis (it might be
needed on AIX too, but I can't confirm) in the configure.ac file
(configure.tgt is called to late for that), I thought about something
more general. In libgomp/configure.ac, why do we have the two
following tests:

AC_CHECK_HEADER([pthread.h],[],
  [AC_MSG_ERROR([Pthreads are required to build libgomp])])

and

# Check to see if -pthread or -lpthread is needed.  Prefer the former.
XPCFLAGS=""
CFLAGS="$CFLAGS -pthread"
AC_LINK_IFELSE(
 [AC_LANG_PROGRAM(
  [#include <pthread.h>
   void *g(void *d) { return NULL; }],
  [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
 [XPCFLAGS=" -Wc,-pthread"],
 [CFLAGS="$save_CFLAGS" LIBS="-lpthread $LIBS"
  AC_LINK_IFELSE(
   [AC_LANG_PROGRAM(
    [#include <pthread.h>
     void *g(void *d) { return NULL; }],
    [pthread_t t; pthread_create(&t,NULL,g,NULL);])],
   [],
   [AC_MSG_ERROR([Pthreads are required to build libgomp])])])


It looks to me that the second alone should be enough because, if
pthread.h is not available, both AC_LINK_IFELSE will fail and we will
have the AC_MSG_ERROR, which is exactly what happens during the
AC_CHECK_HEADER test.

Moreover, removing the first test makes libgomp build on targets (as
Tru64) where the -pthread option is required to include pthread.h.

Is this analysis wrong? If not, could someone OK the attached patch
(tested on alphaev68-dec-osf5.1b)?

Thanks,
FX

:ADDPATCH build:
Index: configure.ac
===================================================================
--- configure.ac        (revision 111110)
+++ configure.ac        (working copy)
@@ -139,8 +139,6 @@
 AC_STDC_HEADERS
 AC_HEADER_TIME
 AC_CHECK_HEADERS(unistd.h semaphore.h sys/loadavg.h sys/time.h)
-AC_CHECK_HEADER([pthread.h],[],
-  [AC_MSG_ERROR([Pthreads are required to build libgomp])])
 
 GCC_HEADER_STDINT(gstdint.h)
 

Attachment: pr26161.ChangeLog
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]