summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorExplorer09 <explorer09@gmail.com>2017-02-07 21:14:04 +0800
committerWill Estes <westes575@gmail.com>2017-02-16 09:33:35 -0500
commit122e58965acaf67386d1fc6893f069bd27e5aa26 (patch)
treedebd9abd3046c080f407cb374694790b54d54780 /configure.ac
parent2e820b6015a56552d7f7adb335b5830883d2973c (diff)
test: skip pthread test when needed files missing.
"Unlisting" the pthread test when libpthread is not available is never a good idea. Should let it compile into a stub program that returns the "skip" status. configure.ac and tests/Makefile.am are edited so that pthread test can be built anyway, but only works (not as the stub) when both pthread.h and libpthread are detected on the system. Also fix a small typo in tests/pthread.l comments.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac10
1 files changed, 5 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 3152ccc..36bf58e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,12 +119,12 @@ AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h r
# all we need is the preprocessor symbol defined since we don't need
# LIBS to include libpthread for building flex.
+LIBPTHREAD=''
AC_CHECK_LIB(pthread, pthread_mutex_lock,
-AC_DEFINE([HAVE_LIBPTHREAD], 1, [pthread library] ),
-AC_DEFINE([HAVE_LIBPTHREAD], 0, [pthread library] )
-)
-AC_CHECK_HEADERS([pthread.h])
-AM_CONDITIONAL([want_pthread], [test "x$ac_cv_lib_pthread_pthread_mutex_lock" = xyes])
+ [AC_CHECK_HEADERS([pthread.h], [LIBPTHREAD=-lpthread],
+ [AC_MSG_WARN([pthread tests will be skipped])])],
+ [AC_MSG_WARN([pthread tests will be skipped])])
+AC_SUBST([LIBPTHREAD])
AC_CHECK_LIB(m, log10)