> openat: Work around compilation error with OSF/1 5.1 DTK cc. Once this problem resolved, the build stops with a link error:
gmake[1]: Entering directory `/home/haible/multibuild-1227/osf51-cc/coreutils-8.12.193-d8dc8/src' CC sort.o CCLD sort ld: Unresolved: __pthread_mutex_init __pthread_mutex_destroy __pthread_mutex_lock __pthread_mutex_unlock __pthread_cond_init __pthread_cond_destroy __pthread_cond_signal __pthread_cond_wait __pthread_create __pthread_join gmake[1]: *** [sort] Error 1 gmake[1]: Leaving directory `/home/haible/multibuild-1227/osf51-cc/coreutils-8.12.193-d8dc8/src' The reason is this: S["LIB_PTHREAD"]="" It comes from this configure test: checking for library containing pthread_join... no And this is due to a renaming of symbols in pthread.h and $ nm /shlib/libpthread.so | grep pthread_join __pthread_join | 0004395905075472 | T | 0000000000000008 This fixes it: Ensure that S["LIB_PTHREAD"]="-lpthread" on this platform. 2011-09-07 Bruno Haible <br...@clisp.org> pthread: Determine $(LIB_PTHREAD) correctly on OSF/1 5.1. * m4/pthread.m4 (gl_PTHREAD_CHECK): Use AC_CACHE_CHECK and AC_LINK_IFELSE instead of AC_SEARCH_LIBS. --- m4/pthread.m4.orig Thu Sep 8 00:47:05 2011 +++ m4/pthread.m4 Thu Sep 8 00:41:15 2011 @@ -1,4 +1,4 @@ -# pthread.m4 serial 2 +# pthread.m4 serial 3 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -38,12 +38,31 @@ AC_DEFUN([gl_PTHREAD_CHECK], LIB_PTHREAD= if test $ac_cv_header_pthread_h = yes; then - gl_saved_libs=$LIBS - AC_SEARCH_LIBS([pthread_join], [pthread], - [if test "$ac_cv_search_pthread_join" != "none required"; then - LIB_PTHREAD="$ac_cv_search_pthread_join" - fi]) - LIBS="$gl_saved_libs" + dnl We cannot use AC_SEARCH_LIBS here, because on OSF/1 5.1 pthread_join + dnl is defined as a macro which expands to __phread_join, and libpthread + dnl contains a definition for __phread_join but none for pthread_join. + AC_CACHE_CHECK([for library containing pthread_join], + [gl_cv_search_pthread_join], + [gl_saved_libs="$LIBS" + gl_cv_search_pthread_join= + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <pthread.h>]], + [[pthread_join (pthread_self (), (void **) 0);]])], + [gl_cv_search_pthread_join="none required"]) + if test -z "$gl_cv_search_pthread_join"; then + LIBS="-lpthread $gl_saved_libs" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <pthread.h>]], + [[pthread_join (pthread_self (), (void **) 0);]])], + [gl_cv_search_pthread_join="-lpthread"]) + fi + LIBS="$gl_saved_libs" + ]) + if test "$gl_cv_search_pthread_join" != "none required"; then + LIB_PTHREAD="$gl_cv_search_pthread_join" + fi fi AC_SUBST([LIB_PTHREAD]) -- In memoriam Joseph Lee Heywood <http://en.wikipedia.org/wiki/Joseph_Lee_Heywood>