diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-02-27 13:47:00 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-02-27 13:47:00 -0500 |
commit | a7a32ec9927cd46d545a47594ebd08c78617773f (patch) | |
tree | be9bebebb5e28b24df6962c618ae852443a93e4e | |
parent | 5d68a3a97b1280c78ee0c9c53910493e0578cff4 (diff) | |
parent | 439d459c96aaeff16eb31ea469b0218f2d1aa992 (diff) | |
download | haskell-a7a32ec9927cd46d545a47594ebd08c78617773f.tar.gz |
Merge branch 'gc-paper/base' of gitlab.well-typed.com:ben/ghc-gc into gc-paper/base
-rw-r--r-- | configure.ac | 33 | ||||
-rw-r--r-- | hadrian/cfg/system.config.in | 4 | ||||
-rw-r--r-- | hadrian/src/Oracles/Flag.hs | 2 | ||||
-rw-r--r-- | hadrian/src/Oracles/Setting.hs | 4 | ||||
-rw-r--r-- | hadrian/src/Settings/Packages.hs | 44 |
5 files changed, 76 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac index 419f002c5e..ce462c5570 100644 --- a/configure.ac +++ b/configure.ac @@ -1285,6 +1285,28 @@ AC_DEFINE_UNQUOTED([USE_LIBDW], [$USE_LIBDW], [Set to 1 to use libdw]) dnl ** Have libnuma? dnl -------------------------------------------------------------- +AC_ARG_WITH([libnuma-libraries], + [AC_HELP_STRING([--with-libnuma-libraries=ARG], + [Find libraries for libnuma in ARG [default=system default]]) + ], + [ + LibNumaLibDir="$withval" + LIBNUMA_LDFLAGS="-L$withval" + ]) + +AC_SUBST(LibNumaLibDir) + +AC_ARG_WITH([libnuma-includes], + [AC_HELP_STRING([--with-libnuma-includes=ARG], + [Find includes for libnuma in ARG [default=system default]]) + ], + [ + LibNumaIncludeDir="$withval" + LIBNUMA_CFLAGS="-I$withval" + ]) + +AC_SUBST(LibNumaIncludeDir) + HaveLibNuma=0 AC_ARG_ENABLE(numa, [AC_HELP_STRING([--enable-numa], @@ -1292,6 +1314,11 @@ AC_ARG_ENABLE(numa, runtime system via numactl's libnuma [default=auto]])]) if test "$enable_numa" != "no" ; then + CFLAGS2="$CFLAGS" + CFLAGS="$LIBNUMA_CFLAGS $CFLAGS" + LDFLAGS2="$LDFLAGS" + LDFLAGS="$LIBNUMA_LDFLAGS $LDFLAGS" + AC_CHECK_HEADERS([numa.h numaif.h]) if test "$ac_cv_header_numa_h$ac_cv_header_numaif_h" = "yesyes" ; then @@ -1300,16 +1327,20 @@ if test "$enable_numa" != "no" ; then if test "$enable_numa:$HaveLibNuma" = "yes:0" ; 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 - dnl ** Documentation dnl -------------------------------------------------------------- if test -n "$SPHINXBUILD"; then diff --git a/hadrian/cfg/system.config.in b/hadrian/cfg/system.config.in index 5c494cf27e..3a67bffbe0 100644 --- a/hadrian/cfg/system.config.in +++ b/hadrian/cfg/system.config.in @@ -172,8 +172,12 @@ ffi-lib-dir = @FFILibDir@ libdw-include-dir = @LibdwIncludeDir@ libdw-lib-dir = @LibdwLibDir@ +libnuma-include-dir = @LibNumaIncludeDir@ +libnuma-lib-dir = @LibNumaLibDir@ + # Optional Dependencies: #======================= with-libdw = @UseLibdw@ +with-libnuma = @UseLibNuma@ have-lib-mingw-ex = @HaveLibMingwEx@ diff --git a/hadrian/src/Oracles/Flag.hs b/hadrian/src/Oracles/Flag.hs index c5c5360422..34713faae1 100644 --- a/hadrian/src/Oracles/Flag.hs +++ b/hadrian/src/Oracles/Flag.hs @@ -21,6 +21,7 @@ data Flag = ArSupportsAtFile | LeadingUnderscore | SolarisBrokenShld | WithLibdw + | WithLibnuma | HaveLibMingwEx | UseSystemFfi @@ -39,6 +40,7 @@ flag f = do LeadingUnderscore -> "leading-underscore" SolarisBrokenShld -> "solaris-broken-shld" WithLibdw -> "with-libdw" + WithLibnuma -> "with-libnuma" HaveLibMingwEx -> "have-lib-mingw-ex" UseSystemFfi -> "use-system-ffi" value <- lookupValueOrError configFile key diff --git a/hadrian/src/Oracles/Setting.hs b/hadrian/src/Oracles/Setting.hs index 632d783e9a..ac343fc67e 100644 --- a/hadrian/src/Oracles/Setting.hs +++ b/hadrian/src/Oracles/Setting.hs @@ -56,6 +56,8 @@ data Setting = BuildArch | IconvLibDir | LibdwIncludeDir | LibdwLibDir + | LibnumaIncludeDir + | LibnumaLibDir | LlvmTarget | ProjectGitCommitId | ProjectName @@ -145,6 +147,8 @@ setting key = lookupValueOrError configFile $ case key of IconvLibDir -> "iconv-lib-dir" LibdwIncludeDir -> "libdw-include-dir" LibdwLibDir -> "libdw-lib-dir" + LibnumaIncludeDir -> "libnuma-include-dir" + LibnumaLibDir -> "libnuma-lib-dir" LlvmTarget -> "llvm-target" ProjectGitCommitId -> "project-git-commit-id" ProjectName -> "project-name" diff --git a/hadrian/src/Settings/Packages.hs b/hadrian/src/Settings/Packages.hs index 67933d66cd..aafd8714ff 100644 --- a/hadrian/src/Settings/Packages.hs +++ b/hadrian/src/Settings/Packages.hs @@ -146,16 +146,7 @@ packageArgs = do builder (Cabal Flags) ? arg "in-ghc-tree" ------------------------------ integerGmp ------------------------------ - , package integerGmp ? mconcat - [ builder (Cabal Setup) ? mconcat - [ flag GmpInTree ? arg "--configure-option=--with-intree-gmp" - -- Windows is always built with inplace GMP until we have dynamic - -- linking working. - , windowsHost ? arg "--configure-option=--with-intree-gmp" - , flag GmpFrameworkPref ? - arg "--configure-option=--with-gmp-framework-preferred" - ] - ] + , gmpPackageArgs ---------------------------------- rts --------------------------------- , package rts ? rtsPackageArgs -- RTS deserves a separate function @@ -178,6 +169,32 @@ packageArgs = do builder (Cabal Flags) ? notStage0 ? intLib == integerSimple ? pure ["+integer-simple", "-bytestring-builder"] ] +gmpPackageArgs :: Args +gmpPackageArgs = do + -- These are only used for non-in-tree builds. + librariesGmp <- getSetting GmpLibDir + includesGmp <- getSetting GmpIncludeDir + + -- Windows is always built with inplace GMP until we have dynamic + -- linking working. + inTreeFlag <- getFlag GmpInTree + let inTree = inTreeFlag || windowsHost + + package integerGmp ? mconcat + [ builder (Cabal Setup) ? mconcat + [ inTree ? arg "--configure-option=--with-intree-gmp" + , flag GmpFrameworkPref ? + arg "--configure-option=--with-gmp-framework-preferred" + + -- Ensure that the integer-gmp package registration includes + -- knowledge of the system gmp's library and include directories. + , notM (flag GmpInTree) ? mconcat + [ if not (null librariesGmp) then arg ("--extra-lib-dirs=" ++ librariesGmp) else mempty + , if not (null includesGmp) then arg ("--extra-include-dirs=" ++ includesGmp) else mempty + ] + ] + ] + -- | RTS-specific command line arguments. rtsPackageArgs :: Args rtsPackageArgs = package rts ? do @@ -205,6 +222,8 @@ rtsPackageArgs = package rts ? do ffiLibraryDir <- getSetting FfiLibDir libdwIncludeDir <- getSetting LibdwIncludeDir libdwLibraryDir <- getSetting LibdwLibDir + libnumaIncludeDir <- getSetting LibnumaIncludeDir + libnumaLibraryDir <- getSetting LibnumaLibDir -- Arguments passed to GHC when compiling C and .cmm sources. let ghcArgs = mconcat @@ -212,6 +231,8 @@ rtsPackageArgs = package rts ? do , arg $ "-I" ++ path , flag WithLibdw ? if not (null libdwIncludeDir) then arg ("-I" ++ libdwIncludeDir) else mempty , flag WithLibdw ? if not (null libdwLibraryDir) then arg ("-L" ++ libdwLibraryDir) else mempty + , flag WithLibnuma ? if not (null libnumaIncludeDir) then arg ("-I" ++ libnumaIncludeDir) else mempty + , flag WithLibnuma ? if not (null libnumaLibraryDir) then arg ("-L" ++ libnumaLibraryDir) else mempty , arg $ "-DRtsWay=\"rts_" ++ show way ++ "\"" -- Set the namespace for the rts fs functions , arg $ "-DFS_NAMESPACE=rts" @@ -321,6 +342,9 @@ rtsPackageArgs = package rts ? do , any (wayUnit Dynamic) rtsWays ? arg "dynamic" , Debug `wayUnit` way ? arg "find-ptr" ] + , builder (Cabal Setup) ? + if not (null libnumaLibraryDir) then arg ("--extra-lib-dirs="++libnumaLibraryDir) else mempty + <> if not (null libnumaIncludeDir) then arg ("--extra-include-dirs="++libnumaIncludeDir) else mempty , builder (Cc FindCDependencies) ? cArgs , builder (Ghc CompileCWithGhc) ? map ("-optc" ++) <$> cArgs , builder Ghc ? ghcArgs |