Hello!

libgomp's configure checks -pthread option using following commands:

--cut here--
# 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])])])
--cut here--

On solaris-2.8, this results in:

configure:5636: /home/uros/gcc-build-gomp/./gcc/xgcc
-B/home/uros/gcc-build-gomp/./gcc/ -B/usr/local/sparc-sun-solaris2.8/bin/
-B/usr/local/sparc-sun-solaris2.8/lib/ -isystem
/usr/local/sparc-sun-solaris2.8/include -isystem
/usr/local/sparc-sun-solaris2.8/sys-include -o conftest -O2 -g -O2   -pthread  
conftest.c  >&5
xgcc: unrecognized option '-pthread'
configure:5642: $? = 0
configure:5646: test -z 
                         || test ! -s conftest.err
configure:5649: $? = 0
configure:5652: test -s conftest
configure:5655: $? = 0

Please note, that -pthread is not a valid option for gcc on solaris-2.8 target.
However, the check above does not finish in AC_MSG_ERROR. [It looks that
conftest executable remains undeleted from previous checks.] This results in
wrong option '-pthread' passed during libgomp compilation.

The fact that gcc returns 0 for unrecognized option is a bit strange:

bash-2.03$ gcc -whatever p.c
gcc: unrecognized option `-whatever'
bash-2.03$ echo $?
0

Is this intentional?

Thanks,
Uros.

Reply via email to