diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-11-05 04:31:03 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2023-01-02 02:28:55 -0500 |
commit | 7b2cf80717a6b16e3f6135c6c6905bd5d3bbde72 (patch) | |
tree | 7a55d9a8e92a6c0cad8c7bef93ffbe9dff38d13d | |
parent | dde92d14a0dc64a1d3025ab97773bed72727b006 (diff) | |
download | haskell-7b2cf80717a6b16e3f6135c6c6905bd5d3bbde72.tar.gz |
Move lib{numa,dw} defines to RTS configurewip/rts-configure-libdw-libnuma
Clean up the m4 to handle the auto case always and be more consistent.
Also simplify the CPP --- we should always have both headers if we are
using libnuma.
"side effects" (AC_DEFINE, and AC_SUBST) are removed from the macros to
better separate searching from actions taken based on search results.
This might seem overkill now, but will make shuffling logic between
configure scripts easier later.
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | m4/fp_find_libdw.m4 | 31 | ||||
-rw-r--r-- | m4/fp_find_libnuma.m4 | 31 | ||||
-rw-r--r-- | rts/configure.ac | 9 | ||||
-rw-r--r-- | rts/posix/OSMem.c | 4 |
5 files changed, 40 insertions, 42 deletions
diff --git a/configure.ac b/configure.ac index be88deb270..4a39a9a314 100644 --- a/configure.ac +++ b/configure.ac @@ -1124,7 +1124,14 @@ AC_SUBST([UseLibffiForAdjustors]) dnl ** Other RTS features dnl -------------------------------------------------------------- FP_FIND_LIBDW +AC_SUBST(UseLibdw) +AC_SUBST(LibdwLibDir) +AC_SUBST(LibdwIncludeDir) + FP_FIND_LIBNUMA +AC_SUBST(UseLibNuma) +AC_SUBST(LibNumaLibDir) +AC_SUBST(LibNumaIncludeDir) dnl ** Documentation dnl -------------------------------------------------------------- diff --git a/m4/fp_find_libdw.m4 b/m4/fp_find_libdw.m4 index 29008408d7..fa5bf807cb 100644 --- a/m4/fp_find_libdw.m4 +++ b/m4/fp_find_libdw.m4 @@ -12,8 +12,6 @@ AC_DEFUN([FP_FIND_LIBDW], LIBDW_LDFLAGS="-L$withval" ]) - AC_SUBST(LibdwLibDir) - AC_ARG_WITH([libdw-includes], [AS_HELP_STRING([--with-libdw-includes=ARG], [Find includes for libdw in ARG [default=system default]]) @@ -23,32 +21,29 @@ AC_DEFUN([FP_FIND_LIBDW], LIBDW_CFLAGS="-I$withval" ]) - AC_SUBST(LibdwIncludeDir) + AC_ARG_ENABLE(dwarf-unwind, + [AS_HELP_STRING([--enable-dwarf-unwind], + [Enable DWARF unwinding support in the runtime system via elfutils' libdw [default=no]])], + [], + [enable_dwarf_unwind=no]) UseLibdw=NO - USE_LIBDW=0 - AC_ARG_ENABLE(dwarf-unwind, - [AS_HELP_STRING([--enable-dwarf-unwind], - [Enable DWARF unwinding support in the runtime system via elfutils' libdw [default=no]])]) - if test "$enable_dwarf_unwind" = "yes" ; then + if test "$enable_dwarf_unwind" != "no" ; then CFLAGS2="$CFLAGS" CFLAGS="$LIBDW_CFLAGS $CFLAGS" LDFLAGS2="$LDFLAGS" LDFLAGS="$LIBDW_LDFLAGS $LDFLAGS" - AC_CHECK_LIB(dw, dwfl_attach_state, - [AC_CHECK_HEADERS([elfutils/libdw.h], [break], []) - UseLibdw=YES], - [AC_MSG_ERROR([Cannot find system libdw (required by --enable-dwarf-unwind)])]) + AC_CHECK_HEADER([elfutils/libdwfl.h], + [AC_CHECK_LIB(dw, dwfl_attach_state, + [UseLibdw=YES])]) + + if test "x:$enable_dwarf_unwind:$UseLibdw" = "x:yes:NO" ; then + AC_MSG_ERROR([Cannot find system libdw (required by --enable-dwarf-unwind)]) + fi CFLAGS="$CFLAGS2" LDFLAGS="$LDFLAGS2" fi - - AC_SUBST(UseLibdw) - if test $UseLibdw = "YES" ; then - USE_LIBDW=1 - fi - AC_DEFINE_UNQUOTED([USE_LIBDW], [$USE_LIBDW], [Set to 1 to use libdw]) ]) diff --git a/m4/fp_find_libnuma.m4 b/m4/fp_find_libnuma.m4 index 4f55453f8e..1563ca4e89 100644 --- a/m4/fp_find_libnuma.m4 +++ b/m4/fp_find_libnuma.m4 @@ -11,8 +11,6 @@ AC_DEFUN([FP_FIND_LIBNUMA], LIBNUMA_LDFLAGS="-L$withval" ]) - AC_SUBST(LibNumaLibDir) - AC_ARG_WITH([libnuma-includes], [AS_HELP_STRING([--with-libnuma-includes=ARG], [Find includes for libnuma in ARG [default=system default]]) @@ -22,14 +20,14 @@ AC_DEFUN([FP_FIND_LIBNUMA], LIBNUMA_CFLAGS="-I$withval" ]) - AC_SUBST(LibNumaIncludeDir) - - HaveLibNuma=0 AC_ARG_ENABLE(numa, - [AS_HELP_STRING([--enable-numa], - [Enable NUMA memory policy and thread affinity support in the - runtime system via numactl's libnuma [default=auto]])]) + [AS_HELP_STRING([--enable-numa], + [Enable NUMA memory policy and thread affinity support in the + runtime system via numactl's libnuma [default=auto]])], + [], + [enable_numa=auto]) + UseLibNuma=NO if test "$enable_numa" != "no" ; then CFLAGS2="$CFLAGS" CFLAGS="$LIBNUMA_CFLAGS $CFLAGS" @@ -38,23 +36,14 @@ AC_DEFUN([FP_FIND_LIBNUMA], AC_CHECK_HEADERS([numa.h numaif.h]) - if test "$ac_cv_header_numa_h$ac_cv_header_numaif_h" = "yesyes" ; then - AC_CHECK_LIB(numa, numa_available,HaveLibNuma=1) + if test "x:$ac_cv_header_numa_h:$ac_cv_header_numaif_h" = "x:yes:yes" ; then + AC_CHECK_LIB([numa], [numa_available], [UseLibNuma=YES]) fi - if test "$enable_numa:$HaveLibNuma" = "yes:0" ; then - AC_MSG_ERROR([Cannot find system libnuma (required by --enable-numa)]) + if test "x:$enable_numa:$UseLibNuma" = "x:yes:NO" ; then + AC_MSG_ERROR([Cannot find system libnuma (required by --enable-numa)]) fi CFLAGS="$CFLAGS2" LDFLAGS="$LDFLAGS2" fi - - AC_DEFINE_UNQUOTED([HAVE_LIBNUMA], [$HaveLibNuma], [Define to 1 if you have libnuma]) - if test $HaveLibNuma = "1" ; then - AC_SUBST([UseLibNuma],[YES]) - AC_SUBST([CabalHaveLibNuma],[True]) - else - AC_SUBST([UseLibNuma],[NO]) - AC_SUBST([CabalHaveLibNuma],[False]) - fi ]) diff --git a/rts/configure.ac b/rts/configure.ac index 7c64d491e1..81c702d3c4 100644 --- a/rts/configure.ac +++ b/rts/configure.ac @@ -33,6 +33,15 @@ GHC_CONVERT_PLATFORM_PARTS([host], [Host]) FPTOOLS_SET_PLATFORM_VARS([host], [Host]) FPTOOLS_SET_HASKELL_PLATFORM_VARS([Host]) +dnl ** Other RTS features +dnl -------------------------------------------------------------- +AC_DEFINE_UNQUOTED([USE_LIBDW], [$CABAL_FLAG_libdw], [Set to 1 to use libdw]) + +AC_DEFINE_UNQUOTED([HAVE_LIBNUMA], [$CABAL_FLAG_libnuma], [Define to 1 if you have libnuma]) + +dnl ** Write config files +dnl -------------------------------------------------------------- + AC_OUTPUT dnl ###################################################################### diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c index e08dfca8b6..e266af8e7c 100644 --- a/rts/posix/OSMem.c +++ b/rts/posix/OSMem.c @@ -30,10 +30,8 @@ #if defined(HAVE_FCNTL_H) #include <fcntl.h> #endif -#if defined(HAVE_NUMA_H) +#if HAVE_LIBNUMA #include <numa.h> -#endif -#if defined(HAVE_NUMAIF_H) #include <numaif.h> #endif #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_SYS_TIME_H) |