From 83335e3bfe94ea05b12a43f90becd5e0fe26e8ba Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 18 Feb 2022 18:19:07 +0200 Subject: [PATCH 3/3] configure: Make pthreads test also with "-lpthread" See osdn #43561 Signed-off-by: Marko Lindqvist --- configure.ac | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index aa70acffd0..e7651bea3e 100644 --- a/configure.ac +++ b/configure.ac @@ -855,16 +855,25 @@ if test x$crosser != xyes ; then FC_LD_FLAGS([-pthread], [], [LIBS]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[return pthread_create(NULL, NULL, NULL, NULL);]])], - [AC_DEFINE([FREECIV_HAVE_PTHREAD], [1], [Use pthreads as thread implementation]) - thread_impl=pthreads + [thread_impl=pthreads], + [LIBS="$LIBS -lpthread" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[return pthread_create(NULL, NULL, NULL, NULL);]])], + [thread_impl=pthreads])]) + + if test $thread_impl = pthreads ; then + AC_DEFINE([FREECIV_HAVE_PTHREAD], [1], [Use pthreads as thread implementation]) AC_MSG_RESULT([pthreads]) AC_DEFINE([FREECIV_HAVE_THREAD_COND], [1], [Has thread condition variable implementation]) - thread_cond=true]) + thread_cond=true + else + LIBS="$LIBS_SAVE" + fi fi if test "x$thread_impl" = "xnone" ; then CFLAGS="$CFLAGS_SAVE" - LDFLAGS="$LDFLAGS_SAVE" + LIBS="$LIBS_SAVE" AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[CreateThread(NULL, 0, NULL, NULL, 0, NULL);]])], -- 2.34.1