[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 6 commits: Bump submodule unix to 2.8.2.1

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Mon Sep 25 22:26:29 UTC 2023



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
b8e4fe23 by Andrew Lelechenko at 2023-09-22T20:05:05-04:00
Bump submodule unix to 2.8.2.1

- - - - -
54b2016e by John Ericson at 2023-09-23T11:40:41-04:00
Move lib{numa,dw} defines to RTS configure

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.

The macro comments are converted from `dnl` to `#` following the
recomendation in
https://www.gnu.org/software/autoconf/manual/autoconf-2.71/html_node/Macro-Definitions.html

- - - - -
d51b601b by John Ericson at 2023-09-23T11:40:50-04:00
Shuffle libzstd configuring between scripts

Like the prior commit for libdw and libnuma, `AC_DEFINE` to RTS
configure, `AC_SUBST` goes to the top-level configure script, and the
documentation of the m4 macro is improved.

- - - - -
d1425af0 by John Ericson at 2023-09-23T11:41:03-04:00
Move `FP_ARM_OUTLINE_ATOMICS` to RTS configure

It is just `AC_DEFINE` it belongs there instead.

- - - - -
18de37e4 by John Ericson at 2023-09-23T11:41:03-04:00
Move mmap in the runtime linker check to the RTS configure

`AC_DEFINE` should go there instead.

- - - - -
6f6fb775 by Andrew Lelechenko at 2023-09-25T18:26:05-04:00
Elaborate comment on GHC_NO_UNICODE

- - - - -


8 changed files:

- compiler/GHC/Driver/DynFlags.hs
- configure.ac
- docs/users_guide/using.rst
- libraries/unix
- m4/fp_find_libdw.m4
- m4/fp_find_libnuma.m4
- m4/fp_find_libzstd.m4
- rts/configure.ac


Changes:

=====================================
compiler/GHC/Driver/DynFlags.hs
=====================================
@@ -495,6 +495,8 @@ class ContainsDynFlags t where
 initDynFlags :: DynFlags -> IO DynFlags
 initDynFlags dflags = do
  let
+ -- This is not bulletproof: we test that 'localeEncoding' is Unicode-capable,
+ -- but potentially 'hGetEncoding' 'stdout' might be different. Still good enough.
  canUseUnicode <- do let enc = localeEncoding
                          str = "‘’"
                      (withCString enc str $ \cstr ->


=====================================
configure.ac
=====================================
@@ -1097,41 +1097,28 @@ if test "$use_large_address_space" = "yes" ; then
    AC_DEFINE([USE_LARGE_ADDRESS_SPACE], [1], [Enable single heap address space support])
 fi
 
-dnl ** Use MMAP in the runtime linker?
-dnl --------------------------------------------------------------
-
-case ${TargetOS} in
-    linux|linux-android|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2)
-        RtsLinkerUseMmap=1
-        ;;
-    darwin|ios|watchos|tvos)
-        RtsLinkerUseMmap=1
-        ;;
-    *)
-        # Windows (which doesn't have mmap) and everything else.
-        RtsLinkerUseMmap=0
-        ;;
-    esac
-
-AC_DEFINE_UNQUOTED([RTS_LINKER_USE_MMAP], [$RtsLinkerUseMmap],
-                   [Use mmap in the runtime linker])
-
-
 GHC_ADJUSTORS_METHOD([Target])
 AC_SUBST([UseLibffiForAdjustors])
 
-dnl ** ARM outline atomics
-dnl --------------------------------------------------------------
-FP_ARM_OUTLINE_ATOMICS
-
 dnl ** IPE data compression
 dnl --------------------------------------------------------------
 FP_FIND_LIBZSTD
+AC_SUBST(UseLibZstd)
+AC_SUBST(UseStaticLibZstd)
+AC_SUBST(LibZstdLibDir)
+AC_SUBST(LibZstdIncludeDir)
 
 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 --------------------------------------------------------------
@@ -1282,17 +1269,12 @@ echo "\
    cabal-install : $CABAL
 "
 
-USING_LIBNUMA=$(if [ "$HaveLibNuma" = "1" ]; then echo "YES"; else echo "NO"; fi;)
-USING_LIBZSTD=$(if [ "$HaveLibZstd" = "1" ]; then echo "YES"; else echo "NO"; fi;)
-STATIC_LIBZSTD=$(if [ "$StaticLibZstd" = "1" ]; then echo "YES"; else echo "NO"; fi;)
-USING_LIBDW=$(if [ "$USE_LIBDW" = "1" ]; then echo "YES"; else echo "NO"; fi;)
-
 echo "\
    Using optional dependencies:
