[Git][ghc/ghc][master] rts: remove unneccesary cabal flags
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 643ce801 by Julian Ospald at 2025-10-28T18:18:55-04:00 rts: remove unneccesary cabal flags We perform those checks via proper autoconf macros instead that do the right thing and then add those libs to the rts buildinfo. - - - - - 4 changed files: - m4/fp_check_pthreads.m4 - rts/configure.ac - + rts/rts.buildinfo.in - rts/rts.cabal Changes: ===================================== m4/fp_check_pthreads.m4 ===================================== @@ -12,22 +12,7 @@ AC_DEFUN([FP_CHECK_PTHREAD_LIB], dnl dnl Note that it is important that this happens before we AC_CHECK_LIB(thread) AC_MSG_CHECKING(whether -lpthread is needed for pthreads) - AC_CHECK_FUNC(pthread_create, - [ - AC_MSG_RESULT(no) - UseLibpthread=NO - ], - [ - AC_CHECK_LIB(pthread, pthread_create, - [ - AC_MSG_RESULT(yes) - UseLibpthread=YES - ], - [ - AC_MSG_RESULT([no pthreads support found.]) - UseLibpthread=NO - ]) - ]) + AC_SEARCH_LIBS([pthread_create],[pthread]) ]) # FP_CHECK_PTHREAD_FUNCS @@ -37,6 +22,7 @@ AC_DEFUN([FP_CHECK_PTHREAD_LIB], # `AC_DEFINE`s various C `HAVE_*` macros. AC_DEFUN([FP_CHECK_PTHREAD_FUNCS], [ + OLD_LIBS=$LIBS dnl Setting thread names dnl ~~~~~~~~~~~~~~~~~~~~ dnl The portability situation here is complicated: @@ -123,4 +109,5 @@ AC_DEFUN([FP_CHECK_PTHREAD_FUNCS], ) AC_CHECK_FUNCS_ONCE([pthread_condattr_setclock]) + LIBS=$OLD_LIBS ]) ===================================== rts/configure.ac ===================================== @@ -22,7 +22,7 @@ dnl #define SIZEOF_CHAR 0 dnl recently. AC_PREREQ([2.69]) -AC_CONFIG_FILES([ghcplatform.h.top]) +AC_CONFIG_FILES([ghcplatform.h.top rts.buildinfo]) AC_CONFIG_HEADERS([ghcautoconf.h.autoconf]) @@ -162,14 +162,7 @@ AC_CHECK_DECLS([program_invocation_short_name], , , [#define _GNU_SOURCE 1 #include <errno.h>]) -dnl ** check for math library -dnl Keep that check as early as possible. -dnl as we need to know whether we need libm -dnl for math functions or not -dnl (see https://gitlab.haskell.org/ghc/ghc/issues/3730) -AS_IF( - [test "$CABAL_FLAG_libm" = 1], - [AC_DEFINE([HAVE_LIBM], [1], [Define to 1 if you need to link with libm])]) +AC_SEARCH_LIBS([exp2], [m]) AS_IF([test "$CABAL_FLAG_libbfd" = 1], [FP_WHEN_ENABLED_BFD]) @@ -178,10 +171,13 @@ dnl Check for libraries dnl ################################################################ dnl ** check whether we need -ldl to get dlopen() -AC_CHECK_LIB([dl], [dlopen]) +AC_SEARCH_LIBS([dlopen], [dl]) dnl ** check whether we have dlinfo AC_CHECK_FUNCS([dlinfo]) +FP_CHECK_PTHREAD_LIB + + dnl -------------------------------------------------- dnl * Miscellaneous feature tests dnl -------------------------------------------------- @@ -439,6 +435,11 @@ GHC_IOMANAGER_DEFAULT_AC_DEFINE([IOManagerThreadedDefault], [threaded], GHC_IOMANAGER_DEFAULT_AC_DEFINE([IOManagerThreadedDefault], [threaded], [winio], [IOMGR_DEFAULT_THREADED_WINIO]) +dnl ###################################################################### +dnl Generate build-info +dnl ###################################################################### + +AC_SUBST([EXTRA_LIBS],[` printf " %s " "$LIBS" | sed -E 's/ -l([[^ ]]*)/\1 /g' `]) dnl ** Write config files dnl -------------------------------------------------------------- @@ -487,3 +488,5 @@ cat ghcautoconf.h.autoconf | sed \ >> include/ghcautoconf.h echo "#endif /* __GHCAUTOCONF_H__ */" >> include/ghcautoconf.h ] + + ===================================== rts/rts.buildinfo.in ===================================== @@ -0,0 +1 @@ +extra-libraries: @EXTRA_LIBS@ ===================================== rts/rts.cabal ===================================== @@ -25,24 +25,15 @@ source-repository head location: https://gitlab.haskell.org/ghc/ghc.git subdir: rts -flag libm - default: False - manual: True flag librt default: False manual: True -flag libdl - default: False - manual: True flag use-system-libffi default: False manual: True flag libffi-adjustors default: False manual: True -flag need-pthread - default: False - manual: True flag libbfd default: False manual: True @@ -215,13 +206,8 @@ library -- that it is ordered correctly with libpthread, since ghc-internal.cabal -- also explicitly lists libc. See #19029. extra-libraries: c - if flag(libm) - -- for ldexp() - extra-libraries: m if flag(librt) extra-libraries: rt - if flag(libdl) - extra-libraries: dl if flag(use-system-libffi) extra-libraries: ffi if os(windows) @@ -241,9 +227,6 @@ library -- and also centralizes the versioning. cpp-options: -D_WIN32_WINNT=0x06010000 cc-options: -D_WIN32_WINNT=0x06010000 - if flag(need-pthread) - -- for pthread_getthreadid_np, pthread_create, ... - extra-libraries: pthread if flag(need-atomic) -- for sub-word-sized atomic operations (#19119) extra-libraries: atomic View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/643ce801a8b559071683cad0e5adbc26... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/643ce801a8b559071683cad0e5adbc26... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)