From ef9e6c81d439bcedd2d885d38f03fdb61d6adbf6 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 11 Jan 2022 10:03:01 +0100 Subject: [PATCH 1/3] configure: update the --disable-systhreads option The core runtime system needs to be linked with POSIX threads. Hence, we can disable the systhreads library if we really want to, but this should not break the core runtime system. This commit separates - detecting POSIX threads: mandatory for the system to build - activating the systhreads library: on by default, controlled by --disable-systhreads and --enable-systhreads like before. It also reverts "Do not `disable-systhreads` for the minimal build" (commit ae85a4a33abef16a8133782f457356b7d342114d) since this should now work again. --- configure | 65 +++++++++++++---------------- configure.ac | 48 ++++++++++----------- tools/ci/inria/other-configs/script | 1 + 3 files changed, 53 insertions(+), 61 deletions(-) diff --git a/configure b/configure index 4eaf314bc8d8..7c8e384f3bf5 100755 --- a/configure +++ b/configure @@ -16678,24 +16678,11 @@ $as_echo "yes" >&6; } ;; #( $as_echo "no" >&6; } ;; esac -## Determine if the POSIX threads library is supported +## Determine how to link with the POSIX threads library -case $enable_systhreads,$enable_unix_lib in #( - yes,no) : - systhread_support=false - as_fn_error $? "the Win32/POSIX threads library requires the unix library" "$LINENO" 5 ;; #( - no,*|*,no) : - systhread_support=false - { $as_echo "$as_me:${as_lineno-$LINENO}: the Win32/POSIX threads library is disabled" >&5 -$as_echo "$as_me: the Win32/POSIX threads library is disabled" >&6;} ;; #( - *) : - case $host in #( +case $host in #( *-*-mingw32|*-pc-windows) : - systhread_support=true - otherlibraries="$otherlibraries systhreads" - PTHREAD_LIBS="-lpthread" - { $as_echo "$as_me:${as_lineno-$LINENO}: the Win32 threads library is supported" >&5 -$as_echo "$as_me: the Win32 threads library is supported" >&6;} ;; #( + PTHREAD_LIBS="-lpthread" ;; #( *) : @@ -17406,33 +17393,23 @@ test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX" # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test "x$ax_pthread_ok" = "xyes"; then - systhread_support=true - otherlibraries="$otherlibraries systhreads" - common_cflags="$common_cflags $PTHREAD_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: the POSIX threads library is supported" >&5 -$as_echo "$as_me: the POSIX threads library is supported" >&6;} - saved_CFLAGS="$CFLAGS" - saved_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$LIBS $PTHREAD_LIBS" - ac_fn_c_check_func "$LINENO" "sigwait" "ac_cv_func_sigwait" + common_cflags="$common_cflags $PTHREAD_CFLAGS" + saved_CFLAGS="$CFLAGS" + saved_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$LIBS $PTHREAD_LIBS" + ac_fn_c_check_func "$LINENO" "sigwait" "ac_cv_func_sigwait" if test "x$ac_cv_func_sigwait" = xyes; then : $as_echo "#define HAS_SIGWAIT 1" >>confdefs.h fi - LIBS="$saved_LIBS" - CFLAGS="$saved_CFLAGS" + LIBS="$saved_LIBS" + CFLAGS="$saved_CFLAGS" : else ax_pthread_ok=no - if test x"$enable_systhreads" = "xyes"; then : - as_fn_error $? "the POSIX thread library is not available" "$LINENO" 5 -else - systhread_support=false - { $as_echo "$as_me:${as_lineno-$LINENO}: the POSIX threads library is not supported" >&5 -$as_echo "$as_me: the POSIX threads library is not supported" >&6;} -fi + as_fn_error $? "POSIX threads are required but not supported on this platform" "$LINENO" 5 fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -17441,7 +17418,23 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu ;; -esac ;; +esac + +## Activate the systhread library + +case $enable_systhreads,$enable_unix_lib in #( + yes,no) : + systhread_support=false + as_fn_error $? "the threads library requires the unix library" "$LINENO" 5 ;; #( + no,*|*,no) : + systhread_support=false + { $as_echo "$as_me:${as_lineno-$LINENO}: the threads library is disabled" >&5 +$as_echo "$as_me: the threads library is disabled" >&6;} ;; #( + *) : + systhread_support=true + otherlibraries="$otherlibraries systhreads" + { $as_echo "$as_me:${as_lineno-$LINENO}: the threads library is supported" >&5 +$as_echo "$as_me: the threads library is supported" >&6;} ;; esac ## Does the assembler support debug prefix map and CFI directives diff --git a/configure.ac b/configure.ac index b1a8b29e754d..b4abebfec52f 100644 --- a/configure.ac +++ b/configure.ac @@ -1799,37 +1799,35 @@ AS_CASE([$arch,$system], AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) -## Determine if the POSIX threads library is supported +## Determine how to link with the POSIX threads library + +AS_CASE([$host], + [*-*-mingw32|*-pc-windows], + [PTHREAD_LIBS="-lpthread"], + [AX_PTHREAD( + [common_cflags="$common_cflags $PTHREAD_CFLAGS" + saved_CFLAGS="$CFLAGS" + saved_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$LIBS $PTHREAD_LIBS" + AC_CHECK_FUNC([sigwait], [AC_DEFINE([HAS_SIGWAIT])]) + LIBS="$saved_LIBS" + CFLAGS="$saved_CFLAGS"], + [AC_MSG_ERROR(m4_normalize([POSIX threads are required but not supported on + this platform]))])]) + +## Activate the systhread library AS_CASE([$enable_systhreads,$enable_unix_lib], [yes,no], [systhread_support=false - AC_MSG_ERROR([the Win32/POSIX threads library requires the unix library])], + AC_MSG_ERROR([the threads library requires the unix library])], [no,*|*,no], [systhread_support=false - AC_MSG_NOTICE([the Win32/POSIX threads library is disabled])], - [AS_CASE([$host], - [*-*-mingw32|*-pc-windows], - [systhread_support=true - otherlibraries="$otherlibraries systhreads" - PTHREAD_LIBS="-lpthread" - AC_MSG_NOTICE([the Win32 threads library is supported])], - [AX_PTHREAD( - [systhread_support=true - otherlibraries="$otherlibraries systhreads" - common_cflags="$common_cflags $PTHREAD_CFLAGS" - AC_MSG_NOTICE([the POSIX threads library is supported]) - saved_CFLAGS="$CFLAGS" - saved_LIBS="$LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - LIBS="$LIBS $PTHREAD_LIBS" - AC_CHECK_FUNC([sigwait], [AC_DEFINE([HAS_SIGWAIT])]) - LIBS="$saved_LIBS" - CFLAGS="$saved_CFLAGS"], - [AS_IF([test x"$enable_systhreads" = "xyes"], - [AC_MSG_ERROR([the POSIX thread library is not available])], - [systhread_support=false - AC_MSG_NOTICE([the POSIX threads library is not supported])])])])]) + AC_MSG_NOTICE([the threads library is disabled])], + [systhread_support=true + otherlibraries="$otherlibraries systhreads" + AC_MSG_NOTICE([the threads library is supported])]) ## Does the assembler support debug prefix map and CFI directives as_has_debug_prefix_map=false diff --git a/tools/ci/inria/other-configs/script b/tools/ci/inria/other-configs/script index 0ce1ad5210e3..472098670de9 100755 --- a/tools/ci/inria/other-configs/script +++ b/tools/ci/inria/other-configs/script @@ -31,6 +31,7 @@ ${main} -conf --disable-native-compiler \ -conf --disable-shared \ -conf --disable-debug-runtime \ -conf --disable-instrumented-runtime \ + -conf --disable-systhreads \ -conf --disable-str-lib \ -conf --disable-unix-lib \ -conf --disable-bigarray-lib \ From 3db79db204055fef83e7f0fa14a5e825b77ee163 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 11 Jan 2022 10:29:51 +0100 Subject: [PATCH 2/3] configure: more careful configuration for the native-code compiler If the native-code compiler is not supported for the given platform, do not define "native_compiler", resulting in a bytecode-only build. If, in addition, `--enable-native-compiler` was selected, fail at configure-time instead of continuing with a bytecode-only build. --- configure | 24 +++++++++++++++++------- configure.ac | 16 ++++++++++++---- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 7c8e384f3bf5..492834296c5a 100755 --- a/configure +++ b/configure @@ -14413,13 +14413,23 @@ fi; system=elf ;; #( ;; esac -if test x"$enable_native_compiler" = "xno"; then : - native_compiler=false - { $as_echo "$as_me:${as_lineno-$LINENO}: the native compiler is disabled" >&5 -$as_echo "$as_me: the native compiler is disabled" >&6;} -else - native_compiler=true -fi +case $enable_native_compiler,$arch in #( + no,*) : + native_compiler=false + { $as_echo "$as_me:${as_lineno-$LINENO}: the native compiler is disabled" >&5 +$as_echo "$as_me: the native compiler is disabled" >&6;} ;; #( + yes,none) : + as_fn_error 69 "the native compiler is not supported on this platform" "$LINENO" 5 ;; #( + *,none) : + native_compiler=false + { $as_echo "$as_me:${as_lineno-$LINENO}: the native compiler is not supported on this platform" >&5 +$as_echo "$as_me: the native compiler is not supported on this platform" >&6;} ;; #( + *,*) : + native_compiler=true + ;; #( + *) : + ;; +esac if ! $native_compiler; then : natdynlink=false diff --git a/configure.ac b/configure.ac index b4abebfec52f..70a83d593ff0 100644 --- a/configure.ac +++ b/configure.ac @@ -1151,10 +1151,18 @@ AS_CASE([$host], [arch=riscv; model=riscv64; system=linux] ) -AS_IF([test x"$enable_native_compiler" = "xno"], - [native_compiler=false - AC_MSG_NOTICE([the native compiler is disabled])], - [native_compiler=true]) +AS_CASE([$enable_native_compiler,$arch], + [no,*], + [native_compiler=false + AC_MSG_NOTICE([the native compiler is disabled])], + [yes,none], + [AC_MSG_ERROR([the native compiler is not supported on this platform], 69)], + [*,none], + [native_compiler=false + AC_MSG_NOTICE([the native compiler is not supported on this platform])], + [*,*], + [native_compiler=true] +) AS_IF([! $native_compiler], [natdynlink=false]) From c40b14b46ba9cd2f4c4086d19ea38959ea2db9f9 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Tue, 18 Jan 2022 15:21:20 +0100 Subject: [PATCH 3/3] configure: update the list of configurations that support native code For 5.00 it's only x86_64 on Linux, macOS, BSD, and Mingw, IIUC. --- configure | 86 ++--------------------------- configure.ac | 150 +++++++++++++++++++++++++-------------------------- 2 files changed, 78 insertions(+), 158 deletions(-) diff --git a/configure b/configure index 492834296c5a..24a8604d3075 100755 --- a/configure +++ b/configure @@ -14317,98 +14317,18 @@ model=default system=unknown case $host in #( - i[3456]86-*-linux*) : - arch=i386; system=linux_elf ;; #( - i[3456]86-*-*bsd*) : - arch=i386; system=bsd_elf ;; #( - i[3456]86-*-haiku*) : - arch=i386; system=beos ;; #( - i[3456]86-*-cygwin) : - arch=i386; system=cygwin ;; #( - i[3456]86-*-gnu*) : - arch=i386; system=gnu ;; #( - i[3456]86-*-mingw32) : - arch=i386; system=mingw ;; #( - i686-pc-windows) : - arch=i386; system=win32 ;; #( - x86_64-pc-windows) : - arch=amd64; system=win64 ;; #( - powerpc64le*-*-linux*) : - arch=power; model=ppc64le; system=elf ;; #( - powerpc*-*-linux*) : - arch=power; if $arch64; then : - model=ppc64 -else - model=ppc -fi; system=elf ;; #( - s390x*-*-linux*) : - arch=s390x; model=z10; system=elf ;; #( - # expected to match "gnueabihf" as well as "musleabihf" - armv6*-*-linux-*eabihf) : - arch=arm; model=armv6; system=linux_eabihf ;; #( - armv7*-*-linux-*eabihf) : - arch=arm; model=armv7; system=linux_eabihf ;; #( - armv8*-*-linux-*eabihf) : - arch=arm; model=armv8; system=linux_eabihf ;; #( - armv8*-*-linux-*eabi) : - arch=arm; model=armv8; system=linux_eabi ;; #( - armv7*-*-linux-*eabi) : - arch=arm; model=armv7; system=linux_eabi ;; #( - armv6t2*-*-linux-*eabi) : - arch=arm; model=armv6t2; system=linux_eabi ;; #( - armv6*-*-linux-*eabi) : - arch=arm; model=armv6; system=linux_eabi ;; #( - armv6*-*-freebsd*) : - arch=arm; model=armv6; system=freebsd ;; #( - earmv6*-*-netbsd*) : - arch=arm; model=armv6; system=netbsd ;; #( - earmv7*-*-netbsd*) : - arch=arm; model=armv7; system=netbsd ;; #( - armv5te*-*-linux-*eabi) : - arch=arm; model=armv5te; system=linux_eabi ;; #( - armv5*-*-linux-*eabi) : - arch=arm; model=armv5; system=linux_eabi ;; #( - arm*-*-linux-*eabihf) : - arch=arm; system=linux_eabihf ;; #( - arm*-*-linux-*eabi) : - arch=arm; system=linux_eabi ;; #( - arm*-*-openbsd*) : - arch=arm; system=bsd ;; #( - zaurus*-*-openbsd*) : - arch=arm; system=bsd ;; #( - x86_64-*-linux*) : + x86_64-*-linux*) : arch=amd64; system=linux ;; #( - x86_64-*-gnu*) : - arch=amd64; system=gnu ;; #( - x86_64-*-dragonfly*) : - arch=amd64; system=dragonfly ;; #( - x86_64-*-solaris*) : - arch=amd64; system=solaris ;; #( - x86_64-*-freebsd*) : + x86_64-*-freebsd*) : arch=amd64; system=freebsd ;; #( x86_64-*-netbsd*) : arch=amd64; system=netbsd ;; #( x86_64-*-openbsd*) : arch=amd64; system=openbsd ;; #( - x86_64-*-haiku*) : - arch=amd64; system=beos ;; #( - arm64-*-darwin*) : - arch=arm64; system=macosx ;; #( - aarch64-*-darwin*) : - arch=arm64; system=macosx ;; #( - x86_64-*-darwin*) : + x86_64-*-darwin*) : arch=amd64; system=macosx ;; #( x86_64-*-mingw32) : arch=amd64; system=mingw64 ;; #( - aarch64-*-linux*) : - arch=arm64; system=linux ;; #( - aarch64-*-freebsd*) : - arch=arm64; system=freebsd ;; #( - x86_64-*-cygwin*) : - arch=amd64; system=cygwin ;; #( - riscv64-*-linux*) : - arch=riscv; model=riscv64; system=linux - ;; #( *) : ;; esac diff --git a/configure.ac b/configure.ac index 70a83d593ff0..bc1d1b493f7a 100644 --- a/configure.ac +++ b/configure.ac @@ -1062,93 +1062,93 @@ model=default system=unknown AS_CASE([$host], - [[i[3456]86-*-linux*]], - [arch=i386; system=linux_elf], - [[i[3456]86-*-*bsd*]], - [arch=i386; system=bsd_elf], - [[i[3456]86-*-haiku*]], - [arch=i386; system=beos], - [[i[3456]86-*-cygwin]], - [arch=i386; system=cygwin], - [[i[3456]86-*-gnu*]], - [arch=i386; system=gnu], - [[i[3456]86-*-mingw32]], - [arch=i386; system=mingw], - [i686-pc-windows], - [arch=i386; system=win32], - [x86_64-pc-windows], - [arch=amd64; system=win64], - [[powerpc64le*-*-linux*]], - [arch=power; model=ppc64le; system=elf], - [[powerpc*-*-linux*]], - [arch=power; AS_IF([$arch64],[model=ppc64],[model=ppc]); system=elf], - [[s390x*-*-linux*]], - [arch=s390x; model=z10; system=elf], - # expected to match "gnueabihf" as well as "musleabihf" - [armv6*-*-linux-*eabihf], - [arch=arm; model=armv6; system=linux_eabihf], - [armv7*-*-linux-*eabihf], - [arch=arm; model=armv7; system=linux_eabihf], - [armv8*-*-linux-*eabihf], - [arch=arm; model=armv8; system=linux_eabihf], - [armv8*-*-linux-*eabi], - [arch=arm; model=armv8; system=linux_eabi], - [armv7*-*-linux-*eabi], - [arch=arm; model=armv7; system=linux_eabi], - [armv6t2*-*-linux-*eabi], - [arch=arm; model=armv6t2; system=linux_eabi], - [armv6*-*-linux-*eabi], - [arch=arm; model=armv6; system=linux_eabi], - [armv6*-*-freebsd*], - [arch=arm; model=armv6; system=freebsd], - [earmv6*-*-netbsd*], - [arch=arm; model=armv6; system=netbsd], - [earmv7*-*-netbsd*], - [arch=arm; model=armv7; system=netbsd], - [armv5te*-*-linux-*eabi], - [arch=arm; model=armv5te; system=linux_eabi], - [armv5*-*-linux-*eabi], - [arch=arm; model=armv5; system=linux_eabi], - [arm*-*-linux-*eabihf], - [arch=arm; system=linux_eabihf], - [arm*-*-linux-*eabi], - [arch=arm; system=linux_eabi], - [arm*-*-openbsd*], - [arch=arm; system=bsd], - [zaurus*-*-openbsd*], - [arch=arm; system=bsd], +dnl [[i[3456]86-*-linux*]], +dnl [arch=i386; system=linux_elf], +dnl [[i[3456]86-*-*bsd*]], +dnl [arch=i386; system=bsd_elf], +dnl [[i[3456]86-*-haiku*]], +dnl [arch=i386; system=beos], +dnl [[i[3456]86-*-cygwin]], +dnl [arch=i386; system=cygwin], +dnl [[i[3456]86-*-gnu*]], +dnl [arch=i386; system=gnu], +dnl [[i[3456]86-*-mingw32]], +dnl [arch=i386; system=mingw], +dnl [i686-pc-windows], +dnl [arch=i386; system=win32], +dnl [x86_64-pc-windows], +dnl [arch=amd64; system=win64], +dnl [[powerpc64le*-*-linux*]], +dnl [arch=power; model=ppc64le; system=elf], +dnl [[powerpc*-*-linux*]], +dnl [arch=power; AS_IF([$arch64],[model=ppc64],[model=ppc]); system=elf], +dnl [[s390x*-*-linux*]], +dnl [arch=s390x; model=z10; system=elf], +dnl # expected to match "gnueabihf" as well as "musleabihf" +dnl [armv6*-*-linux-*eabihf], +dnl [arch=arm; model=armv6; system=linux_eabihf], +dnl [armv7*-*-linux-*eabihf], +dnl [arch=arm; model=armv7; system=linux_eabihf], +dnl [armv8*-*-linux-*eabihf], +dnl [arch=arm; model=armv8; system=linux_eabihf], +dnl [armv8*-*-linux-*eabi], +dnl [arch=arm; model=armv8; system=linux_eabi], +dnl [armv7*-*-linux-*eabi], +dnl [arch=arm; model=armv7; system=linux_eabi], +dnl [armv6t2*-*-linux-*eabi], +dnl [arch=arm; model=armv6t2; system=linux_eabi], +dnl [armv6*-*-linux-*eabi], +dnl [arch=arm; model=armv6; system=linux_eabi], +dnl [armv6*-*-freebsd*], +dnl [arch=arm; model=armv6; system=freebsd], +dnl [earmv6*-*-netbsd*], +dnl [arch=arm; model=armv6; system=netbsd], +dnl [earmv7*-*-netbsd*], +dnl [arch=arm; model=armv7; system=netbsd], +dnl [armv5te*-*-linux-*eabi], +dnl [arch=arm; model=armv5te; system=linux_eabi], +dnl [armv5*-*-linux-*eabi], +dnl [arch=arm; model=armv5; system=linux_eabi], +dnl [arm*-*-linux-*eabihf], +dnl [arch=arm; system=linux_eabihf], +dnl [arm*-*-linux-*eabi], +dnl [arch=arm; system=linux_eabi], +dnl [arm*-*-openbsd*], +dnl [arch=arm; system=bsd], +dnl [zaurus*-*-openbsd*], +dnl [arch=arm; system=bsd], [x86_64-*-linux*], [arch=amd64; system=linux], - [x86_64-*-gnu*], - [arch=amd64; system=gnu], - [x86_64-*-dragonfly*], - [arch=amd64; system=dragonfly], - [x86_64-*-solaris*], - [arch=amd64; system=solaris], +dnl [x86_64-*-gnu*], +dnl [arch=amd64; system=gnu], +dnl [x86_64-*-dragonfly*], +dnl [arch=amd64; system=dragonfly], +dnl [x86_64-*-solaris*], +dnl [arch=amd64; system=solaris], [x86_64-*-freebsd*], [arch=amd64; system=freebsd], [x86_64-*-netbsd*], [arch=amd64; system=netbsd], [x86_64-*-openbsd*], [arch=amd64; system=openbsd], - [x86_64-*-haiku*], - [arch=amd64; system=beos], - [arm64-*-darwin*], - [arch=arm64; system=macosx], - [aarch64-*-darwin*], - [arch=arm64; system=macosx], +dnl [x86_64-*-haiku*], +dnl [arch=amd64; system=beos], +dnl [arm64-*-darwin*], +dnl [arch=arm64; system=macosx], +dnl [aarch64-*-darwin*], +dnl [arch=arm64; system=macosx], [x86_64-*-darwin*], [arch=amd64; system=macosx], [x86_64-*-mingw32], [arch=amd64; system=mingw64], - [aarch64-*-linux*], - [arch=arm64; system=linux], - [aarch64-*-freebsd*], - [arch=arm64; system=freebsd], - [x86_64-*-cygwin*], - [arch=amd64; system=cygwin], - [riscv64-*-linux*], - [arch=riscv; model=riscv64; system=linux] +dnl [aarch64-*-linux*], +dnl [arch=arm64; system=linux], +dnl [aarch64-*-freebsd*], +dnl [arch=arm64; system=freebsd], +dnl [x86_64-*-cygwin*], +dnl [arch=amd64; system=cygwin], +dnl [riscv64-*-linux*], +dnl [arch=riscv; model=riscv64; system=linux] ) AS_CASE([$enable_native_compiler,$arch],