When checking for pthread_np.h include pthread.h if available or it may fail (e.g. OpenBSD)

This commit is contained in:
Riccardo Mottola 2018-08-08 11:29:05 +02:00
parent 16ef46642b
commit e87f59a429
3 changed files with 33 additions and 6 deletions

View file

@ -1,3 +1,9 @@
2018-08-08 Riccardo Mottola <rm@gnu.org>
* configure.ac
* configure:
When checking for pthread_np.h include pthread.h if available or it may fail (e.g. OpenBSD).
2018-08-06 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUserDefaults.m: Update the cache on change of volatile

26
configure vendored
View file

@ -7237,13 +7237,29 @@ done
#--------------------------------------------------------------------
# Check for pthread.h
#--------------------------------------------------------------------
for ac_header in pthread.h pthread_np.h
for ac_header in pthread.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
if test "x$ac_cv_header_pthread_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
#define HAVE_PTHREAD_H 1
_ACEOF
fi
done
for ac_header in pthread_np.h
do :
ac_fn_c_check_header_compile "$LINENO" "pthread_np.h" "ac_cv_header_pthread_np_h" "$ac_includes_default
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
"
if test "x$ac_cv_header_pthread_np_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PTHREAD_NP_H 1
_ACEOF
fi

View file

@ -1698,7 +1698,12 @@ AC_CHECK_FUNCS(getaddrinfo)
#--------------------------------------------------------------------
# Check for pthread.h
#--------------------------------------------------------------------
AC_CHECK_HEADERS(pthread.h pthread_np.h)
AC_CHECK_HEADERS([pthread.h])
AC_CHECK_HEADERS([pthread_np.h],[],[],[AC_INCLUDES_DEFAULT
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
])
if test $ac_cv_header_pthread_h = yes ; then
AC_CHECK_SIZEOF(pthread_mutex_t,,[AC_INCLUDES_DEFAULT
#include <pthread.h>])