From 122e58965acaf67386d1fc6893f069bd27e5aa26 Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Tue, 7 Feb 2017 21:14:04 +0800 Subject: 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. --- configure.ac | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'configure.ac') 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) -- cgit v1.2.3