From 58f3babff6a71649554928d269e8c9e21200305f Mon Sep 17 00:00:00 2001 From: John Ericson <John.Ericson@Obsidian.Systems> Date: Sat, 23 Oct 2021 05:07:36 +0000 Subject: [PATCH] Split `FP_CHECK_PTHREADS` and move part to RTS configure `NEED_PTHREAD_LIB` is unused since 3609340743c1b25fdfd0e18b1670dac54c8d8623 (part of the make build system), and so is no longer defined. Progress towards #17191 --- configure.ac | 3 ++- m4/fp_check_pthreads.m4 | 30 ++++++++++++++++++------------ rts/configure.ac | 2 ++ 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 0e6e2b1eb164..17817537be12 100644 --- a/configure.ac +++ b/configure.ac @@ -1038,7 +1038,8 @@ AC_LINK_IFELSE([AC_LANG_CALL([], [printf\$LDBLStub])], [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).]) ]) -FP_CHECK_PTHREADS +FP_CHECK_PTHREAD_LIB +AC_SUBST([UseLibpthread]) GHC_ADJUSTORS_METHOD([Target]) AC_SUBST([UseLibffiForAdjustors]) diff --git a/m4/fp_check_pthreads.m4 b/m4/fp_check_pthreads.m4 index 5713e7c743ff..55657f60b550 100644 --- a/m4/fp_check_pthreads.m4 +++ b/m4/fp_check_pthreads.m4 @@ -1,7 +1,10 @@ -dnl FP_CHECK_PTHREADS -dnl ---------------------------------- -dnl Check various aspects of the platform's pthreads support -AC_DEFUN([FP_CHECK_PTHREADS], +# FP_CHECK_PTHREAD_LIB +# ---------------------------------- +# Check whether -lpthread is needed for pthread. +# +# Sets variables: +# - UseLibpthread: [YES|NO] +AC_DEFUN([FP_CHECK_PTHREAD_LIB], [ dnl Some platforms (e.g. Android's Bionic) have pthreads support available dnl without linking against libpthread. Check whether -lpthread is necessary @@ -12,25 +15,28 @@ AC_DEFUN([FP_CHECK_PTHREADS], AC_CHECK_FUNC(pthread_create, [ AC_MSG_RESULT(no) - AC_SUBST([UseLibpthread],[NO]) - need_lpthread=0 + UseLibpthread=NO ], [ AC_CHECK_LIB(pthread, pthread_create, [ AC_MSG_RESULT(yes) - AC_SUBST([UseLibpthread],[YES]) - need_lpthread=1 + UseLibpthread=YES ], [ - AC_SUBST([UseLibpthread],[NO]) AC_MSG_RESULT([no pthreads support found.]) - need_lpthread=0 + UseLibpthread=NO ]) ]) - AC_DEFINE_UNQUOTED([NEED_PTHREAD_LIB], [$need_lpthread], - [Define 1 if we need to link code using pthreads with -lpthread]) +]) +# FP_CHECK_PTHREAD_FUNCS +# ---------------------------------- +# Check various aspects of the platform's pthreads support +# +# `AC_DEFINE`s various C `HAVE_*` macros. +AC_DEFUN([FP_CHECK_PTHREAD_FUNCS], +[ dnl Setting thread names dnl ~~~~~~~~~~~~~~~~~~~~ dnl The portability situation here is complicated: diff --git a/rts/configure.ac b/rts/configure.ac index a0b9da9259c9..6500e828ac52 100644 --- a/rts/configure.ac +++ b/rts/configure.ac @@ -33,6 +33,8 @@ GHC_CONVERT_PLATFORM_PARTS([host], [Host]) FPTOOLS_SET_PLATFORM_VARS([host], [Host]) FPTOOLS_SET_HASKELL_PLATFORM_VARS([Host]) +FP_CHECK_PTHREAD_FUNCS + dnl ** check for eventfd which is needed by the I/O manager AC_CHECK_HEADERS([sys/eventfd.h]) AC_CHECK_FUNCS([eventfd]) -- GitLab