-      libnuma : $USING_LIBNUMA
-      libzstd : $USING_LIBZSTD
-         statically linked? : $STATIC_LIBZSTD
-      libdw   : $USING_LIBDW
+      libnuma : $UseLibNuma
+      libzstd : $UseLibZstd
+         statically linked? : ${UseStaticLibZstd:-N/A}
+      libdw   : $UseLibdw
 
    Using LLVM tools
       llc   : $LlcCmd


=====================================
docs/users_guide/using.rst
=====================================
@@ -1823,6 +1823,10 @@ GHC can also be configured using various environment variables.
 .. envvar:: GHC_NO_UNICODE
 
     When non-empty, disables Unicode diagnostics output regardless of locale settings.
+    GHC can usually determine that locale is not Unicode-capable and fallback to ASCII
+    automatically, but in some corner cases (e. g., when GHC output is redirected)
+    you might hit ``invalid argument (cannot encode character '\8216')``,
+    in which case do set ``GHC_NO_UNICODE``.
 
 .. envvar:: GHC_CHARENC
 


=====================================
libraries/unix
=====================================
@@ -1 +1 @@
-Subproject commit 5c3f316cf13b1c5a2c8622065cccd8eb81a81b89
+Subproject commit 3f0d217b5b3de5ccec54154d5cd5c7b0d07708df


=====================================
m4/fp_find_libdw.m4
=====================================
@@ -1,6 +1,11 @@
-dnl ** Have libdw?
-dnl --------------------------------------------------------------
-dnl Sets UseLibdw.
+# FP_FIND_LIBDW
+# --------------------------------------------------------------
+# Should we used libdw? (yes, no, or auto.)
+#
+# Sets variables:
+#   - UseLibdw: [YES|NO]
+#   - LibdwLibDir: optional path
+#   - LibdwIncludeDir: optional path
 AC_DEFUN([FP_FIND_LIBDW],
 [
   AC_ARG_WITH([libdw-libraries],
@@ -12,8 +17,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 +26,28 @@ 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])
 ])
-


=====================================
m4/fp_find_libnuma.m4
=====================================
@@ -1,7 +1,13 @@
+# FP_FIND_LIBNUMA
+# --------------------------------------------------------------
+# Should we used libnuma? (yes, no, or auto.)
+#
+# Sets variables:
+#   - UseLibNuma: [YES|NO]
+#   - LibNumaLibDir: optional path
+#   - LibNumaIncludeDir: optional path
 AC_DEFUN([FP_FIND_LIBNUMA],
 [
-  dnl ** Have libnuma?
-  dnl --------------------------------------------------------------
   AC_ARG_WITH([libnuma-libraries],
     [AS_HELP_STRING([--with-libnuma-libraries=ARG],
       [Find libraries for libnuma in ARG [default=system default]])
@@ -11,8 +17,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 +26,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 +42,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 "$ac_cv_header_numa_h:$ac_cv_header_numaif_h" = "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 "$enable_numa:$UseLibNuma" = "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
 ])


=====================================
m4/fp_find_libzstd.m4
=====================================
@@ -1,3 +1,13 @@
+# FP_FIND_LIBZSTD
+# --------------------------------------------------------------
+# Check whether we are we want IPE data compression, whether we have
+# libzstd in order to do it, and whether zstd will be statically linked.
+#
+# Sets variables:
+#   - UseLibZstd: [YES|NO]
+#   - UseStaticLibZstd: [YES|NO]
+#   - LibZstdLibDir: optional path
+#   - LibZstdIncludeDir: optional path
 AC_DEFUN([FP_FIND_LIBZSTD],
 [
   dnl ** Is IPE data compression enabled?
@@ -41,8 +51,6 @@ AC_DEFUN([FP_FIND_LIBZSTD],
         ]
       )
 
-    AC_SUBST(LibZstdLibDir)
-
     AC_ARG_WITH(
         libzstd-includes,
         [AS_HELP_STRING(
@@ -55,8 +63,6 @@ AC_DEFUN([FP_FIND_LIBZSTD],
         ]
       )
 
-    AC_SUBST(LibZstdIncludeDir)
-
     CFLAGS2="$CFLAGS"
     CFLAGS="$LIBZSTD_CFLAGS $CFLAGS"
     LDFLAGS2="$LDFLAGS"
@@ -90,16 +96,8 @@ AC_DEFUN([FP_FIND_LIBZSTD],
     LDFLAGS="$LDFLAGS2"
   fi
 
-  AC_DEFINE_UNQUOTED([HAVE_LIBZSTD], [$HaveLibZstd], [Define to 1 if you
-    wish to compress IPE data in compiler results (requires libzstd)])
-
-  AC_DEFINE_UNQUOTED([STATIC_LIBZSTD], [$StaticLibZstd], [Define to 1 if you
-    wish to statically link the libzstd compression library in the compiler
-    (requires libzstd)])
-
   if test $HaveLibZstd = "1" ; then
-    AC_SUBST([UseLibZstd],[YES])
-    AC_SUBST([CabalHaveLibZstd],[True])
+    UseLibZstd=YES
     if test $StaticLibZstd = "1" ; then
       case "${host_os}" in
           darwin*)
@@ -107,14 +105,11 @@ AC_DEFUN([FP_FIND_LIBZSTD],
                   [--enable-static-libzstd is not compatible with darwin]
                 )
       esac
-      AC_SUBST([UseStaticLibZstd],[YES])
-      AC_SUBST([CabalStaticLibZstd],[True])
+      UseStaticLibZstd=YES
     else
-      AC_SUBST([UseStaticLibZstd],[NO])
-      AC_SUBST([CabalStaticLibZstd],[False])
+      UseStaticLibZstd=NO
     fi
   else
-    AC_SUBST([UseLibZstd],[NO])
-    AC_SUBST([CabalHaveLibZstd],[False])
+    UseLibZstd=NO
   fi
 ])


=====================================
rts/configure.ac
=====================================
@@ -33,6 +33,52 @@ GHC_CONVERT_PLATFORM_PARTS([host], [Host])
 FPTOOLS_SET_PLATFORM_VARS([host], [Host])
 FPTOOLS_SET_HASKELL_PLATFORM_VARS([Host])
 
+dnl ** Use MMAP in the runtime linker?
+dnl --------------------------------------------------------------
+
+case ${HostOS} in
+    linux|linux-android|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2)
+        RtsLinkerUseMmap=1
+        ;;
+    darwin|ios|watchos|tvos)
+        RtsLinkerUseMmap=1
+        ;;
+    *)
+        # Windows (which doesn't have mmap) and everything else.
+        RtsLinkerUseMmap=0
+        ;;
+    esac
+
+AC_DEFINE_UNQUOTED([RTS_LINKER_USE_MMAP], [$RtsLinkerUseMmap],
+                   [Use mmap in the runtime linker])
+
+dnl ** ARM outline atomics
+dnl --------------------------------------------------------------
+FP_ARM_OUTLINE_ATOMICS
+
+dnl ** IPE data compression
+dnl --------------------------------------------------------------
+AC_DEFINE_UNQUOTED([HAVE_LIBZSTD], [$CABAL_FLAG_libzstd], [Define to 1 if you
+  wish to compress IPE data in compiler results (requires libzstd)])
+
+AC_DEFINE_UNQUOTED([STATIC_LIBZSTD], [$CABAL_FLAG_static_libzstd], [Define to 1 if you
+  wish to statically link the libzstd compression library in the compiler
+  (requires libzstd)])
+
+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 We should have these headers if the flag is set, but check anyways
+dnl in order to define `HAVE_*` macros.
+AS_IF(
+  [test "$CABAL_FLAG_libnuma" = 1],
+  [AC_CHECK_HEADERS([numa.h numaif.h])])
+
+dnl ** Write config files
+dnl --------------------------------------------------------------
+
 AC_OUTPUT
 
 dnl ######################################################################



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5cf69620e99ed456bdb86303010819a86b5027f8...6f6fb7752b5b65f85f09dfe381d24d8b8e9ee24e

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5cf69620e99ed456bdb86303010819a86b5027f8...6f6fb7752b5b65f85f09dfe381d24d8b8e9ee24e
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230925/944864ed/attachment-0001.html>


More information about the ghc-commits mailing list