From 43c92cb4331a15bb39c897004a25d7bb7f34b6e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= Date: Fri, 14 Feb 2025 10:28:23 +0100 Subject: [PATCH 01/10] erts: Fix unitialized warning --- erts/emulator/beam/dist.c | 2 ++ erts/emulator/beam/utils.c | 1 + 2 files changed, 3 insertions(+) diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c index cfa857e0df12..a48e7cbc3ee8 100644 --- a/erts/emulator/beam/dist.c +++ b/erts/emulator/beam/dist.c @@ -1150,6 +1150,8 @@ void init_dist(void) { Eterm *hp_start, *hp, **hpp = NULL, tuple; Uint sz = 0, *szp = &sz; + ERTS_UNDEF(hp, NULL); + ERTS_UNDEF(hp_start, NULL); while (1) { struct erl_off_heap_header **ohp; /* diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c index 57f809f29bb2..dfca70ef5b97 100644 --- a/erts/emulator/beam/utils.c +++ b/erts/emulator/beam/utils.c @@ -1525,6 +1525,7 @@ Sint compare_flatmap_atom_keys(const Eterm* a_keys, Eterm a, b; int ai, bi; Sint res; + ERTS_UNDEF(res, 0); ASSERT(n_atoms > 0); ASSERT(is_atom(a_keys[0]) && is_atom(b_keys[0])); From faf2b5abd900e40360ba7b3bf3a2f54251fde2d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= Date: Fri, 21 Feb 2025 14:08:55 +0100 Subject: [PATCH 02/10] erts: Add ERTS_FALLTHROUGH annotation in emu --- erts/emulator/beam/emu/beam_emu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erts/emulator/beam/emu/beam_emu.c b/erts/emulator/beam/emu/beam_emu.c index f43c2d154839..b1c25df6dc03 100644 --- a/erts/emulator/beam/emu/beam_emu.c +++ b/erts/emulator/beam/emu/beam_emu.c @@ -540,7 +540,9 @@ void process_main(ErtsSchedulerData *esdp) Goto(*I); } } - /* Fall through */ +#ifdef NO_JUMP_TABLE + ERTS_FALLTHROUGH(); +#endif OpCase(error_action_code): { handle_error: SWAPOUT; From 5e52b0cf4533281f96bee4afefbd9dd1ff5b015b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= Date: Fri, 14 Feb 2025 10:24:06 +0100 Subject: [PATCH 03/10] gh: Add ossf compiler flags scan to build action --- .../ossf-compiler-flags-scanner/action.yaml | 50 +++++++++++++++++++ .github/workflows/main.yaml | 3 +- .../ossf-compiler-flags-scanner.yaml | 33 +----------- 3 files changed, 54 insertions(+), 32 deletions(-) create mode 100644 .github/actions/ossf-compiler-flags-scanner/action.yaml diff --git a/.github/actions/ossf-compiler-flags-scanner/action.yaml b/.github/actions/ossf-compiler-flags-scanner/action.yaml new file mode 100644 index 000000000000..96a33370ce1f --- /dev/null +++ b/.github/actions/ossf-compiler-flags-scanner/action.yaml @@ -0,0 +1,50 @@ +# %CopyrightBegin% +# +# SPDX-FileCopyrightText: Copyright Ericsson AB 2023-2025. All Rights Reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# %CopyrightEnd% + +name: Open Source Security Foundation + +inputs: + upload: + description: 'Upload sarif results using codeql' + default: false + +runs: + using: composite + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4.2.2 + with: + repository: ossf/wg-best-practices-os-developers + sparse-checkout: docs/Compiler-Hardening-Guides/compiler-options-scraper + path: ossf + + - name: Setup compiler options scraper + shell: bash -eo pipefail {0} + run: | + pip3 install -r ossf/docs/Compiler-Hardening-Guides/compiler-options-scraper/requirements.txt + python3 ossf/docs/Compiler-Hardening-Guides/compiler-options-scraper/main.py + cat compiler-options.json + + - name: Run compiler flag comparison + shell: bash -eo pipefail {0} + run: | + docker run -v `pwd`/.github/scripts:/github --entrypoint "" otp \ + bash -c "/github/ossf-sarif-generator.es '$(cat compiler-options.json)'" > results.sarif + + - name: "Upload artifact" + if: ${{ !cancelled() }} + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # ratchet:actions/upload-artifact@v4.6.1 + with: + name: SARIF file + path: results.sarif + + # Upload the results to GitHub's code scanning dashboard. + - name: "Upload to code-scanning" + if: ${{ !cancelled() && inputs.upload == 'true' }} + uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # ratchet:github/codeql-action/upload-sarif@v3.28.10 + with: + sarif_file: results.sarif \ No newline at end of file diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index cc0dbd3f2d14..b1c5d4a9821c 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -59,7 +59,6 @@ jobs: name: Build Erlang/OTP (64-bit) runs-on: ubuntu-latest outputs: - BASE_BUILD: ${{ steps.base-build.outputs.BASE_BUILD }} changes: ${{ steps.changes.outputs.changes }} c-code-changes: ${{ steps.c-code-changes.outputs.changes }} all: ${{ steps.apps.outputs.all }} @@ -494,6 +493,8 @@ jobs: ## Run dialyzer - name: Run dialyzer run: docker run -v $PWD/:/github otp '/github/scripts/run-dialyzer' + - name: Check OSSF compiler flags + uses: ./.github/actions/ossf-compiler-flags-scanner test: name: Test Erlang/OTP diff --git a/.github/workflows/ossf-compiler-flags-scanner.yaml b/.github/workflows/ossf-compiler-flags-scanner.yaml index 1280ed035f53..ca7d24893aed 100644 --- a/.github/workflows/ossf-compiler-flags-scanner.yaml +++ b/.github/workflows/ossf-compiler-flags-scanner.yaml @@ -45,39 +45,10 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4.2.2 - name: Create initial pre-release tar run: .github/scripts/init-pre-release.sh otp_src.tar.gz - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4.2.2 - with: - repository: ossf/wg-best-practices-os-developers - sparse-checkout: docs/Compiler-Hardening-Guides/compiler-options-scraper - path: ossf - - - name: Setup compiler options scraper - run: | - pip3 install -r ossf/docs/Compiler-Hardening-Guides/compiler-options-scraper/requirements.txt - python3 ossf/docs/Compiler-Hardening-Guides/compiler-options-scraper/main.py - cat compiler-options.json - - uses: ./.github/actions/build-base-image with: BASE_BRANCH: master - BUILD_IMAGE: true - - - name: Run compiler flag comparison - run: | - docker run -v `pwd`/.github/scripts:/github --entrypoint "" otp \ - bash -c "/github/ossf-sarif-generator.es '$(cat compiler-options.json)'" > results.sarif - - - name: "Upload artifact" - if: ${{ !cancelled() }} - uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.4.3 ratchet:actions/upload-artifact@v4 - with: - name: SARIF file - path: results.sarif - # Upload the results to GitHub's code scanning dashboard. - - name: "Upload to code-scanning" - if: ${{ !cancelled() }} - uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # ratchet:github/codeql-action/upload-sarif@v3 + - uses: ./.github/actions/ossf-compiler-flags-scanner with: - sarif_file: results.sarif - + upload: true From 7aa257e676f38d7809ef2484a3f9df8fe4fe90a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= Date: Tue, 18 Feb 2025 11:44:03 +0100 Subject: [PATCH 04/10] otp: Always use $(CC) when compiling, never use ld We do this as AC_LINK_IFELSE needs LDFLAGS to be in $(CC) format to work and all OSs support using $(CC) as the linker. --- erts/configure | 180 +++++++++++++++++- erts/configure.ac | 1 + lib/common_test/configure | 7 + lib/crypto/configure | 199 ++++++++++++++++++-- lib/crypto/configure.ac | 1 + lib/erl_interface/configure | 51 ++++-- lib/erl_interface/configure.ac | 3 +- lib/megaco/configure | 200 ++++++++++++++++++-- lib/megaco/configure.ac | 1 + lib/odbc/configure | 325 +++++++++++++++++---------------- lib/odbc/configure.ac | 4 +- lib/snmp/configure | 7 + lib/wx/configure | 171 +++++++++++++++++ lib/wx/configure.ac | 1 + make/autoconf/otp.m4 | 56 ++++-- make/configure | 99 ++++++++-- make/configure.ac | 2 +- 17 files changed, 1068 insertions(+), 240 deletions(-) diff --git a/erts/configure b/erts/configure index 15525d24a4ac..af01db6952be 100755 --- a/erts/configure +++ b/erts/configure @@ -665,7 +665,6 @@ EMU_LDFLAGS M4 LIBRT BITS64 -HAVE_VALGRIND LIBSCTP SYSTEMD_DAEMON_LIBS SOCKET_LIBS @@ -3668,6 +3667,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + @@ -6292,6 +6298,169 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu +for ac_prog in ld.sh +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$LD" && break +done + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. +set dummy ${ac_tool_prefix}ld; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="${ac_tool_prefix}ld" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LD"; then + ac_ct_LD=$LD + # Extract the first word of "ld", so it can be a program name with args. +set dummy ld; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_LD"; then + ac_cv_prog_ac_ct_LD="$ac_ct_LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LD="ld" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_LD=$ac_cv_prog_ac_ct_LD +if test -n "$ac_ct_LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LD" >&5 +printf "%s\n" "$ac_ct_LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_LD" = x; then + LD=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LD=$ac_ct_LD + fi +else + LD="$ac_cv_prog_LD" +fi + + if test "$LD" = ":" +then : + as_fn_error $? "No linker found" "$LINENO" 5 +else case e in #( + e) + printf "configure:$LINENO: %s\n" 'setting LD to ${CC}' >&5 + + LD=${CC} ;; +esac +fi + @@ -18913,15 +19082,6 @@ then : fi -HAVE_VALGRIND=no -ac_fn_c_check_header_compile "$LINENO" "valgrind/valgrind.h" "ac_cv_header_valgrind_valgrind_h" "$ac_includes_default" -if test "x$ac_cv_header_valgrind_valgrind_h" = xyes -then : - HAVE_VALGRIND=yes -fi - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SO_BSDCOMPAT declaration" >&5 printf %s "checking for SO_BSDCOMPAT declaration... " >&6; } if test ${ac_cv_decl_so_bsdcompat+y} diff --git a/erts/configure.ac b/erts/configure.ac index 51575051e1ac..76a5aab188c5 100644 --- a/erts/configure.ac +++ b/erts/configure.ac @@ -437,6 +437,7 @@ AC_LANG([C]) AC_PROG_CC AC_SUBST(GCC) +LM_PROG_LD AC_PROG_CXX AC_SUBST(CXXFLAGS) diff --git a/lib/common_test/configure b/lib/common_test/configure index ca6cf5608401..d06625424a65 100755 --- a/lib/common_test/configure +++ b/lib/common_test/configure @@ -1915,6 +1915,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + diff --git a/lib/crypto/configure b/lib/crypto/configure index 12ee766cec4d..234bb54403b6 100755 --- a/lib/crypto/configure +++ b/lib/crypto/configure @@ -3034,6 +3034,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + @@ -4349,6 +4356,169 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +for ac_prog in ld.sh +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$LD" && break +done + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. +set dummy ${ac_tool_prefix}ld; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="${ac_tool_prefix}ld" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LD"; then + ac_ct_LD=$LD + # Extract the first word of "ld", so it can be a program name with args. +set dummy ld; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_LD"; then + ac_cv_prog_ac_ct_LD="$ac_ct_LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LD="ld" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_LD=$ac_cv_prog_ac_ct_LD +if test -n "$ac_ct_LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LD" >&5 +printf "%s\n" "$ac_ct_LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_LD" = x; then + LD=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LD=$ac_ct_LD + fi +else + LD="$ac_cv_prog_LD" +fi + + if test "$LD" = ":" +then : + as_fn_error $? "No linker found" "$LINENO" 5 +else case e in #( + e) + printf "configure:$LINENO: %s\n" 'setting LD to ${CC}' >&5 + + LD=${CC} ;; +esac +fi + if test "X$windows_environment_" != "Xchecked"; then @@ -5257,6 +5427,10 @@ See 'config.log' for more details" "$LINENO" 5; } fi USER_LD=$LD +if test "$USER_LD" = '$(CC)' +then : + USER_LD='$(DED_CC)' +fi USER_LDFLAGS="$LDFLAGS" DED_CC=$CC @@ -5581,12 +5755,11 @@ fi # to be specified (cross compiling) if test "x$DED_LD" = "x"; then -DED_LDFLAGS_CONFTEST= + DED_LDFLAGS_CONFTEST= -DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R" -case $host_os in + DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R" + case $host_os in win32) - DED_LD="ld.sh" DED_LDFLAGS="-dll" DED_LD_FLAG_RUNTIME_LIBRARY_PATH= ;; @@ -5595,6 +5768,7 @@ case $host_os in if test X${enable_m64_build} = Xyes; then DED_LDFLAGS="-64 $DED_LDFLAGS" fi + DED_LD="$CC" ;; aix*|os400*) DED_LDFLAGS="-G -bnoentry -bexpall" @@ -5673,7 +5847,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" ;; linux*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared -Wl,-Bsymbolic" if test X${enable_m64_build} = Xyes; then @@ -5684,7 +5857,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h fi ;; freebsd*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared" if test X${enable_m64_build} = Xyes; then @@ -5695,7 +5867,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h fi ;; openbsd*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared" ;; @@ -5709,14 +5880,16 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h DED_LDFLAGS="-shared" # GNU linker has no option for 64bit build, should not propagate -m64 ;; -esac + esac -if test "$DED_LD" = "" && test "$USER_LD" != ""; then - DED_LD="$USER_LD" - DED_LDFLAGS="$USER_LDFLAGS $DED_LDFLAGS" -fi + if test "x$DED_LD" = "x" && test "$USER_LD" != ""; then -DED_LIBS=$LIBS + printf "configure:$LINENO: %s\n" "setting DED_LD to $USER_LD" >&5 + + DED_LD="$USER_LD" + DED_LDFLAGS="$USER_LDFLAGS $DED_LDFLAGS" + fi + DED_LIBS=$LIBS fi # "x$DED_LD" = "x" diff --git a/lib/crypto/configure.ac b/lib/crypto/configure.ac index fb31f7d350df..e20bac8b95f9 100644 --- a/lib/crypto/configure.ac +++ b/lib/crypto/configure.ac @@ -53,6 +53,7 @@ AC_SUBST(CROSS_COMPILING) ERL_XCOMP_SYSROOT_INIT AC_PROG_CC +LM_PROG_LD LM_WINDOWS_ENVIRONMENT ERL_DED diff --git a/lib/erl_interface/configure b/lib/erl_interface/configure index d3a2668d73c0..a4f2988207de 100755 --- a/lib/erl_interface/configure +++ b/lib/erl_interface/configure @@ -2896,6 +2896,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + @@ -4648,7 +4655,7 @@ fi test -n "$LD" && break done -if test -n "$ac_tool_prefix"; then + if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. set dummy ${ac_tool_prefix}ld; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -4738,7 +4745,7 @@ printf "%s\n" "no" >&6; } fi if test "x$ac_ct_LD" = x; then - LD="'$(CC)'" + LD=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -4752,6 +4759,17 @@ else LD="$ac_cv_prog_LD" fi + if test "$LD" = ":" +then : + as_fn_error $? "No linker found" "$LINENO" 5 +else case e in #( + e) + printf "configure:$LINENO: %s\n" 'setting LD to ${CC}' >&5 + + LD=${CC} ;; +esac +fi + ERL_DED_FLAT_BUNDLE=true @@ -5003,6 +5021,10 @@ See 'config.log' for more details" "$LINENO" 5; } fi USER_LD=$LD +if test "$USER_LD" = '$(CC)' +then : + USER_LD='$(DED_CC)' +fi USER_LDFLAGS="$LDFLAGS" DED_CC=$CC @@ -5327,12 +5349,11 @@ fi # to be specified (cross compiling) if test "x$DED_LD" = "x"; then -DED_LDFLAGS_CONFTEST= + DED_LDFLAGS_CONFTEST= -DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R" -case $host_os in + DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R" + case $host_os in win32) - DED_LD="ld.sh" DED_LDFLAGS="-dll" DED_LD_FLAG_RUNTIME_LIBRARY_PATH= ;; @@ -5341,6 +5362,7 @@ case $host_os in if test X${enable_m64_build} = Xyes; then DED_LDFLAGS="-64 $DED_LDFLAGS" fi + DED_LD="$CC" ;; aix*|os400*) DED_LDFLAGS="-G -bnoentry -bexpall" @@ -5419,7 +5441,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" ;; linux*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared -Wl,-Bsymbolic" if test X${enable_m64_build} = Xyes; then @@ -5430,7 +5451,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h fi ;; freebsd*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared" if test X${enable_m64_build} = Xyes; then @@ -5441,7 +5461,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h fi ;; openbsd*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared" ;; @@ -5455,14 +5474,16 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h DED_LDFLAGS="-shared" # GNU linker has no option for 64bit build, should not propagate -m64 ;; -esac + esac -if test "$DED_LD" = "" && test "$USER_LD" != ""; then - DED_LD="$USER_LD" - DED_LDFLAGS="$USER_LDFLAGS $DED_LDFLAGS" -fi + if test "x$DED_LD" = "x" && test "$USER_LD" != ""; then + + printf "configure:$LINENO: %s\n" "setting DED_LD to $USER_LD" >&5 -DED_LIBS=$LIBS + DED_LD="$USER_LD" + DED_LDFLAGS="$USER_LDFLAGS $DED_LDFLAGS" + fi + DED_LIBS=$LIBS fi # "x$DED_LD" = "x" diff --git a/lib/erl_interface/configure.ac b/lib/erl_interface/configure.ac index 1b20cc8d65b4..883b0ec380ed 100644 --- a/lib/erl_interface/configure.ac +++ b/lib/erl_interface/configure.ac @@ -103,8 +103,7 @@ AC_PROG_CPP AC_PROG_EGREP dnl AC_PROG_LIBTOOL AC_PROG_RANLIB -AC_CHECK_PROGS(LD, ld.sh) -AC_CHECK_TOOL(LD, ld, '$(CC)') +LM_PROG_LD AC_SUBST(LD) ERL_DED_FLAT_BUNDLE=true diff --git a/lib/megaco/configure b/lib/megaco/configure index 1277434183b7..d428f28d24f4 100755 --- a/lib/megaco/configure +++ b/lib/megaco/configure @@ -671,6 +671,7 @@ LEX_OUTPUT_ROOT LEX MIXED_MINGW MIXED_VC +LD OBJEXT EXEEXT ac_ct_CC @@ -2780,6 +2781,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + @@ -4021,6 +4029,169 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +for ac_prog in ld.sh +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$LD" && break +done + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. +set dummy ${ac_tool_prefix}ld; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="${ac_tool_prefix}ld" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LD"; then + ac_ct_LD=$LD + # Extract the first word of "ld", so it can be a program name with args. +set dummy ld; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_LD"; then + ac_cv_prog_ac_ct_LD="$ac_ct_LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LD="ld" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_LD=$ac_cv_prog_ac_ct_LD +if test -n "$ac_ct_LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LD" >&5 +printf "%s\n" "$ac_ct_LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_LD" = x; then + LD=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LD=$ac_ct_LD + fi +else + LD="$ac_cv_prog_LD" +fi + + if test "$LD" = ":" +then : + as_fn_error $? "No linker found" "$LINENO" 5 +else case e in #( + e) + printf "configure:$LINENO: %s\n" 'setting LD to ${CC}' >&5 + + LD=${CC} ;; +esac +fi + @@ -5310,6 +5481,10 @@ See 'config.log' for more details" "$LINENO" 5; } fi USER_LD=$LD +if test "$USER_LD" = '$(CC)' +then : + USER_LD='$(DED_CC)' +fi USER_LDFLAGS="$LDFLAGS" DED_CC=$CC @@ -5634,12 +5809,11 @@ fi # to be specified (cross compiling) if test "x$DED_LD" = "x"; then -DED_LDFLAGS_CONFTEST= + DED_LDFLAGS_CONFTEST= -DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R" -case $host_os in + DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R" + case $host_os in win32) - DED_LD="ld.sh" DED_LDFLAGS="-dll" DED_LD_FLAG_RUNTIME_LIBRARY_PATH= ;; @@ -5648,6 +5822,7 @@ case $host_os in if test X${enable_m64_build} = Xyes; then DED_LDFLAGS="-64 $DED_LDFLAGS" fi + DED_LD="$CC" ;; aix*|os400*) DED_LDFLAGS="-G -bnoentry -bexpall" @@ -5726,7 +5901,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" ;; linux*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared -Wl,-Bsymbolic" if test X${enable_m64_build} = Xyes; then @@ -5737,7 +5911,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h fi ;; freebsd*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared" if test X${enable_m64_build} = Xyes; then @@ -5748,7 +5921,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h fi ;; openbsd*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared" ;; @@ -5762,14 +5934,16 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h DED_LDFLAGS="-shared" # GNU linker has no option for 64bit build, should not propagate -m64 ;; -esac + esac -if test "$DED_LD" = "" && test "$USER_LD" != ""; then - DED_LD="$USER_LD" - DED_LDFLAGS="$USER_LDFLAGS $DED_LDFLAGS" -fi + if test "x$DED_LD" = "x" && test "$USER_LD" != ""; then -DED_LIBS=$LIBS + printf "configure:$LINENO: %s\n" "setting DED_LD to $USER_LD" >&5 + + DED_LD="$USER_LD" + DED_LDFLAGS="$USER_LDFLAGS $DED_LDFLAGS" + fi + DED_LIBS=$LIBS fi # "x$DED_LD" = "x" diff --git a/lib/megaco/configure.ac b/lib/megaco/configure.ac index a5c3db9e1aae..a96c7a934c31 100644 --- a/lib/megaco/configure.ac +++ b/lib/megaco/configure.ac @@ -40,6 +40,7 @@ dnl Checks for programs. dnl ---------------------------------------------------------------------- AC_PROG_CC +LM_PROG_LD LM_WINDOWS_ENVIRONMENT diff --git a/lib/odbc/configure b/lib/odbc/configure index a13e824f516d..20152629b122 100755 --- a/lib/odbc/configure +++ b/lib/odbc/configure @@ -650,10 +650,10 @@ GETCONF EGREP GREP RM -LD SET_MAKE MIXED_MINGW MIXED_VC +LD OBJEXT EXEEXT ac_ct_CC @@ -2876,6 +2876,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + @@ -4137,6 +4144,169 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +for ac_prog in ld.sh +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$LD" && break +done + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. +set dummy ${ac_tool_prefix}ld; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="${ac_tool_prefix}ld" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LD"; then + ac_ct_LD=$LD + # Extract the first word of "ld", so it can be a program name with args. +set dummy ld; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_LD"; then + ac_cv_prog_ac_ct_LD="$ac_ct_LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LD="ld" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_LD=$ac_cv_prog_ac_ct_LD +if test -n "$ac_ct_LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LD" >&5 +printf "%s\n" "$ac_ct_LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_LD" = x; then + LD=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LD=$ac_ct_LD + fi +else + LD="$ac_cv_prog_LD" +fi + + if test "$LD" = ":" +then : + as_fn_error $? "No linker found" "$LINENO" 5 +else case e in #( + e) + printf "configure:$LINENO: %s\n" 'setting LD to ${CC}' >&5 + + LD=${CC} ;; +esac +fi + @@ -4293,159 +4463,6 @@ printf "%s\n" "no" >&6; } fi -for ac_prog in ld.sh -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_LD+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$LD"; then - ac_cv_prog_LD="$LD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_LD="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -LD=$ac_cv_prog_LD -if test -n "$LD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -printf "%s\n" "$LD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$LD" && break -done - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. -set dummy ${ac_tool_prefix}ld; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_LD+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$LD"; then - ac_cv_prog_LD="$LD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_LD="${ac_tool_prefix}ld" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -LD=$ac_cv_prog_LD -if test -n "$LD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -printf "%s\n" "$LD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LD"; then - ac_ct_LD=$LD - # Extract the first word of "ld", so it can be a program name with args. -set dummy ld; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_LD+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_LD"; then - ac_cv_prog_ac_ct_LD="$ac_ct_LD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_LD="ld" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -ac_ct_LD=$ac_cv_prog_ac_ct_LD -if test -n "$ac_ct_LD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LD" >&5 -printf "%s\n" "$ac_ct_LD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_LD" = x; then - LD="'$(CC)'" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LD=$ac_ct_LD - fi -else - LD="$ac_cv_prog_LD" -fi - - _search_path=/bin:/usr/bin:/usr/local/bin:$PATH diff --git a/lib/odbc/configure.ac b/lib/odbc/configure.ac index 389fb6be1889..2f0b3ead9b08 100644 --- a/lib/odbc/configure.ac +++ b/lib/odbc/configure.ac @@ -44,6 +44,7 @@ ERL_XCOMP_SYSROOT_INIT dnl Checks for programs. AC_PROG_CC +LM_PROG_LD dnl --------------------------------------------------------------------- dnl Special windows stuff regarding CFLAGS and details in the environment... @@ -52,9 +53,6 @@ LM_WINDOWS_ENVIRONMENT AC_PROG_MAKE_SET -AC_CHECK_PROGS(LD, ld.sh) -AC_CHECK_TOOL(LD, ld, '$(CC)') - AC_SUBST(LD) _search_path=/bin:/usr/bin:/usr/local/bin:$PATH diff --git a/lib/snmp/configure b/lib/snmp/configure index 399f6f62e108..42ec59990b5d 100755 --- a/lib/snmp/configure +++ b/lib/snmp/configure @@ -1910,6 +1910,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + diff --git a/lib/wx/configure b/lib/wx/configure index 7b74849a5533..31baa8f9e485 100755 --- a/lib/wx/configure +++ b/lib/wx/configure @@ -679,6 +679,7 @@ GLIB_LIBS GLIB_CFLAGS MIXED_MINGW MIXED_VC +LD CPP RANLIB ac_ct_CXX @@ -3091,6 +3092,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + @@ -4996,6 +5004,169 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +for ac_prog in ld.sh +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$LD" && break +done + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. +set dummy ${ac_tool_prefix}ld; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="${ac_tool_prefix}ld" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LD"; then + ac_ct_LD=$LD + # Extract the first word of "ld", so it can be a program name with args. +set dummy ld; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_LD"; then + ac_cv_prog_ac_ct_LD="$ac_ct_LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LD="ld" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_LD=$ac_cv_prog_ac_ct_LD +if test -n "$ac_ct_LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LD" >&5 +printf "%s\n" "$ac_ct_LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_LD" = x; then + LD=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LD=$ac_ct_LD + fi +else + LD="$ac_cv_prog_LD" +fi + + if test "$LD" = ":" +then : + as_fn_error $? "No linker found" "$LINENO" 5 +else case e in #( + e) + printf "configure:$LINENO: %s\n" 'setting LD to ${CC}' >&5 + + LD=${CC} ;; +esac +fi + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' diff --git a/lib/wx/configure.ac b/lib/wx/configure.ac index b7cacf405f57..bce9bbaa0158 100644 --- a/lib/wx/configure.ac +++ b/lib/wx/configure.ac @@ -72,6 +72,7 @@ AC_PROG_CC AC_PROG_CXX AC_PROG_RANLIB AC_PROG_CPP +LM_PROG_LD AC_LANG_PUSH([C++]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( diff --git a/make/autoconf/otp.m4 b/make/autoconf/otp.m4 index 6c77cd520db0..51f051169372 100644 --- a/make/autoconf/otp.m4 +++ b/make/autoconf/otp.m4 @@ -29,6 +29,14 @@ dnl The Local Macros which could be part of autoconf are prefixed LM_, dnl macros specific dnl to the Erlang system are prefixed ERL_ (this is dnl not always consistently made...). dnl +dnl To make it easier to debug, sprinkle some calls to LM_LOG in the macros + +dnl Log a message to config.log +AC_DEFUN(LM_LOG, + [ + printf "configure:$LINENO: %s\n" $1 >&AS_MESSAGE_LOG_FD + ]) + dnl We check if -Werror was given on command line and if so dnl we disable it for the configure and only use it when @@ -319,6 +327,28 @@ fi fi ]) + +dnl ---------------------------------------------------------------------- +dnl +dnl LM_PROG_LD +dnl +dnl +dnl Sets LD to the either ld.sh or '$(CC)'. We force LD to be $CC so that +dnl we know that LDFLAGS will have to be in the form acceped by $CC and not +dnl the form used to ld. +dnl +dnl Windows is a bit of a special case as we control ld.sh ourselves, so there +dnl we use ld.sh instead of cc.sh. + +AC_DEFUN(LM_PROG_LD, + [AC_CHECK_PROGS(LD, ld.sh) + AC_CHECK_TOOL(LD, ld, [:]) + AS_IF([test "$LD" = ":"], + [AC_MSG_ERROR([No linker found])], + [LM_LOG('setting LD to ${CC}') + LD=${CC}]) +]) + dnl ---------------------------------------------------------------------- dnl dnl LM_FIND_EMU_CC @@ -3110,6 +3140,7 @@ AC_DEFUN(ERL_DED_FLAGS, AC_SYS_YEAR2038_RECOMMENDED USER_LD=$LD +AS_IF([ test "$USER_LD" = '$(CC)' ], [USER_LD='$(DED_CC)']) USER_LDFLAGS="$LDFLAGS" DED_CC=$CC @@ -3199,12 +3230,11 @@ fi # to be specified (cross compiling) if test "x$DED_LD" = "x"; then -DED_LDFLAGS_CONFTEST= + DED_LDFLAGS_CONFTEST= -DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R" -case $host_os in + DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R" + case $host_os in win32) - DED_LD="ld.sh" DED_LDFLAGS="-dll" DED_LD_FLAG_RUNTIME_LIBRARY_PATH= ;; @@ -3213,6 +3243,7 @@ case $host_os in if test X${enable_m64_build} = Xyes; then DED_LDFLAGS="-64 $DED_LDFLAGS" fi + DED_LD="$CC" ;; aix*|os400*) DED_LDFLAGS="-G -bnoentry -bexpall" @@ -3257,7 +3288,6 @@ case $host_os in DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" ;; linux*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared -Wl,-Bsymbolic" if test X${enable_m64_build} = Xyes; then @@ -3268,7 +3298,6 @@ case $host_os in fi ;; freebsd*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared" if test X${enable_m64_build} = Xyes; then @@ -3279,7 +3308,6 @@ case $host_os in fi ;; openbsd*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared" ;; @@ -3293,14 +3321,14 @@ case $host_os in DED_LDFLAGS="-shared" # GNU linker has no option for 64bit build, should not propagate -m64 ;; -esac - -if test "$DED_LD" = "" && test "$USER_LD" != ""; then - DED_LD="$USER_LD" - DED_LDFLAGS="$USER_LDFLAGS $DED_LDFLAGS" -fi + esac -DED_LIBS=$LIBS + if test "x$DED_LD" = "x" && test "$USER_LD" != ""; then + LM_LOG("setting DED_LD to $USER_LD") + DED_LD="$USER_LD" + DED_LDFLAGS="$USER_LDFLAGS $DED_LDFLAGS" + fi + DED_LIBS=$LIBS fi # "x$DED_LD" = "x" diff --git a/make/configure b/make/configure index 8ecdd0102897..408f8b682552 100755 --- a/make/configure +++ b/make/configure @@ -3304,6 +3304,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + @@ -5022,7 +5029,55 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then +for ac_prog in ld.sh +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LD+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$LD" && break +done + + if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. set dummy ${ac_tool_prefix}ld; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -5112,7 +5167,7 @@ printf "%s\n" "no" >&6; } fi if test "x$ac_ct_LD" = x; then - LD="" + LD=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -5126,6 +5181,17 @@ else LD="$ac_cv_prog_LD" fi + if test "$LD" = ":" +then : + as_fn_error $? "No linker found" "$LINENO" 5 +else case e in #( + e) + printf "configure:$LINENO: %s\n" 'setting LD to ${CC}' >&5 + + LD=${CC} ;; +esac +fi + @@ -6665,6 +6731,10 @@ See 'config.log' for more details" "$LINENO" 5; } fi USER_LD=$LD +if test "$USER_LD" = '$(CC)' +then : + USER_LD='$(DED_CC)' +fi USER_LDFLAGS="$LDFLAGS" DED_CC=$CC @@ -6989,12 +7059,11 @@ fi # to be specified (cross compiling) if test "x$DED_LD" = "x"; then -DED_LDFLAGS_CONFTEST= + DED_LDFLAGS_CONFTEST= -DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R" -case $host_os in + DED_LD_FLAG_RUNTIME_LIBRARY_PATH="-R" + case $host_os in win32) - DED_LD="ld.sh" DED_LDFLAGS="-dll" DED_LD_FLAG_RUNTIME_LIBRARY_PATH= ;; @@ -7003,6 +7072,7 @@ case $host_os in if test X${enable_m64_build} = Xyes; then DED_LDFLAGS="-64 $DED_LDFLAGS" fi + DED_LD="$CC" ;; aix*|os400*) DED_LDFLAGS="-G -bnoentry -bexpall" @@ -7081,7 +7151,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" ;; linux*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared -Wl,-Bsymbolic" if test X${enable_m64_build} = Xyes; then @@ -7092,7 +7161,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h fi ;; freebsd*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared" if test X${enable_m64_build} = Xyes; then @@ -7103,7 +7171,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h fi ;; openbsd*) - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" DED_LDFLAGS="-shared" ;; @@ -7117,14 +7184,16 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h DED_LDFLAGS="-shared" # GNU linker has no option for 64bit build, should not propagate -m64 ;; -esac + esac -if test "$DED_LD" = "" && test "$USER_LD" != ""; then - DED_LD="$USER_LD" - DED_LDFLAGS="$USER_LDFLAGS $DED_LDFLAGS" -fi + if test "x$DED_LD" = "x" && test "$USER_LD" != ""; then -DED_LIBS=$LIBS + printf "configure:$LINENO: %s\n" "setting DED_LD to $USER_LD" >&5 + + DED_LD="$USER_LD" + DED_LDFLAGS="$USER_LDFLAGS $DED_LDFLAGS" + fi + DED_LIBS=$LIBS fi # "x$DED_LD" = "x" diff --git a/make/configure.ac b/make/configure.ac index 3d14c1901238..e356672c4d54 100644 --- a/make/configure.ac +++ b/make/configure.ac @@ -121,7 +121,7 @@ dnl Checks for programs. AC_PROG_CC AC_PROG_CXX -AC_CHECK_TOOL(LD, [ld]) +LM_PROG_LD LM_WINDOWS_ENVIRONMENT From 41928e70355718fa429101a3fecc254ecd6b17f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= Date: Fri, 21 Feb 2025 14:22:33 +0100 Subject: [PATCH 05/10] erts: Fix bash if in emu_cc.sh --- erts/etc/win32/wsl_tools/vc/emu_cc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erts/etc/win32/wsl_tools/vc/emu_cc.sh b/erts/etc/win32/wsl_tools/vc/emu_cc.sh index 495575f503ce..145820c4be61 100755 --- a/erts/etc/win32/wsl_tools/vc/emu_cc.sh +++ b/erts/etc/win32/wsl_tools/vc/emu_cc.sh @@ -23,7 +23,7 @@ if [ X"$CONFIG_SUBTYPE" = X"win64" ]; then GCC="x86_64-w64-mingw32-gcc -m64" -elif [ X"$CONFIG_SUBTYPE" = X"arm64" || X"$CONFIG_SUBTYPE" = X"x64_arm64" ]; then +elif [ X"$CONFIG_SUBTYPE" = X"arm64" ] || [ X"$CONFIG_SUBTYPE" = X"x64_arm64" ]; then GCC="aarch64-w64-mingw32-gcc -m64" else GCC="x86_64-w64-mingw32-gcc -m32" From dd304892eeeeafcc96adc6f4f40ea9a7936aa01d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= Date: Fri, 21 Feb 2025 14:23:07 +0100 Subject: [PATCH 06/10] public_key: Fix compile with gcov --- lib/public_key/c_src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/public_key/c_src/Makefile b/lib/public_key/c_src/Makefile index 064868af42cd..51d75f501526 100644 --- a/lib/public_key/c_src/Makefile +++ b/lib/public_key/c_src/Makefile @@ -91,7 +91,7 @@ endif _create_dirs := $(shell mkdir -p $(OBJDIR) $(LIBDIR)) -debug opt valgrind lcnt asan: $(DIRS) $(PUBKEY_LIB) +debug opt valgrind lcnt asan gcov: $(DIRS) $(PUBKEY_LIB) $(OBJDIR): -@mkdir -p $(OBJDIR) From 6397331bd440474138a98d2585646044b1b4cfaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= Date: Fri, 21 Feb 2025 14:24:46 +0100 Subject: [PATCH 07/10] erts: Remove HAVE_VALGRIND This is done so that we in docker environments can install valgrind after configure has been run. --- erts/configure.ac | 4 ---- erts/emulator/Makefile.in | 6 ------ 2 files changed, 10 deletions(-) diff --git a/erts/configure.ac b/erts/configure.ac index 76a5aab188c5..ed31f3db2f06 100644 --- a/erts/configure.ac +++ b/erts/configure.ac @@ -1858,10 +1858,6 @@ AC_CHECK_HEADERS([linux/types.h linux/errqueue.h], [], [], #endif ]]) -HAVE_VALGRIND=no -AC_CHECK_HEADER(valgrind/valgrind.h, HAVE_VALGRIND=yes) -AC_SUBST(HAVE_VALGRIND) - LM_DECL_SO_BSDCOMPAT LM_DECL_INADDR_LOOPBACK LM_DECL_SYS_ERRLIST diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in index 0eaadfd18736..8de649dfc3ef 100644 --- a/erts/emulator/Makefile.in +++ b/erts/emulator/Makefile.in @@ -247,12 +247,6 @@ endif # DIRTY_SCHEDULER_TEST TF_MARKER=$(TYPEMARKER)$(FLAVOR_MARKER) -ifeq ($(TYPE)-@HAVE_VALGRIND@,valgrind-no) -VOID_EMULATOR = '*** valgrind emulator disabled by configure' -else -VOID_EMULATOR = -endif - OPSYS=@OPSYS@ sol2CFLAGS= From b0b945aab0eeeaea3bf5b8ebc7169e25a4605b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= Date: Fri, 21 Feb 2025 14:26:51 +0100 Subject: [PATCH 08/10] gh: Add compiling of asan, gcov, valgrind, lttng --- .github/workflows/main.yaml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b1c5d4a9821c..7fb215f59e5b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -384,6 +384,11 @@ jobs: needs: pack if: needs.pack.outputs.c-code-changes + strategy: + matrix: + flavor: [jit, emu] + fail-fast: false + steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4.2.2 - uses: ./.github/actions/build-base-image @@ -391,21 +396,33 @@ jobs: BASE_BRANCH: ${{ env.BASE_BRANCH }} - name: Build Erlang/OTP flavors and types run: | - TYPES="opt debug lcnt" - FLAVORS="emu jit" + TYPES="opt debug lcnt asan gcov valgrind" + FLAVORS="${{ matrix.flavor }}" for TYPE in ${TYPES}; do for FLAVOR in ${FLAVORS}; do echo "::group::{TYPE=$TYPE FLAVOR=$FLAVOR}" - docker run otp "make TYPE=$TYPE FLAVOR=$FLAVOR" + docker run otp \ + "if [ ${TYPE} = \"valgrind\" ]; then sudo apt-get install -y valgrind bc; fi && \ + make TYPE=$TYPE FLAVOR=$FLAVOR && \ + cerl -$TYPE -emu_flavor $FLAVOR -noshell -s init stop" echo "::endgroup::" done done - name: Build Erlang/OTP JIT Win32 ABI + if: ${{ matrix.flavor == 'jit' }} run: > docker run otp './configure CFLAGS="$CFLAGS -DERTS_JIT_ABI_WIN32=1" && make && make TYPE=debug && cerl -noshell -s init stop && cerl -debug -noshell -s init stop' + - name: Build Erlang/OTP with LTTNG + if: ${{ matrix.flavor == 'jit' }} + run: > + docker run otp 'sudo apt-get install -y lttng-tools && + ./configure --enable-dynamic-trace=lttng && + make && make TYPE=debug && + cerl -noshell -s init stop && cerl -debug -noshell -s init stop' + build: name: Build Erlang/OTP runs-on: ubuntu-latest From c2a2f47c01036483b3d9057f56074948c440c62e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= Date: Fri, 21 Feb 2025 14:27:06 +0100 Subject: [PATCH 09/10] gh: Add testing of JIT startup flags --- .github/workflows/main.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 7fb215f59e5b..5571d167591f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -423,6 +423,14 @@ jobs: make && make TYPE=debug && cerl -noshell -s init stop && cerl -debug -noshell -s init stop' + - name: Start Erlang with various start options + if: ${{ matrix.flavor == 'jit' }} + run: | + OPTIONS=("+JPperf true" "+JMsingle true" "+JDdump true") + for OPTION in "${OPTIONS[@]}"; do + docker run otp "erl ${OPTION} -noshell -s init stop" + done + build: name: Build Erlang/OTP runs-on: ubuntu-latest From 9c916ab2168a1e459d6f9a2f8b492774f7c2b9d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= Date: Fri, 14 Feb 2025 14:33:24 +0100 Subject: [PATCH 10/10] otp: Use OSSF flags by default when building Erlang --- .github/dockerfiles/Dockerfile.64-bit | 9 +- HOWTO/INSTALL.md | 4 + erts/configure | 4205 +++++++------- erts/configure.ac | 67 +- erts/emulator/Makefile.in | 6 +- lib/common_test/configure | 13 + lib/crypto/configure | 962 +++- lib/erl_interface/configure | 7694 +++++++++++++++---------- lib/erl_interface/configure.ac | 3 +- lib/megaco/configure | 966 +++- lib/odbc/configure | 1372 ++++- lib/odbc/configure.ac | 2 + lib/snmp/configure | 13 + lib/wx/configure | 1278 +++- lib/wx/configure.ac | 8 +- make/autoconf/otp.m4 | 153 +- make/configure | 962 +++- 17 files changed, 12182 insertions(+), 5535 deletions(-) diff --git a/.github/dockerfiles/Dockerfile.64-bit b/.github/dockerfiles/Dockerfile.64-bit index 4c0d15b05410..6666fe5fb974 100644 --- a/.github/dockerfiles/Dockerfile.64-bit +++ b/.github/dockerfiles/Dockerfile.64-bit @@ -14,10 +14,8 @@ WORKDIR /buildroot/otp/ ENV CFLAGS="-O2 -g -Werror -DwxSTC_DISABLE_MACRO_DEPRECATIONS=1" ENV CFLAGS="${CFLAGS} -Wall -Wformat -Wformat=2 -Wno-conversion -Wimplicit-fallthrough \ - -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS \ - -fstack-clash-protection -fstack-protector-strong -Wtrampolines \ - -fcf-protection=full -fexceptions -fno-strict-overflow -fno-delete-null-pointer-checks \ - -D_GLIBCXX_ASSERTIONS" + -Werror=format-security -Wtrampolines -fsanitize=signed-integer-overflow" +ENV CXXFLAGS="-Wno-maybe-uninitialized" ## OpenSSF recommended CFLAGS, skipped are: ## -Wconversion -Wextra -Wsign-conversion - As we have way too many of these warnings ## -fstrict-flex-arrays=3 -Wbidi-chars=any - As gcc 11 does not support it @@ -26,7 +24,7 @@ ENV CFLAGS="${CFLAGS} -Wall -Wformat -Wformat=2 -Wno-conversion -Wimplicit-fallt ENV SKIPPED_OSSF_CFLAGS="-Wconversion -mbranch-protection=standard \ -Wextra -Werror=implicit -Werror=incompatible-pointer-types -Werror=int-conversion \ -Wsign-conversion" -ENV LDFLAGS="-Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -Wl,--no-copy-dt-needed-entries" +ENV LDFLAGS="" ## OpenSSF recommended LDFLAGS, skipped are: ## -Wl,-z,nodlopen - as opening drivers/nifs needs this ## -fPIE - not needed with gcc 11 @@ -46,6 +44,7 @@ RUN if [ ! -f Makefile ]; then \ ## Disable -Werror as testcases do not compile with it on ENV CFLAGS="-O2 -g" ENV LDFLAGS="" +ENV CXXFLAGS="" ## Update init.sh with correct env vars RUN echo "export MAKEFLAGS=$MAKEFLAGS" > /buildroot/env.sh && \ diff --git a/HOWTO/INSTALL.md b/HOWTO/INSTALL.md index eb99c8e15e20..be8a95295cc2 100644 --- a/HOWTO/INSTALL.md +++ b/HOWTO/INSTALL.md @@ -428,6 +428,10 @@ Some of the available `configure` options are: option which will enable `configure` to continue without support for timestamps after mid-January 2038. This is typically only an issue on 32-bit platforms. +* `--disable-security-hardening-flags` - Disable all security hardening + flags when compiling Erlang/OTP. This can be useful in some scenarios + when the flags either causes Erlang/OTP not to build, or unacceptable + performance degradations. If you or your system has special requirements please read the `Makefile` for additional configuration information. diff --git a/erts/configure b/erts/configure index af01db6952be..6bb09f271780 100755 --- a/erts/configure +++ b/erts/configure @@ -646,6 +646,7 @@ LIBOBJS DEBUG_CXXFLAGS DEBUG_CFLAGS ERL_DETERMINISTIC +NO_MAYBE_UNINITIALIZED CFLAGS32 CC32 JAVAC @@ -711,14 +712,6 @@ INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM ELIXIR -LN_S -PERL -YFLAGS -YACC -EGREP -GREP -ac_ct_CXX -GCC STATIC_DRIVERS STATIC_NIFS OTP_VERSION @@ -726,6 +719,14 @@ SYSTEM_VSN OTP_RELEASE USE_VM_PROBES ENABLE_ALLOC_TYPE_VARS +LN_S +PERL +YFLAGS +YACC +EGREP +GREP +GCC +ac_ct_CXX OBJEXT EXEEXT ac_ct_CC @@ -818,6 +819,7 @@ SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking +enable_security_hardening_flags enable_bootstrap_only enable_dirty_schedulers_test enable_smp_require_native_atomics @@ -1527,6 +1529,9 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-security-hardening-flags + disable Open Source Security Foundation security + hardening flags --enable-bootstrap-only enable bootstrap only configuration --enable-dirty-schedulers-test enable dirty scheduler test (for debugging purposes) @@ -1878,21 +1883,21 @@ fi } # ac_fn_c_try_compile -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext - if { { ac_try="$ac_link" + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err + (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 @@ -1901,12 +1906,9 @@ printf "%s\n" "$ac_try_echo"; } >&5 fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || + test -z "$ac_cxx_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - } + } && test -s conftest.$ac_objext then : ac_retval=0 else case e in #( @@ -1916,31 +1918,25 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 ;; esac fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_c_try_link +} # ac_fn_cxx_try_compile -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam - if { { ac_try="$ac_compile" + if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 @@ -1948,38 +1944,39 @@ printf "%s\n" "$ac_try_echo"; } >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext + } then : ac_retval=0 else case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 ;; + ac_retval=1 ;; esac fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_cxx_try_compile +} # ac_fn_c_try_cpp -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 @@ -1987,9 +1984,12 @@ printf "%s\n" "$ac_try_echo"; } >&5 mv -f conftest.er1 conftest.err fi printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext } then : ac_retval=0 @@ -1997,13 +1997,18 @@ else case e in #( e) printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_retval=1 ;; + ac_retval=1 ;; esac fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_c_try_cpp +} # ac_fn_c_try_link # ac_fn_c_try_run LINENO # ---------------------- @@ -3668,6 +3673,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + @@ -3950,6 +3968,14 @@ fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + @@ -4975,591 +5001,452 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 -printf %s "checking for library containing strerror... " >&6; } -if test ${ac_cv_search_strerror+y} + + + + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} then : printf %s "(cached) " >&6 else case e in #( - e) ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char strerror (void); -int -main (void) -{ -return strerror (); - ; - return 0; -} -_ACEOF -for ac_lib in '' cposix + e) if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 fi - if ac_fn_c_try_link "$LINENO" -then : - ac_cv_search_strerror=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext - if test ${ac_cv_search_strerror+y} -then : - break -fi done -if test ${ac_cv_search_strerror+y} -then : + done +IFS=$as_save_IFS -else case e in #( - e) ac_cv_search_strerror=no ;; -esac -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS ;; +fi ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 -printf "%s\n" "$ac_cv_search_strerror" >&6; } -ac_res=$ac_cv_search_strerror -if test "$ac_res" != no -then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -ac_config_headers="$ac_config_headers $host/config.h:config.h.in include/internal/$host/ethread_header_config.h:include/internal/ethread_header_config.h.in include/$host/erl_int_sizes_config.h:include/erl_int_sizes_config.h.in" - -ENABLE_ALLOC_TYPE_VARS= - - -# Check whether --enable-bootstrap-only was given. -if test ${enable_bootstrap_only+y} -then : - enableval=$enable_bootstrap_only; if test "X$enableval" = "Xyes"; then - # Disable stuff not necessary in a bootstrap only system in order - # to speed up things by reducing the amount of stuff needing to be - # built... - with_termcap=no - with_ssl=no - with_ssl_zlib=no - enable_jit=no - enable_sctp=no - fi - + test -n "$CXX" && break + done fi - - -# Check whether --enable-dirty-schedulers-test was given. -if test ${enable_dirty_schedulers_test+y} +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} then : - enableval=$enable_dirty_schedulers_test; case "$enableval" in - yes) enable_dirty_schedulers_test=yes ;; - *) enable_dirty_schedulers_test=no ;; - esac + printf %s "(cached) " >&6 else case e in #( - e) enable_dirty_schedulers_test=no ;; -esac -fi - - -# Check whether --enable-smp-require-native-atomics was given. -if test ${enable_smp_require_native_atomics+y} -then : - enableval=$enable_smp_require_native_atomics; case "$enableval" in - no) smp_require_native_atomics=no ;; - *) smp_require_native_atomics=yes ;; + e) if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; esac -else case e in #( - e) smp_require_native_atomics=yes ;; + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; esac +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi + test -n "$ac_ct_CXX" && break +done -# Check whether --with-termcap was given. -if test ${with_termcap+y} -then : - withval=$with_termcap; -else case e in #( - e) with_termcap=yes ;; + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; esac + CXX=$ac_ct_CXX + fi fi + fi +fi +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done -# Check whether --enable-lock-checking was given. -if test ${enable_lock_checking+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} then : - enableval=$enable_lock_checking; case "$enableval" in - no) enable_lock_check=no ;; - *) enable_lock_check=yes ;; - esac - + printf %s "(cached) " >&6 else case e in #( - e) enable_lock_check=no ;; -esac -fi + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif -# Check whether --enable-lock-counter was given. -if test ${enable_lock_counter+y} + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" then : - enableval=$enable_lock_counter; case "$enableval" in - no) enable_lock_count=no ;; - *) enable_lock_count=yes ;; - esac + ac_compiler_gnu=yes else case e in #( - e) enable_lock_count=no ;; + e) ac_compiler_gnu=no ;; esac fi - - -# Check whether --enable-kernel-poll was given. -if test ${enable_kernel_poll+y} -then : - enableval=$enable_kernel_poll; case "$enableval" in - no) enable_kernel_poll=no ;; - *) enable_kernel_poll=yes ;; - esac -else case e in #( - e) enable_kernel_poll=unknown ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + ;; esac fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - -# Check whether --enable-sctp was given. -if test ${enable_sctp+y} -then : - enableval=$enable_sctp; case "x$enableval" in - xno|xyes|xlib|x) - ;; - x*) - as_fn_error $? "\"invalid value --enable-sctp=$enableval\"" "$LINENO" 5 - ;; - esac +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= fi - - -# Check whether --enable-jit was given. -if test ${enable_jit+y} +ac_test_CXXFLAGS=${CXXFLAGS+y} +ac_save_CXXFLAGS=$CXXFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} then : - enableval=$enable_jit; case "$enableval" in - no) enable_jit=no ;; - *) enable_jit=yes ;; - esac - + printf %s "(cached) " >&6 else case e in #( - e) enable_jit=auto ;; -esac -fi + e) ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main (void) +{ -# Check whether --enable-m64-build was given. -if test ${enable_m64_build+y} + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" then : - enableval=$enable_m64_build; case "$enableval" in - no) enable_m64_build=no ;; - *) enable_m64_build=yes ;; - esac - + ac_cv_prog_cxx_g=yes else case e in #( - e) enable_m64_build=no ;; -esac -fi + e) CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main (void) +{ -# Check whether --enable-m32-build was given. -if test ${enable_m32_build+y} + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" then : - enableval=$enable_m32_build; case "$enableval" in - no) enable_m32_build=no ;; - *) enable_m32_build=yes ;; - esac else case e in #( - e) enable_m32_build=no ;; -esac -fi - + e) ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main (void) +{ -# Check whether --with-dynamic-trace was given. -if test ${with_dynamic_trace+y} + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" then : - withval=$with_dynamic_trace; + ac_cv_prog_cxx_g=yes fi - - -if test X"$with_dynamic_trace" = X""; then - with_dynamic_trace=no +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac fi - -case "$with_dynamic_trace" in - no) DYNAMIC_TRACE_FRAMEWORK=;; - lttng) - -printf "%s\n" "#define USE_LTTNG 1" >>confdefs.h - - DYNAMIC_TRACE_FRAMEWORK=lttng;; - dtrace) - -printf "%s\n" "#define USE_DTRACE 1" >>confdefs.h - - DYNAMIC_TRACE_FRAMEWORK=dtrace;; - systemtap) - -printf "%s\n" "#define USE_SYSTEMTAP 1" >>confdefs.h - - DYNAMIC_TRACE_FRAMEWORK=systemtap;; - *) - as_fn_error $? "Unknown dynamic tracing framework specified with --with-dynamic-trace!" "$LINENO" 5;; +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac - -if test X"$DYNAMIC_TRACE_FRAMEWORK" != X""; then - -printf "%s\n" "#define USE_DYNAMIC_TRACE 1" >>confdefs.h - fi - -# Check whether --enable-vm-probes was given. -if test ${enable_vm_probes+y} +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno then : - enableval=$enable_vm_probes; case "$enableval" in - no) use_vm_probes=no ;; - *) - if test X"$DYNAMIC_TRACE_FRAMEWORK" != X""; then - use_vm_probes=yes ; - else - as_fn_error $? "Can not enable VM probes without any dynamic tracing framework!" "$LINENO" 5; - fi;; - esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_cxx11+y} +then : + printf %s "(cached) " >&6 else case e in #( - e) if test X"$DYNAMIC_TRACE_FRAMEWORK" != X""; then - use_vm_probes=yes ; - else - use_vm_probes=no - fi ;; -esac + e) ac_cv_prog_cxx_cxx11=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx11_program +_ACEOF +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg fi - - - -if test X"$DYNAMIC_TRACE_FRAMEWORK" != X"lttng"; then - if test X"$use_vm_probes" = X"yes"; then - USE_VM_PROBES=yes - -printf "%s\n" "#define USE_VM_PROBES 1" >>confdefs.h - - fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX ;; +esac fi - -# Check whether --with-assumed-cache-line-size was given. -if test ${with_assumed_cache_line_size+y} +if test "x$ac_cv_prog_cxx_cxx11" = xno then : - withval=$with_assumed_cache_line_size; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" ;; +esac fi - - -case "$with_assumed_cache_line_size" in - ""|no|yes) - with_assumed_cache_line_size=64;; - 16|32|64|128|256|512|1024|2048|4096|8192) - ;; - *) - as_fn_error $? "Invalid assumed cache-line size of $with_assumed_cache_line_size bytes" "$LINENO" 5 - ;; + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 ;; esac - - -printf "%s\n" "#define ASSUMED_CACHE_LINE_SIZE $with_assumed_cache_line_size" >>confdefs.h - - -# Check whether --enable-systemd was given. -if test ${enable_systemd+y} +fi +fi +if test x$ac_prog_cxx_stdcxx = xno then : - enableval=$enable_systemd; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_cxx98+y} +then : + printf %s "(cached) " >&6 else case e in #( - e) enable_systemd=no ;; + e) ac_cv_prog_cxx_cxx98=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx98_program +_ACEOF +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX ;; esac fi - - -# Check whether --with-microstate-accounting was given. -if test ${with_microstate_accounting+y} +if test "x$ac_cv_prog_cxx_cxx98" = xno then : - withval=$with_microstate_accounting; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } else case e in #( - e) with_microstate_accounting=yes ;; + e) if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" ;; esac fi - - -case "$with_microstate_accounting" in - yes) -printf "%s\n" "#define ERTS_ENABLE_MSACC 1" >>confdefs.h - ;; - extra) -printf "%s\n" "#define ERTS_ENABLE_MSACC 2" >>confdefs.h - ;; - *) ;; + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 ;; esac - -# Check whether --enable-ensure-os-monotonic-time was given. -if test ${enable_ensure_os_monotonic_time+y} -then : - enableval=$enable_ensure_os_monotonic_time; +fi fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test "$enable_ensure_os_monotonic_time" = "yes" +for ac_prog in ld.sh +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LD+y} then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LD="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - -printf "%s\n" "#define ERTS_ENSURE_OS_MONOTONIC_TIME 1" >>confdefs.h - - +fi ;; +esac fi - -OTP_RELEASE= -if test "${ERLANG_COMMERCIAL_BUILD}" != ""; then - OTP_EXTRA_FLAGS=-DOTP_RELEASE - OTP_RELEASE=yes +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } else - OTP_EXTRA_FLAGS= + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking OTP release" >&5 -printf %s "checking OTP release... " >&6; } -SYSTEM_VSN=`cat $ERL_TOP/OTP_VERSION | sed "s|\([0-9]*\).*|\1|"` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SYSTEM_VSN" >&5 -printf "%s\n" "$SYSTEM_VSN" >&6; } - + test -n "$LD" && break +done -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking OTP version" >&5 -printf %s "checking OTP version... " >&6; } -OTP_VERSION=`cat $ERL_TOP/OTP_VERSION` -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTP_VERSION" >&5 -printf "%s\n" "$OTP_VERSION" >&6; } - - -if test X${enable_m64_build} = Xyes; then - case $CFLAGS in - *-m64*) - ;; - *) - CFLAGS="-m64 $CFLAGS" - ;; - esac -else - if test X${enable_m32_build} = Xyes; - then - case $CFLAGS in - *-m32*) - ;; - *) - CFLAGS="-m32 $CFLAGS" - ;; - esac ; - fi -fi - -# Check whether --enable-static-nifs was given. -if test ${enable_static_nifs+y} -then : - enableval=$enable_static_nifs; STATIC_NIFS="$enableval" -else case e in #( - e) STATIC_NIFS=no ;; -esac -fi - - - -# Check whether --enable-static-drivers was given. -if test ${enable_static_drivers+y} -then : - enableval=$enable_static_drivers; STATIC_DRIVERS="$enableval" -else case e in #( - e) STATIC_DRIVERS=no ;; -esac -fi - - - - -# Check whether --with-ets-write-concurrency-locks was given. -if test ${with_ets_write_concurrency_locks+y} -then : - withval=$with_ets_write_concurrency_locks; -fi - - -if test X"$with_ets_write_concurrency_locks" != X""; then - -printf "%s\n" "#define ERTS_DB_HASH_LOCK_CNT $with_ets_write_concurrency_locks" >>confdefs.h - -fi - - -# Check whether --with-spectre-mitigation was given. -if test ${with_spectre_mitigation+y} -then : - withval=$with_spectre_mitigation; -else case e in #( - e) with_spectre_mitigation=no ;; -esac -fi - - -case "$with_spectre_mitigation" in - no) ;; - yes) ;; - incomplete) ;; - *) as_fn_error $? "Invalid spectre mitigation setting" "$LINENO" 5 ;; -esac - -i_noretpoline_attr="" - -if test X"$with_spectre_mitigation" != X"no" -then : - - CFLAGS="$CFLAGS -mindirect-branch=thunk" - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for spectre mitigation" >&5 -printf %s "checking for spectre mitigation... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -else case e in #( - e) - CFLAGS="$CFLAGS -fcf-protection=none" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -else case e in #( - e) as_fn_error $? "no" "$LINENO" 5 ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - - if test X"$with_spectre_mitigation" = X"incomplete" -then : - - # gcc and clang support this attribute if they're recent enough. Note - # that we must compile with -Werror to check for actual support as they - # warn rather than error out on unsupported attributes. - - i_noretpoline_attr='__attribute__((__indirect_branch__("keep")))' - i_preserve_cflags="$CFLAGS" - CFLAGS="$CFLAGS -Werror" - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether spectre mitigation can be disabled on a per-function basis" >&5 -printf %s "checking whether spectre mitigation can be disabled on a per-function basis... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$i_noretpoline_attr -int -main (void) -{ -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -else case e in #( - e) as_fn_error $? "no" "$LINENO" 5 ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - - CFLAGS="$i_preserve_cflags" - -fi - -fi - - -printf "%s\n" "#define ERTS_NO_RETPOLINE $i_noretpoline_attr" >>confdefs.h - - -# Remove old configuration information. -# Next line should be before first output to CONF_INFO. -rm -f "$ERL_TOP/erts/CONF_INFO" - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. +set dummy ${ac_tool_prefix}ld; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} +if test ${ac_cv_prog_LD+y} then : printf %s "(cached) " >&6 else case e in #( - e) if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. + e) if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5572,7 +5459,7 @@ do esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" + ac_cv_prog_LD="${ac_tool_prefix}ld" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5583,10 +5470,10 @@ IFS=$as_save_IFS fi ;; esac fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } +LD=$ac_cv_prog_LD +if test -n "$LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 +printf "%s\n" "$LD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } @@ -5594,18 +5481,18 @@ fi fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 +if test -z "$ac_cv_prog_LD"; then + ac_ct_LD=$LD + # Extract the first word of "ld", so it can be a program name with args. +set dummy ld; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} +if test ${ac_cv_prog_ac_ct_LD+y} then : printf %s "(cached) " >&6 else case e in #( - e) if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. + e) if test -n "$ac_ct_LD"; then + ac_cv_prog_ac_ct_LD="$ac_ct_LD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5618,7 +5505,7 @@ do esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" + ac_cv_prog_ac_ct_LD="ld" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5629,17 +5516,17 @@ IFS=$as_save_IFS fi ;; esac fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } +ac_ct_LD=$ac_cv_prog_ac_ct_LD +if test -n "$ac_ct_LD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LD" >&5 +printf "%s\n" "$ac_ct_LD" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi - if test "x$ac_ct_CC" = x; then - CC="" + if test "x$ac_ct_LD" = x; then + LD=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -5647,74 +5534,38 @@ yes:) printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - CC=$ac_ct_CC + LD=$ac_ct_LD fi else - CC="$ac_cv_prog_CC" + LD="$ac_cv_prog_LD" fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} + if test "$LD" = ":" then : - printf %s "(cached) " >&6 + as_fn_error $? "No linker found" "$LINENO" 5 else case e in #( - e) if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + e) + printf "configure:$LINENO: %s\n" 'setting LD to ${CC}' >&5 -fi ;; + LD=${CC} ;; esac -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } fi - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} then : printf %s "(cached) " >&6 else case e in #( - e) if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH + e) if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( @@ -5722,63 +5573,73 @@ do */) ;; *) as_dir=$as_dir/ ;; esac + for ac_prog in grep ggrep + do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in #( +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +#( +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break done -IFS=$as_save_IFS + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi +else + ac_cv_path_GREP=$GREP fi -fi ;; + ;; esac fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} then : printf %s "(cached) " >&6 else case e in #( - e) if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH + e) if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS case $as_dir in #((( @@ -5786,108 +5647,211 @@ do */) ;; *) as_dir=$as_dir/ ;; esac + for ac_prog in egrep + do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in #( +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +#( +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done done IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi -fi ;; + fi ;; esac fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + EGREP_TRADITIONAL=$EGREP + ac_cv_path_EGREP_TRADITIONAL=$EGREP - test -n "$CC" && break - done +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} +if test -z "$CPP"; then + if test ${ac_cv_prog_CPP+y} then : printf %s "(cached) " >&6 else case e in #( - e) if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH + e) # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else case e in #( + e) # Broken: fails on valid input. +continue ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else case e in #( + e) # Passes both tests. +ac_preproc_ok=: +break ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + done - done -IFS=$as_save_IFS +# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi -fi ;; + done + ac_cv_prog_CPP=$CPP + ;; esac fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } + CPP=$ac_cv_prog_CPP else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + ac_cv_prog_CPP=$CPP fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf "%s\n" "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : +else case e in #( + e) # Broken: fails on valid input. +continue ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else case e in #( + e) # Passes both tests. +ac_preproc_ok=: +break ;; +esac +fi +rm -f conftest.err conftest.i conftest.$ac_ext - test -n "$ac_ct_CC" && break done +# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; +else case e in #( + e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See 'config.log' for more details" "$LINENO" 5; } ;; esac - CC=$ac_ct_CC - fi fi -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. -set dummy ${ac_tool_prefix}clang; ac_word=$2 +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} +if test ${ac_cv_prog_RANLIB+y} then : printf %s "(cached) " >&6 else case e in #( - e) if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. + e) if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5900,7 +5864,7 @@ do esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}clang" + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5911,10 +5875,10 @@ IFS=$as_save_IFS fi ;; esac fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } @@ -5922,18 +5886,18 @@ fi fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "clang", so it can be a program name with args. -set dummy clang; ac_word=$2 +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} +if test ${ac_cv_prog_ac_ct_RANLIB+y} then : printf %s "(cached) " >&6 else case e in #( - e) if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. + e) if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5946,7 +5910,7 @@ do esac for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="clang" + ac_cv_prog_ac_ct_RANLIB="ranlib" printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi @@ -5957,17 +5921,17 @@ IFS=$as_save_IFS fi ;; esac fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } fi - if test "x$ac_ct_CC" = x; then - CC="" + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) @@ -5975,1503 +5939,1735 @@ yes:) printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - CC=$ac_ct_CC + RANLIB=$ac_ct_RANLIB fi else - CC="$ac_cv_prog_CC" -fi - + RANLIB="$ac_cv_prog_RANLIB" fi - -test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See 'config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion -version; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 -printf %s "checking whether the compiler supports GNU C... " >&6; } -if test ${ac_cv_c_compiler_gnu+y} +for ac_prog in 'bison -y' byacc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_YACC+y} then : printf %s "(cached) " >&6 else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + e) if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_YACC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -int -main (void) -{ -#ifndef __GNUC__ - choke me -#endif +fi ;; +esac +fi +YACC=$ac_cv_prog_YACC +if test -n "$YACC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 +printf "%s\n" "$YACC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" + + test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" + +for ac_prog in perl5 perl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PERL+y} then : - ac_compiler_gnu=yes + printf %s "(cached) " >&6 else case e in #( - e) ac_compiler_gnu=no ;; + e) case $PERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_PERL="$PERL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="/usr/local/bin:/opt/local/bin:/usr/local/gnu/bin:${PATH}" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PERL="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac ;; esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - ;; -esac +PERL=$ac_cv_path_PERL +if test -n "$PERL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 +printf "%s\n" "$PERL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test $ac_compiler_gnu = yes; then - GCC=yes + + test -n "$PERL" && break +done +test -n "$PERL" || PERL="false" + +if test "$PERL" = "false"; then + ac_cv_path_PERL=false + PERL=false +fi + +if test "$ac_cv_path_PERL" = false; then + as_fn_error $? "Perl version 5 is required to build the emulator!" "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +printf %s "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - GCC= + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +printf "%s\n" "no, using $LN_S" >&6; } fi -ac_test_CFLAGS=${CFLAGS+y} -ac_save_CFLAGS=$CFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -printf %s "checking whether $CC accepts -g... " >&6; } -if test ${ac_cv_prog_cc_g+y} + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} then : printf %s "(cached) " >&6 else case e in #( - e) ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + e) if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -int -main (void) -{ +fi ;; +esac +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} then : - ac_cv_prog_cc_g=yes + printf %s "(cached) " >&6 else case e in #( - e) CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + e) if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + +if test "$ac_cv_prog_AR" = false; then + as_fn_error $? "No 'ar' command found in PATH" "$LINENO" 5 +fi -int -main (void) -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : + + if test "X$host" = "Xwin32" +then : + ossf_security_hardening_default=no else case e in #( - e) ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + e) ossf_security_hardening_default=yes ;; +esac +fi + # Check whether --enable-security-hardening-flags was given. +if test ${enable_security_hardening_flags+y} +then : + enableval=$enable_security_hardening_flags; case "$enableval" in + no) ossf_security_hardening=no ;; + *) ossf_security_hardening=yes ;; + esac +else case e in #( + e) ossf_security_hardening=$ossf_security_hardening_default ;; +esac +fi + + + + if test "$ossf_security_hardening" = "yes" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include int main (void) { - +return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -printf "%s\n" "$ac_cv_prog_cc_g" >&6; } -if test $ac_test_CFLAGS; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -ac_prog_cc_stdc=no -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 -printf %s "checking for $CC option to enable C11 features... " >&6; } -if test ${ac_cv_prog_cc_c11+y} + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( - e) ac_cv_prog_cc_c11=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c11_program -_ACEOF -for ac_arg in '' -std=gnu11 -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c11" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC ;; + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -if test "x$ac_cv_prog_cc_c11" = xno + if test "X$can_enable_flag" = "Xfalse" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cc_c11" = x + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } + can_enable_flag=true else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 -printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } - CC="$CC $ac_cv_prog_cc_c11" ;; + e) can_enable_flag=false ;; esac fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 - ac_prog_cc_stdc=c11 ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi + + fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 -printf %s "checking for $CC option to enable C99 features... " >&6; } -if test ${ac_cv_prog_cc_c99+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-clash-protection to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-clash-protection to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-clash-protection $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_c_conftest_c99_program + +int +main (void) +{ +return 0; + ; + return 0; +} _ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi - -if test "x$ac_cv_prog_cc_c99" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cc_c99" = x +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } + + CFLAGS="-fstack-clash-protection $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } - CC="$CC $ac_cv_prog_cc_c99" ;; -esac -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 - ac_prog_cc_stdc=c99 ;; + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 -printf %s "checking for $CC option to enable C89 features... " >&6; } -if test ${ac_cv_prog_cc_c89+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector-strong $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_c_conftest_c89_program + +int +main (void) +{ +return 0; + ; + return 0; +} _ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi - -if test "x$ac_cv_prog_cc_c89" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cc_c89" = x +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } + + CFLAGS="-fstack-protector-strong $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } - CC="$CC $ac_cv_prog_cc_c89" ;; -esac -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 - ac_prog_cc_stdc=c89 ;; + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test "X$can_enable_flag" = "Xfalse" +then : -for ac_prog in ld.sh -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_LD+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$LD"; then - ac_cv_prog_LD="$LD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_LD="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -fi ;; +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi -LD=$ac_cv_prog_LD -if test -n "$LD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -printf "%s\n" "$LD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fstack-protector $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } + ;; +esac fi - test -n "$LD" && break -done +else case e in #( + e) + # Some systems (solaris) also require this to be part of LDFLAGS - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. -set dummy ${ac_tool_prefix}ld; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_LD+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-fstack-protector-strong"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" then : - printf %s "(cached) " >&6 + can_enable_flag=true else case e in #( - e) if test -n "$LD"; then - ac_cv_prog_LD="$LD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_LD="${ac_tool_prefix}ld" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; + e) can_enable_flag=false + ;; esac fi -LD=$ac_cv_prog_LD -if test -n "$LD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 -printf "%s\n" "$LD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } + ;; +esac fi + ;; +esac fi -if test -z "$ac_cv_prog_LD"; then - ac_ct_LD=$LD - # Extract the first word of "ld", so it can be a program name with args. -set dummy ld; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_LD+y} + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fcf-protection=full to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fcf-protection=full to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fcf-protection=full $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - printf %s "(cached) " >&6 + can_enable_flag=true else case e in #( - e) if test -n "$ac_ct_LD"; then - ac_cv_prog_ac_ct_LD="$ac_ct_LD" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_LD="ld" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; + e) can_enable_flag=false ;; esac fi -ac_ct_LD=$ac_cv_prog_ac_ct_LD -if test -n "$ac_ct_LD"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LD" >&5 -printf "%s\n" "$ac_ct_LD" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : - if test "x$ac_ct_LD" = x; then - LD=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LD=$ac_ct_LD - fi -else - LD="$ac_cv_prog_LD" -fi + CFLAGS="-fcf-protection=full $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } - if test "$LD" = ":" -then : - as_fn_error $? "No linker found" "$LINENO" 5 else case e in #( e) - printf "configure:$LINENO: %s\n" 'setting LD to ${CC}' >&5 - - LD=${CC} ;; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -mbranch-protection=standard to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -mbranch-protection=standard to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -mbranch-protection=standard $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + CFLAGS="-mbranch-protection=standard $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fexceptions to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fexceptions to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fexceptions $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CXX+y} +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - printf %s "(cached) " >&6 + can_enable_flag=true else case e in #( - e) if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; + e) can_enable_flag=false ;; esac fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -printf "%s\n" "$CXX" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + CFLAGS="-fexceptions $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CXX+y} -then : - printf %s "(cached) " >&6 else case e in #( - e) if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -printf "%s\n" "$ac_ct_CXX" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; + ;; esac - CXX=$ac_ct_CXX - fi fi - fi -fi -# Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 -printf %s "checking whether the compiler supports GNU C++... " >&6; } -if test ${ac_cv_cxx_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-overflow to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-overflow to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-overflow $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -#ifndef __GNUC__ - choke me -#endif - +return 0; ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ac_compiler_gnu=yes + can_enable_flag=true else case e in #( - e) ac_compiler_gnu=no ;; + e) can_enable_flag=false ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - ;; + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fno-strict-overflow $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+y} -ac_save_CXXFLAGS=$CXXFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -printf %s "checking whether $CXX accepts -g... " >&6; } -if test ${ac_cv_prog_cxx_g+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-delete-null-pointer-checks to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-delete-null-pointer-checks to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-delete-null-pointer-checks $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { - +return 0; ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ac_cv_prog_cxx_g=yes + can_enable_flag=true else case e in #( - e) CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : + CFLAGS="-fno-delete-null-pointer-checks $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( - e) ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-aliasing to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-aliasing to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-aliasing $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { - +return 0; ; return 0; } _ACEOF -if ac_fn_cxx_try_compile "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ac_cv_prog_cxx_g=yes + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fno-strict-aliasing $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -ftrivial-auto-var-init=zero to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -ftrivial-auto-var-init=zero to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -ftrivial-auto-var-init=zero $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } -if test $ac_test_CXXFLAGS; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_prog_cxx_stdcxx=no -if test x$ac_prog_cxx_stdcxx = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 -printf %s "checking for $CXX option to enable C++11 features... " >&6; } -if test ${ac_cv_prog_cxx_cxx11+y} + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + CFLAGS="-ftrivial-auto-var-init=zero $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( - e) ac_cv_prog_cxx_cxx11=no -ac_save_CXX=$CXX -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=3 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=3 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=3 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_cxx_conftest_cxx11_program + +int +main (void) +{ +return 0; + ; + return 0; +} _ACEOF -for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA -do - CXX="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ac_cv_prog_cxx_cxx11=$ac_arg + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cxx_cxx11" != "xno" && break -done -rm -f conftest.$ac_ext -CXX=$ac_save_CXX ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fstrict-flex-arrays=3 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -if test "x$ac_cv_prog_cxx_cxx11" = xno + if test "X$can_enable_flag" = "Xfalse" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cxx_cxx11" = x + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=2 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=2 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=2 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } + can_enable_flag=true else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 -printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } - CXX="$CXX $ac_cv_prog_cxx_cxx11" ;; + e) can_enable_flag=false ;; esac fi - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 - ac_prog_cxx_stdcxx=cxx11 ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fstrict-flex-arrays=2 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -fi -if test x$ac_prog_cxx_stdcxx = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 -printf %s "checking for $CXX option to enable C++98 features... " >&6; } -if test ${ac_cv_prog_cxx_cxx98+y} -then : - printf %s "(cached) " >&6 + + else case e in #( - e) ac_cv_prog_cxx_cxx98=no -ac_save_CXX=$CXX -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_cxx_conftest_cxx98_program -_ACEOF -for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA -do - CXX="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO" + e) if test "X$can_enable_flag" != "Xtrue" then : - ac_cv_prog_cxx_cxx98=$ac_arg + exit 1 fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cxx_cxx98" != "xno" && break -done -rm -f conftest.$ac_ext -CXX=$ac_save_CXX ;; + ;; esac fi -if test "x$ac_cv_prog_cxx_cxx98" = xno +fi + + + if test "$ossf_security_hardening" = "yes" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cxx_cxx98" = x + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -D_GLIBCXX_ASSERTIONS to CXXFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -D_GLIBCXX_ASSERTIONS to CXXFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -D_GLIBCXX_ASSERTIONS $CXXFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } + can_enable_flag=true else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 -printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } - CXX="$CXX $ac_cv_prog_cxx_cxx98" ;; + e) can_enable_flag=false ;; esac fi - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 - ac_prog_cxx_stdcxx=cxx98 ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CXXFLAGS="-D_GLIBCXX_ASSERTIONS $CXXFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi + + fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test "$ossf_security_hardening" = "yes" +then : -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -printf %s "checking for grep that handles long lines and -e... " >&6; } -if test ${ac_cv_path_GREP+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,noexecstack to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,noexecstack to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,noexecstack"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" then : - printf %s "(cached) " >&6 + can_enable_flag=true else case e in #( - e) if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in grep ggrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in #( -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -#( -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; + e) can_enable_flag=false + ;; esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP fi - ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -printf "%s\n" "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -printf %s "checking for egrep... " >&6; } -if test ${ac_cv_path_EGREP+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,relro to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,relro to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,relro"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" then : - printf %s "(cached) " >&6 + can_enable_flag=true else case e in #( - e) if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in egrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in #( -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -#( -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; + e) can_enable_flag=false + ;; esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : - fi ;; + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -printf "%s\n" "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - EGREP_TRADITIONAL=$EGREP - ac_cv_path_EGREP_TRADITIONAL=$EGREP -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -printf %s "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test ${ac_cv_prog_CPP+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) # Double quotes because $CC needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,now to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,now to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,now"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - Syntax error + +int +main (void) +{ +return 0; + ; + return 0; +} _ACEOF -if ac_fn_c_try_cpp "$LINENO" +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( - e) # Broken: fails on valid input. -continue ;; + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--as-needed to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--as-needed to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--as-needed"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + +int +main (void) +{ +return 0; + ; + return 0; +} _ACEOF -if ac_fn_c_try_cpp "$LINENO" +if ac_fn_c_try_link "$LINENO" then : - # Broken: success on invalid input. -continue + can_enable_flag=true else case e in #( - e) # Passes both tests. -ac_preproc_ok=: -break ;; + e) can_enable_flag=false + ;; esac fi -rm -f conftest.err conftest.i conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : -done -# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--no-copy-dt-needed-entries to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--no-copy-dt-needed-entries to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--no-copy-dt-needed-entries"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" then : - break + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : - done - ac_cv_prog_CPP=$CPP - ;; + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP + + fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -printf "%s\n" "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 +printf %s "checking for library containing strerror... " >&6; } +if test ${ac_cv_search_strerror+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - Syntax error + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char strerror (void); +int +main (void) +{ +return strerror (); + ; + return 0; +} _ACEOF -if ac_fn_c_try_cpp "$LINENO" +for ac_lib in '' cposix +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_strerror=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_strerror+y} +then : + break +fi +done +if test ${ac_cv_search_strerror+y} then : else case e in #( - e) # Broken: fails on valid input. -continue ;; + e) ac_cv_search_strerror=no ;; +esac +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 +printf "%s\n" "$ac_cv_search_strerror" >&6; } +ac_res=$ac_cv_search_strerror +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + +ac_config_headers="$ac_config_headers $host/config.h:config.h.in include/internal/$host/ethread_header_config.h:include/internal/ethread_header_config.h.in include/$host/erl_int_sizes_config.h:include/erl_int_sizes_config.h.in" + +ENABLE_ALLOC_TYPE_VARS= + + +# Check whether --enable-bootstrap-only was given. +if test ${enable_bootstrap_only+y} +then : + enableval=$enable_bootstrap_only; if test "X$enableval" = "Xyes"; then + # Disable stuff not necessary in a bootstrap only system in order + # to speed up things by reducing the amount of stuff needing to be + # built... + with_termcap=no + with_ssl=no + with_ssl_zlib=no + enable_jit=no + enable_sctp=no + fi + +fi + + +# Check whether --enable-dirty-schedulers-test was given. +if test ${enable_dirty_schedulers_test+y} +then : + enableval=$enable_dirty_schedulers_test; case "$enableval" in + yes) enable_dirty_schedulers_test=yes ;; + *) enable_dirty_schedulers_test=no ;; + esac +else case e in #( + e) enable_dirty_schedulers_test=no ;; +esac +fi + + +# Check whether --enable-smp-require-native-atomics was given. +if test ${enable_smp_require_native_atomics+y} +then : + enableval=$enable_smp_require_native_atomics; case "$enableval" in + no) smp_require_native_atomics=no ;; + *) smp_require_native_atomics=yes ;; + esac +else case e in #( + e) smp_require_native_atomics=yes ;; +esac +fi + + + +# Check whether --with-termcap was given. +if test ${with_termcap+y} +then : + withval=$with_termcap; +else case e in #( + e) with_termcap=yes ;; +esac +fi + + +# Check whether --enable-lock-checking was given. +if test ${enable_lock_checking+y} +then : + enableval=$enable_lock_checking; case "$enableval" in + no) enable_lock_check=no ;; + *) enable_lock_check=yes ;; + esac + +else case e in #( + e) enable_lock_check=no ;; +esac +fi + + +# Check whether --enable-lock-counter was given. +if test ${enable_lock_counter+y} +then : + enableval=$enable_lock_counter; case "$enableval" in + no) enable_lock_count=no ;; + *) enable_lock_count=yes ;; + esac +else case e in #( + e) enable_lock_count=no ;; +esac +fi + + +# Check whether --enable-kernel-poll was given. +if test ${enable_kernel_poll+y} +then : + enableval=$enable_kernel_poll; case "$enableval" in + no) enable_kernel_poll=no ;; + *) enable_kernel_poll=yes ;; + esac +else case e in #( + e) enable_kernel_poll=unknown ;; +esac +fi + + + +# Check whether --enable-sctp was given. +if test ${enable_sctp+y} +then : + enableval=$enable_sctp; case "x$enableval" in + xno|xyes|xlib|x) + ;; + x*) + as_fn_error $? "\"invalid value --enable-sctp=$enableval\"" "$LINENO" 5 + ;; + esac +fi + + +# Check whether --enable-jit was given. +if test ${enable_jit+y} +then : + enableval=$enable_jit; case "$enableval" in + no) enable_jit=no ;; + *) enable_jit=yes ;; + esac + +else case e in #( + e) enable_jit=auto ;; +esac +fi + + +# Check whether --enable-m64-build was given. +if test ${enable_m64_build+y} +then : + enableval=$enable_m64_build; case "$enableval" in + no) enable_m64_build=no ;; + *) enable_m64_build=yes ;; + esac + +else case e in #( + e) enable_m64_build=no ;; +esac +fi + + +# Check whether --enable-m32-build was given. +if test ${enable_m32_build+y} +then : + enableval=$enable_m32_build; case "$enableval" in + no) enable_m32_build=no ;; + *) enable_m32_build=yes ;; + esac + +else case e in #( + e) enable_m32_build=no ;; +esac +fi + + + +# Check whether --with-dynamic-trace was given. +if test ${with_dynamic_trace+y} +then : + withval=$with_dynamic_trace; +fi + + +if test X"$with_dynamic_trace" = X""; then + with_dynamic_trace=no +fi + +case "$with_dynamic_trace" in + no) DYNAMIC_TRACE_FRAMEWORK=;; + lttng) + +printf "%s\n" "#define USE_LTTNG 1" >>confdefs.h + + DYNAMIC_TRACE_FRAMEWORK=lttng;; + dtrace) + +printf "%s\n" "#define USE_DTRACE 1" >>confdefs.h + + DYNAMIC_TRACE_FRAMEWORK=dtrace;; + systemtap) + +printf "%s\n" "#define USE_SYSTEMTAP 1" >>confdefs.h + + DYNAMIC_TRACE_FRAMEWORK=systemtap;; + *) + as_fn_error $? "Unknown dynamic tracing framework specified with --with-dynamic-trace!" "$LINENO" 5;; esac + +if test X"$DYNAMIC_TRACE_FRAMEWORK" != X""; then + +printf "%s\n" "#define USE_DYNAMIC_TRACE 1" >>confdefs.h + +fi + +# Check whether --enable-vm-probes was given. +if test ${enable_vm_probes+y} +then : + enableval=$enable_vm_probes; case "$enableval" in + no) use_vm_probes=no ;; + *) + if test X"$DYNAMIC_TRACE_FRAMEWORK" != X""; then + use_vm_probes=yes ; + else + as_fn_error $? "Can not enable VM probes without any dynamic tracing framework!" "$LINENO" 5; + fi;; + esac +else case e in #( + e) if test X"$DYNAMIC_TRACE_FRAMEWORK" != X""; then + use_vm_probes=yes ; + else + use_vm_probes=no + fi ;; +esac +fi + + + +if test X"$DYNAMIC_TRACE_FRAMEWORK" != X"lttng"; then + if test X"$use_vm_probes" = X"yes"; then + USE_VM_PROBES=yes + +printf "%s\n" "#define USE_VM_PROBES 1" >>confdefs.h + + fi +fi + + +# Check whether --with-assumed-cache-line-size was given. +if test ${with_assumed_cache_line_size+y} +then : + withval=$with_assumed_cache_line_size; +fi + + +case "$with_assumed_cache_line_size" in + ""|no|yes) + with_assumed_cache_line_size=64;; + 16|32|64|128|256|512|1024|2048|4096|8192) + ;; + *) + as_fn_error $? "Invalid assumed cache-line size of $with_assumed_cache_line_size bytes" "$LINENO" 5 + ;; +esac + + +printf "%s\n" "#define ASSUMED_CACHE_LINE_SIZE $with_assumed_cache_line_size" >>confdefs.h + + +# Check whether --enable-systemd was given. +if test ${enable_systemd+y} +then : + enableval=$enable_systemd; +else case e in #( + e) enable_systemd=no ;; +esac +fi + + + +# Check whether --with-microstate-accounting was given. +if test ${with_microstate_accounting+y} +then : + withval=$with_microstate_accounting; +else case e in #( + e) with_microstate_accounting=yes ;; +esac +fi + + +case "$with_microstate_accounting" in + yes) +printf "%s\n" "#define ERTS_ENABLE_MSACC 1" >>confdefs.h + ;; + extra) +printf "%s\n" "#define ERTS_ENABLE_MSACC 2" >>confdefs.h + ;; + *) ;; +esac + +# Check whether --enable-ensure-os-monotonic-time was given. +if test ${enable_ensure_os_monotonic_time+y} +then : + enableval=$enable_ensure_os_monotonic_time; +fi + + +if test "$enable_ensure_os_monotonic_time" = "yes" +then : + + +printf "%s\n" "#define ERTS_ENSURE_OS_MONOTONIC_TIME 1" >>confdefs.h + + +fi + +OTP_RELEASE= +if test "${ERLANG_COMMERCIAL_BUILD}" != ""; then + OTP_EXTRA_FLAGS=-DOTP_RELEASE + OTP_RELEASE=yes +else + OTP_EXTRA_FLAGS= +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking OTP release" >&5 +printf %s "checking OTP release... " >&6; } +SYSTEM_VSN=`cat $ERL_TOP/OTP_VERSION | sed "s|\([0-9]*\).*|\1|"` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SYSTEM_VSN" >&5 +printf "%s\n" "$SYSTEM_VSN" >&6; } + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking OTP version" >&5 +printf %s "checking OTP version... " >&6; } +OTP_VERSION=`cat $ERL_TOP/OTP_VERSION` +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTP_VERSION" >&5 +printf "%s\n" "$OTP_VERSION" >&6; } + + +if test X${enable_m64_build} = Xyes; then + case $CFLAGS in + *-m64*) + ;; + *) + CFLAGS="-m64 $CFLAGS" + ;; + esac +else + if test X${enable_m32_build} = Xyes; + then + case $CFLAGS in + *-m32*) + ;; + *) + CFLAGS="-m32 $CFLAGS" + ;; + esac ; + fi fi -rm -f conftest.err conftest.i conftest.$ac_ext - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO" +# Check whether --enable-static-nifs was given. +if test ${enable_static_nifs+y} then : - # Broken: success on invalid input. -continue + enableval=$enable_static_nifs; STATIC_NIFS="$enableval" else case e in #( - e) # Passes both tests. -ac_preproc_ok=: -break ;; + e) STATIC_NIFS=no ;; esac fi -rm -f conftest.err conftest.i conftest.$ac_ext -done -# Because of 'break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok -then : + +# Check whether --enable-static-drivers was given. +if test ${enable_static_drivers+y} +then : + enableval=$enable_static_drivers; STATIC_DRIVERS="$enableval" else case e in #( - e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See 'config.log' for more details" "$LINENO" 5; } ;; + e) STATIC_DRIVERS=no ;; esac fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_RANLIB+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS -fi ;; -esac -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -printf "%s\n" "$RANLIB" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + +# Check whether --with-ets-write-concurrency-locks was given. +if test ${with_ets_write_concurrency_locks+y} +then : + withval=$with_ets_write_concurrency_locks; fi -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_RANLIB+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS +if test X"$with_ets_write_concurrency_locks" != X""; then -fi ;; -esac -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -printf "%s\n" "$ac_ct_RANLIB" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi +printf "%s\n" "#define ERTS_DB_HASH_LOCK_CNT $with_ets_write_concurrency_locks" >>confdefs.h - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" fi -for ac_prog in 'bison -y' byacc -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_YACC+y} + +# Check whether --with-spectre-mitigation was given. +if test ${with_spectre_mitigation+y} then : - printf %s "(cached) " >&6 + withval=$with_spectre_mitigation; else case e in #( - e) if test -n "$YACC"; then - ac_cv_prog_YACC="$YACC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_YACC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; + e) with_spectre_mitigation=no ;; esac fi -YACC=$ac_cv_prog_YACC -if test -n "$YACC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 -printf "%s\n" "$YACC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$YACC" && break -done -test -n "$YACC" || YACC="yacc" -for ac_prog in perl5 perl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_PERL+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) case $PERL in - [\\/]* | ?:[\\/]*) - ac_cv_path_PERL="$PERL" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy="/usr/local/bin:/opt/local/bin:/usr/local/gnu/bin:${PATH}" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_PERL="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - ;; -esac ;; +case "$with_spectre_mitigation" in + no) ;; + yes) ;; + incomplete) ;; + *) as_fn_error $? "Invalid spectre mitigation setting" "$LINENO" 5 ;; esac -fi -PERL=$ac_cv_path_PERL -if test -n "$PERL"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 -printf "%s\n" "$PERL" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi +i_noretpoline_attr="" - test -n "$PERL" && break -done -test -n "$PERL" || PERL="false" +if test X"$with_spectre_mitigation" != X"no" +then : -if test "$PERL" = "false"; then - ac_cv_path_PERL=false - PERL=false -fi + CFLAGS="$CFLAGS -mindirect-branch=thunk" + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for spectre mitigation" >&5 +printf %s "checking for spectre mitigation... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -if test "$ac_cv_path_PERL" = false; then - as_fn_error $? "Perl version 5 is required to build the emulator!" "$LINENO" 5 -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -printf %s "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -printf "%s\n" "no, using $LN_S" >&6; } -fi +else case e in #( + e) + CFLAGS="$CFLAGS -fcf-protection=none" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_AR+y} +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - printf %s "(cached) " >&6 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else case e in #( - e) if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; + e) as_fn_error $? "no" "$LINENO" 5 ;; esac fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -printf "%s\n" "$AR" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; +esac fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + + if test X"$with_spectre_mitigation" = X"incomplete" +then : + # gcc and clang support this attribute if they're recent enough. Note + # that we must compile with -Werror to check for actual support as they + # warn rather than error out on unsupported attributes. -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_AR+y} + i_noretpoline_attr='__attribute__((__indirect_branch__("keep")))' + i_preserve_cflags="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether spectre mitigation can be disabled on a per-function basis" >&5 +printf %s "checking whether spectre mitigation can be disabled on a per-function basis... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$i_noretpoline_attr +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - printf %s "(cached) " >&6 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else case e in #( - e) if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="ar" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; + e) as_fn_error $? "no" "$LINENO" 5 ;; esac fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -printf "%s\n" "$ac_ct_AR" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + + CFLAGS="$i_preserve_cflags" - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -else - AR="$ac_cv_prog_AR" fi -if test "$ac_cv_prog_AR" = false; then - as_fn_error $? "No 'ar' command found in PATH" "$LINENO" 5 fi +printf "%s\n" "#define ERTS_NO_RETPOLINE $i_noretpoline_attr" >>confdefs.h + + +# Remove old configuration information. +# Next line should be before first output to CONF_INFO. +rm -f "$ERL_TOP/erts/CONF_INFO" + # # Get programs needed for building the documentation # @@ -8196,7 +8392,7 @@ then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=return-type to WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=return-type to WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=return-type $WERRORFLAGS"; + CFLAGS="-Werror -Werror=return-type $WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8220,9 +8416,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + WERRORFLAGS="-Werror=return-type $WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - WERRORFLAGS="-Werror=return-type $WERRORFLAGS" else case e in #( e) @@ -8236,7 +8432,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=implicit to WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=implicit to WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=implicit $WERRORFLAGS"; + CFLAGS="-Werror -Werror=implicit $WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8260,9 +8456,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + WERRORFLAGS="-Werror=implicit $WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - WERRORFLAGS="-Werror=implicit $WERRORFLAGS" else case e in #( e) @@ -8276,7 +8472,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=undef to WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=undef to WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=undef $WERRORFLAGS"; + CFLAGS="-Werror -Werror=undef $WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8300,9 +8496,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + WERRORFLAGS="-Werror=undef $WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - WERRORFLAGS="-Werror=undef $WERRORFLAGS" else case e in #( e) @@ -8360,7 +8556,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-common to CFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -fno-common to CFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-fno-common $CFLAGS"; + CFLAGS="-Werror -fno-common $CFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8384,50 +8580,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } CFLAGS="-fno-common $CFLAGS" - -else case e in #( - e) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - ;; -esac -fi - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-aliasing to CFLAGS (via CFLAGS)" >&5 -printf %s "checking if we can add -fno-strict-aliasing to CFLAGS (via CFLAGS)... " >&6; } - saved_CFLAGS=$CFLAGS; - CFLAGS="-fno-strict-aliasing $CFLAGS"; - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - can_enable_flag=true -else case e in #( - e) can_enable_flag=false ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$saved_CFLAGS; - if test "X$can_enable_flag" = "Xtrue" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - CFLAGS="-fno-strict-aliasing $CFLAGS" else case e in #( e) @@ -8438,6 +8593,7 @@ esac fi + else case e in #( e) WFLAGS="" @@ -8483,7 +8639,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -fprofile-generate -Werror..." >&5 printf %s "checking whether $CC accepts -fprofile-generate -Werror...... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-fprofile-generate -Werror $CFLAGS"; + CFLAGS="-Werror -fprofile-generate -Werror $CFLAGS"; if test "$cross_compiling" = yes then : can_enable_flag=false @@ -8525,7 +8681,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -fprofile-use -Werror..." >&5 printf %s "checking whether $CC accepts -fprofile-use -Werror...... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-fprofile-use -Werror $CFLAGS"; + CFLAGS="-Werror -fprofile-use -Werror $CFLAGS"; if test "$cross_compiling" = yes then : can_enable_flag=false @@ -8567,7 +8723,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -fprofile-use -fprofile-correction -Werror..." >&5 printf %s "checking whether $CC accepts -fprofile-use -fprofile-correction -Werror...... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-fprofile-use -fprofile-correction -Werror $CFLAGS"; + CFLAGS="-Werror -fprofile-use -fprofile-correction -Werror $CFLAGS"; if test "$cross_compiling" = yes then : can_enable_flag=false @@ -8649,7 +8805,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -fprofile-instr-generate -Werror..." >&5 printf %s "checking whether $CC accepts -fprofile-instr-generate -Werror...... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-fprofile-instr-generate -Werror $CFLAGS"; + CFLAGS="-Werror -fprofile-instr-generate -Werror $CFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -27146,6 +27302,49 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$saved_CFLAGS" +NO_MAYBE_UNINITIALIZED="" + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wno-maybe-uninitialized to NO_MAYBE_UNINITIALIZED (via CFLAGS)" >&5 +printf %s "checking if we can add -Wno-maybe-uninitialized to NO_MAYBE_UNINITIALIZED (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -Wno-maybe-uninitialized $NO_MAYBE_UNINITIALIZED"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + NO_MAYBE_UNINITIALIZED="-Wno-maybe-uninitialized $NO_MAYBE_UNINITIALIZED" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + if test "x$GCC" = xyes; then @@ -27182,7 +27381,7 @@ DEBUG_CFLAGS="-g -Og $no_opt_CFLAGS" no_opt_CXXFLAGS=$(echo " $CXXFLAGS" | sed 's/ -O[^ ]*/ /g') -DEBUG_CXXFLAGS="-g -O0 $no_opt_CXXFLAGS" +DEBUG_CXXFLAGS="-g -Og $no_opt_CXXFLAGS" diff --git a/erts/configure.ac b/erts/configure.ac index ed31f3db2f06..f76fa030746e 100644 --- a/erts/configure.ac +++ b/erts/configure.ac @@ -86,6 +86,35 @@ AC_SUBST(CROSS_COMPILING) ERL_XCOMP_SYSROOT_INIT +dnl ---------------------------------------------------------------------- +dnl Checks for programs. +dnl ---------------------------------------------------------------------- + +AC_LANG([C]) + +AC_PROG_CC +AC_PROG_CXX +LM_PROG_LD + +AC_SUBST(GCC) +AC_SUBST(CXXFLAGS) + +AC_PROG_EGREP +AC_PROG_CPP +AC_PROG_RANLIB +AC_PROG_YACC +LM_PROG_PERL5 +if test "$ac_cv_path_PERL" = false; then + AC_MSG_ERROR([Perl version 5 is required to build the emulator!]) +fi +AC_PROG_LN_S +AC_CHECK_TOOL([AR], [ar], [false]) +if test "$ac_cv_prog_AR" = false; then + AC_MSG_ERROR([No 'ar' command found in PATH]) +fi + +ERL_OSSF_FLAGS + AC_SEARCH_LIBS([strerror],[cposix]) AC_CONFIG_HEADERS([$host/config.h:config.h.in include/internal/$host/ethread_header_config.h:include/internal/ethread_header_config.h.in include/$host/erl_int_sizes_config.h:include/erl_int_sizes_config.h.in]) @@ -429,34 +458,6 @@ AC_DEFINE_UNQUOTED(ERTS_NO_RETPOLINE, $i_noretpoline_attr, # Next line should be before first output to CONF_INFO. rm -f "$ERL_TOP/erts/CONF_INFO" -dnl ---------------------------------------------------------------------- -dnl Checks for programs. -dnl ---------------------------------------------------------------------- - -AC_LANG([C]) - -AC_PROG_CC -AC_SUBST(GCC) -LM_PROG_LD - -AC_PROG_CXX -AC_SUBST(CXXFLAGS) - -AC_PROG_EGREP -AC_PROG_CPP -AC_PROG_RANLIB -AC_PROG_YACC -LM_PROG_PERL5 -if test "$ac_cv_path_PERL" = false; then - AC_MSG_ERROR([Perl version 5 is required to build the emulator!]) -fi -AC_PROG_LN_S -AC_CHECK_TOOL([AR], [ar], [false]) -if test "$ac_cv_prog_AR" = false; then - AC_MSG_ERROR([No 'ar' command found in PATH]) -fi - - # # Get programs needed for building the documentation # @@ -604,7 +605,6 @@ AS_IF([test "x$GCC" = xyes], # such dubious duplicates. LM_TRY_ENABLE_CFLAG([-fno-common], [CFLAGS]) - LM_TRY_ENABLE_CFLAG([-fno-strict-aliasing], [CFLAGS]) ], [ WFLAGS="" @@ -3649,6 +3649,10 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[_Pragma("GCC diagnostic push") define if compiler support _Pragma('GCC diagnostic ignored '-Wformat-nonliteral''))],[]) CFLAGS="$saved_CFLAGS" +NO_MAYBE_UNINITIALIZED="" +LM_TRY_ENABLE_CFLAG([-Wno-maybe-uninitialized], [NO_MAYBE_UNINITIALIZED]) +AC_SUBST(NO_MAYBE_UNINITIALIZED) + dnl ---------------------------------------------------------------------- dnl Enable any -Werror flags dnl ---------------------------------------------------------------------- @@ -3682,7 +3686,7 @@ DEBUG_CFLAGS="-g -Og $no_opt_CFLAGS" AC_SUBST(DEBUG_CFLAGS) no_opt_CXXFLAGS=$(echo " $CXXFLAGS" | sed 's/ -O[[^ ]]*/ /g') -DEBUG_CXXFLAGS="-g -O0 $no_opt_CXXFLAGS" +DEBUG_CXXFLAGS="-g -Og $no_opt_CXXFLAGS" AC_SUBST(DEBUG_CXXFLAGS) dnl @@ -3694,7 +3698,8 @@ dnl AC_DEFINE_UNQUOTED(ERTS_EMU_CMDLINE_FLAGS, "$STATIC_CFLAGS $CFLAGS $CXXFLAGS $DEBUG_CFLAGS $DEBUG_CXXFLAGS $EMU_THR_DEFS $DEFS $WERRORFLAGS $WFLAGS", -[The only reason ERTS_EMU_CMDLINE_FLAGS exists is to force modification of config.h when the emulator command line flags are modified by configure]) +[The only reason ERTS_EMU_CMDLINE_FLAGS exists is to force modification + of config.h when the emulator command line flags are modified by configure]) dnl ---------------------------------------------------------------------- dnl Output the result. diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in index 8de649dfc3ef..23c5750e593d 100644 --- a/erts/emulator/Makefile.in +++ b/erts/emulator/Makefile.in @@ -147,7 +147,7 @@ else ifeq ($(TYPE),valgrind) TYPEMARKER = .valgrind -TYPE_FLAGS = @DEBUG_CFLAGS@ -DVALGRIND -DNO_JUMP_TABLE +TYPE_FLAGS = @DEBUG_CFLAGS@ -DVALGRIND -DNO_JUMP_TABLE @NO_MAYBE_UNINITIALIZED@ TYPE_CXXFLAGS = @DEBUG_CXXFLAGS@ ENABLE_ALLOC_TYPE_VARS += valgrind else @@ -155,7 +155,7 @@ else ifeq ($(TYPE),asan) PURIFY = TYPEMARKER = .asan -TYPE_FLAGS = @DEBUG_CFLAGS@ -fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer -DADDRESS_SANITIZER +TYPE_FLAGS = @DEBUG_CFLAGS@ -fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer -DADDRESS_SANITIZER @NO_MAYBE_UNINITIALIZED@ TYPE_CXXFLAGS = @DEBUG_CXXFLAGS@ LDFLAGS += -fsanitize=address ENABLE_ALLOC_TYPE_VARS += asan @@ -956,7 +956,7 @@ $(OBJDIR)/%.o: nifs/$(ERLANG_OSTYPE)/%.c # included before any other directives, including other #includes. # ASMJIT_FLAGS=-DASMJIT_EMBED=1 -DASMJIT_NO_BUILDER=1 -DASMJIT_NO_DEPRECATED=1 -DASMJIT_STATIC=1 -DASMJIT_NO_FOREIGN=1 -ASMJIT_CXXFLAGS=$(filter-out -Wformat -Wformat=2, $(CXXFLAGS)) +ASMJIT_CXXFLAGS=$(filter-out -Wformat -Wformat=2, $(CXXFLAGS)) @NO_MAYBE_UNINITIALIZED@ ASMJIT_PCH_OBJ=$(TTF_DIR)/asmjit/asmjit.hpp.gch ASMJIT_PCH_SRC=$(TTF_DIR)/asmjit/asmjit.hpp diff --git a/lib/common_test/configure b/lib/common_test/configure index d06625424a65..4ff0632570f1 100755 --- a/lib/common_test/configure +++ b/lib/common_test/configure @@ -1916,6 +1916,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + diff --git a/lib/crypto/configure b/lib/crypto/configure index 234bb54403b6..0a294d4762b8 100755 --- a/lib/crypto/configure +++ b/lib/crypto/configure @@ -763,6 +763,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking enable_largefile +enable_security_hardening_flags with_ssl with_ssl_lib_subdir with_ssl_incl @@ -1435,6 +1436,9 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-largefile omit support for large files + --disable-security-hardening-flags + disable Open Source Security Foundation security + hardening flags --enable-dynamic-ssl-lib enable using dynamic openssl libraries when linking the crypto NIF @@ -3035,6 +3039,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + @@ -5438,6 +5455,7 @@ DED_GCC=$GCC DED_CFLAGS= DED_OSTYPE=unix + case $host_os in linux*) DED_CFLAGS="-D_GNU_SOURCE" ;; @@ -5462,7 +5480,7 @@ esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wdeclaration-after-statement to DED_WARN_FLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Wdeclaration-after-statement to DED_WARN_FLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Wdeclaration-after-statement $DED_WARN_FLAGS"; + CFLAGS="-Werror -Wdeclaration-after-statement $DED_WARN_FLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5486,9 +5504,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WARN_FLAGS="-Wdeclaration-after-statement $DED_WARN_FLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WARN_FLAGS="-Wdeclaration-after-statement $DED_WARN_FLAGS" else case e in #( e) @@ -5503,7 +5521,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=return-type to DED_WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=return-type to DED_WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=return-type $DED_WERRORFLAGS"; + CFLAGS="-Werror -Werror=return-type $DED_WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5527,9 +5545,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WERRORFLAGS="-Werror=return-type $DED_WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WERRORFLAGS="-Werror=return-type $DED_WERRORFLAGS" else case e in #( e) @@ -5543,7 +5561,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=implicit to DED_WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=implicit to DED_WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=implicit $DED_WERRORFLAGS"; + CFLAGS="-Werror -Werror=implicit $DED_WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5567,9 +5585,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WERRORFLAGS="-Werror=implicit $DED_WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WERRORFLAGS="-Werror=implicit $DED_WERRORFLAGS" else case e in #( e) @@ -5583,7 +5601,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=undef to DED_WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=undef to DED_WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=undef $DED_WERRORFLAGS"; + CFLAGS="-Werror -Werror=undef $DED_WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5607,9 +5625,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WERRORFLAGS="-Werror=undef $DED_WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WERRORFLAGS="-Werror=undef $DED_WERRORFLAGS" else case e in #( e) @@ -5635,7 +5653,7 @@ then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-common to DED_CFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -fno-common to DED_CFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-fno-common $DED_CFLAGS"; + CFLAGS="-Werror -fno-common $DED_CFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5659,50 +5677,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } DED_CFLAGS="-fno-common $DED_CFLAGS" - -else case e in #( - e) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - ;; -esac -fi - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)" >&5 -printf %s "checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)... " >&6; } - saved_CFLAGS=$CFLAGS; - CFLAGS="-fno-strict-aliasing $DED_CFLAGS"; - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - can_enable_flag=true -else case e in #( - e) can_enable_flag=false ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$saved_CFLAGS; - if test "X$can_enable_flag" = "Xtrue" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_CFLAGS="-fno-strict-aliasing $DED_CFLAGS" else case e in #( e) @@ -5768,7 +5745,6 @@ if test "x$DED_LD" = "x"; then if test X${enable_m64_build} = Xyes; then DED_LDFLAGS="-64 $DED_LDFLAGS" fi - DED_LD="$CC" ;; aix*|os400*) DED_LDFLAGS="-G -bnoentry -bexpall" @@ -5843,7 +5819,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h esac fi fi - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" ;; linux*) @@ -6001,6 +5976,889 @@ fi test "$DED_LD" != "false" || as_fn_error $? "No linker found" "$LINENO" 5 + + if test "X$host" = "Xwin32" +then : + ossf_security_hardening_default=no +else case e in #( + e) ossf_security_hardening_default=yes ;; +esac +fi + # Check whether --enable-security-hardening-flags was given. +if test ${enable_security_hardening_flags+y} +then : + enableval=$enable_security_hardening_flags; case "$enableval" in + no) ossf_security_hardening=no ;; + *) ossf_security_hardening=yes ;; + esac +else case e in #( + e) ossf_security_hardening=$ossf_security_hardening_default ;; +esac +fi + + + + if test "$ossf_security_hardening" = "yes" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + if test "X$can_enable_flag" = "Xfalse" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-clash-protection to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-clash-protection to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-clash-protection $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstack-clash-protection $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector-strong $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstack-protector-strong $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + if test "X$can_enable_flag" = "Xfalse" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstack-protector $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +else case e in #( + e) + # Some systems (solaris) also require this to be part of LDFLAGS + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-fstack-protector-strong"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + ;; +esac +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fcf-protection=full to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fcf-protection=full to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fcf-protection=full $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fcf-protection=full $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -mbranch-protection=standard to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -mbranch-protection=standard to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -mbranch-protection=standard $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-mbranch-protection=standard $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fexceptions to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fexceptions to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fexceptions $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fexceptions $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-overflow to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-overflow to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-overflow $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fno-strict-overflow $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-delete-null-pointer-checks to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-delete-null-pointer-checks to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-delete-null-pointer-checks $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fno-delete-null-pointer-checks $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-aliasing $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fno-strict-aliasing $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -ftrivial-auto-var-init=zero to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -ftrivial-auto-var-init=zero to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -ftrivial-auto-var-init=zero $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-ftrivial-auto-var-init=zero $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=3 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=3 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=3 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstrict-flex-arrays=3 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + if test "X$can_enable_flag" = "Xfalse" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=2 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=2 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=2 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstrict-flex-arrays=2 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +else case e in #( + e) if test "X$can_enable_flag" != "Xtrue" +then : + exit 1 +fi + ;; +esac +fi + +fi + + + if test "$ossf_security_hardening" = "yes" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,noexecstack to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,noexecstack to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,noexecstack"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,relro to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,relro to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,relro"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,now to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,now to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,now"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--as-needed to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--as-needed to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--as-needed"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--no-copy-dt-needed-entries to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--no-copy-dt-needed-entries to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--no-copy-dt-needed-entries"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for static compiler flags" >&5 printf %s "checking for static compiler flags... " >&6; } DED_STATIC_CFLAGS="$DED_WERRORFLAGS $DED_WARN_FLAGS $DED_THR_DEFS $DED_STATIC_CFLAGS" diff --git a/lib/erl_interface/configure b/lib/erl_interface/configure index a4f2988207de..f91fad8ced89 100755 --- a/lib/erl_interface/configure +++ b/lib/erl_interface/configure @@ -748,6 +748,7 @@ enable_threads enable_mask_real_errno enable_ei_dynamic_lib enable_largefile +enable_security_hardening_flags with_gmp enable_year2038 ' @@ -1385,6 +1386,9 @@ Optional Features: --disable-mask-real-errno do not mask real 'errno' --enable-ei-dynamic-lib build ei as a dynamic library --disable-largefile omit support for large files + --disable-security-hardening-flags + disable Open Source Security Foundation security + hardening flags --disable-year2038 don't support timestamps after 2038 Optional Packages: @@ -2897,6 +2901,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + @@ -5032,6 +5049,7 @@ DED_GCC=$GCC DED_CFLAGS= DED_OSTYPE=unix + case $host_os in linux*) DED_CFLAGS="-D_GNU_SOURCE" ;; @@ -5056,7 +5074,7 @@ esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wdeclaration-after-statement to DED_WARN_FLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Wdeclaration-after-statement to DED_WARN_FLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Wdeclaration-after-statement $DED_WARN_FLAGS"; + CFLAGS="-Werror -Wdeclaration-after-statement $DED_WARN_FLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5080,9 +5098,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WARN_FLAGS="-Wdeclaration-after-statement $DED_WARN_FLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WARN_FLAGS="-Wdeclaration-after-statement $DED_WARN_FLAGS" else case e in #( e) @@ -5097,7 +5115,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=return-type to DED_WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=return-type to DED_WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=return-type $DED_WERRORFLAGS"; + CFLAGS="-Werror -Werror=return-type $DED_WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5121,9 +5139,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WERRORFLAGS="-Werror=return-type $DED_WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WERRORFLAGS="-Werror=return-type $DED_WERRORFLAGS" else case e in #( e) @@ -5137,7 +5155,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=implicit to DED_WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=implicit to DED_WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=implicit $DED_WERRORFLAGS"; + CFLAGS="-Werror -Werror=implicit $DED_WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5161,9 +5179,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WERRORFLAGS="-Werror=implicit $DED_WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WERRORFLAGS="-Werror=implicit $DED_WERRORFLAGS" else case e in #( e) @@ -5177,7 +5195,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=undef to DED_WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=undef to DED_WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=undef $DED_WERRORFLAGS"; + CFLAGS="-Werror -Werror=undef $DED_WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5201,9 +5219,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WERRORFLAGS="-Werror=undef $DED_WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WERRORFLAGS="-Werror=undef $DED_WERRORFLAGS" else case e in #( e) @@ -5229,7 +5247,7 @@ then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-common to DED_CFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -fno-common to DED_CFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-fno-common $DED_CFLAGS"; + CFLAGS="-Werror -fno-common $DED_CFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5253,50 +5271,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } DED_CFLAGS="-fno-common $DED_CFLAGS" - -else case e in #( - e) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - ;; -esac -fi - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)" >&5 -printf %s "checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)... " >&6; } - saved_CFLAGS=$CFLAGS; - CFLAGS="-fno-strict-aliasing $DED_CFLAGS"; - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - can_enable_flag=true -else case e in #( - e) can_enable_flag=false ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$saved_CFLAGS; - if test "X$can_enable_flag" = "Xtrue" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_CFLAGS="-fno-strict-aliasing $DED_CFLAGS" else case e in #( e) @@ -5362,7 +5339,6 @@ if test "x$DED_LD" = "x"; then if test X${enable_m64_build} = Xyes; then DED_LDFLAGS="-64 $DED_LDFLAGS" fi - DED_LD="$CC" ;; aix*|os400*) DED_LDFLAGS="-G -bnoentry -bexpall" @@ -5437,7 +5413,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h esac fi fi - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" ;; linux*) @@ -5595,2592 +5570,4370 @@ fi test "$DED_LD" != "false" || as_fn_error $? "No linker found" "$LINENO" 5 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for static compiler flags" >&5 -printf %s "checking for static compiler flags... " >&6; } -DED_STATIC_CFLAGS="$DED_WERRORFLAGS $DED_WARN_FLAGS $DED_THR_DEFS $DED_STATIC_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DED_STATIC_CFLAGS" >&5 -printf "%s\n" "$DED_STATIC_CFLAGS" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for basic compiler flags for loadable drivers" >&5 -printf %s "checking for basic compiler flags for loadable drivers... " >&6; } -DED_BASIC_CFLAGS=$DED_CFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DED_CFLAGS" >&5 -printf "%s\n" "$DED_CFLAGS" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for compiler flags for loadable drivers" >&5 -printf %s "checking for compiler flags for loadable drivers... " >&6; } -DED_CFLAGS="$DED_WERRORFLAGS $DED_WARN_FLAGS $DED_THR_DEFS $DED_CFLAGS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DED_CFLAGS" >&5 -printf "%s\n" "$DED_CFLAGS" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker for loadable drivers" >&5 -printf %s "checking for linker for loadable drivers... " >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DED_LD" >&5 -printf "%s\n" "$DED_LD" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker flags for loadable drivers" >&5 -printf %s "checking for linker flags for loadable drivers... " >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DED_LDFLAGS" >&5 -printf "%s\n" "$DED_LDFLAGS" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 'runtime library path' linker flag" >&5 -printf %s "checking for 'runtime library path' linker flag... " >&6; } -if test "x$DED_LD_FLAG_RUNTIME_LIBRARY_PATH" != "x"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DED_LD_FLAG_RUNTIME_LIBRARY_PATH" >&5 -printf "%s\n" "$DED_LD_FLAG_RUNTIME_LIBRARY_PATH" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -printf "%s\n" "not found" >&6; } -fi - - - - - - - - - - - - - - - - - - -# Subst flags for libs - - - - - - - -LIB_CFLAGS="$DED_BASIC_CFLAGS $DED_THR_DEFS" -LIB_LD="$DED_LD" -LIB_LDFLAGS="$DED_LDFLAGS" -LIB_LD_FLAG_RUNTIME_LIBRARY_PATH="$DED_LD_FLAG_RUNTIME_LIBRARY_PATH" -LIB_EXT="$DED_EXT" - -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 -printf %s "checking size of short... " >&6; } -if test ${ac_cv_sizeof_short+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default" + if test "X$host" = "Xwin32" then : - + ossf_security_hardening_default=no else case e in #( - e) if test "$ac_cv_type_short" = yes; then - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (short) -See 'config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_short=0 - fi ;; + e) ossf_security_hardening_default=yes ;; esac fi - ;; + # Check whether --enable-security-hardening-flags was given. +if test ${enable_security_hardening_flags+y} +then : + enableval=$enable_security_hardening_flags; case "$enableval" in + no) ossf_security_hardening=no ;; + *) ossf_security_hardening=yes ;; + esac +else case e in #( + e) ossf_security_hardening=$ossf_security_hardening_default ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 -printf "%s\n" "$ac_cv_sizeof_short" >&6; } -printf "%s\n" "#define SIZEOF_SHORT $ac_cv_sizeof_short" >>confdefs.h + if test "$ossf_security_hardening" = "yes" +then : -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 -printf %s "checking size of int... " >&6; } -if test ${ac_cv_sizeof_int+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - printf %s "(cached) " >&6 + can_enable_flag=true else case e in #( - e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default" + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : + DED_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( - e) if test "$ac_cv_type_int" = yes; then - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (int) -See 'config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_int=0 - fi ;; -esac -fi - ;; + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 -printf "%s\n" "$ac_cv_sizeof_int" >&6; } - - -printf "%s\n" "#define SIZEOF_INT $ac_cv_sizeof_int" >>confdefs.h + if test "X$can_enable_flag" = "Xfalse" +then : -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 -printf %s "checking size of long... " >&6; } -if test ${ac_cv_sizeof_long+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - printf %s "(cached) " >&6 + can_enable_flag=true else case e in #( - e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default" + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : + DED_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( - e) if test "$ac_cv_type_long" = yes; then - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (long) -See 'config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_long=0 - fi ;; -esac -fi - ;; + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 -printf "%s\n" "$ac_cv_sizeof_long" >&6; } - -printf "%s\n" "#define SIZEOF_LONG $ac_cv_sizeof_long" >>confdefs.h +fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-clash-protection to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-clash-protection to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-clash-protection $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 -printf %s "checking size of void *... " >&6; } -if test ${ac_cv_sizeof_void_p+y} +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - printf %s "(cached) " >&6 + can_enable_flag=true else case e in #( - e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default" + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : + DED_CFLAGS="-fstack-clash-protection $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( - e) if test "$ac_cv_type_void_p" = yes; then - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (void *) -See 'config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_void_p=0 - fi ;; + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi - ;; + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector-strong $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 -printf "%s\n" "$ac_cv_sizeof_void_p" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + DED_CFLAGS="-fstack-protector-strong $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi -printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h + if test "X$can_enable_flag" = "Xfalse" +then : -# The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 -printf %s "checking size of long long... " >&6; } -if test ${ac_cv_sizeof_long_long+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - printf %s "(cached) " >&6 + can_enable_flag=true else case e in #( - e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default" + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : + DED_CFLAGS="-fstack-protector $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( - e) if test "$ac_cv_type_long_long" = yes; then - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (long long) -See 'config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_long_long=0 - fi ;; + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi - ;; + + +else case e in #( + e) + # Some systems (solaris) also require this to be part of LDFLAGS + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-fstack-protector-strong"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 -printf "%s\n" "$ac_cv_sizeof_long_long" >&6; } +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi -printf "%s\n" "#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long" >>confdefs.h + ;; +esac +fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fcf-protection=full to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fcf-protection=full to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fcf-protection=full $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -if test $mask_real_errno = yes; then +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : -printf "%s\n" "#define EI_HIDE_REAL_ERRNO 1" >>confdefs.h + DED_CFLAGS="-fcf-protection=full $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac fi -if test $ac_cv_sizeof_long = 8; then - CFLAGS="$CFLAGS -DEI_64BIT" - LIB_CFLAGS="$LIB_CFLAGS -DEI_64BIT" + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -mbranch-protection=standard to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -mbranch-protection=standard to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -mbranch-protection=standard $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + DED_CFLAGS="-mbranch-protection=standard $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking target hardware architecture" >&5 -printf %s "checking target hardware architecture... " >&6; } - if test "x$host_alias" != "x" -a "x$host_cpu" != "x"; then - chk_arch_=$host_cpu - else - chk_arch_=`uname -m` - fi +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi - case $chk_arch_ in - sun4u) ARCH=ultrasparc;; - sparc64) ARCH=sparc64;; - sun4v) ARCH=ultrasparc;; - i86pc) ARCH=x86;; - i386) ARCH=x86;; - i486) ARCH=x86;; - i586) ARCH=x86;; - i686) ARCH=x86;; - x86_64) ARCH=amd64;; - amd64) ARCH=amd64;; - macppc) ARCH=ppc;; - powerpc) ARCH=ppc;; - ppc) ARCH=ppc;; - ppc64) ARCH=ppc64;; - ppc64le) ARCH=ppc64le;; - powerpc64) ARCH=ppc64;; - powerpc64le) ARCH=ppc64le;; - "Power Macintosh") ARCH=ppc;; - arm64) ARCH=arm64;; - armv5b) ARCH=arm;; - armv5teb) ARCH=arm;; - armv5tel) ARCH=arm;; - armv5tejl) ARCH=arm;; - armv6l) ARCH=arm;; - armv6hl) ARCH=arm;; - armv7l) ARCH=arm;; - armv7hl) ARCH=arm;; - armv8*) ARCH=arm;; - aarch64) ARCH=arm64;; - aarch*) ARCH=arm;; - tile) ARCH=tile;; - e2k) ARCH=e2k;; - *) ARCH=noarch;; - esac - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ARCH" >&5 -printf "%s\n" "$ARCH" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether compilation mode forces ARCH adjustment" >&5 -printf %s "checking whether compilation mode forces ARCH adjustment... " >&6; } - case "$ARCH-$ac_cv_sizeof_void_p" in - x86-8) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: adjusting ARCH=x86 to ARCH=amd64" >&5 -printf "%s\n" "yes: adjusting ARCH=x86 to ARCH=amd64" >&6; } - ARCH=amd64 - ;; - amd64-4) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: adjusting ARCH=amd64 to ARCH=x86" >&5 -printf "%s\n" "yes: adjusting ARCH=amd64 to ARCH=x86" >&6; } - ARCH=x86 - ;; - ultrasparc-8) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: adjusting ARCH=ultrasparc to ARCH=sparc64" >&5 -printf "%s\n" "yes: adjusting ARCH=ultrasparc to ARCH=sparc64" >&6; } - ARCH=sparc64 - ;; - sparc64-4) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: adjusting ARCH=sparc64 to ARCH=ultrasparc" >&5 -printf "%s\n" "yes: adjusting ARCH=sparc64 to ARCH=ultrasparc" >&6; } - ARCH=ultrasparc - ;; - ppc64-4) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: adjusting ARCH=ppc64 to ARCH=ppc" >&5 -printf "%s\n" "yes: adjusting ARCH=ppc64 to ARCH=ppc" >&6; } - ARCH=ppc - ;; - ppc-8) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: adjusting ARCH=ppc to ARCH=ppc64" >&5 -printf "%s\n" "yes: adjusting ARCH=ppc to ARCH=ppc64" >&6; } - ARCH=ppc64 - ;; - arm-8) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: adjusting ARCH=arm to ARCH=arm64" >&5 -printf "%s\n" "yes: adjusting ARCH=arm to ARCH=arm64" >&6; } - ARCH=arm64 - ;; - *) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no: ARCH is $ARCH" >&5 -printf "%s\n" "no: ARCH is $ARCH" >&6; } - ;; - esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fexceptions to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fexceptions to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fexceptions $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + DED_CFLAGS="-fexceptions $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for unaligned word access" >&5 -printf %s "checking for unaligned word access... " >&6; } -case "$ARCH" in - x86|amd64) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: x86 or amd64" >&5 -printf "%s\n" "yes: x86 or amd64" >&6; } -printf "%s\n" "#define HAVE_UNALIGNED_WORD_ACCESS 1" >>confdefs.h - ;; - *) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - ;; -esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-overflow to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-overflow to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-overflow $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_AR+y} +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - printf %s "(cached) " >&6 + can_enable_flag=true else case e in #( - e) if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; + e) can_enable_flag=false ;; esac fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -printf "%s\n" "$AR" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fno-strict-overflow $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } + ;; +esac fi -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_AR+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-delete-null-pointer-checks to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-delete-null-pointer-checks to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-delete-null-pointer-checks $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - printf %s "(cached) " >&6 + can_enable_flag=true else case e in #( - e) if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="ar" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; + e) can_enable_flag=false ;; esac fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -printf "%s\n" "$ac_ct_AR" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; + DED_CFLAGS="-fno-delete-null-pointer-checks $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac - AR=$ac_ct_AR - fi -else - AR="$ac_cv_prog_AR" fi -if test "$AR" = false; then - as_fn_error $? "No 'ar' command found in PATH" "$LINENO" 5 -fi - -case $host in - *-*-solaris*|free_source) - if test -x /usr/ucb/install; then - INSTALL="/usr/ucb/install -c" - fi - ;; - *) - ;; -esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-aliasing $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - # Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -printf %s "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if test ${ac_cv_path_install+y} +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - printf %s "(cached) " >&6 + can_enable_flag=true else case e in #( - e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - # Account for fact that we put trailing slashes in our PATH walk. -case $as_dir in #(( - ./ | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - ;; + e) can_enable_flag=false ;; esac fi - if test ${ac_cv_path_install+y}; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -printf "%s\n" "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + DED_CFLAGS="-fno-strict-aliasing $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to create a directory including parents" >&5 -printf %s "checking how to create a directory including parents... " >&6; } -if test ${ac_cv_prog_mkdir_p+y} -then : - printf %s "(cached) " >&6 else case e in #( e) -temp_name_base=config.$$ -temp_name=$temp_name_base/x/y/z -$INSTALL -d $temp_name >/dev/null 2>&1 -ac_cv_prog_mkdir_p=none -if test -d $temp_name; then - ac_cv_prog_mkdir_p="$INSTALL -d" -else - mkdir -p $temp_name >/dev/null 2>&1 - if test -d $temp_name; then - ac_cv_prog_mkdir_p="mkdir -p" - fi -fi -rm -fr $temp_name_base - ;; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_mkdir_p" >&5 -printf "%s\n" "$ac_cv_prog_mkdir_p" >&6; } - -case "${ac_cv_prog_mkdir_p}" in - none) as_fn_error $? "don't know how create directories with parents" "$LINENO" 5 ;; - *) INSTALL_DIR="$ac_cv_prog_mkdir_p" ;; -esac - - -case $host_os in - darwin*) - INSTALL_DATA="$INSTALL_DATA -p";; - *) - ;; -esac -# Checks for libraries. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 -printf %s "checking for library containing gethostbyname... " >&6; } -if test ${ac_cv_search_gethostbyname+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -ftrivial-auto-var-init=zero to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -ftrivial-auto-var-init=zero to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -ftrivial-auto-var-init=zero $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char gethostbyname (void); int main (void) { -return gethostbyname (); +return 0; ; return 0; } _ACEOF -for ac_lib in '' nsl -do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO" -then : - ac_cv_search_gethostbyname=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext - if test ${ac_cv_search_gethostbyname+y} +if ac_fn_c_try_compile "$LINENO" then : - break + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac fi -done -if test ${ac_cv_search_gethostbyname+y} +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : + DED_CFLAGS="-ftrivial-auto-var-init=zero $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( - e) ac_cv_search_gethostbyname=no ;; -esac -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS ;; + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 -printf "%s\n" "$ac_cv_search_gethostbyname" >&6; } -ac_res=$ac_cv_search_gethostbyname -if test "$ac_res" != no -then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing getpeername" >&5 -printf %s "checking for library containing getpeername... " >&6; } -if test ${ac_cv_search_getpeername+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=3 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=3 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=3 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char getpeername (void); int main (void) { -return getpeername (); +return 0; ; return 0; } _ACEOF -for ac_lib in '' socket -do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO" -then : - ac_cv_search_getpeername=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext - if test ${ac_cv_search_getpeername+y} -then : - break -fi -done -if test ${ac_cv_search_getpeername+y} +if ac_fn_c_try_compile "$LINENO" then : - + can_enable_flag=true else case e in #( - e) ac_cv_search_getpeername=no ;; -esac -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS ;; + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getpeername" >&5 -printf "%s\n" "$ac_cv_search_getpeername" >&6; } -ac_res=$ac_cv_search_getpeername -if test "$ac_res" != no +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" -fi + DED_CFLAGS="-fstrict-flex-arrays=3 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi -# Checks for header files. + if test "X$can_enable_flag" = "Xfalse" +then : -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 -printf %s "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } -if test ${ac_cv_header_sys_wait_h+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=2 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=2 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=2 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#ifndef WEXITSTATUS -# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) -#endif -#ifndef WIFEXITED -# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) -#endif int main (void) { - int s; - wait (&s); - s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; +return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO" then : - ac_cv_header_sys_wait_h=yes + can_enable_flag=true else case e in #( - e) ac_cv_header_sys_wait_h=no ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 -printf "%s\n" "$ac_cv_header_sys_wait_h" >&6; } -if test $ac_cv_header_sys_wait_h = yes; then - -printf "%s\n" "#define HAVE_SYS_WAIT_H 1" >>confdefs.h - -fi - -ac_fn_c_check_header_compile "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" -if test "x$ac_cv_header_arpa_inet_h" = xyes +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf "%s\n" "#define HAVE_ARPA_INET_H 1" >>confdefs.h -fi -ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" -if test "x$ac_cv_header_fcntl_h" = xyes -then : - printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h + DED_CFLAGS="-fstrict-flex-arrays=2 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac fi -ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" -if test "x$ac_cv_header_limits_h" = xyes -then : - printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h -fi -ac_fn_c_check_header_compile "$LINENO" "malloc.h" "ac_cv_header_malloc_h" "$ac_includes_default" -if test "x$ac_cv_header_malloc_h" = xyes -then : - printf "%s\n" "#define HAVE_MALLOC_H 1" >>confdefs.h -fi -ac_fn_c_check_header_compile "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default" -if test "x$ac_cv_header_netdb_h" = xyes +else case e in #( + e) if test "X$can_enable_flag" != "Xtrue" then : - printf "%s\n" "#define HAVE_NETDB_H 1" >>confdefs.h - + exit 1 fi -ac_fn_c_check_header_compile "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" -if test "x$ac_cv_header_netinet_in_h" = xyes -then : - printf "%s\n" "#define HAVE_NETINET_IN_H 1" >>confdefs.h - + ;; +esac fi -ac_fn_c_check_header_compile "$LINENO" "stddef.h" "ac_cv_header_stddef_h" "$ac_includes_default" -if test "x$ac_cv_header_stddef_h" = xyes -then : - printf "%s\n" "#define HAVE_STDDEF_H 1" >>confdefs.h fi -ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes -then : - printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h -fi -ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" -if test "x$ac_cv_header_string_h" = xyes -then : - printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h -fi -ac_fn_c_check_header_compile "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_param_h" = xyes + if test "$ossf_security_hardening" = "yes" then : - printf "%s\n" "#define HAVE_SYS_PARAM_H 1" >>confdefs.h -fi -ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_socket_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_SOCKET_H 1" >>confdefs.h -fi -ac_fn_c_check_header_compile "$LINENO" "sys/select.h" "ac_cv_header_sys_select_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_select_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_SELECT_H 1" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,noexecstack to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,noexecstack to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,noexecstack"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -fi -ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_time_h" = xyes +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" then : - printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h - + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac fi -ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" -if test "x$ac_cv_header_unistd_h" = xyes +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h -fi -ac_fn_c_check_header_compile "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_types_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_TYPES_H 1" >>confdefs.h + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac fi -ac_fn_c_check_header_compile "$LINENO" "sys/uio.h" "ac_cv_header_sys_uio_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_uio_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_UIO_H 1" >>confdefs.h -fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,relro to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,relro to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,relro"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -# Checks for typedefs, structures, and compiler characteristics. -# fixme AC_C_CONST & AC_C_VOLATILE needed for Windows? -ac_fn_c_check_type "$LINENO" "uid_t" "ac_cv_type_uid_t" "$ac_includes_default" -if test "x$ac_cv_type_uid_t" = xyes +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" then : - + can_enable_flag=true else case e in #( - e) -printf "%s\n" "#define uid_t int" >>confdefs.h - ;; + e) can_enable_flag=false + ;; esac fi - -ac_fn_c_check_type "$LINENO" "gid_t" "ac_cv_type_gid_t" "$ac_includes_default" -if test "x$ac_cv_type_gid_t" = xyes +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) -printf "%s\n" "#define gid_t int" >>confdefs.h - ;; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi - ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default -" -if test "x$ac_cv_type_pid_t" = xyes -then : - -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,now to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,now to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,now"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #if defined _WIN64 && !defined __CYGWIN__ - LLP64 - #endif - int main (void) { - +return 0; ; return 0; } - _ACEOF -if ac_fn_c_try_compile "$LINENO" +if ac_fn_c_try_link "$LINENO" then : - ac_pid_type='int' + can_enable_flag=true else case e in #( - e) ac_pid_type='__int64' ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - -printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h - + e) can_enable_flag=false ;; esac fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : - -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes -then : + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else case e in #( e) -printf "%s\n" "#define size_t unsigned int" >>confdefs.h - ;; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for socklen_t usability" >&5 -printf %s "checking for socklen_t usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--as-needed to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--as-needed to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--as-needed"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include + int main (void) { -socklen_t mylen; +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -printf "%s\n" "#define HAVE_SOCKLEN_T /**/" >>confdefs.h + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } ;; + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -# Checks for library functions. -# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works -# for constant arguments. Useless! -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 -printf %s "checking for working alloca.h... " >&6; } -if test ${ac_cv_working_alloca_h+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--no-copy-dt-needed-entries to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--no-copy-dt-needed-entries to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--no-copy-dt-needed-entries"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + int main (void) { -char *p = (char *) alloca (2 * sizeof (int)); - if (p) return 0; +return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ac_cv_working_alloca_h=yes + can_enable_flag=true else case e in #( - e) ac_cv_working_alloca_h=no ;; + e) can_enable_flag=false + ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext ;; + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 -printf "%s\n" "$ac_cv_working_alloca_h" >&6; } -if test $ac_cv_working_alloca_h = yes; then -printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 -printf %s "checking for alloca... " >&6; } -if test ${ac_cv_func_alloca_works+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_func_alloca_works=$ac_cv_working_alloca_h -if test "$ac_cv_func_alloca_works" != yes -then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#ifndef alloca -# ifdef __GNUC__ -# define alloca __builtin_alloca -# elif defined _MSC_VER -# include -# define alloca _alloca -# else -# ifdef __cplusplus -extern "C" -# endif -void *alloca (size_t); -# endif -#endif -int -main (void) -{ -char *p = (char *) alloca (1); - if (p) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_func_alloca_works=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi ;; -esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for static compiler flags" >&5 +printf %s "checking for static compiler flags... " >&6; } +DED_STATIC_CFLAGS="$DED_WERRORFLAGS $DED_WARN_FLAGS $DED_THR_DEFS $DED_STATIC_CFLAGS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DED_STATIC_CFLAGS" >&5 +printf "%s\n" "$DED_STATIC_CFLAGS" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for basic compiler flags for loadable drivers" >&5 +printf %s "checking for basic compiler flags for loadable drivers... " >&6; } +DED_BASIC_CFLAGS=$DED_CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DED_CFLAGS" >&5 +printf "%s\n" "$DED_CFLAGS" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for compiler flags for loadable drivers" >&5 +printf %s "checking for compiler flags for loadable drivers... " >&6; } +DED_CFLAGS="$DED_WERRORFLAGS $DED_WARN_FLAGS $DED_THR_DEFS $DED_CFLAGS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DED_CFLAGS" >&5 +printf "%s\n" "$DED_CFLAGS" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker for loadable drivers" >&5 +printf %s "checking for linker for loadable drivers... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DED_LD" >&5 +printf "%s\n" "$DED_LD" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker flags for loadable drivers" >&5 +printf %s "checking for linker flags for loadable drivers... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DED_LDFLAGS" >&5 +printf "%s\n" "$DED_LDFLAGS" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 'runtime library path' linker flag" >&5 +printf %s "checking for 'runtime library path' linker flag... " >&6; } +if test "x$DED_LD_FLAG_RUNTIME_LIBRARY_PATH" != "x"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DED_LD_FLAG_RUNTIME_LIBRARY_PATH" >&5 +printf "%s\n" "$DED_LD_FLAG_RUNTIME_LIBRARY_PATH" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +printf "%s\n" "not found" >&6; } fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 -printf "%s\n" "$ac_cv_func_alloca_works" >&6; } -if test $ac_cv_func_alloca_works = yes; then -printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h -else - # The SVR3 libPW and SVR4 libucb both contain incompatible functions -# that cause trouble. Some versions do not even contain alloca or -# contain a buggy version. If you still want to use their alloca, -# use ar to extract alloca.o from them instead of compiling alloca.c. -ALLOCA=\${LIBOBJDIR}alloca.$ac_objext -printf "%s\n" "#define C_ALLOCA 1" >>confdefs.h -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 -printf %s "checking stack direction for C alloca... " >&6; } -if test ${ac_cv_c_stack_direction+y} + + + + + + + + + + + + +# Subst flags for libs + + + + + + + +LIB_CFLAGS="$DED_BASIC_CFLAGS $DED_THR_DEFS" +LIB_LD="$DED_LD" +LIB_LDFLAGS="$DED_LDFLAGS" +LIB_LD_FLAG_RUNTIME_LIBRARY_PATH="$DED_LD_FLAG_RUNTIME_LIBRARY_PATH" +LIB_EXT="$DED_EXT" + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 +printf %s "checking size of short... " >&6; } +if test ${ac_cv_sizeof_short+y} then : printf %s "(cached) " >&6 else case e in #( - e) if test "$cross_compiling" = yes + e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default" then : - ac_cv_c_stack_direction=0 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -find_stack_direction (int *addr, int depth) -{ - int dir, dummy = 0; - if (! addr) - addr = &dummy; - *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; - dir = depth ? find_stack_direction (addr, depth - 1) : 0; - return dir + dummy; -} -int -main (int argc, char **argv) -{ - return find_stack_direction (0, argc + !argv + 20) < 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO" -then : - ac_cv_c_stack_direction=1 else case e in #( - e) ac_cv_c_stack_direction=-1 ;; -esac -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext ;; + e) if test "$ac_cv_type_short" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (short) +See 'config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_short=0 + fi ;; esac fi ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 -printf "%s\n" "$ac_cv_c_stack_direction" >&6; } -printf "%s\n" "#define STACK_DIRECTION $ac_cv_c_stack_direction" >>confdefs.h +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 +printf "%s\n" "$ac_cv_sizeof_short" >&6; } -fi -# Check if malloc(0) is ok -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 -printf %s "checking for working memcmp... " >&6; } -if test ${ac_cv_func_memcmp_working+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test "$cross_compiling" = yes -then : - ac_cv_func_memcmp_working=no -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main (void) -{ - - /* Some versions of memcmp are not 8-bit clean. */ - char c0 = '\100', c1 = '\200', c2 = '\201'; - if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) - return 1; +printf "%s\n" "#define SIZEOF_SHORT $ac_cv_sizeof_short" >>confdefs.h - /* The Next x86 OpenStep bug shows up only when comparing 16 bytes - or more and with at least one buffer not starting on a 4-byte boundary. - William Lewis provided this test program. */ - { - char foo[21]; - char bar[21]; - int i; - for (i = 0; i < 4; i++) - { - char *a = foo + i; - char *b = bar + i; - strcpy (a, "--------01111111"); - strcpy (b, "--------10000000"); - if (memcmp (a, b, 16) >= 0) - return 1; - } - return 0; - } - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO" +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 +printf %s "checking size of int... " >&6; } +if test ${ac_cv_sizeof_int+y} then : - ac_cv_func_memcmp_working=yes + printf %s "(cached) " >&6 else case e in #( - e) ac_cv_func_memcmp_working=no ;; + e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default" +then : + +else case e in #( + e) if test "$ac_cv_type_int" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (int) +See 'config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_int=0 + fi ;; esac fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext ;; + ;; esac fi - ;; +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 +printf "%s\n" "$ac_cv_sizeof_int" >&6; } + + + +printf "%s\n" "#define SIZEOF_INT $ac_cv_sizeof_int" >>confdefs.h + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 +printf %s "checking size of long... " >&6; } +if test ${ac_cv_sizeof_long+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default" +then : + +else case e in #( + e) if test "$ac_cv_type_long" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long) +See 'config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_long=0 + fi ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 -printf "%s\n" "$ac_cv_func_memcmp_working" >&6; } -test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in - *" memcmp.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" ;; esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +printf "%s\n" "$ac_cv_sizeof_long" >&6; } -ac_fn_c_check_func "$LINENO" "dup2" "ac_cv_func_dup2" -if test "x$ac_cv_func_dup2" = xyes -then : - printf "%s\n" "#define HAVE_DUP2 1" >>confdefs.h +printf "%s\n" "#define SIZEOF_LONG $ac_cv_sizeof_long" >>confdefs.h -fi -ac_fn_c_check_func "$LINENO" "gethostbyaddr" "ac_cv_func_gethostbyaddr" -if test "x$ac_cv_func_gethostbyaddr" = xyes -then : - printf "%s\n" "#define HAVE_GETHOSTBYADDR 1" >>confdefs.h -fi -ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" -if test "x$ac_cv_func_gethostbyname" = xyes +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 +printf %s "checking size of void *... " >&6; } +if test ${ac_cv_sizeof_void_p+y} then : - printf "%s\n" "#define HAVE_GETHOSTBYNAME 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "gethostbyaddr_r" "ac_cv_func_gethostbyaddr_r" -if test "x$ac_cv_func_gethostbyaddr_r" = xyes + printf %s "(cached) " >&6 +else case e in #( + e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default" then : - printf "%s\n" "#define HAVE_GETHOSTBYADDR_R 1" >>confdefs.h +else case e in #( + e) if test "$ac_cv_type_void_p" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (void *) +See 'config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_void_p=0 + fi ;; +esac fi -ac_fn_c_check_func "$LINENO" "gethostbyname_r" "ac_cv_func_gethostbyname_r" -if test "x$ac_cv_func_gethostbyname_r" = xyes -then : - printf "%s\n" "#define HAVE_GETHOSTBYNAME_R 1" >>confdefs.h - + ;; +esac fi -ac_fn_c_check_func "$LINENO" "gethostname" "ac_cv_func_gethostname" -if test "x$ac_cv_func_gethostname" = xyes -then : - printf "%s\n" "#define HAVE_GETHOSTNAME 1" >>confdefs.h +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 +printf "%s\n" "$ac_cv_sizeof_void_p" >&6; } -fi -ac_fn_c_check_func "$LINENO" "writev" "ac_cv_func_writev" -if test "x$ac_cv_func_writev" = xyes -then : - printf "%s\n" "#define HAVE_WRITEV 1" >>confdefs.h -fi -ac_fn_c_check_func "$LINENO" "gethrtime" "ac_cv_func_gethrtime" -if test "x$ac_cv_func_gethrtime" = xyes -then : - printf "%s\n" "#define HAVE_GETHRTIME 1" >>confdefs.h -fi -ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" -if test "x$ac_cv_func_gettimeofday" = xyes -then : - printf "%s\n" "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h +printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h -fi -ac_fn_c_check_func "$LINENO" "inet_ntoa" "ac_cv_func_inet_ntoa" -if test "x$ac_cv_func_inet_ntoa" = xyes -then : - printf "%s\n" "#define HAVE_INET_NTOA 1" >>confdefs.h -fi -ac_fn_c_check_func "$LINENO" "memchr" "ac_cv_func_memchr" -if test "x$ac_cv_func_memchr" = xyes +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 +printf %s "checking size of long long... " >&6; } +if test ${ac_cv_sizeof_long_long+y} then : - printf "%s\n" "#define HAVE_MEMCHR 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" -if test "x$ac_cv_func_memmove" = xyes + printf %s "(cached) " >&6 +else case e in #( + e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default" then : - printf "%s\n" "#define HAVE_MEMMOVE 1" >>confdefs.h +else case e in #( + e) if test "$ac_cv_type_long_long" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long long) +See 'config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_long_long=0 + fi ;; +esac fi -ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" -if test "x$ac_cv_func_memset" = xyes -then : - printf "%s\n" "#define HAVE_MEMSET 1" >>confdefs.h - + ;; +esac fi -ac_fn_c_check_func "$LINENO" "select" "ac_cv_func_select" -if test "x$ac_cv_func_select" = xyes -then : - printf "%s\n" "#define HAVE_SELECT 1" >>confdefs.h +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 +printf "%s\n" "$ac_cv_sizeof_long_long" >&6; } -fi -ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket" -if test "x$ac_cv_func_socket" = xyes -then : - printf "%s\n" "#define HAVE_SOCKET 1" >>confdefs.h -fi -ac_fn_c_check_func "$LINENO" "strchr" "ac_cv_func_strchr" -if test "x$ac_cv_func_strchr" = xyes -then : - printf "%s\n" "#define HAVE_STRCHR 1" >>confdefs.h -fi -ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" -if test "x$ac_cv_func_strerror" = xyes -then : - printf "%s\n" "#define HAVE_STRERROR 1" >>confdefs.h +printf "%s\n" "#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long" >>confdefs.h -fi -ac_fn_c_check_func "$LINENO" "strrchr" "ac_cv_func_strrchr" -if test "x$ac_cv_func_strrchr" = xyes -then : - printf "%s\n" "#define HAVE_STRRCHR 1" >>confdefs.h -fi -ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" -if test "x$ac_cv_func_strstr" = xyes -then : - printf "%s\n" "#define HAVE_STRSTR 1" >>confdefs.h -fi -ac_fn_c_check_func "$LINENO" "uname" "ac_cv_func_uname" -if test "x$ac_cv_func_uname" = xyes -then : - printf "%s\n" "#define HAVE_UNAME 1" >>confdefs.h +if test $mask_real_errno = yes; then -fi -ac_fn_c_check_func "$LINENO" "sysconf" "ac_cv_func_sysconf" -if test "x$ac_cv_func_sysconf" = xyes -then : - printf "%s\n" "#define HAVE_SYSCONF 1" >>confdefs.h +printf "%s\n" "#define EI_HIDE_REAL_ERRNO 1" >>confdefs.h fi -ac_fn_c_check_func "$LINENO" "res_gethostbyname" "ac_cv_func_res_gethostbyname" -if test "x$ac_cv_func_res_gethostbyname" = xyes +if test $ac_cv_sizeof_long = 8; then + CFLAGS="$CFLAGS -DEI_64BIT" + LIB_CFLAGS="$LIB_CFLAGS -DEI_64BIT" +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking target hardware architecture" >&5 +printf %s "checking target hardware architecture... " >&6; } + if test "x$host_alias" != "x" -a "x$host_cpu" != "x"; then + chk_arch_=$host_cpu + else + chk_arch_=`uname -m` + fi + + case $chk_arch_ in + sun4u) ARCH=ultrasparc;; + sparc64) ARCH=sparc64;; + sun4v) ARCH=ultrasparc;; + i86pc) ARCH=x86;; + i386) ARCH=x86;; + i486) ARCH=x86;; + i586) ARCH=x86;; + i686) ARCH=x86;; + x86_64) ARCH=amd64;; + amd64) ARCH=amd64;; + macppc) ARCH=ppc;; + powerpc) ARCH=ppc;; + ppc) ARCH=ppc;; + ppc64) ARCH=ppc64;; + ppc64le) ARCH=ppc64le;; + powerpc64) ARCH=ppc64;; + powerpc64le) ARCH=ppc64le;; + "Power Macintosh") ARCH=ppc;; + arm64) ARCH=arm64;; + armv5b) ARCH=arm;; + armv5teb) ARCH=arm;; + armv5tel) ARCH=arm;; + armv5tejl) ARCH=arm;; + armv6l) ARCH=arm;; + armv6hl) ARCH=arm;; + armv7l) ARCH=arm;; + armv7hl) ARCH=arm;; + armv8*) ARCH=arm;; + aarch64) ARCH=arm64;; + aarch*) ARCH=arm;; + tile) ARCH=tile;; + e2k) ARCH=e2k;; + *) ARCH=noarch;; + esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ARCH" >&5 +printf "%s\n" "$ARCH" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether compilation mode forces ARCH adjustment" >&5 +printf %s "checking whether compilation mode forces ARCH adjustment... " >&6; } + case "$ARCH-$ac_cv_sizeof_void_p" in + x86-8) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: adjusting ARCH=x86 to ARCH=amd64" >&5 +printf "%s\n" "yes: adjusting ARCH=x86 to ARCH=amd64" >&6; } + ARCH=amd64 + ;; + amd64-4) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: adjusting ARCH=amd64 to ARCH=x86" >&5 +printf "%s\n" "yes: adjusting ARCH=amd64 to ARCH=x86" >&6; } + ARCH=x86 + ;; + ultrasparc-8) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: adjusting ARCH=ultrasparc to ARCH=sparc64" >&5 +printf "%s\n" "yes: adjusting ARCH=ultrasparc to ARCH=sparc64" >&6; } + ARCH=sparc64 + ;; + sparc64-4) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: adjusting ARCH=sparc64 to ARCH=ultrasparc" >&5 +printf "%s\n" "yes: adjusting ARCH=sparc64 to ARCH=ultrasparc" >&6; } + ARCH=ultrasparc + ;; + ppc64-4) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: adjusting ARCH=ppc64 to ARCH=ppc" >&5 +printf "%s\n" "yes: adjusting ARCH=ppc64 to ARCH=ppc" >&6; } + ARCH=ppc + ;; + ppc-8) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: adjusting ARCH=ppc to ARCH=ppc64" >&5 +printf "%s\n" "yes: adjusting ARCH=ppc to ARCH=ppc64" >&6; } + ARCH=ppc64 + ;; + arm-8) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: adjusting ARCH=arm to ARCH=arm64" >&5 +printf "%s\n" "yes: adjusting ARCH=arm to ARCH=arm64" >&6; } + ARCH=arm64 + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no: ARCH is $ARCH" >&5 +printf "%s\n" "no: ARCH is $ARCH" >&6; } + ;; + esac + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for unaligned word access" >&5 +printf %s "checking for unaligned word access... " >&6; } +case "$ARCH" in + x86|amd64) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes: x86 or amd64" >&5 +printf "%s\n" "yes: x86 or amd64" >&6; } + +printf "%s\n" "#define HAVE_UNALIGNED_WORD_ACCESS 1" >>confdefs.h + + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + +if test "$AR" = false; then + as_fn_error $? "No 'ar' command found in PATH" "$LINENO" 5 +fi + +case $host in + *-*-solaris*|free_source) + if test -x /usr/ucb/install; then + INSTALL="/usr/ucb/install -c" + fi + ;; + *) + ;; +esac + + + # Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + ;; +esac +fi + if test ${ac_cv_path_install+y}; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to create a directory including parents" >&5 +printf %s "checking how to create a directory including parents... " >&6; } +if test ${ac_cv_prog_mkdir_p+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) +temp_name_base=config.$$ +temp_name=$temp_name_base/x/y/z +$INSTALL -d $temp_name >/dev/null 2>&1 +ac_cv_prog_mkdir_p=none +if test -d $temp_name; then + ac_cv_prog_mkdir_p="$INSTALL -d" +else + mkdir -p $temp_name >/dev/null 2>&1 + if test -d $temp_name; then + ac_cv_prog_mkdir_p="mkdir -p" + fi +fi +rm -fr $temp_name_base + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_mkdir_p" >&5 +printf "%s\n" "$ac_cv_prog_mkdir_p" >&6; } + +case "${ac_cv_prog_mkdir_p}" in + none) as_fn_error $? "don't know how create directories with parents" "$LINENO" 5 ;; + *) INSTALL_DIR="$ac_cv_prog_mkdir_p" ;; +esac + + + +case $host_os in + darwin*) + INSTALL_DATA="$INSTALL_DATA -p";; + *) + ;; +esac + +# Checks for libraries. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 +printf %s "checking for library containing gethostbyname... " >&6; } +if test ${ac_cv_search_gethostbyname+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (void); +int +main (void) +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +for ac_lib in '' nsl +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_gethostbyname=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_gethostbyname+y} +then : + break +fi +done +if test ${ac_cv_search_gethostbyname+y} +then : + +else case e in #( + e) ac_cv_search_gethostbyname=no ;; +esac +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 +printf "%s\n" "$ac_cv_search_gethostbyname" >&6; } +ac_res=$ac_cv_search_gethostbyname +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing getpeername" >&5 +printf %s "checking for library containing getpeername... " >&6; } +if test ${ac_cv_search_getpeername+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char getpeername (void); +int +main (void) +{ +return getpeername (); + ; + return 0; +} +_ACEOF +for ac_lib in '' socket +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_getpeername=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_getpeername+y} +then : + break +fi +done +if test ${ac_cv_search_getpeername+y} +then : + +else case e in #( + e) ac_cv_search_getpeername=no ;; +esac +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getpeername" >&5 +printf "%s\n" "$ac_cv_search_getpeername" >&6; } +ac_res=$ac_cv_search_getpeername +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + +# Checks for header files. + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5 +printf %s "checking for sys/wait.h that is POSIX.1 compatible... " >&6; } +if test ${ac_cv_header_sys_wait_h+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8) +#endif +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + +int +main (void) +{ + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_header_sys_wait_h=yes +else case e in #( + e) ac_cv_header_sys_wait_h=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5 +printf "%s\n" "$ac_cv_header_sys_wait_h" >&6; } +if test $ac_cv_header_sys_wait_h = yes; then + +printf "%s\n" "#define HAVE_SYS_WAIT_H 1" >>confdefs.h + +fi + +ac_fn_c_check_header_compile "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" +if test "x$ac_cv_header_arpa_inet_h" = xyes +then : + printf "%s\n" "#define HAVE_ARPA_INET_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default" +if test "x$ac_cv_header_fcntl_h" = xyes +then : + printf "%s\n" "#define HAVE_FCNTL_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" +if test "x$ac_cv_header_limits_h" = xyes +then : + printf "%s\n" "#define HAVE_LIMITS_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "malloc.h" "ac_cv_header_malloc_h" "$ac_includes_default" +if test "x$ac_cv_header_malloc_h" = xyes +then : + printf "%s\n" "#define HAVE_MALLOC_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "netdb.h" "ac_cv_header_netdb_h" "$ac_includes_default" +if test "x$ac_cv_header_netdb_h" = xyes +then : + printf "%s\n" "#define HAVE_NETDB_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" +if test "x$ac_cv_header_netinet_in_h" = xyes +then : + printf "%s\n" "#define HAVE_NETINET_IN_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "stddef.h" "ac_cv_header_stddef_h" "$ac_includes_default" +if test "x$ac_cv_header_stddef_h" = xyes +then : + printf "%s\n" "#define HAVE_STDDEF_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = xyes +then : + printf "%s\n" "#define HAVE_STDLIB_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" +if test "x$ac_cv_header_string_h" = xyes +then : + printf "%s\n" "#define HAVE_STRING_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/param.h" "ac_cv_header_sys_param_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_param_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_PARAM_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_socket_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SOCKET_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/select.h" "ac_cv_header_sys_select_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_select_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SELECT_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/time.h" "ac_cv_header_sys_time_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_time_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_TIME_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" +if test "x$ac_cv_header_unistd_h" = xyes +then : + printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_types_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_TYPES_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/uio.h" "ac_cv_header_sys_uio_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_uio_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_UIO_H 1" >>confdefs.h + +fi + + +# Checks for typedefs, structures, and compiler characteristics. +# fixme AC_C_CONST & AC_C_VOLATILE needed for Windows? +ac_fn_c_check_type "$LINENO" "uid_t" "ac_cv_type_uid_t" "$ac_includes_default" +if test "x$ac_cv_type_uid_t" = xyes +then : + +else case e in #( + e) +printf "%s\n" "#define uid_t int" >>confdefs.h + ;; +esac +fi + +ac_fn_c_check_type "$LINENO" "gid_t" "ac_cv_type_gid_t" "$ac_includes_default" +if test "x$ac_cv_type_gid_t" = xyes +then : + +else case e in #( + e) +printf "%s\n" "#define gid_t int" >>confdefs.h + ;; +esac +fi + + + ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default +" +if test "x$ac_cv_type_pid_t" = xyes +then : + +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if defined _WIN64 && !defined __CYGWIN__ + LLP64 + #endif + +int +main (void) +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_pid_type='int' +else case e in #( + e) ac_pid_type='__int64' ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h + + ;; +esac +fi + + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes +then : + +else case e in #( + e) +printf "%s\n" "#define size_t unsigned int" >>confdefs.h + ;; +esac +fi + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for socklen_t usability" >&5 +printf %s "checking for socklen_t usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +int +main (void) +{ +socklen_t mylen; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +printf "%s\n" "#define HAVE_SOCKLEN_T /**/" >>confdefs.h + +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +# Checks for library functions. +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 +printf %s "checking for working alloca.h... " >&6; } +if test ${ac_cv_working_alloca_h+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +char *p = (char *) alloca (2 * sizeof (int)); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_working_alloca_h=yes +else case e in #( + e) ac_cv_working_alloca_h=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 +printf "%s\n" "$ac_cv_working_alloca_h" >&6; } +if test $ac_cv_working_alloca_h = yes; then + +printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 +printf %s "checking for alloca... " >&6; } +if test ${ac_cv_func_alloca_works+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_func_alloca_works=$ac_cv_working_alloca_h +if test "$ac_cv_func_alloca_works" != yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#ifndef alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# else +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + +int +main (void) +{ +char *p = (char *) alloca (1); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_func_alloca_works=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +printf "%s\n" "$ac_cv_func_alloca_works" >&6; } + +if test $ac_cv_func_alloca_works = yes; then + +printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext + +printf "%s\n" "#define C_ALLOCA 1" >>confdefs.h + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 +printf %s "checking stack direction for C alloca... " >&6; } +if test ${ac_cv_c_stack_direction+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test "$cross_compiling" = yes +then : + ac_cv_c_stack_direction=0 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +find_stack_direction (int *addr, int depth) +{ + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; +} + +int +main (int argc, char **argv) +{ + return find_stack_direction (0, argc + !argv + 20) < 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_c_stack_direction=1 +else case e in #( + e) ac_cv_c_stack_direction=-1 ;; +esac +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 +printf "%s\n" "$ac_cv_c_stack_direction" >&6; } +printf "%s\n" "#define STACK_DIRECTION $ac_cv_c_stack_direction" >>confdefs.h + + +fi + +# Check if malloc(0) is ok +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5 +printf %s "checking for working memcmp... " >&6; } +if test ${ac_cv_func_memcmp_working+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test "$cross_compiling" = yes +then : + ac_cv_func_memcmp_working=no +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main (void) +{ + + /* Some versions of memcmp are not 8-bit clean. */ + char c0 = '\100', c1 = '\200', c2 = '\201'; + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + return 1; + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + return 1; + } + return 0; + } + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_func_memcmp_working=yes +else case e in #( + e) ac_cv_func_memcmp_working=no ;; +esac +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5 +printf "%s\n" "$ac_cv_func_memcmp_working" >&6; } +test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in + *" memcmp.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS memcmp.$ac_objext" + ;; +esac + + + +ac_fn_c_check_func "$LINENO" "dup2" "ac_cv_func_dup2" +if test "x$ac_cv_func_dup2" = xyes +then : + printf "%s\n" "#define HAVE_DUP2 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gethostbyaddr" "ac_cv_func_gethostbyaddr" +if test "x$ac_cv_func_gethostbyaddr" = xyes +then : + printf "%s\n" "#define HAVE_GETHOSTBYADDR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" +if test "x$ac_cv_func_gethostbyname" = xyes +then : + printf "%s\n" "#define HAVE_GETHOSTBYNAME 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gethostbyaddr_r" "ac_cv_func_gethostbyaddr_r" +if test "x$ac_cv_func_gethostbyaddr_r" = xyes +then : + printf "%s\n" "#define HAVE_GETHOSTBYADDR_R 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gethostbyname_r" "ac_cv_func_gethostbyname_r" +if test "x$ac_cv_func_gethostbyname_r" = xyes +then : + printf "%s\n" "#define HAVE_GETHOSTBYNAME_R 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gethostname" "ac_cv_func_gethostname" +if test "x$ac_cv_func_gethostname" = xyes +then : + printf "%s\n" "#define HAVE_GETHOSTNAME 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "writev" "ac_cv_func_writev" +if test "x$ac_cv_func_writev" = xyes +then : + printf "%s\n" "#define HAVE_WRITEV 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gethrtime" "ac_cv_func_gethrtime" +if test "x$ac_cv_func_gethrtime" = xyes +then : + printf "%s\n" "#define HAVE_GETHRTIME 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" +if test "x$ac_cv_func_gettimeofday" = xyes +then : + printf "%s\n" "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "inet_ntoa" "ac_cv_func_inet_ntoa" +if test "x$ac_cv_func_inet_ntoa" = xyes +then : + printf "%s\n" "#define HAVE_INET_NTOA 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memchr" "ac_cv_func_memchr" +if test "x$ac_cv_func_memchr" = xyes +then : + printf "%s\n" "#define HAVE_MEMCHR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" +if test "x$ac_cv_func_memmove" = xyes +then : + printf "%s\n" "#define HAVE_MEMMOVE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "memset" "ac_cv_func_memset" +if test "x$ac_cv_func_memset" = xyes +then : + printf "%s\n" "#define HAVE_MEMSET 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "select" "ac_cv_func_select" +if test "x$ac_cv_func_select" = xyes +then : + printf "%s\n" "#define HAVE_SELECT 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket" +if test "x$ac_cv_func_socket" = xyes +then : + printf "%s\n" "#define HAVE_SOCKET 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strchr" "ac_cv_func_strchr" +if test "x$ac_cv_func_strchr" = xyes +then : + printf "%s\n" "#define HAVE_STRCHR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strerror" "ac_cv_func_strerror" +if test "x$ac_cv_func_strerror" = xyes +then : + printf "%s\n" "#define HAVE_STRERROR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strrchr" "ac_cv_func_strrchr" +if test "x$ac_cv_func_strrchr" = xyes +then : + printf "%s\n" "#define HAVE_STRRCHR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "strstr" "ac_cv_func_strstr" +if test "x$ac_cv_func_strstr" = xyes +then : + printf "%s\n" "#define HAVE_STRSTR 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "uname" "ac_cv_func_uname" +if test "x$ac_cv_func_uname" = xyes +then : + printf "%s\n" "#define HAVE_UNAME 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "sysconf" "ac_cv_func_sysconf" +if test "x$ac_cv_func_sysconf" = xyes +then : + printf "%s\n" "#define HAVE_SYSCONF 1" >>confdefs.h + +fi + +ac_fn_c_check_func "$LINENO" "res_gethostbyname" "ac_cv_func_res_gethostbyname" +if test "x$ac_cv_func_res_gethostbyname" = xyes +then : + +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for res_gethostbyname in -lresolv" >&5 +printf %s "checking for res_gethostbyname in -lresolv... " >&6; } +if test ${ac_cv_lib_resolv_res_gethostbyname+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lresolv $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char res_gethostbyname (void); +int +main (void) +{ +return res_gethostbyname (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_resolv_res_gethostbyname=yes +else case e in #( + e) ac_cv_lib_resolv_res_gethostbyname=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_res_gethostbyname" >&5 +printf "%s\n" "$ac_cv_lib_resolv_res_gethostbyname" >&6; } +if test "x$ac_cv_lib_resolv_res_gethostbyname" = xyes +then : + printf "%s\n" "#define HAVE_LIBRESOLV 1" >>confdefs.h + + LIBS="-lresolv $LIBS" + +fi + + ;; +esac +fi + +ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" +if test "x$ac_cv_func_clock_gettime" = xyes +then : + +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 +printf %s "checking for clock_gettime in -lrt... " >&6; } +if test ${ac_cv_lib_rt_clock_gettime+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (void); +int +main (void) +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_rt_clock_gettime=yes +else case e in #( + e) ac_cv_lib_rt_clock_gettime=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 +printf "%s\n" "$ac_cv_lib_rt_clock_gettime" >&6; } +if test "x$ac_cv_lib_rt_clock_gettime" = xyes +then : + printf "%s\n" "#define HAVE_LIBRT 1" >>confdefs.h + + LIBS="-lrt $LIBS" + +fi + + ;; +esac +fi + + +# --------------------------------------------------------------------------- +# We don't link against libgmp except for "make check" +# but linking will also tell us that it is >= 4.1 +# --------------------------------------------------------------------------- + + +# Check whether --with-gmp was given. +if test ${with_gmp+y} +then : + withval=$with_gmp; +fi + + +# We don't just want any GNU MP version, we want 4.1 or later +# that contain the import/export functions we need. + +if test "x$with_gmp" = "xyes" +then : + + for dir in /usr /usr/pkg /usr/local /usr/local/gmp /usr/lib/gmp /usr/gmp; do + as_ac_Header=`printf "%s\n" "ac_cv_header_$dir/include/gmp.h" | sed "$as_sed_sh"` +ac_fn_c_check_header_compile "$LINENO" "$dir/include/gmp.h" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" +then : + ac_cv_gmp=yes +else case e in #( + e) ac_cv_gmp=no ;; +esac +fi + + if test $ac_cv_gmp = yes ; then + CFLAGS="$CFLAGS -I$dir/include -L$dir/lib" + LIB_CFLAGS="$LIB_CFLAGS -I$dir/include -L$dir/lib" + +printf "%s\n" "#define HAVE_GMP_H /**/" >>confdefs.h + + break + fi + done + if test $ac_cv_gmp = no ; then + as_fn_error $? "No GNU MP installation found" "$LINENO" 5 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __gmpz_export in -lgmp" >&5 +printf %s "checking for __gmpz_export in -lgmp... " >&6; } +if test ${ac_cv_lib_gmp___gmpz_export+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lgmp $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char __gmpz_export (void); +int +main (void) +{ +return __gmpz_export (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_gmp___gmpz_export=yes +else case e in #( + e) ac_cv_lib_gmp___gmpz_export=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gmp___gmpz_export" >&5 +printf "%s\n" "$ac_cv_lib_gmp___gmpz_export" >&6; } +if test "x$ac_cv_lib_gmp___gmpz_export" = xyes +then : + printf "%s\n" "#define HAVE_LIBGMP 1" >>confdefs.h + + LIBS="-lgmp $LIBS" + +fi + + # FIXME return ERROR if no lib +elif test "x$with_gmp" != "xno" -a -n "$with_gmp" ;then + # Option given with PATH to package + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU MP" >&5 +printf %s "checking for GNU MP... " >&6; } + if test ! -d "$with_gmp" ; then + as_fn_error $? "Invalid path to option --with-gmp=PATH" "$LINENO" 5 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + CFLAGS="$CFLAGS -I$with_gmp/include -L$with_gmp/lib" + LIB_CFLAGS="$LIB_CFLAGS -I$with_gmp/include -L$with_gmp/lib" + +printf "%s\n" "#define HAVE_GMP_H /**/" >>confdefs.h + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __gmpz_export in -lgmp" >&5 +printf %s "checking for __gmpz_export in -lgmp... " >&6; } +if test ${ac_cv_lib_gmp___gmpz_export+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lgmp $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char __gmpz_export (void); +int +main (void) +{ +return __gmpz_export (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_gmp___gmpz_export=yes +else case e in #( + e) ac_cv_lib_gmp___gmpz_export=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gmp___gmpz_export" >&5 +printf "%s\n" "$ac_cv_lib_gmp___gmpz_export" >&6; } +if test "x$ac_cv_lib_gmp___gmpz_export" = xyes +then : + printf "%s\n" "#define HAVE_LIBGMP 1" >>confdefs.h + + LIBS="-lgmp $LIBS" + +fi + + # FIXME return ERROR if no lib + +fi + + + +if test "X$windows_environment_" != "Xchecked"; then +windows_environment_=checked +MIXED_CYGWIN=no +MIXED_MSYS=no +MIXED_VSL=no + +MIXED_VC=no +MIXED_MINGW=no + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mixed mingw-gcc and native VC++ environment" >&5 +printf %s "checking for mixed mingw-gcc and native VC++ environment... " >&6; } +if test "X$host" = "Xwin32" -a "x$GCC" != "xyes"; then + if test -x /usr/bin/msys-?.0.dll; then + CFLAGS="$CFLAGS -O2" + MIXED_MSYS=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: MSYS and VC" >&5 +printf "%s\n" "MSYS and VC" >&6; } + MIXED_VC=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_VC" + elif test -x /usr/bin/cygpath; then + CFLAGS="$CFLAGS -O2" + MIXED_CYGWIN=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Cygwin and VC" >&5 +printf "%s\n" "Cygwin and VC" >&6; } + MIXED_VC=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_VC" + elif test -x /bin/wslpath; then + CFLAGS="$CFLAGS -O2" + MIXED_WSL=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: WSL and VC" >&5 +printf "%s\n" "WSL and VC" >&6; } + MIXED_VC=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_VC" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: undeterminable" >&5 +printf "%s\n" "undeterminable" >&6; } + as_fn_error cannot handle this! "Seems to be mixed windows but not within any known env" "$LINENO" 5 + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + +if test "x$MIXED_MSYS" != "xyes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mixed cygwin and native MinGW environment" >&5 +printf %s "checking for mixed cygwin and native MinGW environment... " >&6; } + if test "X$host" = "Xwin32" -a "x$GCC" = x"yes"; then + if test -x /usr/bin/cygpath; then + CFLAGS="$CFLAGS -O2" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + MIXED_MINGW=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MINGW" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: undeterminable" >&5 +printf "%s\n" "undeterminable" >&6; } + as_fn_error cannot handle this! "Seems to be mixed windows but not with cygwin" "$LINENO" 5 + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mixed MSYS and native MinGW environment" >&5 +printf %s "checking for mixed MSYS and native MinGW environment... " >&6; } + if test "x$GCC" = x"yes"; then + if test -x /usr/bin/msys-=.0.dll; then + CFLAGS="$CFLAGS -O2" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + MIXED_MINGW=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MINGW" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: undeterminable" >&5 +printf "%s\n" "undeterminable" >&6; } + as_fn_error cannot handle this! "Seems to be mixed windows but not with msys" "$LINENO" 5 + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we mix cygwin with any native compiler" >&5 +printf %s "checking if we mix cygwin with any native compiler... " >&6; } +if test "X$MIXED_CYGWIN" = "Xyes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we mix msys with another native compiler" >&5 +printf %s "checking if we mix msys with another native compiler... " >&6; } +if test "X$MIXED_MSYS" = "Xyes" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we mix WSL with another native compiler" >&5 +printf %s "checking if we mix WSL with another native compiler... " >&6; } +if test "X$MIXED_WSL" = "Xyes" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + +fi + + + +THR_LIBS= +THR_DEFS= + + + + +case "$threads_disabled" in #( + no|maybe) : + + + +NEED_NPTL_PTHREAD_H=no + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for native win32 threads" >&5 +printf %s "checking for native win32 threads... " >&6; } +if test "X$host_os" = "Xwin32" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + THR_DEFS="-DWIN32_THREADS" + THR_LIBS= + THR_LIB_NAME=win32_threads + THR_LIB_TYPE=win32_threads + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + THR_DEFS= + THR_LIBS= + THR_LIB_NAME= + THR_LIB_TYPE=posix_unknown + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 +printf %s "checking for pthread_create in -lpthread... " >&6; } +if test ${ac_cv_lib_pthread_pthread_create+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (void); +int +main (void) +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthread_pthread_create=yes +else case e in #( + e) ac_cv_lib_pthread_pthread_create=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 +printf "%s\n" "$ac_cv_lib_pthread_pthread_create" >&6; } +if test "x$ac_cv_lib_pthread_pthread_create" = xyes +then : + THR_LIBS="-lpthread" +fi + + + if test "x$THR_LIBS" = "x" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc_r" >&5 +printf %s "checking for pthread_create in -lc_r... " >&6; } +if test ${ac_cv_lib_c_r_pthread_create+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_create (void); +int +main (void) +{ +return pthread_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_c_r_pthread_create=yes +else case e in #( + e) ac_cv_lib_c_r_pthread_create=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_create" >&5 +printf "%s\n" "$ac_cv_lib_c_r_pthread_create" >&6; } +if test "x$ac_cv_lib_c_r_pthread_create" = xyes +then : + THR_LIBS="-lc_r" +fi + + +fi + + if test "x$THR_LIBS" = "x" +then : + + ac_fn_c_check_func "$LINENO" "pthread_create" "ac_cv_func_pthread_create" +if test "x$ac_cv_func_pthread_create" = xyes +then : + THR_LIBS="none_needed" +fi + + +fi + + if test "x$THR_LIBS" = "x" +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the '-pthread' switch can be used" >&5 +printf %s "checking if the '-pthread' switch can be used... " >&6; } + saved_cflags=$CFLAGS + CFLAGS="$CFLAGS -pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +pthread_create((void*)0,(void*)0,(void*)0,(void*)0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + THR_DEFS="-pthread" + THR_LIBS="-pthread" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$saved_cflags + if test "x$THR_LIBS" != "x"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi + +fi + + if test "x$THR_LIBS" != "x" +then : + + THR_DEFS="$THR_DEFS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS" + THR_LIB_NAME=pthread + if test "x$THR_LIBS" = "xnone_needed"; then + THR_LIBS= + fi + case $host_os in #( + solaris*) : + + THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS" + ;; #( + linux*) : + + THR_DEFS="$THR_DEFS -D_POSIX_THREAD_SAFE_FUNCTIONS" + + +if test "$cross_compiling" != "yes" +then : + + # Extract the first word of "getconf", so it can be a program name with args. +set dummy getconf; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_GETCONF+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$GETCONF"; then + ac_cv_prog_GETCONF="$GETCONF" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_GETCONF="getconf" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_GETCONF" && ac_cv_prog_GETCONF="false" +fi ;; +esac +fi +GETCONF=$ac_cv_prog_GETCONF +if test -n "$GETCONF"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GETCONF" >&5 +printf "%s\n" "$GETCONF" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + +else case e in #( + e) + host_getconf="$host_alias-getconf" + # Extract the first word of "$host_getconf", so it can be a program name with args. +set dummy $host_getconf; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_GETCONF+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$GETCONF"; then + ac_cv_prog_GETCONF="$GETCONF" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_GETCONF="$host_getconf" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_GETCONF" && ac_cv_prog_GETCONF="false" +fi ;; +esac +fi +GETCONF=$ac_cv_prog_GETCONF +if test -n "$GETCONF"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GETCONF" >&5 +printf "%s\n" "$GETCONF" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + if test "$GETCONF" = "false" && test "$erl_xcomp_sysroot" != "" then : -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for res_gethostbyname in -lresolv" >&5 -printf %s "checking for res_gethostbyname in -lresolv... " >&6; } -if test ${ac_cv_lib_resolv_res_gethostbyname+y} + GETCONF= + prfx="$erl_xcomp_sysroot" + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}getconf", so it can be a program name with args. +set dummy ${ac_tool_prefix}getconf; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_GETCONF+y} then : printf %s "(cached) " >&6 else case e in #( - e) ac_check_lib_save_LIBS=$LIBS -LIBS="-lresolv $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + e) case $GETCONF in + [\\/]* | ?:[\\/]*) + ac_cv_path_GETCONF="$GETCONF" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy=""$prfx/usr/bin:$prfx/bin:$prfx/usr/local/bin"" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_GETCONF="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char res_gethostbyname (void); -int -main (void) -{ -return res_gethostbyname (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" + ;; +esac ;; +esac +fi +GETCONF=$ac_cv_path_GETCONF +if test -n "$GETCONF"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GETCONF" >&5 +printf "%s\n" "$GETCONF" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_GETCONF"; then + ac_pt_GETCONF=$GETCONF + # Extract the first word of "getconf", so it can be a program name with args. +set dummy getconf; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ac_pt_GETCONF+y} then : - ac_cv_lib_resolv_res_gethostbyname=yes + printf %s "(cached) " >&6 else case e in #( - e) ac_cv_lib_resolv_res_gethostbyname=no ;; + e) case $ac_pt_GETCONF in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_GETCONF="$ac_pt_GETCONF" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy=""$prfx/usr/bin:$prfx/bin:$prfx/usr/local/bin"" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_GETCONF="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac ;; esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS ;; +ac_pt_GETCONF=$ac_cv_path_ac_pt_GETCONF +if test -n "$ac_pt_GETCONF"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_GETCONF" >&5 +printf "%s\n" "$ac_pt_GETCONF" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_pt_GETCONF" = x; then + GETCONF="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + GETCONF=$ac_pt_GETCONF + fi +else + GETCONF="$ac_cv_path_GETCONF" +fi + + +fi + ;; +esac +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Native POSIX Thread Library" >&5 +printf %s "checking for Native POSIX Thread Library... " >&6; } + libpthr_vsn=`$GETCONF GNU_LIBPTHREAD_VERSION 2>/dev/null` + if test $? -eq 0; then + case "$libpthr_vsn" in + *nptl*|*NPTL*) nptl=yes;; + *) nptl=no;; + esac + elif test "$cross_compiling" = "yes"; then + case "$erl_xcomp_linux_nptl" in + "") nptl=cross;; + yes|no) nptl=$erl_xcomp_linux_nptl;; + *) as_fn_error $? "Bad erl_xcomp_linux_nptl value: $erl_xcomp_linux_nptl" "$LINENO" 5;; + esac + else + nptl=no + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $nptl" >&5 +printf "%s\n" "$nptl" >&6; } + if test $nptl = cross; then + nptl=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: result yes guessed because of cross compilation" >&5 +printf "%s\n" "$as_me: WARNING: result yes guessed because of cross compilation" >&2;} + fi + if test $nptl = yes +then : + + THR_LIB_TYPE=posix_nptl + need_nptl_incldir=no + ac_fn_c_check_header_compile "$LINENO" "nptl/pthread.h" "ac_cv_header_nptl_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_nptl_pthread_h" = xyes +then : + need_nptl_incldir=yes + NEED_NPTL_PTHREAD_H=yes +fi + + if test $need_nptl_incldir = yes +then : + + # Ahh... + nptl_path="$C_INCLUDE_PATH:$CPATH" + if test X$cross_compiling != Xyes; then + nptl_path="$nptl_path:/usr/local/include:/usr/include" + else + IROOT="$erl_xcomp_isysroot" + test "$IROOT" != "" || IROOT="$erl_xcomp_sysroot" + test "$IROOT" != "" || as_fn_error $? "Don't know where to search for includes! Please set erl_xcomp_isysroot" "$LINENO" 5 + nptl_path="$nptl_path:$IROOT/usr/local/include:$IROOT/usr/include" + fi + nptl_ws_path= + save_ifs="$IFS"; IFS=":" + for dir in $nptl_path; do + if test "x$dir" != "x"; then + nptl_ws_path="$nptl_ws_path $dir" + fi + done + IFS=$save_ifs + nptl_incldir= + for dir in $nptl_ws_path; do + as_ac_Header=`printf "%s\n" "ac_cv_header_$dir/nptl/pthread.h" | sed "$as_sed_sh"` +ac_fn_c_check_header_compile "$LINENO" "$dir/nptl/pthread.h" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes" +then : + nptl_incldir=$dir/nptl +fi + + if test "x$nptl_incldir" != "x"; then + THR_DEFS="$THR_DEFS -isystem $nptl_incldir" + break + fi + done + if test "x$nptl_incldir" = "x"; then + as_fn_error $? "Failed to locate nptl system include directory" "$LINENO" 5 + fi + +fi + +fi + ;; #( + *) : + ;; esac + + saved_cppflags=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $THR_DEFS" + + + ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes +then : + +printf "%s\n" "#define HAVE_PTHREAD_H 1" >>confdefs.h + fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_res_gethostbyname" >&5 -printf "%s\n" "$ac_cv_lib_resolv_res_gethostbyname" >&6; } -if test "x$ac_cv_lib_resolv_res_gethostbyname" = xyes + + + ac_fn_c_check_header_compile "$LINENO" "pthread/mit/pthread.h" "ac_cv_header_pthread_mit_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_mit_pthread_h" = xyes then : - printf "%s\n" "#define HAVE_LIBRESOLV 1" >>confdefs.h + \ - LIBS="-lresolv $LIBS" +printf "%s\n" "#define HAVE_MIT_PTHREAD_H 1" >>confdefs.h fi - ;; + + CPPFLAGS=$saved_cppflags + + +fi + ;; esac fi -ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime" -if test "x$ac_cv_func_clock_gettime" = xyes -then : -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 -printf %s "checking for clock_gettime in -lrt... " >&6; } -if test ${ac_cv_lib_rt_clock_gettime+y} + + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 +printf %s "checking size of short... " >&6; } +if test ${ac_cv_sizeof_short+y} then : printf %s "(cached) " >&6 else case e in #( - e) ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char clock_gettime (void); -int -main (void) -{ -return clock_gettime (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" + e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default" then : - ac_cv_lib_rt_clock_gettime=yes + else case e in #( - e) ac_cv_lib_rt_clock_gettime=no ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS ;; + e) if test "$ac_cv_type_short" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (short) +See 'config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_short=0 + fi ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 -printf "%s\n" "$ac_cv_lib_rt_clock_gettime" >&6; } -if test "x$ac_cv_lib_rt_clock_gettime" = xyes -then : - printf "%s\n" "#define HAVE_LIBRT 1" >>confdefs.h - - LIBS="-lrt $LIBS" - -fi - ;; esac fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 +printf "%s\n" "$ac_cv_sizeof_short" >&6; } -# --------------------------------------------------------------------------- -# We don't link against libgmp except for "make check" -# but linking will also tell us that it is >= 4.1 -# --------------------------------------------------------------------------- - - -# Check whether --with-gmp was given. -if test ${with_gmp+y} -then : - withval=$with_gmp; -fi +printf "%s\n" "#define SIZEOF_SHORT $ac_cv_sizeof_short" >>confdefs.h -# We don't just want any GNU MP version, we want 4.1 or later -# that contain the import/export functions we need. -if test "x$with_gmp" = "xyes" + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 +printf %s "checking size of int... " >&6; } +if test ${ac_cv_sizeof_int+y} then : - - for dir in /usr /usr/pkg /usr/local /usr/local/gmp /usr/lib/gmp /usr/gmp; do - as_ac_Header=`printf "%s\n" "ac_cv_header_$dir/include/gmp.h" | sed "$as_sed_sh"` -ac_fn_c_check_header_compile "$LINENO" "$dir/include/gmp.h" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes" + printf %s "(cached) " >&6 +else case e in #( + e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default" then : - ac_cv_gmp=yes + else case e in #( - e) ac_cv_gmp=no ;; + e) if test "$ac_cv_type_int" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (int) +See 'config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_int=0 + fi ;; esac fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 +printf "%s\n" "$ac_cv_sizeof_int" >&6; } - if test $ac_cv_gmp = yes ; then - CFLAGS="$CFLAGS -I$dir/include -L$dir/lib" - LIB_CFLAGS="$LIB_CFLAGS -I$dir/include -L$dir/lib" -printf "%s\n" "#define HAVE_GMP_H /**/" >>confdefs.h - break - fi - done - if test $ac_cv_gmp = no ; then - as_fn_error $? "No GNU MP installation found" "$LINENO" 5 - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __gmpz_export in -lgmp" >&5 -printf %s "checking for __gmpz_export in -lgmp... " >&6; } -if test ${ac_cv_lib_gmp___gmpz_export+y} +printf "%s\n" "#define SIZEOF_INT $ac_cv_sizeof_int" >>confdefs.h + + + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 +printf %s "checking size of long... " >&6; } +if test ${ac_cv_sizeof_long+y} then : printf %s "(cached) " >&6 else case e in #( - e) ac_check_lib_save_LIBS=$LIBS -LIBS="-lgmp $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char __gmpz_export (void); -int -main (void) -{ -return __gmpz_export (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" + e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default" then : - ac_cv_lib_gmp___gmpz_export=yes + else case e in #( - e) ac_cv_lib_gmp___gmpz_export=no ;; + e) if test "$ac_cv_type_long" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long) +See 'config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_long=0 + fi ;; esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS ;; + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gmp___gmpz_export" >&5 -printf "%s\n" "$ac_cv_lib_gmp___gmpz_export" >&6; } -if test "x$ac_cv_lib_gmp___gmpz_export" = xyes -then : - printf "%s\n" "#define HAVE_LIBGMP 1" >>confdefs.h - - LIBS="-lgmp $LIBS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 +printf "%s\n" "$ac_cv_sizeof_long" >&6; } -fi - # FIXME return ERROR if no lib -elif test "x$with_gmp" != "xno" -a -n "$with_gmp" ;then - # Option given with PATH to package - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU MP" >&5 -printf %s "checking for GNU MP... " >&6; } - if test ! -d "$with_gmp" ; then - as_fn_error $? "Invalid path to option --with-gmp=PATH" "$LINENO" 5 - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - CFLAGS="$CFLAGS -I$with_gmp/include -L$with_gmp/lib" - LIB_CFLAGS="$LIB_CFLAGS -I$with_gmp/include -L$with_gmp/lib" -printf "%s\n" "#define HAVE_GMP_H /**/" >>confdefs.h +printf "%s\n" "#define SIZEOF_LONG $ac_cv_sizeof_long" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for __gmpz_export in -lgmp" >&5 -printf %s "checking for __gmpz_export in -lgmp... " >&6; } -if test ${ac_cv_lib_gmp___gmpz_export+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_check_lib_save_LIBS=$LIBS -LIBS="-lgmp $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char __gmpz_export (void); -int -main (void) -{ -return __gmpz_export (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 +printf %s "checking size of long long... " >&6; } +if test ${ac_cv_sizeof_long_long+y} then : - ac_cv_lib_gmp___gmpz_export=yes + printf %s "(cached) " >&6 else case e in #( - e) ac_cv_lib_gmp___gmpz_export=no ;; + e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default" +then : + +else case e in #( + e) if test "$ac_cv_type_long_long" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long long) +See 'config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_long_long=0 + fi ;; esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS ;; + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gmp___gmpz_export" >&5 -printf "%s\n" "$ac_cv_lib_gmp___gmpz_export" >&6; } -if test "x$ac_cv_lib_gmp___gmpz_export" = xyes -then : - printf "%s\n" "#define HAVE_LIBGMP 1" >>confdefs.h +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 +printf "%s\n" "$ac_cv_sizeof_long_long" >&6; } - LIBS="-lgmp $LIBS" -fi - # FIXME return ERROR if no lib +printf "%s\n" "#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long" >>confdefs.h -fi + # The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of __int128_t" >&5 +printf %s "checking size of __int128_t... " >&6; } +if test ${ac_cv_sizeof___int128_t+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (__int128_t))" "ac_cv_sizeof___int128_t" "$ac_includes_default" +then : +else case e in #( + e) if test "$ac_cv_type___int128_t" = yes; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (__int128_t) +See 'config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof___int128_t=0 + fi ;; +esac +fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof___int128_t" >&5 +printf "%s\n" "$ac_cv_sizeof___int128_t" >&6; } -if test "X$windows_environment_" != "Xchecked"; then -windows_environment_=checked -MIXED_CYGWIN=no -MIXED_MSYS=no -MIXED_VSL=no -MIXED_VC=no -MIXED_MINGW=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mixed mingw-gcc and native VC++ environment" >&5 -printf %s "checking for mixed mingw-gcc and native VC++ environment... " >&6; } -if test "X$host" = "Xwin32" -a "x$GCC" != "xyes"; then - if test -x /usr/bin/msys-?.0.dll; then - CFLAGS="$CFLAGS -O2" - MIXED_MSYS=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: MSYS and VC" >&5 -printf "%s\n" "MSYS and VC" >&6; } - MIXED_VC=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_VC" - elif test -x /usr/bin/cygpath; then - CFLAGS="$CFLAGS -O2" - MIXED_CYGWIN=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Cygwin and VC" >&5 -printf "%s\n" "Cygwin and VC" >&6; } - MIXED_VC=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_VC" - elif test -x /bin/wslpath; then - CFLAGS="$CFLAGS -O2" - MIXED_WSL=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: WSL and VC" >&5 -printf "%s\n" "WSL and VC" >&6; } - MIXED_VC=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_VC" - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: undeterminable" >&5 -printf "%s\n" "undeterminable" >&6; } - as_fn_error cannot handle this! "Seems to be mixed windows but not within any known env" "$LINENO" 5 - fi -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi +printf "%s\n" "#define SIZEOF___INT128_T $ac_cv_sizeof___int128_t" >>confdefs.h -if test "x$MIXED_MSYS" != "xyes"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mixed cygwin and native MinGW environment" >&5 -printf %s "checking for mixed cygwin and native MinGW environment... " >&6; } - if test "X$host" = "Xwin32" -a "x$GCC" = x"yes"; then - if test -x /usr/bin/cygpath; then - CFLAGS="$CFLAGS -O2" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - MIXED_MINGW=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MINGW" - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: undeterminable" >&5 -printf "%s\n" "undeterminable" >&6; } - as_fn_error cannot handle this! "Seems to be mixed windows but not with cygwin" "$LINENO" 5 - fi + if test "$ac_cv_sizeof_short" = "4"; then + gcc_atomic_type32="short" + elif test "$ac_cv_sizeof_int" = "4"; then + gcc_atomic_type32="int" + elif test "$ac_cv_sizeof_long" = "4"; then + gcc_atomic_type32="long" else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + as_fn_error $? "No 32-bit type found" "$LINENO" 5 fi -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mixed MSYS and native MinGW environment" >&5 -printf %s "checking for mixed MSYS and native MinGW environment... " >&6; } - if test "x$GCC" = x"yes"; then - if test -x /usr/bin/msys-=.0.dll; then - CFLAGS="$CFLAGS -O2" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - MIXED_MINGW=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MINGW" - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: undeterminable" >&5 -printf "%s\n" "undeterminable" >&6; } - as_fn_error cannot handle this! "Seems to be mixed windows but not with msys" "$LINENO" 5 - fi + + if test "$ac_cv_sizeof_int" = "8"; then + gcc_atomic_type64="int" + elif test "$ac_cv_sizeof_long" = "8"; then + gcc_atomic_type64="long" + elif test "$ac_cv_sizeof_long_long" = "8"; then + gcc_atomic_type64="long long" else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + as_fn_error $? "No 64-bit type found" "$LINENO" 5 fi -fi + if test "$ac_cv_sizeof___int128_t" = "16"; then + gcc_atomic_type128="__int128_t" + else + gcc_atomic_type128="#error " + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working __sync_synchronize()" >&5 +printf %s "checking for a working __sync_synchronize()... " >&6; } +if test ${ethr_cv___sync_synchronize+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) + ethr_cv___sync_synchronize=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we mix cygwin with any native compiler" >&5 -printf %s "checking if we mix cygwin with any native compiler... " >&6; } -if test "X$MIXED_CYGWIN" = "Xyes"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we mix msys with another native compiler" >&5 -printf %s "checking if we mix msys with another native compiler... " >&6; } -if test "X$MIXED_MSYS" = "Xyes" ; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } +int +main (void) +{ + __sync_synchronize(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ethr_cv___sync_synchronize=yes fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test $ethr_cv___sync_synchronize = yes; then + # + # Old gcc versions on at least x86 have a buggy + # __sync_synchronize() which does not emit a + # memory barrier. We try to detect this by + # compiling to assembly with and without + # __sync_synchronize() and compare the results. + # -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we mix WSL with another native compiler" >&5 -printf %s "checking if we mix WSL with another native compiler... " >&6; } -if test "X$MIXED_WSL" = "Xyes" ; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi + ethr_test_filename="chk_if___sync_synchronize_noop_config1test.$$" + cat > "${ethr_test_filename}.c" < "${ethr_test_filename}.c" </dev/null 2>&1; then + ethr___sync_synchronize_noop=yes + else + ethr___sync_synchronize_noop=no + fi + rm -f "${ethr_test_filename}.c" "${ethr_test_filename}1.o" "${ethr_test_filename}2.o" + if test $ethr___sync_synchronize_noop = yes; then + # Got a buggy implementation of + # __sync_synchronize... + ethr_cv___sync_synchronize="no; buggy implementation" + fi + fi + ;; +esac fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv___sync_synchronize" >&5 +printf "%s\n" "$ethr_cv___sync_synchronize" >&6; } + if test "$ethr_cv___sync_synchronize" = "yes"; then + have_sync_synchronize_value="~0" + else + have_sync_synchronize_value="0" + fi +printf "%s\n" "#define ETHR_HAVE___sync_synchronize $have_sync_synchronize_value" >>confdefs.h -THR_LIBS= -THR_DEFS= - - - - -case "$threads_disabled" in #( - no|maybe) : + # __sync_add_and_fetch - atomic_op -NEED_NPTL_PTHREAD_H=no + for atomic_bit_size in 32 64 128; do + case $atomic_bit_size in + 32) gcc_atomic_type="$gcc_atomic_type32";; + 64) gcc_atomic_type="$gcc_atomic_type64";; + 128) gcc_atomic_type="$gcc_atomic_type128";; + esac + gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" + case __sync_add_and_fetch in + __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0);" + ;; + __sync_val_compare_and_swap) + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" + ;; + __atomic_store_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + ;; + __atomic_load_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_add_and_fetch(&var, __ATOMIC_RELAXED); res = __sync_add_and_fetch(&var, __ATOMIC_ACQUIRE);" + ;; + __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + ;; + __atomic_compare_exchange_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __sync_add_and_fetch(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __sync_add_and_fetch(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" + ;; + *) + as_fn_error $? "Internal error: missing implementation for __sync_add_and_fetch" "$LINENO" 5 + ;; + esac + eval atomic${atomic_bit_size}_call=\"$atomic_call\" + done -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for native win32 threads" >&5 -printf %s "checking for native win32 threads... " >&6; } -if test "X$host_os" = "Xwin32" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __sync_add_and_fetch()" >&5 +printf %s "checking for 32-bit __sync_add_and_fetch()... " >&6; } +if test ${ethr_cv_32bit___sync_add_and_fetch+y} then : - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - THR_DEFS="-DWIN32_THREADS" - THR_LIBS= - THR_LIB_NAME=win32_threads - THR_LIB_TYPE=win32_threads - + printf %s "(cached) " >&6 else case e in #( e) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - THR_DEFS= - THR_LIBS= - THR_LIB_NAME= - THR_LIB_TYPE=posix_unknown - + ethr_cv_32bit___sync_add_and_fetch=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 -printf %s "checking for pthread_create in -lpthread... " >&6; } -if test ${ac_cv_lib_pthread_pthread_create+y} +int +main (void) +{ +$atomic32_call + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ethr_cv_32bit___sync_add_and_fetch=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___sync_add_and_fetch" >&5 +printf "%s\n" "$ethr_cv_32bit___sync_add_and_fetch" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __sync_add_and_fetch()" >&5 +printf %s "checking for 64-bit __sync_add_and_fetch()... " >&6; } +if test ${ethr_cv_64bit___sync_add_and_fetch+y} then : printf %s "(cached) " >&6 else case e in #( - e) ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + e) + ethr_cv_64bit___sync_add_and_fetch=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_create (void); int main (void) { -return pthread_create (); +$atomic64_call ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ac_cv_lib_pthread_pthread_create=yes -else case e in #( - e) ac_cv_lib_pthread_pthread_create=no ;; -esac + ethr_cv_64bit___sync_add_and_fetch=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS ;; + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 -printf "%s\n" "$ac_cv_lib_pthread_pthread_create" >&6; } -if test "x$ac_cv_lib_pthread_pthread_create" = xyes +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___sync_add_and_fetch" >&5 +printf "%s\n" "$ethr_cv_64bit___sync_add_and_fetch" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __sync_add_and_fetch()" >&5 +printf %s "checking for 128-bit __sync_add_and_fetch()... " >&6; } +if test ${ethr_cv_128bit___sync_add_and_fetch+y} then : - THR_LIBS="-lpthread" + printf %s "(cached) " >&6 +else case e in #( + e) + ethr_cv_128bit___sync_add_and_fetch=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +$atomic128_call + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ethr_cv_128bit___sync_add_and_fetch=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ;; +esac fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___sync_add_and_fetch" >&5 +printf "%s\n" "$ethr_cv_128bit___sync_add_and_fetch" >&6; } + + case $ethr_cv_128bit___sync_add_and_fetch-$ethr_cv_64bit___sync_add_and_fetch-$ethr_cv_32bit___sync_add_and_fetch in + no-no-no) + have_atomic_ops=0;; + no-no-yes) + have_atomic_ops=4;; + no-yes-no) + have_atomic_ops=8;; + no-yes-yes) + have_atomic_ops=12;; + yes-no-no) + have_atomic_ops=16;; + yes-no-yes) + have_atomic_ops=20;; + yes-yes-no) + have_atomic_ops=24;; + yes-yes-yes) + have_atomic_ops=28;; + esac +printf "%s\n" "#define ETHR_HAVE___sync_add_and_fetch $have_atomic_ops" >>confdefs.h - if test "x$THR_LIBS" = "x" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lc_r" >&5 -printf %s "checking for pthread_create in -lc_r... " >&6; } -if test ${ac_cv_lib_c_r_pthread_create+y} + + # __sync_fetch_and_and - atomic_op + + for atomic_bit_size in 32 64 128; do + case $atomic_bit_size in + 32) gcc_atomic_type="$gcc_atomic_type32";; + 64) gcc_atomic_type="$gcc_atomic_type64";; + 128) gcc_atomic_type="$gcc_atomic_type128";; + esac + gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" + case __sync_fetch_and_and in + __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0);" + ;; + __sync_val_compare_and_swap) + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" + ;; + __atomic_store_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + ;; + __atomic_load_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_and(&var, __ATOMIC_RELAXED); res = __sync_fetch_and_and(&var, __ATOMIC_ACQUIRE);" + ;; + __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + ;; + __atomic_compare_exchange_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __sync_fetch_and_and(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __sync_fetch_and_and(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" + ;; + *) + as_fn_error $? "Internal error: missing implementation for __sync_fetch_and_and" "$LINENO" 5 + ;; + esac + eval atomic${atomic_bit_size}_call=\"$atomic_call\" + done + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __sync_fetch_and_and()" >&5 +printf %s "checking for 32-bit __sync_fetch_and_and()... " >&6; } +if test ${ethr_cv_32bit___sync_fetch_and_and+y} then : printf %s "(cached) " >&6 else case e in #( - e) ac_check_lib_save_LIBS=$LIBS -LIBS="-lc_r $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + e) + ethr_cv_32bit___sync_fetch_and_and=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +$atomic32_call + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ethr_cv_32bit___sync_fetch_and_and=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___sync_fetch_and_and" >&5 +printf "%s\n" "$ethr_cv_32bit___sync_fetch_and_and" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __sync_fetch_and_and()" >&5 +printf %s "checking for 64-bit __sync_fetch_and_and()... " >&6; } +if test ${ethr_cv_64bit___sync_fetch_and_and+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) + ethr_cv_64bit___sync_fetch_and_and=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_create (void); int main (void) { -return pthread_create (); +$atomic64_call ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ac_cv_lib_c_r_pthread_create=yes -else case e in #( - e) ac_cv_lib_c_r_pthread_create=no ;; -esac + ethr_cv_64bit___sync_fetch_and_and=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS ;; + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_create" >&5 -printf "%s\n" "$ac_cv_lib_c_r_pthread_create" >&6; } -if test "x$ac_cv_lib_c_r_pthread_create" = xyes -then : - THR_LIBS="-lc_r" -fi - - -fi - - if test "x$THR_LIBS" = "x" -then : - - ac_fn_c_check_func "$LINENO" "pthread_create" "ac_cv_func_pthread_create" -if test "x$ac_cv_func_pthread_create" = xyes -then : - THR_LIBS="none_needed" -fi - - -fi - - if test "x$THR_LIBS" = "x" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___sync_fetch_and_and" >&5 +printf "%s\n" "$ethr_cv_64bit___sync_fetch_and_and" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __sync_fetch_and_and()" >&5 +printf %s "checking for 128-bit __sync_fetch_and_and()... " >&6; } +if test ${ethr_cv_128bit___sync_fetch_and_and+y} then : - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the '-pthread' switch can be used" >&5 -printf %s "checking if the '-pthread' switch can be used... " >&6; } - saved_cflags=$CFLAGS - CFLAGS="$CFLAGS -pthread" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + printf %s "(cached) " >&6 +else case e in #( + e) + ethr_cv_128bit___sync_fetch_and_and=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include + int main (void) { -pthread_create((void*)0,(void*)0,(void*)0,(void*)0); +$atomic128_call ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - THR_DEFS="-pthread" - THR_LIBS="-pthread" + ethr_cv_128bit___sync_fetch_and_and=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - CFLAGS=$saved_cflags - if test "x$THR_LIBS" != "x"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - fi - + ;; +esac fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___sync_fetch_and_and" >&5 +printf "%s\n" "$ethr_cv_128bit___sync_fetch_and_and" >&6; } - if test "x$THR_LIBS" != "x" -then : + case $ethr_cv_128bit___sync_fetch_and_and-$ethr_cv_64bit___sync_fetch_and_and-$ethr_cv_32bit___sync_fetch_and_and in + no-no-no) + have_atomic_ops=0;; + no-no-yes) + have_atomic_ops=4;; + no-yes-no) + have_atomic_ops=8;; + no-yes-yes) + have_atomic_ops=12;; + yes-no-no) + have_atomic_ops=16;; + yes-no-yes) + have_atomic_ops=20;; + yes-yes-no) + have_atomic_ops=24;; + yes-yes-yes) + have_atomic_ops=28;; + esac - THR_DEFS="$THR_DEFS -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS" - THR_LIB_NAME=pthread - if test "x$THR_LIBS" = "xnone_needed"; then - THR_LIBS= - fi - case $host_os in #( - solaris*) : +printf "%s\n" "#define ETHR_HAVE___sync_fetch_and_and $have_atomic_ops" >>confdefs.h - THR_DEFS="$THR_DEFS -D_POSIX_PTHREAD_SEMANTICS" - ;; #( - linux*) : - THR_DEFS="$THR_DEFS -D_POSIX_THREAD_SAFE_FUNCTIONS" + # __sync_fetch_and_or - atomic_op -if test "$cross_compiling" != "yes" -then : + for atomic_bit_size in 32 64 128; do + case $atomic_bit_size in + 32) gcc_atomic_type="$gcc_atomic_type32";; + 64) gcc_atomic_type="$gcc_atomic_type64";; + 128) gcc_atomic_type="$gcc_atomic_type128";; + esac + gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" + case __sync_fetch_and_or in + __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0);" + ;; + __sync_val_compare_and_swap) + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" + ;; + __atomic_store_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + ;; + __atomic_load_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_or(&var, __ATOMIC_RELAXED); res = __sync_fetch_and_or(&var, __ATOMIC_ACQUIRE);" + ;; + __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + ;; + __atomic_compare_exchange_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __sync_fetch_and_or(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __sync_fetch_and_or(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" + ;; + *) + as_fn_error $? "Internal error: missing implementation for __sync_fetch_and_or" "$LINENO" 5 + ;; + esac + eval atomic${atomic_bit_size}_call=\"$atomic_call\" + done - # Extract the first word of "getconf", so it can be a program name with args. -set dummy getconf; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_GETCONF+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __sync_fetch_and_or()" >&5 +printf %s "checking for 32-bit __sync_fetch_and_or()... " >&6; } +if test ${ethr_cv_32bit___sync_fetch_and_or+y} then : printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$GETCONF"; then - ac_cv_prog_GETCONF="$GETCONF" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_GETCONF="getconf" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_prog_GETCONF" && ac_cv_prog_GETCONF="false" -fi ;; -esac -fi -GETCONF=$ac_cv_prog_GETCONF -if test -n "$GETCONF"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GETCONF" >&5 -printf "%s\n" "$GETCONF" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - else case e in #( e) - host_getconf="$host_alias-getconf" - # Extract the first word of "$host_getconf", so it can be a program name with args. -set dummy $host_getconf; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_GETCONF+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$GETCONF"; then - ac_cv_prog_GETCONF="$GETCONF" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_GETCONF="$host_getconf" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_prog_GETCONF" && ac_cv_prog_GETCONF="false" -fi ;; -esac -fi -GETCONF=$ac_cv_prog_GETCONF -if test -n "$GETCONF"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GETCONF" >&5 -printf "%s\n" "$GETCONF" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - + ethr_cv_32bit___sync_fetch_and_or=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - if test "$GETCONF" = "false" && test "$erl_xcomp_sysroot" != "" +int +main (void) +{ +$atomic32_call + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" then : - - GETCONF= - prfx="$erl_xcomp_sysroot" - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}getconf", so it can be a program name with args. -set dummy ${ac_tool_prefix}getconf; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_GETCONF+y} + ethr_cv_32bit___sync_fetch_and_or=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___sync_fetch_and_or" >&5 +printf "%s\n" "$ethr_cv_32bit___sync_fetch_and_or" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __sync_fetch_and_or()" >&5 +printf %s "checking for 64-bit __sync_fetch_and_or()... " >&6; } +if test ${ethr_cv_64bit___sync_fetch_and_or+y} then : printf %s "(cached) " >&6 else case e in #( - e) case $GETCONF in - [\\/]* | ?:[\\/]*) - ac_cv_path_GETCONF="$GETCONF" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy=""$prfx/usr/bin:$prfx/bin:$prfx/usr/local/bin"" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_GETCONF="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + e) + ethr_cv_64bit___sync_fetch_and_or=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - ;; -esac ;; -esac -fi -GETCONF=$ac_cv_path_GETCONF -if test -n "$GETCONF"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GETCONF" >&5 -printf "%s\n" "$GETCONF" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } +int +main (void) +{ +$atomic64_call + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ethr_cv_64bit___sync_fetch_and_or=yes fi - - +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ;; +esac fi -if test -z "$ac_cv_path_GETCONF"; then - ac_pt_GETCONF=$GETCONF - # Extract the first word of "getconf", so it can be a program name with args. -set dummy getconf; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_ac_pt_GETCONF+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___sync_fetch_and_or" >&5 +printf "%s\n" "$ethr_cv_64bit___sync_fetch_and_or" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __sync_fetch_and_or()" >&5 +printf %s "checking for 128-bit __sync_fetch_and_or()... " >&6; } +if test ${ethr_cv_128bit___sync_fetch_and_or+y} then : printf %s "(cached) " >&6 else case e in #( - e) case $ac_pt_GETCONF in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_GETCONF="$ac_pt_GETCONF" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_dummy=""$prfx/usr/bin:$prfx/bin:$prfx/usr/local/bin"" -for as_dir in $as_dummy -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_GETCONF="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + e) + ethr_cv_128bit___sync_fetch_and_or=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - ;; -esac ;; -esac -fi -ac_pt_GETCONF=$ac_cv_path_ac_pt_GETCONF -if test -n "$ac_pt_GETCONF"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_GETCONF" >&5 -printf "%s\n" "$ac_pt_GETCONF" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } +int +main (void) +{ +$atomic128_call + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ethr_cv_128bit___sync_fetch_and_or=yes fi - - if test "x$ac_pt_GETCONF" = x; then - GETCONF="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ;; esac - GETCONF=$ac_pt_GETCONF - fi -else - GETCONF="$ac_cv_path_GETCONF" fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___sync_fetch_and_or" >&5 +printf "%s\n" "$ethr_cv_128bit___sync_fetch_and_or" >&6; } + case $ethr_cv_128bit___sync_fetch_and_or-$ethr_cv_64bit___sync_fetch_and_or-$ethr_cv_32bit___sync_fetch_and_or in + no-no-no) + have_atomic_ops=0;; + no-no-yes) + have_atomic_ops=4;; + no-yes-no) + have_atomic_ops=8;; + no-yes-yes) + have_atomic_ops=12;; + yes-no-no) + have_atomic_ops=16;; + yes-no-yes) + have_atomic_ops=20;; + yes-yes-no) + have_atomic_ops=24;; + yes-yes-yes) + have_atomic_ops=28;; + esac -fi - ;; -esac -fi +printf "%s\n" "#define ETHR_HAVE___sync_fetch_and_or $have_atomic_ops" >>confdefs.h - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Native POSIX Thread Library" >&5 -printf %s "checking for Native POSIX Thread Library... " >&6; } - libpthr_vsn=`$GETCONF GNU_LIBPTHREAD_VERSION 2>/dev/null` - if test $? -eq 0; then - case "$libpthr_vsn" in - *nptl*|*NPTL*) nptl=yes;; - *) nptl=no;; - esac - elif test "$cross_compiling" = "yes"; then - case "$erl_xcomp_linux_nptl" in - "") nptl=cross;; - yes|no) nptl=$erl_xcomp_linux_nptl;; - *) as_fn_error $? "Bad erl_xcomp_linux_nptl value: $erl_xcomp_linux_nptl" "$LINENO" 5;; - esac - else - nptl=no - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $nptl" >&5 -printf "%s\n" "$nptl" >&6; } - if test $nptl = cross; then - nptl=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: result yes guessed because of cross compilation" >&5 -printf "%s\n" "$as_me: WARNING: result yes guessed because of cross compilation" >&2;} - fi - if test $nptl = yes -then : - THR_LIB_TYPE=posix_nptl - need_nptl_incldir=no - ac_fn_c_check_header_compile "$LINENO" "nptl/pthread.h" "ac_cv_header_nptl_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_nptl_pthread_h" = xyes + + # __sync_val_compare_and_swap - atomic_op + + for atomic_bit_size in 32 64 128; do + case $atomic_bit_size in + 32) gcc_atomic_type="$gcc_atomic_type32";; + 64) gcc_atomic_type="$gcc_atomic_type64";; + 128) gcc_atomic_type="$gcc_atomic_type128";; + esac + gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" + case __sync_val_compare_and_swap in + __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0);" + ;; + __sync_val_compare_and_swap) + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" + ;; + __atomic_store_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + ;; + __atomic_load_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_val_compare_and_swap(&var, __ATOMIC_RELAXED); res = __sync_val_compare_and_swap(&var, __ATOMIC_ACQUIRE);" + ;; + __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + ;; + __atomic_compare_exchange_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __sync_val_compare_and_swap(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __sync_val_compare_and_swap(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" + ;; + *) + as_fn_error $? "Internal error: missing implementation for __sync_val_compare_and_swap" "$LINENO" 5 + ;; + esac + eval atomic${atomic_bit_size}_call=\"$atomic_call\" + done + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __sync_val_compare_and_swap()" >&5 +printf %s "checking for 32-bit __sync_val_compare_and_swap()... " >&6; } +if test ${ethr_cv_32bit___sync_val_compare_and_swap+y} then : - need_nptl_incldir=yes - NEED_NPTL_PTHREAD_H=yes + printf %s "(cached) " >&6 +else case e in #( + e) + ethr_cv_32bit___sync_val_compare_and_swap=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +$atomic32_call + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ethr_cv_32bit___sync_val_compare_and_swap=yes fi - - if test $need_nptl_incldir = yes +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___sync_val_compare_and_swap" >&5 +printf "%s\n" "$ethr_cv_32bit___sync_val_compare_and_swap" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __sync_val_compare_and_swap()" >&5 +printf %s "checking for 64-bit __sync_val_compare_and_swap()... " >&6; } +if test ${ethr_cv_64bit___sync_val_compare_and_swap+y} then : + printf %s "(cached) " >&6 +else case e in #( + e) + ethr_cv_64bit___sync_val_compare_and_swap=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - # Ahh... - nptl_path="$C_INCLUDE_PATH:$CPATH" - if test X$cross_compiling != Xyes; then - nptl_path="$nptl_path:/usr/local/include:/usr/include" - else - IROOT="$erl_xcomp_isysroot" - test "$IROOT" != "" || IROOT="$erl_xcomp_sysroot" - test "$IROOT" != "" || as_fn_error $? "Don't know where to search for includes! Please set erl_xcomp_isysroot" "$LINENO" 5 - nptl_path="$nptl_path:$IROOT/usr/local/include:$IROOT/usr/include" - fi - nptl_ws_path= - save_ifs="$IFS"; IFS=":" - for dir in $nptl_path; do - if test "x$dir" != "x"; then - nptl_ws_path="$nptl_ws_path $dir" - fi - done - IFS=$save_ifs - nptl_incldir= - for dir in $nptl_ws_path; do - as_ac_Header=`printf "%s\n" "ac_cv_header_$dir/nptl/pthread.h" | sed "$as_sed_sh"` -ac_fn_c_check_header_compile "$LINENO" "$dir/nptl/pthread.h" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes" +int +main (void) +{ +$atomic64_call + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" then : - nptl_incldir=$dir/nptl + ethr_cv_64bit___sync_val_compare_and_swap=yes fi - - if test "x$nptl_incldir" != "x"; then - THR_DEFS="$THR_DEFS -isystem $nptl_incldir" - break - fi - done - if test "x$nptl_incldir" = "x"; then - as_fn_error $? "Failed to locate nptl system include directory" "$LINENO" 5 - fi - +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ;; +esac fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___sync_val_compare_and_swap" >&5 +printf "%s\n" "$ethr_cv_64bit___sync_val_compare_and_swap" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __sync_val_compare_and_swap()" >&5 +printf %s "checking for 128-bit __sync_val_compare_and_swap()... " >&6; } +if test ${ethr_cv_128bit___sync_val_compare_and_swap+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) + ethr_cv_128bit___sync_val_compare_and_swap=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int +main (void) +{ +$atomic128_call + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ethr_cv_128bit___sync_val_compare_and_swap=yes fi - ;; #( - *) : - ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ;; esac - - saved_cppflags=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $THR_DEFS" - - - ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = xyes -then : - -printf "%s\n" "#define HAVE_PTHREAD_H 1" >>confdefs.h - fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___sync_val_compare_and_swap" >&5 +printf "%s\n" "$ethr_cv_128bit___sync_val_compare_and_swap" >&6; } + case $ethr_cv_128bit___sync_val_compare_and_swap-$ethr_cv_64bit___sync_val_compare_and_swap-$ethr_cv_32bit___sync_val_compare_and_swap in + no-no-no) + have_atomic_ops=0;; + no-no-yes) + have_atomic_ops=4;; + no-yes-no) + have_atomic_ops=8;; + no-yes-yes) + have_atomic_ops=12;; + yes-no-no) + have_atomic_ops=16;; + yes-no-yes) + have_atomic_ops=20;; + yes-yes-no) + have_atomic_ops=24;; + yes-yes-yes) + have_atomic_ops=28;; + esac - ac_fn_c_check_header_compile "$LINENO" "pthread/mit/pthread.h" "ac_cv_header_pthread_mit_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_mit_pthread_h" = xyes -then : - \ - -printf "%s\n" "#define HAVE_MIT_PTHREAD_H 1" >>confdefs.h - -fi - +printf "%s\n" "#define ETHR_HAVE___sync_val_compare_and_swap $have_atomic_ops" >>confdefs.h - CPPFLAGS=$saved_cppflags -fi - ;; -esac -fi + # __atomic_store_n - atomic_op + for atomic_bit_size in 32 64 128; do + case $atomic_bit_size in + 32) gcc_atomic_type="$gcc_atomic_type32";; + 64) gcc_atomic_type="$gcc_atomic_type64";; + 128) gcc_atomic_type="$gcc_atomic_type128";; + esac + gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" + case __atomic_store_n in + __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_store_n(&var, ($gcc_atomic_type) 0);" + ;; + __sync_val_compare_and_swap) + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_store_n(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" + ;; + __atomic_store_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + ;; + __atomic_load_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_store_n(&var, __ATOMIC_RELAXED); res = __atomic_store_n(&var, __ATOMIC_ACQUIRE);" + ;; + __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + ;; + __atomic_compare_exchange_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_store_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_store_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" + ;; + *) + as_fn_error $? "Internal error: missing implementation for __atomic_store_n" "$LINENO" 5 + ;; + esac + eval atomic${atomic_bit_size}_call=\"$atomic_call\" + done - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 -printf %s "checking size of short... " >&6; } -if test ${ac_cv_sizeof_short+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __atomic_store_n()" >&5 +printf %s "checking for 32-bit __atomic_store_n()... " >&6; } +if test ${ethr_cv_32bit___atomic_store_n+y} then : printf %s "(cached) " >&6 else case e in #( - e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default" -then : + e) + ethr_cv_32bit___atomic_store_n=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -else case e in #( - e) if test "$ac_cv_type_short" = yes; then - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (short) -See 'config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_short=0 - fi ;; -esac +int +main (void) +{ +$atomic32_call + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ethr_cv_32bit___atomic_store_n=yes fi - ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 -printf "%s\n" "$ac_cv_sizeof_short" >&6; } - - - -printf "%s\n" "#define SIZEOF_SHORT $ac_cv_sizeof_short" >>confdefs.h - - - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 -printf %s "checking size of int... " >&6; } -if test ${ac_cv_sizeof_int+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___atomic_store_n" >&5 +printf "%s\n" "$ethr_cv_32bit___atomic_store_n" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __atomic_store_n()" >&5 +printf %s "checking for 64-bit __atomic_store_n()... " >&6; } +if test ${ethr_cv_64bit___atomic_store_n+y} then : printf %s "(cached) " >&6 else case e in #( - e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default" -then : + e) + ethr_cv_64bit___atomic_store_n=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -else case e in #( - e) if test "$ac_cv_type_int" = yes; then - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (int) -See 'config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_int=0 - fi ;; -esac +int +main (void) +{ +$atomic64_call + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ethr_cv_64bit___atomic_store_n=yes fi - ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 -printf "%s\n" "$ac_cv_sizeof_int" >&6; } - - - -printf "%s\n" "#define SIZEOF_INT $ac_cv_sizeof_int" >>confdefs.h - - - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 -printf %s "checking size of long... " >&6; } -if test ${ac_cv_sizeof_long+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___atomic_store_n" >&5 +printf "%s\n" "$ethr_cv_64bit___atomic_store_n" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __atomic_store_n()" >&5 +printf %s "checking for 128-bit __atomic_store_n()... " >&6; } +if test ${ethr_cv_128bit___atomic_store_n+y} then : printf %s "(cached) " >&6 else case e in #( - e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default" -then : + e) + ethr_cv_128bit___atomic_store_n=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -else case e in #( - e) if test "$ac_cv_type_long" = yes; then - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (long) -See 'config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_long=0 - fi ;; -esac +int +main (void) +{ +$atomic128_call + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ethr_cv_128bit___atomic_store_n=yes fi - ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 -printf "%s\n" "$ac_cv_sizeof_long" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___atomic_store_n" >&5 +printf "%s\n" "$ethr_cv_128bit___atomic_store_n" >&6; } + + case $ethr_cv_128bit___atomic_store_n-$ethr_cv_64bit___atomic_store_n-$ethr_cv_32bit___atomic_store_n in + no-no-no) + have_atomic_ops=0;; + no-no-yes) + have_atomic_ops=4;; + no-yes-no) + have_atomic_ops=8;; + no-yes-yes) + have_atomic_ops=12;; + yes-no-no) + have_atomic_ops=16;; + yes-no-yes) + have_atomic_ops=20;; + yes-yes-no) + have_atomic_ops=24;; + yes-yes-yes) + have_atomic_ops=28;; + esac +printf "%s\n" "#define ETHR_HAVE___atomic_store_n $have_atomic_ops" >>confdefs.h -printf "%s\n" "#define SIZEOF_LONG $ac_cv_sizeof_long" >>confdefs.h + # __atomic_load_n - atomic_op - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5 -printf %s "checking size of long long... " >&6; } -if test ${ac_cv_sizeof_long_long+y} + for atomic_bit_size in 32 64 128; do + case $atomic_bit_size in + 32) gcc_atomic_type="$gcc_atomic_type32";; + 64) gcc_atomic_type="$gcc_atomic_type64";; + 128) gcc_atomic_type="$gcc_atomic_type128";; + esac + gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" + case __atomic_load_n in + __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_load_n(&var, ($gcc_atomic_type) 0);" + ;; + __sync_val_compare_and_swap) + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_load_n(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" + ;; + __atomic_store_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + ;; + __atomic_load_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_load_n(&var, __ATOMIC_RELAXED); res = __atomic_load_n(&var, __ATOMIC_ACQUIRE);" + ;; + __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + ;; + __atomic_compare_exchange_n) + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_load_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_load_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" + ;; + *) + as_fn_error $? "Internal error: missing implementation for __atomic_load_n" "$LINENO" 5 + ;; + esac + eval atomic${atomic_bit_size}_call=\"$atomic_call\" + done + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __atomic_load_n()" >&5 +printf %s "checking for 32-bit __atomic_load_n()... " >&6; } +if test ${ethr_cv_32bit___atomic_load_n+y} then : printf %s "(cached) " >&6 else case e in #( - e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default" -then : + e) + ethr_cv_32bit___atomic_load_n=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -else case e in #( - e) if test "$ac_cv_type_long_long" = yes; then - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (long long) -See 'config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_long_long=0 - fi ;; -esac +int +main (void) +{ +$atomic32_call + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ethr_cv_32bit___atomic_load_n=yes fi - ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5 -printf "%s\n" "$ac_cv_sizeof_long_long" >&6; } - - - -printf "%s\n" "#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long" >>confdefs.h - - - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like 'int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking size of __int128_t" >&5 -printf %s "checking size of __int128_t... " >&6; } -if test ${ac_cv_sizeof___int128_t+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___atomic_load_n" >&5 +printf "%s\n" "$ethr_cv_32bit___atomic_load_n" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __atomic_load_n()" >&5 +printf %s "checking for 64-bit __atomic_load_n()... " >&6; } +if test ${ethr_cv_64bit___atomic_load_n+y} then : printf %s "(cached) " >&6 else case e in #( - e) if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (__int128_t))" "ac_cv_sizeof___int128_t" "$ac_includes_default" -then : + e) + ethr_cv_64bit___atomic_load_n=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -else case e in #( - e) if test "$ac_cv_type___int128_t" = yes; then - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (__int128_t) -See 'config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof___int128_t=0 - fi ;; -esac +int +main (void) +{ +$atomic64_call + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ethr_cv_64bit___atomic_load_n=yes fi - ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof___int128_t" >&5 -printf "%s\n" "$ac_cv_sizeof___int128_t" >&6; } - - - -printf "%s\n" "#define SIZEOF___INT128_T $ac_cv_sizeof___int128_t" >>confdefs.h - - - - if test "$ac_cv_sizeof_short" = "4"; then - gcc_atomic_type32="short" - elif test "$ac_cv_sizeof_int" = "4"; then - gcc_atomic_type32="int" - elif test "$ac_cv_sizeof_long" = "4"; then - gcc_atomic_type32="long" - else - as_fn_error $? "No 32-bit type found" "$LINENO" 5 - fi - - if test "$ac_cv_sizeof_int" = "8"; then - gcc_atomic_type64="int" - elif test "$ac_cv_sizeof_long" = "8"; then - gcc_atomic_type64="long" - elif test "$ac_cv_sizeof_long_long" = "8"; then - gcc_atomic_type64="long long" - else - as_fn_error $? "No 64-bit type found" "$LINENO" 5 - fi - - if test "$ac_cv_sizeof___int128_t" = "16"; then - gcc_atomic_type128="__int128_t" - else - gcc_atomic_type128="#error " - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working __sync_synchronize()" >&5 -printf %s "checking for a working __sync_synchronize()... " >&6; } -if test ${ethr_cv___sync_synchronize+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___atomic_load_n" >&5 +printf "%s\n" "$ethr_cv_64bit___atomic_load_n" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __atomic_load_n()" >&5 +printf %s "checking for 128-bit __atomic_load_n()... " >&6; } +if test ${ethr_cv_128bit___atomic_load_n+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv___sync_synchronize=no + ethr_cv_128bit___atomic_load_n=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { - __sync_synchronize(); +$atomic128_call ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv___sync_synchronize=yes + ethr_cv_128bit___atomic_load_n=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - if test $ethr_cv___sync_synchronize = yes; then - # - # Old gcc versions on at least x86 have a buggy - # __sync_synchronize() which does not emit a - # memory barrier. We try to detect this by - # compiling to assembly with and without - # __sync_synchronize() and compare the results. - # - - ethr_test_filename="chk_if___sync_synchronize_noop_config1test.$$" - cat > "${ethr_test_filename}.c" < "${ethr_test_filename}.c" </dev/null 2>&1; then - ethr___sync_synchronize_noop=yes - else - ethr___sync_synchronize_noop=no - fi - rm -f "${ethr_test_filename}.c" "${ethr_test_filename}1.o" "${ethr_test_filename}2.o" - - if test $ethr___sync_synchronize_noop = yes; then - # Got a buggy implementation of - # __sync_synchronize... - ethr_cv___sync_synchronize="no; buggy implementation" - fi - fi ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv___sync_synchronize" >&5 -printf "%s\n" "$ethr_cv___sync_synchronize" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___atomic_load_n" >&5 +printf "%s\n" "$ethr_cv_128bit___atomic_load_n" >&6; } - if test "$ethr_cv___sync_synchronize" = "yes"; then - have_sync_synchronize_value="~0" - else - have_sync_synchronize_value="0" - fi + case $ethr_cv_128bit___atomic_load_n-$ethr_cv_64bit___atomic_load_n-$ethr_cv_32bit___atomic_load_n in + no-no-no) + have_atomic_ops=0;; + no-no-yes) + have_atomic_ops=4;; + no-yes-no) + have_atomic_ops=8;; + no-yes-yes) + have_atomic_ops=12;; + yes-no-no) + have_atomic_ops=16;; + yes-no-yes) + have_atomic_ops=20;; + yes-yes-no) + have_atomic_ops=24;; + yes-yes-yes) + have_atomic_ops=28;; + esac -printf "%s\n" "#define ETHR_HAVE___sync_synchronize $have_sync_synchronize_value" >>confdefs.h +printf "%s\n" "#define ETHR_HAVE___atomic_load_n $have_atomic_ops" >>confdefs.h - # __sync_add_and_fetch - atomic_op + # __atomic_add_fetch - atomic_op for atomic_bit_size in 32 64 128; do case $atomic_bit_size in @@ -8189,40 +9942,40 @@ printf "%s\n" "#define ETHR_HAVE___sync_synchronize $have_sync_synchronize_value 128) gcc_atomic_type="$gcc_atomic_type128";; esac gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __sync_add_and_fetch in + case __atomic_add_fetch in __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0);" + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0);" ;; __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" ;; __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" ;; __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_add_and_fetch(&var, __ATOMIC_RELAXED); res = __sync_add_and_fetch(&var, __ATOMIC_ACQUIRE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_add_fetch(&var, __ATOMIC_RELAXED); res = __atomic_add_fetch(&var, __ATOMIC_ACQUIRE);" ;; __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __sync_add_and_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" ;; __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __sync_add_and_fetch(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __sync_add_and_fetch(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_add_fetch(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_add_fetch(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" ;; *) - as_fn_error $? "Internal error: missing implementation for __sync_add_and_fetch" "$LINENO" 5 + as_fn_error $? "Internal error: missing implementation for __atomic_add_fetch" "$LINENO" 5 ;; esac eval atomic${atomic_bit_size}_call=\"$atomic_call\" done - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __sync_add_and_fetch()" >&5 -printf %s "checking for 32-bit __sync_add_and_fetch()... " >&6; } -if test ${ethr_cv_32bit___sync_add_and_fetch+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __atomic_add_fetch()" >&5 +printf %s "checking for 32-bit __atomic_add_fetch()... " >&6; } +if test ${ethr_cv_32bit___atomic_add_fetch+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_32bit___sync_add_and_fetch=no + ethr_cv_32bit___atomic_add_fetch=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8236,23 +9989,23 @@ $atomic32_call _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_32bit___sync_add_and_fetch=yes + ethr_cv_32bit___atomic_add_fetch=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___sync_add_and_fetch" >&5 -printf "%s\n" "$ethr_cv_32bit___sync_add_and_fetch" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __sync_add_and_fetch()" >&5 -printf %s "checking for 64-bit __sync_add_and_fetch()... " >&6; } -if test ${ethr_cv_64bit___sync_add_and_fetch+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___atomic_add_fetch" >&5 +printf "%s\n" "$ethr_cv_32bit___atomic_add_fetch" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __atomic_add_fetch()" >&5 +printf %s "checking for 64-bit __atomic_add_fetch()... " >&6; } +if test ${ethr_cv_64bit___atomic_add_fetch+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_64bit___sync_add_and_fetch=no + ethr_cv_64bit___atomic_add_fetch=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8266,23 +10019,23 @@ $atomic64_call _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_64bit___sync_add_and_fetch=yes + ethr_cv_64bit___atomic_add_fetch=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___sync_add_and_fetch" >&5 -printf "%s\n" "$ethr_cv_64bit___sync_add_and_fetch" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __sync_add_and_fetch()" >&5 -printf %s "checking for 128-bit __sync_add_and_fetch()... " >&6; } -if test ${ethr_cv_128bit___sync_add_and_fetch+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___atomic_add_fetch" >&5 +printf "%s\n" "$ethr_cv_64bit___atomic_add_fetch" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __atomic_add_fetch()" >&5 +printf %s "checking for 128-bit __atomic_add_fetch()... " >&6; } +if test ${ethr_cv_128bit___atomic_add_fetch+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_128bit___sync_add_and_fetch=no + ethr_cv_128bit___atomic_add_fetch=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8296,17 +10049,17 @@ $atomic128_call _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_128bit___sync_add_and_fetch=yes + ethr_cv_128bit___atomic_add_fetch=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___sync_add_and_fetch" >&5 -printf "%s\n" "$ethr_cv_128bit___sync_add_and_fetch" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___atomic_add_fetch" >&5 +printf "%s\n" "$ethr_cv_128bit___atomic_add_fetch" >&6; } - case $ethr_cv_128bit___sync_add_and_fetch-$ethr_cv_64bit___sync_add_and_fetch-$ethr_cv_32bit___sync_add_and_fetch in + case $ethr_cv_128bit___atomic_add_fetch-$ethr_cv_64bit___atomic_add_fetch-$ethr_cv_32bit___atomic_add_fetch in no-no-no) have_atomic_ops=0;; no-no-yes) @@ -8325,11 +10078,11 @@ printf "%s\n" "$ethr_cv_128bit___sync_add_and_fetch" >&6; } have_atomic_ops=28;; esac -printf "%s\n" "#define ETHR_HAVE___sync_add_and_fetch $have_atomic_ops" >>confdefs.h +printf "%s\n" "#define ETHR_HAVE___atomic_add_fetch $have_atomic_ops" >>confdefs.h - # __sync_fetch_and_and - atomic_op + # __atomic_fetch_and - atomic_op for atomic_bit_size in 32 64 128; do case $atomic_bit_size in @@ -8338,40 +10091,40 @@ printf "%s\n" "#define ETHR_HAVE___sync_add_and_fetch $have_atomic_ops" >>confde 128) gcc_atomic_type="$gcc_atomic_type128";; esac gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __sync_fetch_and_and in + case __atomic_fetch_and in __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0);" + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0);" ;; __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" ;; __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" ;; __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_and(&var, __ATOMIC_RELAXED); res = __sync_fetch_and_and(&var, __ATOMIC_ACQUIRE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_and(&var, __ATOMIC_RELAXED); res = __atomic_fetch_and(&var, __ATOMIC_ACQUIRE);" ;; __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __sync_fetch_and_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" ;; __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __sync_fetch_and_and(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __sync_fetch_and_and(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_fetch_and(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_fetch_and(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" ;; *) - as_fn_error $? "Internal error: missing implementation for __sync_fetch_and_and" "$LINENO" 5 + as_fn_error $? "Internal error: missing implementation for __atomic_fetch_and" "$LINENO" 5 ;; esac eval atomic${atomic_bit_size}_call=\"$atomic_call\" done - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __sync_fetch_and_and()" >&5 -printf %s "checking for 32-bit __sync_fetch_and_and()... " >&6; } -if test ${ethr_cv_32bit___sync_fetch_and_and+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __atomic_fetch_and()" >&5 +printf %s "checking for 32-bit __atomic_fetch_and()... " >&6; } +if test ${ethr_cv_32bit___atomic_fetch_and+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_32bit___sync_fetch_and_and=no + ethr_cv_32bit___atomic_fetch_and=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8385,23 +10138,23 @@ $atomic32_call _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_32bit___sync_fetch_and_and=yes + ethr_cv_32bit___atomic_fetch_and=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___sync_fetch_and_and" >&5 -printf "%s\n" "$ethr_cv_32bit___sync_fetch_and_and" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __sync_fetch_and_and()" >&5 -printf %s "checking for 64-bit __sync_fetch_and_and()... " >&6; } -if test ${ethr_cv_64bit___sync_fetch_and_and+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___atomic_fetch_and" >&5 +printf "%s\n" "$ethr_cv_32bit___atomic_fetch_and" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __atomic_fetch_and()" >&5 +printf %s "checking for 64-bit __atomic_fetch_and()... " >&6; } +if test ${ethr_cv_64bit___atomic_fetch_and+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_64bit___sync_fetch_and_and=no + ethr_cv_64bit___atomic_fetch_and=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8415,23 +10168,23 @@ $atomic64_call _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_64bit___sync_fetch_and_and=yes + ethr_cv_64bit___atomic_fetch_and=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___sync_fetch_and_and" >&5 -printf "%s\n" "$ethr_cv_64bit___sync_fetch_and_and" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __sync_fetch_and_and()" >&5 -printf %s "checking for 128-bit __sync_fetch_and_and()... " >&6; } -if test ${ethr_cv_128bit___sync_fetch_and_and+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___atomic_fetch_and" >&5 +printf "%s\n" "$ethr_cv_64bit___atomic_fetch_and" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __atomic_fetch_and()" >&5 +printf %s "checking for 128-bit __atomic_fetch_and()... " >&6; } +if test ${ethr_cv_128bit___atomic_fetch_and+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_128bit___sync_fetch_and_and=no + ethr_cv_128bit___atomic_fetch_and=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8445,17 +10198,17 @@ $atomic128_call _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_128bit___sync_fetch_and_and=yes + ethr_cv_128bit___atomic_fetch_and=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___sync_fetch_and_and" >&5 -printf "%s\n" "$ethr_cv_128bit___sync_fetch_and_and" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___atomic_fetch_and" >&5 +printf "%s\n" "$ethr_cv_128bit___atomic_fetch_and" >&6; } - case $ethr_cv_128bit___sync_fetch_and_and-$ethr_cv_64bit___sync_fetch_and_and-$ethr_cv_32bit___sync_fetch_and_and in + case $ethr_cv_128bit___atomic_fetch_and-$ethr_cv_64bit___atomic_fetch_and-$ethr_cv_32bit___atomic_fetch_and in no-no-no) have_atomic_ops=0;; no-no-yes) @@ -8474,11 +10227,11 @@ printf "%s\n" "$ethr_cv_128bit___sync_fetch_and_and" >&6; } have_atomic_ops=28;; esac -printf "%s\n" "#define ETHR_HAVE___sync_fetch_and_and $have_atomic_ops" >>confdefs.h +printf "%s\n" "#define ETHR_HAVE___atomic_fetch_and $have_atomic_ops" >>confdefs.h - # __sync_fetch_and_or - atomic_op + # __atomic_fetch_or - atomic_op for atomic_bit_size in 32 64 128; do case $atomic_bit_size in @@ -8487,40 +10240,40 @@ printf "%s\n" "#define ETHR_HAVE___sync_fetch_and_and $have_atomic_ops" >>confde 128) gcc_atomic_type="$gcc_atomic_type128";; esac gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __sync_fetch_and_or in + case __atomic_fetch_or in __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0);" + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0);" ;; __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" ;; __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" ;; __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_or(&var, __ATOMIC_RELAXED); res = __sync_fetch_and_or(&var, __ATOMIC_ACQUIRE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_or(&var, __ATOMIC_RELAXED); res = __atomic_fetch_or(&var, __ATOMIC_ACQUIRE);" ;; __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __sync_fetch_and_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" ;; __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __sync_fetch_and_or(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __sync_fetch_and_or(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_fetch_or(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_fetch_or(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" ;; *) - as_fn_error $? "Internal error: missing implementation for __sync_fetch_and_or" "$LINENO" 5 + as_fn_error $? "Internal error: missing implementation for __atomic_fetch_or" "$LINENO" 5 ;; esac eval atomic${atomic_bit_size}_call=\"$atomic_call\" done - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __sync_fetch_and_or()" >&5 -printf %s "checking for 32-bit __sync_fetch_and_or()... " >&6; } -if test ${ethr_cv_32bit___sync_fetch_and_or+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __atomic_fetch_or()" >&5 +printf %s "checking for 32-bit __atomic_fetch_or()... " >&6; } +if test ${ethr_cv_32bit___atomic_fetch_or+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_32bit___sync_fetch_and_or=no + ethr_cv_32bit___atomic_fetch_or=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8534,23 +10287,23 @@ $atomic32_call _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_32bit___sync_fetch_and_or=yes + ethr_cv_32bit___atomic_fetch_or=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___sync_fetch_and_or" >&5 -printf "%s\n" "$ethr_cv_32bit___sync_fetch_and_or" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __sync_fetch_and_or()" >&5 -printf %s "checking for 64-bit __sync_fetch_and_or()... " >&6; } -if test ${ethr_cv_64bit___sync_fetch_and_or+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___atomic_fetch_or" >&5 +printf "%s\n" "$ethr_cv_32bit___atomic_fetch_or" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __atomic_fetch_or()" >&5 +printf %s "checking for 64-bit __atomic_fetch_or()... " >&6; } +if test ${ethr_cv_64bit___atomic_fetch_or+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_64bit___sync_fetch_and_or=no + ethr_cv_64bit___atomic_fetch_or=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8564,23 +10317,23 @@ $atomic64_call _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_64bit___sync_fetch_and_or=yes + ethr_cv_64bit___atomic_fetch_or=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___sync_fetch_and_or" >&5 -printf "%s\n" "$ethr_cv_64bit___sync_fetch_and_or" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __sync_fetch_and_or()" >&5 -printf %s "checking for 128-bit __sync_fetch_and_or()... " >&6; } -if test ${ethr_cv_128bit___sync_fetch_and_or+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___atomic_fetch_or" >&5 +printf "%s\n" "$ethr_cv_64bit___atomic_fetch_or" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __atomic_fetch_or()" >&5 +printf %s "checking for 128-bit __atomic_fetch_or()... " >&6; } +if test ${ethr_cv_128bit___atomic_fetch_or+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_128bit___sync_fetch_and_or=no + ethr_cv_128bit___atomic_fetch_or=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8594,17 +10347,17 @@ $atomic128_call _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_128bit___sync_fetch_and_or=yes + ethr_cv_128bit___atomic_fetch_or=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___sync_fetch_and_or" >&5 -printf "%s\n" "$ethr_cv_128bit___sync_fetch_and_or" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___atomic_fetch_or" >&5 +printf "%s\n" "$ethr_cv_128bit___atomic_fetch_or" >&6; } - case $ethr_cv_128bit___sync_fetch_and_or-$ethr_cv_64bit___sync_fetch_and_or-$ethr_cv_32bit___sync_fetch_and_or in + case $ethr_cv_128bit___atomic_fetch_or-$ethr_cv_64bit___atomic_fetch_or-$ethr_cv_32bit___atomic_fetch_or in no-no-no) have_atomic_ops=0;; no-no-yes) @@ -8623,11 +10376,11 @@ printf "%s\n" "$ethr_cv_128bit___sync_fetch_and_or" >&6; } have_atomic_ops=28;; esac -printf "%s\n" "#define ETHR_HAVE___sync_fetch_and_or $have_atomic_ops" >>confdefs.h +printf "%s\n" "#define ETHR_HAVE___atomic_fetch_or $have_atomic_ops" >>confdefs.h - # __sync_val_compare_and_swap - atomic_op + # __atomic_compare_exchange_n - atomic_op for atomic_bit_size in 32 64 128; do case $atomic_bit_size in @@ -8636,40 +10389,40 @@ printf "%s\n" "#define ETHR_HAVE___sync_fetch_and_or $have_atomic_ops" >>confdef 128) gcc_atomic_type="$gcc_atomic_type128";; esac gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __sync_val_compare_and_swap in + case __atomic_compare_exchange_n in __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0);" + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0);" ;; __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" + atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" ;; __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" ;; __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_val_compare_and_swap(&var, __ATOMIC_RELAXED); res = __sync_val_compare_and_swap(&var, __ATOMIC_ACQUIRE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_compare_exchange_n(&var, __ATOMIC_RELAXED); res = __atomic_compare_exchange_n(&var, __ATOMIC_ACQUIRE);" ;; __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __sync_val_compare_and_swap(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" ;; __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __sync_val_compare_and_swap(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __sync_val_compare_and_swap(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" + atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_compare_exchange_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_compare_exchange_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" ;; *) - as_fn_error $? "Internal error: missing implementation for __sync_val_compare_and_swap" "$LINENO" 5 + as_fn_error $? "Internal error: missing implementation for __atomic_compare_exchange_n" "$LINENO" 5 ;; esac eval atomic${atomic_bit_size}_call=\"$atomic_call\" done - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __sync_val_compare_and_swap()" >&5 -printf %s "checking for 32-bit __sync_val_compare_and_swap()... " >&6; } -if test ${ethr_cv_32bit___sync_val_compare_and_swap+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __atomic_compare_exchange_n()" >&5 +printf %s "checking for 32-bit __atomic_compare_exchange_n()... " >&6; } +if test ${ethr_cv_32bit___atomic_compare_exchange_n+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_32bit___sync_val_compare_and_swap=no + ethr_cv_32bit___atomic_compare_exchange_n=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8683,23 +10436,23 @@ $atomic32_call _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_32bit___sync_val_compare_and_swap=yes + ethr_cv_32bit___atomic_compare_exchange_n=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___sync_val_compare_and_swap" >&5 -printf "%s\n" "$ethr_cv_32bit___sync_val_compare_and_swap" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __sync_val_compare_and_swap()" >&5 -printf %s "checking for 64-bit __sync_val_compare_and_swap()... " >&6; } -if test ${ethr_cv_64bit___sync_val_compare_and_swap+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___atomic_compare_exchange_n" >&5 +printf "%s\n" "$ethr_cv_32bit___atomic_compare_exchange_n" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __atomic_compare_exchange_n()" >&5 +printf %s "checking for 64-bit __atomic_compare_exchange_n()... " >&6; } +if test ${ethr_cv_64bit___atomic_compare_exchange_n+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_64bit___sync_val_compare_and_swap=no + ethr_cv_64bit___atomic_compare_exchange_n=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8713,23 +10466,23 @@ $atomic64_call _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_64bit___sync_val_compare_and_swap=yes + ethr_cv_64bit___atomic_compare_exchange_n=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___sync_val_compare_and_swap" >&5 -printf "%s\n" "$ethr_cv_64bit___sync_val_compare_and_swap" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __sync_val_compare_and_swap()" >&5 -printf %s "checking for 128-bit __sync_val_compare_and_swap()... " >&6; } -if test ${ethr_cv_128bit___sync_val_compare_and_swap+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___atomic_compare_exchange_n" >&5 +printf "%s\n" "$ethr_cv_64bit___atomic_compare_exchange_n" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __atomic_compare_exchange_n()" >&5 +printf %s "checking for 128-bit __atomic_compare_exchange_n()... " >&6; } +if test ${ethr_cv_128bit___atomic_compare_exchange_n+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_128bit___sync_val_compare_and_swap=no + ethr_cv_128bit___atomic_compare_exchange_n=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -8743,17 +10496,17 @@ $atomic128_call _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_128bit___sync_val_compare_and_swap=yes + ethr_cv_128bit___atomic_compare_exchange_n=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___sync_val_compare_and_swap" >&5 -printf "%s\n" "$ethr_cv_128bit___sync_val_compare_and_swap" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___atomic_compare_exchange_n" >&5 +printf "%s\n" "$ethr_cv_128bit___atomic_compare_exchange_n" >&6; } - case $ethr_cv_128bit___sync_val_compare_and_swap-$ethr_cv_64bit___sync_val_compare_and_swap-$ethr_cv_32bit___sync_val_compare_and_swap in + case $ethr_cv_128bit___atomic_compare_exchange_n-$ethr_cv_64bit___atomic_compare_exchange_n-$ethr_cv_32bit___atomic_compare_exchange_n in no-no-no) have_atomic_ops=0;; no-no-yes) @@ -8772,1226 +10525,1211 @@ printf "%s\n" "$ethr_cv_128bit___sync_val_compare_and_swap" >&6; } have_atomic_ops=28;; esac -printf "%s\n" "#define ETHR_HAVE___sync_val_compare_and_swap $have_atomic_ops" >>confdefs.h - - +printf "%s\n" "#define ETHR_HAVE___atomic_compare_exchange_n $have_atomic_ops" >>confdefs.h - # __atomic_store_n - atomic_op - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __atomic_store_n in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_store_n(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_store_n(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_store_n(&var, __ATOMIC_RELAXED); res = __atomic_store_n(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_store_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_store_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_store_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - as_fn_error $? "Internal error: missing implementation for __atomic_store_n" "$LINENO" 5 - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done + ethr_have_gcc_native_atomics=no + ethr_arm_dbm_sy_instr_val=0 + ethr_arm_dbm_st_instr_val=0 + ethr_arm_dbm_ld_instr_val=0 + ethr_arm_isb_sy_instr_val=0 + ethr_arm_dc_cvau_instr_val=0 + ethr_arm_ic_ivau_instr_val=0 + case "$GCC-$host_cpu" in #( + yes-arm*|yes-aarch*) : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __atomic_store_n()" >&5 -printf %s "checking for 32-bit __atomic_store_n()... " >&6; } -if test ${ethr_cv_32bit___atomic_store_n+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM 'dmb sy' instruction" >&5 +printf %s "checking for ARM 'dmb sy' instruction... " >&6; } +if test ${ethr_cv_arm_dbm_sy_instr+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_32bit___atomic_store_n=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ethr_cv_arm_dbm_sy_instr=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic32_call + + __asm__ __volatile__("dmb sy" : : : "memory"); + ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_32bit___atomic_store_n=yes + ethr_cv_arm_dbm_sy_instr=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - ;; + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___atomic_store_n" >&5 -printf "%s\n" "$ethr_cv_32bit___atomic_store_n" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __atomic_store_n()" >&5 -printf %s "checking for 64-bit __atomic_store_n()... " >&6; } -if test ${ethr_cv_64bit___atomic_store_n+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_arm_dbm_sy_instr" >&5 +printf "%s\n" "$ethr_cv_arm_dbm_sy_instr" >&6; } + if test $ethr_cv_arm_dbm_sy_instr = yes; then + ethr_arm_dbm_sy_instr_val=1 + test $ethr_cv_64bit___atomic_compare_exchange_n = yes && + ethr_have_gcc_native_atomics=yes + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM 'dmb st' instruction" >&5 +printf %s "checking for ARM 'dmb st' instruction... " >&6; } +if test ${ethr_cv_arm_dbm_st_instr+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_64bit___atomic_store_n=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ethr_cv_arm_dbm_st_instr=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic64_call + + __asm__ __volatile__("dmb st" : : : "memory"); + ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_64bit___atomic_store_n=yes + ethr_cv_arm_dbm_st_instr=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - ;; + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___atomic_store_n" >&5 -printf "%s\n" "$ethr_cv_64bit___atomic_store_n" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __atomic_store_n()" >&5 -printf %s "checking for 128-bit __atomic_store_n()... " >&6; } -if test ${ethr_cv_128bit___atomic_store_n+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_arm_dbm_st_instr" >&5 +printf "%s\n" "$ethr_cv_arm_dbm_st_instr" >&6; } + if test $ethr_cv_arm_dbm_st_instr = yes; then + ethr_arm_dbm_st_instr_val=1 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM 'dmb ld' instruction" >&5 +printf %s "checking for ARM 'dmb ld' instruction... " >&6; } +if test ${ethr_cv_arm_dbm_ld_instr+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_128bit___atomic_store_n=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ethr_cv_arm_dbm_ld_instr=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic128_call + + __asm__ __volatile__("dmb ld" : : : "memory"); + ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_128bit___atomic_store_n=yes + ethr_cv_arm_dbm_ld_instr=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - ;; + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___atomic_store_n" >&5 -printf "%s\n" "$ethr_cv_128bit___atomic_store_n" >&6; } - - case $ethr_cv_128bit___atomic_store_n-$ethr_cv_64bit___atomic_store_n-$ethr_cv_32bit___atomic_store_n in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - -printf "%s\n" "#define ETHR_HAVE___atomic_store_n $have_atomic_ops" >>confdefs.h - - - - # __atomic_load_n - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __atomic_load_n in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_load_n(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_load_n(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_load_n(&var, __ATOMIC_RELAXED); res = __atomic_load_n(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_load_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_load_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_load_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - as_fn_error $? "Internal error: missing implementation for __atomic_load_n" "$LINENO" 5 - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __atomic_load_n()" >&5 -printf %s "checking for 32-bit __atomic_load_n()... " >&6; } -if test ${ethr_cv_32bit___atomic_load_n+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_arm_dbm_ld_instr" >&5 +printf "%s\n" "$ethr_cv_arm_dbm_ld_instr" >&6; } + if test $ethr_cv_arm_dbm_ld_instr = yes; then + ethr_arm_dbm_ld_instr_val=1 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM 'isb sy' instruction" >&5 +printf %s "checking for ARM 'isb sy' instruction... " >&6; } +if test ${ethr_cv_arm_isb_sy_instr+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_32bit___atomic_load_n=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ethr_cv_arm_isb_sy_instr=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic32_call + + __asm__ __volatile__("isb sy\n" : : : "memory"); + ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_32bit___atomic_load_n=yes + ethr_cv_arm_isb_sy_instr=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - ;; + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___atomic_load_n" >&5 -printf "%s\n" "$ethr_cv_32bit___atomic_load_n" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __atomic_load_n()" >&5 -printf %s "checking for 64-bit __atomic_load_n()... " >&6; } -if test ${ethr_cv_64bit___atomic_load_n+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_arm_isb_sy_instr" >&5 +printf "%s\n" "$ethr_cv_arm_isb_sy_instr" >&6; } + if test $ethr_cv_arm_isb_sy_instr = yes; then + ethr_arm_isb_sy_instr_val=1 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM 'dc cvau' instruction" >&5 +printf %s "checking for ARM 'dc cvau' instruction... " >&6; } +if test ${ethr_cv_arm_dc_cvau_instr+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_64bit___atomic_load_n=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ethr_cv_arm_dc_cvau_instr=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic64_call + + char data[512]; __asm__ __volatile__("dc cvau, %0\n" :: "r" (data) : "memory"); + ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_64bit___atomic_load_n=yes + ethr_cv_arm_dc_cvau_instr=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - ;; + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___atomic_load_n" >&5 -printf "%s\n" "$ethr_cv_64bit___atomic_load_n" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __atomic_load_n()" >&5 -printf %s "checking for 128-bit __atomic_load_n()... " >&6; } -if test ${ethr_cv_128bit___atomic_load_n+y} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_arm_dc_cvau_instr" >&5 +printf "%s\n" "$ethr_cv_arm_dc_cvau_instr" >&6; } + if test $ethr_cv_arm_dc_cvau_instr = yes; then + ethr_arm_dc_cvau_instr_val=1 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM 'ic ivau' instruction" >&5 +printf %s "checking for ARM 'ic ivau' instruction... " >&6; } +if test ${ethr_cv_arm_ic_ivau_instr+y} then : printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_128bit___atomic_load_n=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ethr_cv_arm_ic_ivau_instr=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic128_call + + char data[512]; __asm__ __volatile__("ic ivau, %0\n" :: "r" (data) : "memory"); + ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_128bit___atomic_load_n=yes + ethr_cv_arm_ic_ivau_instr=yes fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - ;; + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___atomic_load_n" >&5 -printf "%s\n" "$ethr_cv_128bit___atomic_load_n" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_arm_ic_ivau_instr" >&5 +printf "%s\n" "$ethr_cv_arm_ic_ivau_instr" >&6; } + if test $ethr_cv_arm_ic_ivau_instr = yes; then + ethr_arm_ic_ivau_instr_val=1 + fi + ;; #( + *) : + ;; +esac - case $ethr_cv_128bit___atomic_load_n-$ethr_cv_64bit___atomic_load_n-$ethr_cv_32bit___atomic_load_n in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac -printf "%s\n" "#define ETHR_HAVE___atomic_load_n $have_atomic_ops" >>confdefs.h +printf "%s\n" "#define ETHR_HAVE_GCC_ASM_ARM_DMB_INSTRUCTION $ethr_arm_dbm_sy_instr_val" >>confdefs.h +printf "%s\n" "#define ETHR_HAVE_GCC_ASM_ARM_DMB_ST_INSTRUCTION $ethr_arm_dbm_st_instr_val" >>confdefs.h - # __atomic_add_fetch - atomic_op - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __atomic_add_fetch in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_add_fetch(&var, __ATOMIC_RELAXED); res = __atomic_add_fetch(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_add_fetch(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" +printf "%s\n" "#define ETHR_HAVE_GCC_ASM_ARM_DMB_LD_INSTRUCTION $ethr_arm_dbm_ld_instr_val" >>confdefs.h + + +printf "%s\n" "#define ETHR_HAVE_GCC_ASM_ARM_ISB_SY_INSTRUCTION $ethr_arm_isb_sy_instr_val" >>confdefs.h + + +printf "%s\n" "#define ETHR_HAVE_GCC_ASM_ARM_DC_CVAU_INSTRUCTION $ethr_arm_dc_cvau_instr_val" >>confdefs.h + + +printf "%s\n" "#define ETHR_HAVE_GCC_ASM_ARM_IC_IVAU_INSTRUCTION $ethr_arm_ic_ivau_instr_val" >>confdefs.h + + + test $ethr_cv_32bit___sync_val_compare_and_swap = yes && + ethr_have_gcc_native_atomics=yes + test $ethr_cv_64bit___sync_val_compare_and_swap = yes && + ethr_have_gcc_native_atomics=yes + if test "$ethr_cv___sync_synchronize" = "yes"; then + test $ethr_cv_64bit___atomic_compare_exchange_n = yes && + ethr_have_gcc_native_atomics=yes + test $ethr_cv_32bit___atomic_compare_exchange_n = yes && + ethr_have_gcc_native_atomics=yes + fi + ethr_have_gcc_atomic_builtins=0 + if test $ethr_have_gcc_native_atomics = yes; then + ethr_native_atomic_implementation=gcc_sync + test $ethr_cv_32bit___atomic_compare_exchange_n = yes && ethr_have_gcc_atomic_builtins=1 + test $ethr_cv_64bit___atomic_compare_exchange_n = yes && ethr_have_gcc_atomic_builtins=1 + test $ethr_have_gcc_atomic_builtins = 1 && ethr_native_atomic_implementation=gcc_atomic_sync + fi + +printf "%s\n" "#define ETHR_HAVE_GCC___ATOMIC_BUILTINS $ethr_have_gcc_atomic_builtins" >>confdefs.h + + test $ethr_have_gcc_native_atomics = yes && ethr_have_native_atomics=yes + + + case "$THR_LIB_NAME" in + "") + EI_THREADS="false" + # Fail if --enable-threads given and no threads found + if test "x$threads_disabled" = "xno"; then + as_fn_error $? "No threads support found" "$LINENO" 5 + fi + ;; + win32_threads) + EI_THREADS="true" + THR_DEFS="$THR_DEFS -D_REENTRANT -D_WIN32_WINNT=0x0600 -DWINVER=0x0600" ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_add_fetch(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_add_fetch(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" + pthread) + EI_THREADS="true" ;; *) - as_fn_error $? "Internal error: missing implementation for __atomic_add_fetch" "$LINENO" 5 + EI_THREADS="true" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Unexpected thread library: $THR_LIB_NAME" >&5 +printf "%s\n" "$as_me: WARNING: Unexpected thread library: $THR_LIB_NAME" >&2;} ;; esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done + ;; #( + yes) : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __atomic_add_fetch()" >&5 -printf %s "checking for 32-bit __atomic_add_fetch()... " >&6; } -if test ${ethr_cv_32bit___atomic_add_fetch+y} + # Threads disabled + EI_THREADS="false" + ;; #( + *) : + ;; +esac + +# --------------------------------------------------------------------------- +# Warning flags to the C compiler +# --------------------------------------------------------------------------- + + +WFLAGS="$WERRORFLAGS $DED_WERRORFLAGS $DED_WARN_FLAGS" +if test "x$GCC" = xyes then : - printf %s "(cached) " >&6 + WFLAGS="$WFLAGS -Wmissing-declarations -Wnested-externs -Winline" +fi + + + + if test "X$host" = "Xwin32" +then : + ossf_security_hardening_default=no +else case e in #( + e) ossf_security_hardening_default=yes ;; +esac +fi + # Check whether --enable-security-hardening-flags was given. +if test ${enable_security_hardening_flags+y} +then : + enableval=$enable_security_hardening_flags; case "$enableval" in + no) ossf_security_hardening=no ;; + *) ossf_security_hardening=yes ;; + esac +else case e in #( + e) ossf_security_hardening=$ossf_security_hardening_default ;; +esac +fi + + + + if test "$ossf_security_hardening" = "yes" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_32bit___atomic_add_fetch=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + if test "X$can_enable_flag" = "Xfalse" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - +#include int main (void) { -$atomic32_call +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ethr_cv_32bit___atomic_add_fetch=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___atomic_add_fetch" >&5 -printf "%s\n" "$ethr_cv_32bit___atomic_add_fetch" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __atomic_add_fetch()" >&5 -printf %s "checking for 64-bit __atomic_add_fetch()... " >&6; } -if test ${ethr_cv_64bit___atomic_add_fetch+y} +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_64bit___atomic_add_fetch=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-clash-protection to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-clash-protection to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-clash-protection $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic64_call +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ethr_cv_64bit___atomic_add_fetch=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___atomic_add_fetch" >&5 -printf "%s\n" "$ethr_cv_64bit___atomic_add_fetch" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __atomic_add_fetch()" >&5 -printf %s "checking for 128-bit __atomic_add_fetch()... " >&6; } -if test ${ethr_cv_128bit___atomic_add_fetch+y} +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + CFLAGS="-fstack-clash-protection $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_128bit___atomic_add_fetch=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector-strong $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic128_call +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ethr_cv_128bit___atomic_add_fetch=yes + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ;; +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fstack-protector-strong $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___atomic_add_fetch" >&5 -printf "%s\n" "$ethr_cv_128bit___atomic_add_fetch" >&6; } - case $ethr_cv_128bit___atomic_add_fetch-$ethr_cv_64bit___atomic_add_fetch-$ethr_cv_32bit___atomic_add_fetch in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac + if test "X$can_enable_flag" = "Xfalse" +then : -printf "%s\n" "#define ETHR_HAVE___atomic_add_fetch $have_atomic_ops" >>confdefs.h + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + CFLAGS="-fstack-protector $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } - # __atomic_fetch_and - atomic_op +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __atomic_fetch_and in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_and(&var, __ATOMIC_RELAXED); res = __atomic_fetch_and(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_fetch_and(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_fetch_and(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_fetch_and(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - as_fn_error $? "Internal error: missing implementation for __atomic_fetch_and" "$LINENO" 5 - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __atomic_fetch_and()" >&5 -printf %s "checking for 32-bit __atomic_fetch_and()... " >&6; } -if test ${ethr_cv_32bit___atomic_fetch_and+y} -then : - printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_32bit___atomic_fetch_and=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # Some systems (solaris) also require this to be part of LDFLAGS + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-fstack-protector-strong"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic32_call +return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_32bit___atomic_fetch_and=yes + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___atomic_fetch_and" >&5 -printf "%s\n" "$ethr_cv_32bit___atomic_fetch_and" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __atomic_fetch_and()" >&5 -printf %s "checking for 64-bit __atomic_fetch_and()... " >&6; } -if test ${ethr_cv_64bit___atomic_fetch_and+y} + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_64bit___atomic_fetch_and=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + ;; +esac +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fcf-protection=full to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fcf-protection=full to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fcf-protection=full $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic64_call +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ethr_cv_64bit___atomic_fetch_and=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___atomic_fetch_and" >&5 -printf "%s\n" "$ethr_cv_64bit___atomic_fetch_and" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __atomic_fetch_and()" >&5 -printf %s "checking for 128-bit __atomic_fetch_and()... " >&6; } -if test ${ethr_cv_128bit___atomic_fetch_and+y} +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + CFLAGS="-fcf-protection=full $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_128bit___atomic_fetch_and=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -mbranch-protection=standard to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -mbranch-protection=standard to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -mbranch-protection=standard $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic128_call +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ethr_cv_128bit___atomic_fetch_and=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___atomic_fetch_and" >&5 -printf "%s\n" "$ethr_cv_128bit___atomic_fetch_and" >&6; } - - case $ethr_cv_128bit___atomic_fetch_and-$ethr_cv_64bit___atomic_fetch_and-$ethr_cv_32bit___atomic_fetch_and in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - -printf "%s\n" "#define ETHR_HAVE___atomic_fetch_and $have_atomic_ops" >>confdefs.h - - - - # __atomic_fetch_or - atomic_op +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __atomic_fetch_or in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_or(&var, __ATOMIC_RELAXED); res = __atomic_fetch_or(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_fetch_or(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_fetch_or(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_fetch_or(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - as_fn_error $? "Internal error: missing implementation for __atomic_fetch_or" "$LINENO" 5 - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done + CFLAGS="-mbranch-protection=standard $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __atomic_fetch_or()" >&5 -printf %s "checking for 32-bit __atomic_fetch_or()... " >&6; } -if test ${ethr_cv_32bit___atomic_fetch_or+y} -then : - printf %s "(cached) " >&6 else case e in #( e) - ethr_cv_32bit___atomic_fetch_or=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fexceptions to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fexceptions to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fexceptions $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic32_call +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ethr_cv_32bit___atomic_fetch_or=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___atomic_fetch_or" >&5 -printf "%s\n" "$ethr_cv_32bit___atomic_fetch_or" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __atomic_fetch_or()" >&5 -printf %s "checking for 64-bit __atomic_fetch_or()... " >&6; } -if test ${ethr_cv_64bit___atomic_fetch_or+y} +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + CFLAGS="-fexceptions $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_64bit___atomic_fetch_or=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-overflow to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-overflow to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-overflow $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic64_call +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ethr_cv_64bit___atomic_fetch_or=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___atomic_fetch_or" >&5 -printf "%s\n" "$ethr_cv_64bit___atomic_fetch_or" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __atomic_fetch_or()" >&5 -printf %s "checking for 128-bit __atomic_fetch_or()... " >&6; } -if test ${ethr_cv_128bit___atomic_fetch_or+y} +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + CFLAGS="-fno-strict-overflow $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_128bit___atomic_fetch_or=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-delete-null-pointer-checks to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-delete-null-pointer-checks to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-delete-null-pointer-checks $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic128_call +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ethr_cv_128bit___atomic_fetch_or=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___atomic_fetch_or" >&5 -printf "%s\n" "$ethr_cv_128bit___atomic_fetch_or" >&6; } - - case $ethr_cv_128bit___atomic_fetch_or-$ethr_cv_64bit___atomic_fetch_or-$ethr_cv_32bit___atomic_fetch_or in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac - -printf "%s\n" "#define ETHR_HAVE___atomic_fetch_or $have_atomic_ops" >>confdefs.h - - - - # __atomic_compare_exchange_n - atomic_op - - for atomic_bit_size in 32 64 128; do - case $atomic_bit_size in - 32) gcc_atomic_type="$gcc_atomic_type32";; - 64) gcc_atomic_type="$gcc_atomic_type64";; - 128) gcc_atomic_type="$gcc_atomic_type128";; - esac - gcc_atomic_lockfree="int x[(2*__atomic_always_lock_free(sizeof($gcc_atomic_type), 0))-1]" - case __atomic_compare_exchange_n in - __sync_add_and_fetch | __sync_fetch_and_and | __sync_fetch_and_or) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0);" - ;; - __sync_val_compare_and_swap) - atomic_call="volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, ($gcc_atomic_type) 0);" - ;; - __atomic_store_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_load_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_compare_exchange_n(&var, __ATOMIC_RELAXED); res = __atomic_compare_exchange_n(&var, __ATOMIC_ACQUIRE);" - ;; - __atomic_add_fetch| __atomic_fetch_and | __atomic_fetch_or) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELAXED); res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_ACQUIRE); res = __atomic_compare_exchange_n(&var, ($gcc_atomic_type) 0, __ATOMIC_RELEASE);" - ;; - __atomic_compare_exchange_n) - atomic_call="$gcc_atomic_lockfree; volatile $gcc_atomic_type var; $gcc_atomic_type val; int res = __atomic_compare_exchange_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); res = __atomic_compare_exchange_n(&var, &val, ($gcc_atomic_type) 0, 0, __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE);" - ;; - *) - as_fn_error $? "Internal error: missing implementation for __atomic_compare_exchange_n" "$LINENO" 5 - ;; - esac - eval atomic${atomic_bit_size}_call=\"$atomic_call\" - done - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 32-bit __atomic_compare_exchange_n()" >&5 -printf %s "checking for 32-bit __atomic_compare_exchange_n()... " >&6; } -if test ${ethr_cv_32bit___atomic_compare_exchange_n+y} +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + CFLAGS="-fno-delete-null-pointer-checks $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_32bit___atomic_compare_exchange_n=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-aliasing to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-aliasing to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-aliasing $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic32_call +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ethr_cv_32bit___atomic_compare_exchange_n=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_32bit___atomic_compare_exchange_n" >&5 -printf "%s\n" "$ethr_cv_32bit___atomic_compare_exchange_n" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit __atomic_compare_exchange_n()" >&5 -printf %s "checking for 64-bit __atomic_compare_exchange_n()... " >&6; } -if test ${ethr_cv_64bit___atomic_compare_exchange_n+y} +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + CFLAGS="-fno-strict-aliasing $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_64bit___atomic_compare_exchange_n=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -ftrivial-auto-var-init=zero to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -ftrivial-auto-var-init=zero to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -ftrivial-auto-var-init=zero $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic64_call +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ethr_cv_64bit___atomic_compare_exchange_n=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_64bit___atomic_compare_exchange_n" >&5 -printf "%s\n" "$ethr_cv_64bit___atomic_compare_exchange_n" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 128-bit __atomic_compare_exchange_n()" >&5 -printf %s "checking for 128-bit __atomic_compare_exchange_n()... " >&6; } -if test ${ethr_cv_128bit___atomic_compare_exchange_n+y} +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + CFLAGS="-ftrivial-auto-var-init=zero $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_128bit___atomic_compare_exchange_n=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=3 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=3 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=3 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { -$atomic128_call +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ethr_cv_128bit___atomic_compare_exchange_n=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_128bit___atomic_compare_exchange_n" >&5 -printf "%s\n" "$ethr_cv_128bit___atomic_compare_exchange_n" >&6; } - - case $ethr_cv_128bit___atomic_compare_exchange_n-$ethr_cv_64bit___atomic_compare_exchange_n-$ethr_cv_32bit___atomic_compare_exchange_n in - no-no-no) - have_atomic_ops=0;; - no-no-yes) - have_atomic_ops=4;; - no-yes-no) - have_atomic_ops=8;; - no-yes-yes) - have_atomic_ops=12;; - yes-no-no) - have_atomic_ops=16;; - yes-no-yes) - have_atomic_ops=20;; - yes-yes-no) - have_atomic_ops=24;; - yes-yes-yes) - have_atomic_ops=28;; - esac +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : -printf "%s\n" "#define ETHR_HAVE___atomic_compare_exchange_n $have_atomic_ops" >>confdefs.h + CFLAGS="-fstrict-flex-arrays=3 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + if test "X$can_enable_flag" = "Xfalse" +then : - ethr_have_gcc_native_atomics=no - ethr_arm_dbm_sy_instr_val=0 - ethr_arm_dbm_st_instr_val=0 - ethr_arm_dbm_ld_instr_val=0 - ethr_arm_isb_sy_instr_val=0 - ethr_arm_dc_cvau_instr_val=0 - ethr_arm_ic_ivau_instr_val=0 - case "$GCC-$host_cpu" in #( - yes-arm*|yes-aarch*) : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM 'dmb sy' instruction" >&5 -printf %s "checking for ARM 'dmb sy' instruction... " >&6; } -if test ${ethr_cv_arm_dbm_sy_instr+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) - ethr_cv_arm_dbm_sy_instr=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=2 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=2 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=2 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { - - __asm__ __volatile__("dmb sy" : : : "memory"); - +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ethr_cv_arm_dbm_sy_instr=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_arm_dbm_sy_instr" >&5 -printf "%s\n" "$ethr_cv_arm_dbm_sy_instr" >&6; } - if test $ethr_cv_arm_dbm_sy_instr = yes; then - ethr_arm_dbm_sy_instr_val=1 - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM 'dmb st' instruction" >&5 -printf %s "checking for ARM 'dmb st' instruction... " >&6; } -if test ${ethr_cv_arm_dbm_st_instr+y} +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + CFLAGS="-fstrict-flex-arrays=2 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_arm_dbm_st_instr=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +else case e in #( + e) if test "X$can_enable_flag" != "Xtrue" +then : + exit 1 +fi + ;; +esac +fi + +fi + + + if test "$ossf_security_hardening" = "yes" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -D_GLIBCXX_ASSERTIONS to CXXFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -D_GLIBCXX_ASSERTIONS to CXXFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -D_GLIBCXX_ASSERTIONS $CXXFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { - - __asm__ __volatile__("dmb st" : : : "memory"); - +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ethr_cv_arm_dbm_st_instr=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext - ;; + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_arm_dbm_st_instr" >&5 -printf "%s\n" "$ethr_cv_arm_dbm_st_instr" >&6; } - if test $ethr_cv_arm_dbm_st_instr = yes; then - ethr_arm_dbm_st_instr_val=1 - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM 'dmb ld' instruction" >&5 -printf %s "checking for ARM 'dmb ld' instruction... " >&6; } -if test ${ethr_cv_arm_dbm_ld_instr+y} +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + CXXFLAGS="-D_GLIBCXX_ASSERTIONS $CXXFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_arm_dbm_ld_instr=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +fi + + + if test "$ossf_security_hardening" = "yes" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,noexecstack to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,noexecstack to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,noexecstack"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { - - __asm__ __volatile__("dmb ld" : : : "memory"); - +return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_arm_dbm_ld_instr=yes + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_arm_dbm_ld_instr" >&5 -printf "%s\n" "$ethr_cv_arm_dbm_ld_instr" >&6; } - if test $ethr_cv_arm_dbm_ld_instr = yes; then - ethr_arm_dbm_ld_instr_val=1 - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM 'isb sy' instruction" >&5 -printf %s "checking for ARM 'isb sy' instruction... " >&6; } -if test ${ethr_cv_arm_isb_sy_instr+y} + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_arm_isb_sy_instr=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,relro to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,relro to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,relro"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { - - __asm__ __volatile__("isb sy\n" : : : "memory"); - +return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_arm_isb_sy_instr=yes + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_arm_isb_sy_instr" >&5 -printf "%s\n" "$ethr_cv_arm_isb_sy_instr" >&6; } - if test $ethr_cv_arm_isb_sy_instr = yes; then - ethr_arm_isb_sy_instr_val=1 - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM 'dc cvau' instruction" >&5 -printf %s "checking for ARM 'dc cvau' instruction... " >&6; } -if test ${ethr_cv_arm_dc_cvau_instr+y} + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_arm_dc_cvau_instr=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,now to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,now to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,now"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { - - char data[512]; __asm__ __volatile__("dc cvau, %0\n" :: "r" (data) : "memory"); - +return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_arm_dc_cvau_instr=yes + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_arm_dc_cvau_instr" >&5 -printf "%s\n" "$ethr_cv_arm_dc_cvau_instr" >&6; } - if test $ethr_cv_arm_dc_cvau_instr = yes; then - ethr_arm_dc_cvau_instr_val=1 - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARM 'ic ivau' instruction" >&5 -printf %s "checking for ARM 'ic ivau' instruction... " >&6; } -if test ${ethr_cv_arm_ic_ivau_instr+y} + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - printf %s "(cached) " >&6 + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else case e in #( e) - ethr_cv_arm_ic_ivau_instr=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--as-needed to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--as-needed to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--as-needed"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main (void) { - - char data[512]; __asm__ __volatile__("ic ivau, %0\n" :: "r" (data) : "memory"); - +return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ethr_cv_arm_ic_ivau_instr=yes + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ethr_cv_arm_ic_ivau_instr" >&5 -printf "%s\n" "$ethr_cv_arm_ic_ivau_instr" >&6; } - if test $ethr_cv_arm_ic_ivau_instr = yes; then - ethr_arm_ic_ivau_instr_val=1 - fi - ;; #( - *) : - ;; -esac - - -printf "%s\n" "#define ETHR_HAVE_GCC_ASM_ARM_DMB_INSTRUCTION $ethr_arm_dbm_sy_instr_val" >>confdefs.h - - -printf "%s\n" "#define ETHR_HAVE_GCC_ASM_ARM_DMB_ST_INSTRUCTION $ethr_arm_dbm_st_instr_val" >>confdefs.h - - -printf "%s\n" "#define ETHR_HAVE_GCC_ASM_ARM_DMB_LD_INSTRUCTION $ethr_arm_dbm_ld_instr_val" >>confdefs.h - - -printf "%s\n" "#define ETHR_HAVE_GCC_ASM_ARM_ISB_SY_INSTRUCTION $ethr_arm_isb_sy_instr_val" >>confdefs.h - - -printf "%s\n" "#define ETHR_HAVE_GCC_ASM_ARM_DC_CVAU_INSTRUCTION $ethr_arm_dc_cvau_instr_val" >>confdefs.h - - -printf "%s\n" "#define ETHR_HAVE_GCC_ASM_ARM_IC_IVAU_INSTRUCTION $ethr_arm_ic_ivau_instr_val" >>confdefs.h - - - test $ethr_cv_32bit___sync_val_compare_and_swap = yes && - ethr_have_gcc_native_atomics=yes - test $ethr_cv_64bit___sync_val_compare_and_swap = yes && - ethr_have_gcc_native_atomics=yes - if test "$ethr_cv___sync_synchronize" = "yes"; then - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - test $ethr_cv_32bit___atomic_compare_exchange_n = yes && - ethr_have_gcc_native_atomics=yes - fi - ethr_have_gcc_atomic_builtins=0 - if test $ethr_have_gcc_native_atomics = yes; then - ethr_native_atomic_implementation=gcc_sync - test $ethr_cv_32bit___atomic_compare_exchange_n = yes && ethr_have_gcc_atomic_builtins=1 - test $ethr_cv_64bit___atomic_compare_exchange_n = yes && ethr_have_gcc_atomic_builtins=1 - test $ethr_have_gcc_atomic_builtins = 1 && ethr_native_atomic_implementation=gcc_atomic_sync - fi - -printf "%s\n" "#define ETHR_HAVE_GCC___ATOMIC_BUILTINS $ethr_have_gcc_atomic_builtins" >>confdefs.h - - test $ethr_have_gcc_native_atomics = yes && ethr_have_native_atomics=yes - + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : - case "$THR_LIB_NAME" in - "") - EI_THREADS="false" - # Fail if --enable-threads given and no threads found - if test "x$threads_disabled" = "xno"; then - as_fn_error $? "No threads support found" "$LINENO" 5 - fi - ;; - win32_threads) - EI_THREADS="true" - THR_DEFS="$THR_DEFS -D_REENTRANT -D_WIN32_WINNT=0x0600 -DWINVER=0x0600" - ;; - pthread) - EI_THREADS="true" - ;; - *) - EI_THREADS="true" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Unexpected thread library: $THR_LIB_NAME" >&5 -printf "%s\n" "$as_me: WARNING: Unexpected thread library: $THR_LIB_NAME" >&2;} - ;; - esac - ;; #( - yes) : + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } - # Threads disabled - EI_THREADS="false" - ;; #( - *) : - ;; +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac - -# --------------------------------------------------------------------------- -# Warning flags to the C compiler -# --------------------------------------------------------------------------- - - -WFLAGS="$WERRORFLAGS $DED_WERRORFLAGS $DED_WARN_FLAGS" -if test "x$GCC" = xyes -then : - WFLAGS="$WFLAGS -Wmissing-declarations -Wnested-externs -Winline" fi -# Use -fno-common for gcc, that is link error if multiple definitions of -# global variables are encountered. This is ISO C compliant. -# Until version 10, gcc has had -fcommon as default, which allows and merges -# such dubious duplicates. - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-common to CFLAGS (via CFLAGS)" >&5 -printf %s "checking if we can add -fno-common to CFLAGS (via CFLAGS)... " >&6; } - saved_CFLAGS=$CFLAGS; - CFLAGS="-fno-common $CFLAGS"; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--no-copy-dt-needed-entries to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--no-copy-dt-needed-entries to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--no-copy-dt-needed-entries"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -10003,21 +11741,23 @@ return 0; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO" +if ac_fn_c_try_link "$LINENO" then : can_enable_flag=true else case e in #( - e) can_enable_flag=false ;; + e) can_enable_flag=false + ;; esac fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$saved_CFLAGS; +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; if test "X$can_enable_flag" = "Xtrue" then : + LDFLAGS="$saved_LDFLAG $LDFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - CFLAGS="-fno-common $CFLAGS" else case e in #( e) @@ -10027,12 +11767,20 @@ printf "%s\n" "no" >&6; } esac fi -# No strict aliasing until we determined it is safe... - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-aliasing to CFLAGS (via CFLAGS)" >&5 -printf %s "checking if we can add -fno-strict-aliasing to CFLAGS (via CFLAGS)... " >&6; } +fi + + + +# Use -fno-common for gcc, that is link error if multiple definitions of +# global variables are encountered. This is ISO C compliant. +# Until version 10, gcc has had -fcommon as default, which allows and merges +# such dubious duplicates. + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-common to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-common to CFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-fno-strict-aliasing $CFLAGS"; + CFLAGS="-Werror -fno-common $CFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -10056,9 +11804,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + CFLAGS="-fno-common $CFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - CFLAGS="-fno-strict-aliasing $CFLAGS" else case e in #( e) diff --git a/lib/erl_interface/configure.ac b/lib/erl_interface/configure.ac index 883b0ec380ed..b3dd584e331c 100644 --- a/lib/erl_interface/configure.ac +++ b/lib/erl_interface/configure.ac @@ -330,14 +330,13 @@ WFLAGS="$WERRORFLAGS $DED_WERRORFLAGS $DED_WARN_FLAGS" AS_IF([test "x$GCC" = xyes], [WFLAGS="$WFLAGS -Wmissing-declarations -Wnested-externs -Winline"]) +ERL_OSSF_FLAGS # Use -fno-common for gcc, that is link error if multiple definitions of # global variables are encountered. This is ISO C compliant. # Until version 10, gcc has had -fcommon as default, which allows and merges # such dubious duplicates. LM_TRY_ENABLE_CFLAG([-fno-common], [CFLAGS]) -# No strict aliasing until we determined it is safe... -LM_TRY_ENABLE_CFLAG([-fno-strict-aliasing], [CFLAGS]) ERL_POP_WERROR diff --git a/lib/megaco/configure b/lib/megaco/configure index d428f28d24f4..0aeb9dce1959 100755 --- a/lib/megaco/configure +++ b/lib/megaco/configure @@ -736,6 +736,7 @@ enable_option_checking enable_megaco_reentrant_flex_scanner enable_megaco_flex_scanner_lineno enable_largefile +enable_security_hardening_flags enable_year2038 ' ac_precious_vars='build_alias @@ -1372,6 +1373,9 @@ Optional Features: --enable-megaco-flex-scanner-lineno enable megaco flex scanner lineno --disable-megaco-flex-scanner-lineno disable megaco flex scanner lineno --disable-largefile omit support for large files + --disable-security-hardening-flags + disable Open Source Security Foundation security + hardening flags --disable-year2038 don't support timestamps after 2038 Some influential environment variables: @@ -2782,6 +2786,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + @@ -4657,7 +4674,7 @@ if test "x$GCC" = xyes; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=return-type to CFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=return-type to CFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=return-type $CFLAGS"; + CFLAGS="-Werror -Werror=return-type $CFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4681,9 +4698,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + CFLAGS="-Werror=return-type $CFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - CFLAGS="-Werror=return-type $CFLAGS" else case e in #( e) @@ -5492,6 +5509,7 @@ DED_GCC=$GCC DED_CFLAGS= DED_OSTYPE=unix + case $host_os in linux*) DED_CFLAGS="-D_GNU_SOURCE" ;; @@ -5516,7 +5534,7 @@ esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wdeclaration-after-statement to DED_WARN_FLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Wdeclaration-after-statement to DED_WARN_FLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Wdeclaration-after-statement $DED_WARN_FLAGS"; + CFLAGS="-Werror -Wdeclaration-after-statement $DED_WARN_FLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5540,9 +5558,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WARN_FLAGS="-Wdeclaration-after-statement $DED_WARN_FLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WARN_FLAGS="-Wdeclaration-after-statement $DED_WARN_FLAGS" else case e in #( e) @@ -5557,7 +5575,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=return-type to DED_WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=return-type to DED_WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=return-type $DED_WERRORFLAGS"; + CFLAGS="-Werror -Werror=return-type $DED_WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5581,9 +5599,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WERRORFLAGS="-Werror=return-type $DED_WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WERRORFLAGS="-Werror=return-type $DED_WERRORFLAGS" else case e in #( e) @@ -5597,7 +5615,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=implicit to DED_WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=implicit to DED_WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=implicit $DED_WERRORFLAGS"; + CFLAGS="-Werror -Werror=implicit $DED_WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5621,9 +5639,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WERRORFLAGS="-Werror=implicit $DED_WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WERRORFLAGS="-Werror=implicit $DED_WERRORFLAGS" else case e in #( e) @@ -5637,7 +5655,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=undef to DED_WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=undef to DED_WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=undef $DED_WERRORFLAGS"; + CFLAGS="-Werror -Werror=undef $DED_WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5661,9 +5679,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WERRORFLAGS="-Werror=undef $DED_WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WERRORFLAGS="-Werror=undef $DED_WERRORFLAGS" else case e in #( e) @@ -5689,7 +5707,7 @@ then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-common to DED_CFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -fno-common to DED_CFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-fno-common $DED_CFLAGS"; + CFLAGS="-Werror -fno-common $DED_CFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5713,50 +5731,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } DED_CFLAGS="-fno-common $DED_CFLAGS" - -else case e in #( - e) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - ;; -esac -fi - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)" >&5 -printf %s "checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)... " >&6; } - saved_CFLAGS=$CFLAGS; - CFLAGS="-fno-strict-aliasing $DED_CFLAGS"; - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - can_enable_flag=true -else case e in #( - e) can_enable_flag=false ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$saved_CFLAGS; - if test "X$can_enable_flag" = "Xtrue" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_CFLAGS="-fno-strict-aliasing $DED_CFLAGS" else case e in #( e) @@ -5822,7 +5799,6 @@ if test "x$DED_LD" = "x"; then if test X${enable_m64_build} = Xyes; then DED_LDFLAGS="-64 $DED_LDFLAGS" fi - DED_LD="$CC" ;; aix*|os400*) DED_LDFLAGS="-G -bnoentry -bexpall" @@ -5897,7 +5873,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h esac fi fi - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" ;; linux*) @@ -6055,6 +6030,889 @@ fi test "$DED_LD" != "false" || as_fn_error $? "No linker found" "$LINENO" 5 + + if test "X$host" = "Xwin32" +then : + ossf_security_hardening_default=no +else case e in #( + e) ossf_security_hardening_default=yes ;; +esac +fi + # Check whether --enable-security-hardening-flags was given. +if test ${enable_security_hardening_flags+y} +then : + enableval=$enable_security_hardening_flags; case "$enableval" in + no) ossf_security_hardening=no ;; + *) ossf_security_hardening=yes ;; + esac +else case e in #( + e) ossf_security_hardening=$ossf_security_hardening_default ;; +esac +fi + + + + if test "$ossf_security_hardening" = "yes" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + if test "X$can_enable_flag" = "Xfalse" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-clash-protection to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-clash-protection to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-clash-protection $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstack-clash-protection $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector-strong $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstack-protector-strong $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + if test "X$can_enable_flag" = "Xfalse" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstack-protector $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +else case e in #( + e) + # Some systems (solaris) also require this to be part of LDFLAGS + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-fstack-protector-strong"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + ;; +esac +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fcf-protection=full to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fcf-protection=full to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fcf-protection=full $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fcf-protection=full $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -mbranch-protection=standard to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -mbranch-protection=standard to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -mbranch-protection=standard $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-mbranch-protection=standard $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fexceptions to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fexceptions to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fexceptions $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fexceptions $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-overflow to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-overflow to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-overflow $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fno-strict-overflow $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-delete-null-pointer-checks to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-delete-null-pointer-checks to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-delete-null-pointer-checks $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fno-delete-null-pointer-checks $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-aliasing $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fno-strict-aliasing $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -ftrivial-auto-var-init=zero to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -ftrivial-auto-var-init=zero to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -ftrivial-auto-var-init=zero $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-ftrivial-auto-var-init=zero $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=3 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=3 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=3 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstrict-flex-arrays=3 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + if test "X$can_enable_flag" = "Xfalse" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=2 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=2 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=2 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstrict-flex-arrays=2 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +else case e in #( + e) if test "X$can_enable_flag" != "Xtrue" +then : + exit 1 +fi + ;; +esac +fi + +fi + + + if test "$ossf_security_hardening" = "yes" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,noexecstack to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,noexecstack to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,noexecstack"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,relro to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,relro to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,relro"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,now to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,now to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,now"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--as-needed to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--as-needed to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--as-needed"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--no-copy-dt-needed-entries to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--no-copy-dt-needed-entries to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--no-copy-dt-needed-entries"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for static compiler flags" >&5 printf %s "checking for static compiler flags... " >&6; } DED_STATIC_CFLAGS="$DED_WERRORFLAGS $DED_WARN_FLAGS $DED_THR_DEFS $DED_STATIC_CFLAGS" diff --git a/lib/odbc/configure b/lib/odbc/configure index 20152629b122..c3539aa2ea65 100755 --- a/lib/odbc/configure +++ b/lib/odbc/configure @@ -716,6 +716,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking with_odbc +enable_security_hardening_flags ' ac_precious_vars='build_alias host_alias @@ -1342,6 +1343,14 @@ if test -n "$ac_init_help"; then cat <<\_ACEOF +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-security-hardening-flags + disable Open Source Security Foundation security + hardening flags + Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) @@ -2877,6 +2886,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + @@ -4465,252 +4487,1184 @@ fi -_search_path=/bin:/usr/bin:/usr/local/bin:$PATH -# Extract the first word of "rm", so it can be a program name with args. -set dummy rm; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_RM+y} + if test "X$host" = "Xwin32" then : - printf %s "(cached) " >&6 + ossf_security_hardening_default=no else case e in #( - e) case $RM in - [\\/]* | ?:[\\/]*) - ac_cv_path_RM="$RM" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $_search_path -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_RM="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_path_RM" && ac_cv_path_RM="false" - ;; -esac ;; + e) ossf_security_hardening_default=yes ;; esac fi -RM=$ac_cv_path_RM -if test -n "$RM"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RM" >&5 -printf "%s\n" "$RM" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -if test "$ac_cv_path_RM" = false; then - as_fn_error $? "No 'rm' command found" "$LINENO" 5 + # Check whether --enable-security-hardening-flags was given. +if test ${enable_security_hardening_flags+y} +then : + enableval=$enable_security_hardening_flags; case "$enableval" in + no) ossf_security_hardening=no ;; + *) ossf_security_hardening=yes ;; + esac +else case e in #( + e) ossf_security_hardening=$ossf_security_hardening_default ;; +esac fi -_search_path= - - -ac_header= ac_cache= -for ac_item in $ac_header_c_list -do - if test $ac_cache; then - ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" - if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then - printf "%s\n" "#define $ac_item 1" >> confdefs.h - fi - ac_header= ac_cache= - elif test $ac_header; then - ac_cache=$ac_item - else - ac_header=$ac_item - fi -done - - - - - - -if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes + if test "$ossf_security_hardening" = "yes" then : -printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -printf %s "checking for grep that handles long lines and -e... " >&6; } -if test ${ac_cv_path_GREP+y} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" then : - printf %s "(cached) " >&6 + can_enable_flag=true else case e in #( - e) if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in grep ggrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in #( -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -#( -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - ;; + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -printf "%s\n" "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -if test "$with_odbc" = "no" +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - - rm -f "$ERL_TOP/lib/odbc/SKIP" - + CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else case e in #( e) - - -# Sockets -#-------------------------------------------------------------------- -# Check for the existence of the -lsocket and -lnsl libraries. -# The order here is important, so that they end up in the right -# order in the command line generated by make. Here are some -# special considerations: -# 1. Use "connect" and "accept" to check for -lsocket, and -# "gethostbyname" to check for -lnsl. -# 2. Use each function name only once: can't redo a check because -# autoconf caches the results of the last check and won't redo it. -# 3. Use -lnsl and -lsocket only if they supply procedures that -# aren't already present in the normal libraries. This is because -# IRIX 5.2 has libraries, but they aren't needed and they're -# bogus: they goof up name resolution if used. -# 4. On some SVR4 systems, can't use -lsocket without -lnsl too. -# To get around this problem, check for both libraries together -# if -lsocket doesn't work by itself. -#-------------------------------------------------------------------- -erl_checkBoth=0 -ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" -if test "x$ac_cv_func_connect" = xyes -then : - erl_checkSocket=0 -else case e in #( - e) erl_checkSocket=1 ;; + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; esac fi -if test "$erl_checkSocket" = 1 + if test "X$can_enable_flag" = "Xfalse" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 -printf %s "checking for socket in -lsocket... " >&6; } -if test ${ac_cv_lib_socket_socket+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char socket (void); + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include int main (void) { -return socket (); +return 0; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO" +if ac_fn_c_try_compile "$LINENO" then : - ac_cv_lib_socket_socket=yes + can_enable_flag=true else case e in #( - e) ac_cv_lib_socket_socket=no ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS ;; + e) can_enable_flag=false ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 -printf "%s\n" "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = xyes +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" then : - LIBS="$LIBS -lsocket" -else case e in #( - e) erl_checkBoth=1 ;; + + CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-clash-protection to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-clash-protection to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-clash-protection $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fstack-clash-protection $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector-strong $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fstack-protector-strong $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + if test "X$can_enable_flag" = "Xfalse" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fstack-protector $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +else case e in #( + e) + # Some systems (solaris) also require this to be part of LDFLAGS + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-fstack-protector-strong"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + ;; +esac +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fcf-protection=full to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fcf-protection=full to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fcf-protection=full $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fcf-protection=full $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -mbranch-protection=standard to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -mbranch-protection=standard to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -mbranch-protection=standard $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-mbranch-protection=standard $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fexceptions to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fexceptions to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fexceptions $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fexceptions $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-overflow to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-overflow to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-overflow $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fno-strict-overflow $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-delete-null-pointer-checks to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-delete-null-pointer-checks to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-delete-null-pointer-checks $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fno-delete-null-pointer-checks $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-aliasing to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-aliasing to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-aliasing $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fno-strict-aliasing $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -ftrivial-auto-var-init=zero to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -ftrivial-auto-var-init=zero to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -ftrivial-auto-var-init=zero $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-ftrivial-auto-var-init=zero $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=3 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=3 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=3 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fstrict-flex-arrays=3 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + if test "X$can_enable_flag" = "Xfalse" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=2 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=2 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=2 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fstrict-flex-arrays=2 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +else case e in #( + e) if test "X$can_enable_flag" != "Xtrue" +then : + exit 1 +fi + ;; +esac +fi + +fi + + + if test "$ossf_security_hardening" = "yes" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -D_GLIBCXX_ASSERTIONS to CXXFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -D_GLIBCXX_ASSERTIONS to CXXFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -D_GLIBCXX_ASSERTIONS $CXXFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CXXFLAGS="-D_GLIBCXX_ASSERTIONS $CXXFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +fi + + + if test "$ossf_security_hardening" = "yes" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,noexecstack to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,noexecstack to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,noexecstack"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,relro to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,relro to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,relro"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,now to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,now to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,now"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--as-needed to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--as-needed to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--as-needed"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--no-copy-dt-needed-entries to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--no-copy-dt-needed-entries to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--no-copy-dt-needed-entries"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +fi + + + + + +_search_path=/bin:/usr/bin:/usr/local/bin:$PATH + +# Extract the first word of "rm", so it can be a program name with args. +set dummy rm; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_RM+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) case $RM in + [\\/]* | ?:[\\/]*) + ac_cv_path_RM="$RM" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $_search_path +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_RM="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_RM" && ac_cv_path_RM="false" + ;; +esac ;; +esac +fi +RM=$ac_cv_path_RM +if test -n "$RM"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RM" >&5 +printf "%s\n" "$RM" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +if test "$ac_cv_path_RM" = false; then + as_fn_error $? "No 'rm' command found" "$LINENO" 5 +fi + +_search_path= + +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in #( +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +#( +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +if test "$with_odbc" = "no" +then : + + + rm -f "$ERL_TOP/lib/odbc/SKIP" + + +else case e in #( + e) + + +# Sockets +#-------------------------------------------------------------------- +# Check for the existence of the -lsocket and -lnsl libraries. +# The order here is important, so that they end up in the right +# order in the command line generated by make. Here are some +# special considerations: +# 1. Use "connect" and "accept" to check for -lsocket, and +# "gethostbyname" to check for -lnsl. +# 2. Use each function name only once: can't redo a check because +# autoconf caches the results of the last check and won't redo it. +# 3. Use -lnsl and -lsocket only if they supply procedures that +# aren't already present in the normal libraries. This is because +# IRIX 5.2 has libraries, but they aren't needed and they're +# bogus: they goof up name resolution if used. +# 4. On some SVR4 systems, can't use -lsocket without -lnsl too. +# To get around this problem, check for both libraries together +# if -lsocket doesn't work by itself. +#-------------------------------------------------------------------- +erl_checkBoth=0 +ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" +if test "x$ac_cv_func_connect" = xyes +then : + erl_checkSocket=0 +else case e in #( + e) erl_checkSocket=1 ;; +esac +fi + +if test "$erl_checkSocket" = 1 +then : + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5 +printf %s "checking for socket in -lsocket... " >&6; } +if test ${ac_cv_lib_socket_socket+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char socket (void); +int +main (void) +{ +return socket (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_socket_socket=yes +else case e in #( + e) ac_cv_lib_socket_socket=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5 +printf "%s\n" "$ac_cv_lib_socket_socket" >&6; } +if test "x$ac_cv_lib_socket_socket" = xyes +then : + LIBS="$LIBS -lsocket" +else case e in #( + e) erl_checkBoth=1 ;; esac fi @@ -6304,7 +7258,7 @@ then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=return-type to CFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=return-type to CFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=return-type $CFLAGS"; + CFLAGS="-Werror -Werror=return-type $CFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -6328,9 +7282,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + CFLAGS="-Werror=return-type $CFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - CFLAGS="-Werror=return-type $CFLAGS" else case e in #( e) diff --git a/lib/odbc/configure.ac b/lib/odbc/configure.ac index 2f0b3ead9b08..3e153c7a6064 100644 --- a/lib/odbc/configure.ac +++ b/lib/odbc/configure.ac @@ -53,6 +53,8 @@ LM_WINDOWS_ENVIRONMENT AC_PROG_MAKE_SET +ERL_OSSF_FLAGS + AC_SUBST(LD) _search_path=/bin:/usr/bin:/usr/local/bin:$PATH diff --git a/lib/snmp/configure b/lib/snmp/configure index 42ec59990b5d..6239ae122d50 100755 --- a/lib/snmp/configure +++ b/lib/snmp/configure @@ -1911,6 +1911,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + diff --git a/lib/wx/configure b/lib/wx/configure index 31baa8f9e485..344866419587 100755 --- a/lib/wx/configure +++ b/lib/wx/configure @@ -748,6 +748,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking with_wx +enable_security_hardening_flags with_wxdir with_wx_config with_wx_prefix @@ -1382,6 +1383,14 @@ if test -n "$ac_init_help"; then cat <<\_ACEOF +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-security-hardening-flags + disable Open Source Security Foundation security + hardening flags + Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) @@ -1606,6 +1615,54 @@ fi } # ac_fn_c_try_cpp +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + # ac_fn_c_try_run LINENO # ---------------------- # Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that @@ -3093,6 +3150,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + @@ -5221,156 +5291,1088 @@ WXERL_CAN_BUILD_DRIVER=true -if test "X$windows_environment_" != "Xchecked"; then -windows_environment_=checked -MIXED_CYGWIN=no -MIXED_MSYS=no -MIXED_VSL=no - -MIXED_VC=no -MIXED_MINGW=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mixed mingw-gcc and native VC++ environment" >&5 -printf %s "checking for mixed mingw-gcc and native VC++ environment... " >&6; } -if test "X$host" = "Xwin32" -a "x$GCC" != "xyes"; then - if test -x /usr/bin/msys-?.0.dll; then - CFLAGS="$CFLAGS -O2" - MIXED_MSYS=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: MSYS and VC" >&5 -printf "%s\n" "MSYS and VC" >&6; } - MIXED_VC=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_VC" - elif test -x /usr/bin/cygpath; then - CFLAGS="$CFLAGS -O2" - MIXED_CYGWIN=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Cygwin and VC" >&5 -printf "%s\n" "Cygwin and VC" >&6; } - MIXED_VC=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_VC" - elif test -x /bin/wslpath; then - CFLAGS="$CFLAGS -O2" - MIXED_WSL=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: WSL and VC" >&5 -printf "%s\n" "WSL and VC" >&6; } - MIXED_VC=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_VC" - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: undeterminable" >&5 -printf "%s\n" "undeterminable" >&6; } - as_fn_error cannot handle this! "Seems to be mixed windows but not within any known env" "$LINENO" 5 - fi -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + if test "X$host" = "Xwin32" +then : + ossf_security_hardening_default=no +else case e in #( + e) ossf_security_hardening_default=yes ;; +esac +fi + # Check whether --enable-security-hardening-flags was given. +if test ${enable_security_hardening_flags+y} +then : + enableval=$enable_security_hardening_flags; case "$enableval" in + no) ossf_security_hardening=no ;; + *) ossf_security_hardening=yes ;; + esac +else case e in #( + e) ossf_security_hardening=$ossf_security_hardening_default ;; +esac fi -if test "x$MIXED_MSYS" != "xyes"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mixed cygwin and native MinGW environment" >&5 -printf %s "checking for mixed cygwin and native MinGW environment... " >&6; } - if test "X$host" = "Xwin32" -a "x$GCC" = x"yes"; then - if test -x /usr/bin/cygpath; then - CFLAGS="$CFLAGS -O2" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - MIXED_MINGW=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MINGW" - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: undeterminable" >&5 -printf "%s\n" "undeterminable" >&6; } - as_fn_error cannot handle this! "Seems to be mixed windows but not with cygwin" "$LINENO" 5 - fi - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - fi -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mixed MSYS and native MinGW environment" >&5 -printf %s "checking for mixed MSYS and native MinGW environment... " >&6; } - if test "x$GCC" = x"yes"; then - if test -x /usr/bin/msys-=.0.dll; then - CFLAGS="$CFLAGS -O2" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - MIXED_MINGW=yes - CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MINGW" - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: undeterminable" >&5 -printf "%s\n" "undeterminable" >&6; } - as_fn_error cannot handle this! "Seems to be mixed windows but not with msys" "$LINENO" 5 - fi - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - fi -fi + if test "$ossf_security_hardening" = "yes" +then : -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we mix cygwin with any native compiler" >&5 -printf %s "checking if we mix cygwin with any native compiler... " >&6; } -if test "X$MIXED_CYGWIN" = "Xyes"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we mix msys with another native compiler" >&5 -printf %s "checking if we mix msys with another native compiler... " >&6; } -if test "X$MIXED_MSYS" = "Xyes" ; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we mix WSL with another native compiler" >&5 -printf %s "checking if we mix WSL with another native compiler... " >&6; } -if test "X$MIXED_WSL" = "Xyes" ; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } + ;; +esac fi -fi - + if test "X$can_enable_flag" = "Xfalse" +then : -USER_CFLAGS=$CFLAGS -if test X"$MIXED_VC" = X"yes" ; then - CFLAGS="-Owx" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } -ac_header= ac_cache= -for ac_item in $ac_header_c_list -do - if test $ac_cache; then - ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" - if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then - printf "%s\n" "#define $ac_item 1" >> confdefs.h - fi - ac_header= ac_cache= - elif test $ac_header; then - ac_cache=$ac_item - else - ac_header=$ac_item - fi -done - - - - +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi +fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-clash-protection to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-clash-protection to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-clash-protection $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fstack-clash-protection $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector-strong $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fstack-protector-strong $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + if test "X$can_enable_flag" = "Xfalse" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fstack-protector $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +else case e in #( + e) + # Some systems (solaris) also require this to be part of LDFLAGS + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-fstack-protector-strong"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + ;; +esac +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fcf-protection=full to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fcf-protection=full to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fcf-protection=full $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fcf-protection=full $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -mbranch-protection=standard to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -mbranch-protection=standard to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -mbranch-protection=standard $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-mbranch-protection=standard $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fexceptions to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fexceptions to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fexceptions $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fexceptions $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-overflow to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-overflow to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-overflow $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fno-strict-overflow $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-delete-null-pointer-checks to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-delete-null-pointer-checks to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-delete-null-pointer-checks $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fno-delete-null-pointer-checks $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-aliasing to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-aliasing to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-aliasing $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fno-strict-aliasing $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -ftrivial-auto-var-init=zero to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -ftrivial-auto-var-init=zero to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -ftrivial-auto-var-init=zero $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-ftrivial-auto-var-init=zero $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=3 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=3 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=3 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fstrict-flex-arrays=3 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + if test "X$can_enable_flag" = "Xfalse" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=2 to CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=2 to CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=2 $CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CFLAGS="-fstrict-flex-arrays=2 $CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +else case e in #( + e) if test "X$can_enable_flag" != "Xtrue" +then : + exit 1 +fi + ;; +esac +fi + +fi + + + if test "$ossf_security_hardening" = "yes" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -D_GLIBCXX_ASSERTIONS to CXXFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -D_GLIBCXX_ASSERTIONS to CXXFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -D_GLIBCXX_ASSERTIONS $CXXFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + CXXFLAGS="-D_GLIBCXX_ASSERTIONS $CXXFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +fi + + + if test "$ossf_security_hardening" = "yes" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,noexecstack to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,noexecstack to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,noexecstack"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,relro to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,relro to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,relro"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,now to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,now to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,now"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--as-needed to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--as-needed to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--as-needed"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--no-copy-dt-needed-entries to LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--no-copy-dt-needed-entries to LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--no-copy-dt-needed-entries"; + LDFLAGS="$saved_LDFLAG $LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + LDFLAGS="$saved_LDFLAG $LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +fi + + + + + +if test "X$windows_environment_" != "Xchecked"; then +windows_environment_=checked +MIXED_CYGWIN=no +MIXED_MSYS=no +MIXED_VSL=no + +MIXED_VC=no +MIXED_MINGW=no + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mixed mingw-gcc and native VC++ environment" >&5 +printf %s "checking for mixed mingw-gcc and native VC++ environment... " >&6; } +if test "X$host" = "Xwin32" -a "x$GCC" != "xyes"; then + if test -x /usr/bin/msys-?.0.dll; then + CFLAGS="$CFLAGS -O2" + MIXED_MSYS=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: MSYS and VC" >&5 +printf "%s\n" "MSYS and VC" >&6; } + MIXED_VC=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_VC" + elif test -x /usr/bin/cygpath; then + CFLAGS="$CFLAGS -O2" + MIXED_CYGWIN=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Cygwin and VC" >&5 +printf "%s\n" "Cygwin and VC" >&6; } + MIXED_VC=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_VC" + elif test -x /bin/wslpath; then + CFLAGS="$CFLAGS -O2" + MIXED_WSL=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: WSL and VC" >&5 +printf "%s\n" "WSL and VC" >&6; } + MIXED_VC=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_VC" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: undeterminable" >&5 +printf "%s\n" "undeterminable" >&6; } + as_fn_error cannot handle this! "Seems to be mixed windows but not within any known env" "$LINENO" 5 + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + +if test "x$MIXED_MSYS" != "xyes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mixed cygwin and native MinGW environment" >&5 +printf %s "checking for mixed cygwin and native MinGW environment... " >&6; } + if test "X$host" = "Xwin32" -a "x$GCC" = x"yes"; then + if test -x /usr/bin/cygpath; then + CFLAGS="$CFLAGS -O2" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + MIXED_MINGW=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MINGW" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: undeterminable" >&5 +printf "%s\n" "undeterminable" >&6; } + as_fn_error cannot handle this! "Seems to be mixed windows but not with cygwin" "$LINENO" 5 + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mixed MSYS and native MinGW environment" >&5 +printf %s "checking for mixed MSYS and native MinGW environment... " >&6; } + if test "x$GCC" = x"yes"; then + if test -x /usr/bin/msys-=.0.dll; then + CFLAGS="$CFLAGS -O2" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + MIXED_MINGW=yes + CPPFLAGS="$CPPFLAGS -DERTS_MIXED_MINGW" + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: undeterminable" >&5 +printf "%s\n" "undeterminable" >&6; } + as_fn_error cannot handle this! "Seems to be mixed windows but not with msys" "$LINENO" 5 + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we mix cygwin with any native compiler" >&5 +printf %s "checking if we mix cygwin with any native compiler... " >&6; } +if test "X$MIXED_CYGWIN" = "Xyes"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we mix msys with another native compiler" >&5 +printf %s "checking if we mix msys with another native compiler... " >&6; } +if test "X$MIXED_MSYS" = "Xyes" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we mix WSL with another native compiler" >&5 +printf %s "checking if we mix WSL with another native compiler... " >&6; } +if test "X$MIXED_WSL" = "Xyes" ; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + +fi + + +USER_CFLAGS=$CFLAGS + +if test X"$MIXED_VC" = X"yes" ; then + CFLAGS="-Owx" +fi + +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes then : printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h @@ -5572,7 +6574,7 @@ esac case $host_os in mingw32) DEBUG_CFLAGS="-g -Wall -DDEBUG $CFLAGS" - CFLAGS="-g -Wall -O2 $CFLAGS -fomit-frame-pointer -fno-strict-aliasing" + CFLAGS="-g -Wall -O2 $CFLAGS -fomit-frame-pointer" ;; win32) DEBUG_CFLAGS="-g -Wall $CFLAGS -DDEBUG" @@ -5581,11 +6583,11 @@ case $host_os in darwin*) DEBUG_CFLAGS="-g -Wall -fPIC $CFLAGS -DDEBUG" # omit-frame-pointer causes seg faults with 10.9 and clang - CFLAGS="-g -Wall -fPIC $CFLAGS -fno-strict-aliasing" + CFLAGS="-g -Wall -fPIC $CFLAGS" ;; *) DEBUG_CFLAGS="-g -Wall -fPIC $CFLAGS -DDEBUG" - CFLAGS="-Wall -fPIC $CFLAGS -fomit-frame-pointer -fno-strict-aliasing" + CFLAGS="-Wall -fPIC $CFLAGS -fomit-frame-pointer" ;; esac @@ -5598,7 +6600,7 @@ then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-move-loop-invariants to CXXNOOPT (via CFLAGS)" >&5 printf %s "checking if we can add -fno-move-loop-invariants to CXXNOOPT (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-fno-move-loop-invariants $CXXNOOPT"; + CFLAGS="-Werror -fno-move-loop-invariants $CXXNOOPT"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5622,9 +6624,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + CXXNOOPT="-fno-move-loop-invariants $CXXNOOPT" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - CXXNOOPT="-fno-move-loop-invariants $CXXNOOPT" else case e in #( e) @@ -5638,7 +6640,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-var-tracking-assignments to CXXNOOPT (via CFLAGS)" >&5 printf %s "checking if we can add -fno-var-tracking-assignments to CXXNOOPT (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-fno-var-tracking-assignments $CXXNOOPT"; + CFLAGS="-Werror -fno-var-tracking-assignments $CXXNOOPT"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5662,9 +6664,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + CXXNOOPT="-fno-var-tracking-assignments $CXXNOOPT" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - CXXNOOPT="-fno-var-tracking-assignments $CXXNOOPT" else case e in #( e) @@ -7419,7 +8421,7 @@ then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=return-type to CFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=return-type to CFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=return-type $CFLAGS"; + CFLAGS="-Werror -Werror=return-type $CFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7443,9 +8445,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + CFLAGS="-Werror=return-type $CFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - CFLAGS="-Werror=return-type $CFLAGS" else case e in #( e) @@ -7459,7 +8461,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=return-type to CXXFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=return-type to CXXFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=return-type $CXXFLAGS"; + CFLAGS="-Werror -Werror=return-type $CXXFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -7483,9 +8485,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + CXXFLAGS="-Werror=return-type $CXXFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - CXXFLAGS="-Werror=return-type $CXXFLAGS" else case e in #( e) diff --git a/lib/wx/configure.ac b/lib/wx/configure.ac index bce9bbaa0158..87dfc595a8a1 100644 --- a/lib/wx/configure.ac +++ b/lib/wx/configure.ac @@ -89,6 +89,8 @@ WXERL_CAN_BUILD_DRIVER=false AC_MSG_NOTICE(Building for [$host_os]) WXERL_CAN_BUILD_DRIVER=true +ERL_OSSF_FLAGS + LM_WINDOWS_ENVIRONMENT USER_CFLAGS=$CFLAGS @@ -242,7 +244,7 @@ dnl ---------------------------------------------------------------------- case $host_os in mingw32) DEBUG_CFLAGS="-g -Wall -DDEBUG $CFLAGS" - CFLAGS="-g -Wall -O2 $CFLAGS -fomit-frame-pointer -fno-strict-aliasing" + CFLAGS="-g -Wall -O2 $CFLAGS -fomit-frame-pointer" ;; win32) DEBUG_CFLAGS="-g -Wall $CFLAGS -DDEBUG" @@ -251,11 +253,11 @@ case $host_os in darwin*) DEBUG_CFLAGS="-g -Wall -fPIC $CFLAGS -DDEBUG" # omit-frame-pointer causes seg faults with 10.9 and clang - CFLAGS="-g -Wall -fPIC $CFLAGS -fno-strict-aliasing" + CFLAGS="-g -Wall -fPIC $CFLAGS" ;; *) DEBUG_CFLAGS="-g -Wall -fPIC $CFLAGS -DDEBUG" - CFLAGS="-Wall -fPIC $CFLAGS -fomit-frame-pointer -fno-strict-aliasing" + CFLAGS="-Wall -fPIC $CFLAGS -fomit-frame-pointer" ;; esac diff --git a/make/autoconf/otp.m4 b/make/autoconf/otp.m4 index 51f051169372..1f2784b7d725 100644 --- a/make/autoconf/otp.m4 +++ b/make/autoconf/otp.m4 @@ -2904,20 +2904,22 @@ dnl dnl Tries a CFLAG and sees if it can be enabled without compiler errors dnl $1: textual cflag to add dnl $2: variable to store the modified CFLAG in +dnl $3: prologue dnl Usage example LM_TRY_ENABLE_CFLAG([-Werror=return-type], [CFLAGS]) dnl dnl AC_DEFUN([LM_TRY_ENABLE_CFLAG], [ AC_MSG_CHECKING([if we can add $1 to $2 (via CFLAGS)]) saved_CFLAGS=$CFLAGS; - CFLAGS="$1 $$2"; - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[can_enable_flag=true],[can_enable_flag=false]) + CFLAGS="-Werror $1 $$2"; + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$3], [[return 0;]])], + [can_enable_flag=true],[can_enable_flag=false]) CFLAGS=$saved_CFLAGS; AS_IF( [test "X$can_enable_flag" = "Xtrue"], [ - AC_MSG_RESULT([yes]) AS_VAR_SET($2, "$1 $$2") + AC_MSG_RESULT([yes]) ], [ AC_MSG_RESULT([no]) @@ -2927,7 +2929,7 @@ AC_DEFUN([LM_TRY_ENABLE_CFLAG], [ AC_DEFUN([LM_CHECK_ENABLE_CFLAG], [ AC_MSG_CHECKING([whether $CC accepts $1...]) saved_CFLAGS=$CFLAGS; - CFLAGS="$1 $CFLAGS"; + CFLAGS="-Werror $1 $CFLAGS"; AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[can_enable_flag=true],[can_enable_flag=false]) CFLAGS=$saved_CFLAGS; AS_IF( @@ -2952,7 +2954,7 @@ dnl AC_DEFUN([LM_CHECK_RUN_CFLAG], [ AC_MSG_CHECKING([whether $CC accepts $1...]) saved_CFLAGS=$CFLAGS; - CFLAGS="$1 $CFLAGS"; + CFLAGS="-Werror $1 $CFLAGS"; AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[return 0;],[can_enable_flag=true],[can_enable_flag=false]) CFLAGS=$saved_CFLAGS; AS_IF( @@ -2967,6 +2969,38 @@ AC_DEFUN([LM_CHECK_RUN_CFLAG], [ ]) ]) +dnl ---------------------------------------------------------------------- +dnl +dnl LM_TRY_ENABLE_LDFLAG +dnl +dnl +dnl Tries a LDFLAG and sees if it can be enabled without compiler errors +dnl $1: textual ldflag to add +dnl $2: variable to store the modified LDFLAG in +dnl Usage example LM_TRY_ENABLE_LDFLAG([-Wl,-z,noexecstack], [LDFLAGS]) +dnl +AC_DEFUN([LM_TRY_ENABLE_LDFLAG], [ + AC_MSG_CHECKING([if we can add $1 to $2 (via LDFLAGS)]) + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="$1"; + LDFLAGS="$saved_LDFLAG $$2"; + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[]], [[return 0;]])], + [can_enable_flag=true], + [can_enable_flag=false] + ) + LDFLAGS=$saved_LDFLAGS; + AS_IF( + [test "X$can_enable_flag" = "Xtrue"], + [ + AS_VAR_SET($2, "$saved_LDFLAG $$2") + AC_MSG_RESULT([yes]) + ], + [ + AC_MSG_RESULT([no]) + ]) +]) + dnl ERL_TRY_LINK_JAVA(CLASSES, FUNCTION-BODY dnl [ACTION_IF_FOUND [, ACTION-IF-NOT-FOUND]]) dnl Freely inspired by AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]). (Maybe better to create a @@ -3093,6 +3127,104 @@ AC_DEFUN([LM_HARDWARE_ARCH], [ AC_SUBST(ARCH) ]) +dnl +dnl-------------------------------------------------------------------- +dnl Open Source Security Foundation FLAGS +dnl +dnl Enable the flags recomended by the OSSF that we think are good for +dnl Erlang/OTP. See https://github.com/ossf/wg-best-practices-os-developers/blob/main/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.md +dnl for details. +dnl +dnl-------------------------------------------------------------------- + +AC_DEFUN([ERL_OSSF], +[ + AS_IF([test "X$host" = "Xwin32"], + [ ossf_security_hardening_default=no], + [ ossf_security_hardening_default=yes]) + AC_ARG_ENABLE(security-hardening-flags, + AS_HELP_STRING([--disable-security-hardening-flags], + [disable Open Source Security Foundation security hardening flags]), + [case "$enableval" in + no) ossf_security_hardening=no ;; + *) ossf_security_hardening=yes ;; + esac], ossf_security_hardening=$ossf_security_hardening_default) +]) + +AC_DEFUN([ERL_OSSF_CFLAGS], +[ + AS_IF([test "$ossf_security_hardening" = "yes"], + [ + LM_TRY_ENABLE_CFLAG([-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3], [$1], [#include ]) + AS_IF([test "X$can_enable_flag" = "Xfalse"], + [ + LM_TRY_ENABLE_CFLAG([-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2], [$1], [#include ]) + ]) + dnl Flags that enable stack protection mechanism + LM_TRY_ENABLE_CFLAG([-fstack-clash-protection], [$1]) + LM_TRY_ENABLE_CFLAG([-fstack-protector-strong], [$1]) + AS_IF([test "X$can_enable_flag" = "Xfalse"], + [ + LM_TRY_ENABLE_CFLAG([-fstack-protector], [$1], []) + ], + [ + # Some systems (solaris) also require this to be part of LDFLAGS + LM_TRY_ENABLE_LDFLAG([-fstack-protector-strong], [$2]) + ] + ) + LM_TRY_ENABLE_CFLAG([-fcf-protection=full], [$1]) + LM_TRY_ENABLE_CFLAG([-mbranch-protection=standard], [$1]) + LM_TRY_ENABLE_CFLAG([-fexceptions],[$1]) + + dnl Flags that protect against various UB things + LM_TRY_ENABLE_CFLAG([-fno-strict-overflow],[$1]) + LM_TRY_ENABLE_CFLAG([-fno-delete-null-pointer-checks],[$1]) + LM_TRY_ENABLE_CFLAG([-fno-strict-aliasing],[$1]) + LM_TRY_ENABLE_CFLAG([-ftrivial-auto-var-init=zero],[$1]) + LM_TRY_ENABLE_CFLAG([-fstrict-flex-arrays=3],[$1]) + AS_IF([test "X$can_enable_flag" = "Xfalse"], + [ + LM_TRY_ENABLE_CFLAG([-fstrict-flex-arrays=2], [$1]) + ], [AS_IF([test "X$can_enable_flag" != "Xtrue"], [exit 1])] + ) + ]) +]) + +AC_DEFUN([ERL_OSSF_CXXFLAGS], +[ + AS_IF([test "$ossf_security_hardening" = "yes"], + [ + LM_TRY_ENABLE_CFLAG([-D_GLIBCXX_ASSERTIONS],[$1]) + ]) +]) + +AC_DEFUN([ERL_OSSF_LDFLAGS], +[ + AS_IF([test "$ossf_security_hardening" = "yes"], + [ + dnl Stack protection + LM_TRY_ENABLE_LDFLAG([-Wl,-z,noexecstack],[$1]) + dnl Disables lazy loading of dynamic libraries + dnl and make sthe relocation area read only + LM_TRY_ENABLE_LDFLAG([-Wl,-z,relro],[$1]) + LM_TRY_ENABLE_LDFLAG([-Wl,-z,now],[$1]) + dnl Only link against dynamic libraries that are used + LM_TRY_ENABLE_LDFLAG([-Wl,--as-needed],[$1]) + dnl Don't load symbols of transative dynamic libraries + dnl that is beam.smp should not load libcrypto.so symbols + dnl when it is loading crypto.so. Only crypto.so should. + LM_TRY_ENABLE_LDFLAG([-Wl,--no-copy-dt-needed-entries],[$1]) + ]) +]) + +AC_DEFUN([ERL_OSSF_FLAGS], +[ + ERL_OSSF + ERL_OSSF_CFLAGS([CFLAGS], [LDFLAGS]) + ERL_OSSF_CXXFLAGS([CXXFLAGS]) + ERL_OSSF_LDFLAGS([LDFLAGS]) +]) + dnl dnl-------------------------------------------------------------------- dnl Dynamic Erlang Drivers @@ -3148,6 +3280,7 @@ DED_GCC=$GCC DED_CFLAGS= DED_OSTYPE=unix + case $host_os in linux*) DED_CFLAGS="-D_GNU_SOURCE" ;; @@ -3167,7 +3300,7 @@ case "$host_cpu" in *) DED_WARN_FLAGS="$DED_WARN_FLAGS -Wmissing-prototypes";; esac - + LM_TRY_ENABLE_CFLAG([-Wdeclaration-after-statement], [DED_WARN_FLAGS]) LM_TRY_ENABLE_CFLAG([-Werror=return-type], [DED_WERRORFLAGS]) @@ -3187,8 +3320,6 @@ AS_IF( # such dubious duplicates. LM_TRY_ENABLE_CFLAG([-fno-common], [DED_CFLAGS]) - LM_TRY_ENABLE_CFLAG([-fno-strict-aliasing], [DED_CFLAGS]) - DED_STATIC_CFLAGS="$DED_CFLAGS" DED_CFLAGS="$DED_CFLAGS -fPIC" # Remove -fPIE and -fno-PIE @@ -3243,7 +3374,6 @@ if test "x$DED_LD" = "x"; then if test X${enable_m64_build} = Xyes; then DED_LDFLAGS="-64 $DED_LDFLAGS" fi - DED_LD="$CC" ;; aix*|os400*) DED_LDFLAGS="-G -bnoentry -bexpall" @@ -3284,7 +3414,6 @@ if test "x$DED_LD" = "x"; then esac fi fi - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" ;; linux*) @@ -3337,6 +3466,10 @@ test "$DED_LDFLAGS_CONFTEST" != "" || DED_LDFLAGS_CONFTEST="$DED_LDFLAGS" AC_CHECK_TOOL(DED_LD, ld, false) test "$DED_LD" != "false" || AC_MSG_ERROR([No linker found]) +ERL_OSSF +ERL_OSSF_CFLAGS([DED_CFLAGS], [DED_LDFLAGS]) +ERL_OSSF_LDFLAGS([DED_LDFLAGS]) + AC_MSG_CHECKING(for static compiler flags) DED_STATIC_CFLAGS="$DED_WERRORFLAGS $DED_WARN_FLAGS $DED_THR_DEFS $DED_STATIC_CFLAGS" AC_MSG_RESULT([$DED_STATIC_CFLAGS]) diff --git a/make/configure b/make/configure index 408f8b682552..02edac7a3cbc 100755 --- a/make/configure +++ b/make/configure @@ -790,6 +790,7 @@ with_libatomic_ops enable_ensure_os_monotonic_time enable_silent_rules enable_largefile +enable_security_hardening_flags enable_year2038 ' ac_precious_vars='build_alias @@ -1503,6 +1504,9 @@ Optional Features: --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --disable-largefile omit support for large files + --disable-security-hardening-flags + disable Open Source Security Foundation security + hardening flags --disable-year2038 don't support timestamps after 2038 Optional Packages: @@ -3305,6 +3309,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + @@ -6742,6 +6759,7 @@ DED_GCC=$GCC DED_CFLAGS= DED_OSTYPE=unix + case $host_os in linux*) DED_CFLAGS="-D_GNU_SOURCE" ;; @@ -6766,7 +6784,7 @@ esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wdeclaration-after-statement to DED_WARN_FLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Wdeclaration-after-statement to DED_WARN_FLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Wdeclaration-after-statement $DED_WARN_FLAGS"; + CFLAGS="-Werror -Wdeclaration-after-statement $DED_WARN_FLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -6790,9 +6808,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WARN_FLAGS="-Wdeclaration-after-statement $DED_WARN_FLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WARN_FLAGS="-Wdeclaration-after-statement $DED_WARN_FLAGS" else case e in #( e) @@ -6807,7 +6825,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=return-type to DED_WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=return-type to DED_WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=return-type $DED_WERRORFLAGS"; + CFLAGS="-Werror -Werror=return-type $DED_WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -6831,9 +6849,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WERRORFLAGS="-Werror=return-type $DED_WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WERRORFLAGS="-Werror=return-type $DED_WERRORFLAGS" else case e in #( e) @@ -6847,7 +6865,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=implicit to DED_WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=implicit to DED_WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=implicit $DED_WERRORFLAGS"; + CFLAGS="-Werror -Werror=implicit $DED_WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -6871,9 +6889,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WERRORFLAGS="-Werror=implicit $DED_WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WERRORFLAGS="-Werror=implicit $DED_WERRORFLAGS" else case e in #( e) @@ -6887,7 +6905,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Werror=undef to DED_WERRORFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -Werror=undef to DED_WERRORFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-Werror=undef $DED_WERRORFLAGS"; + CFLAGS="-Werror -Werror=undef $DED_WERRORFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -6911,9 +6929,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : + DED_WERRORFLAGS="-Werror=undef $DED_WERRORFLAGS" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_WERRORFLAGS="-Werror=undef $DED_WERRORFLAGS" else case e in #( e) @@ -6939,7 +6957,7 @@ then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-common to DED_CFLAGS (via CFLAGS)" >&5 printf %s "checking if we can add -fno-common to DED_CFLAGS (via CFLAGS)... " >&6; } saved_CFLAGS=$CFLAGS; - CFLAGS="-fno-common $DED_CFLAGS"; + CFLAGS="-Werror -fno-common $DED_CFLAGS"; cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -6963,50 +6981,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test "X$can_enable_flag" = "Xtrue" then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } DED_CFLAGS="-fno-common $DED_CFLAGS" - -else case e in #( - e) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - ;; -esac -fi - - - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)" >&5 -printf %s "checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)... " >&6; } - saved_CFLAGS=$CFLAGS; - CFLAGS="-fno-strict-aliasing $DED_CFLAGS"; - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - can_enable_flag=true -else case e in #( - e) can_enable_flag=false ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - CFLAGS=$saved_CFLAGS; - if test "X$can_enable_flag" = "Xtrue" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - DED_CFLAGS="-fno-strict-aliasing $DED_CFLAGS" else case e in #( e) @@ -7072,7 +7049,6 @@ if test "x$DED_LD" = "x"; then if test X${enable_m64_build} = Xyes; then DED_LDFLAGS="-64 $DED_LDFLAGS" fi - DED_LD="$CC" ;; aix*|os400*) DED_LDFLAGS="-G -bnoentry -bexpall" @@ -7147,7 +7123,6 @@ printf "%s\n" "#define SIZEOF_VOID_P $ac_cv_sizeof_void_p" >>confdefs.h esac fi fi - DED_LD="$CC" DED_LD_FLAG_RUNTIME_LIBRARY_PATH="$CFLAG_RUNTIME_LIBRARY_PATH" ;; linux*) @@ -7305,6 +7280,889 @@ fi test "$DED_LD" != "false" || as_fn_error $? "No linker found" "$LINENO" 5 + + if test "X$host" = "Xwin32" +then : + ossf_security_hardening_default=no +else case e in #( + e) ossf_security_hardening_default=yes ;; +esac +fi + # Check whether --enable-security-hardening-flags was given. +if test ${enable_security_hardening_flags+y} +then : + enableval=$enable_security_hardening_flags; case "$enableval" in + no) ossf_security_hardening=no ;; + *) ossf_security_hardening=yes ;; + esac +else case e in #( + e) ossf_security_hardening=$ossf_security_hardening_default ;; +esac +fi + + + + if test "$ossf_security_hardening" = "yes" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + if test "X$can_enable_flag" = "Xfalse" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-clash-protection to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-clash-protection to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-clash-protection $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstack-clash-protection $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector-strong $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstack-protector-strong $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + if test "X$can_enable_flag" = "Xfalse" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstack-protector $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstack-protector $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +else case e in #( + e) + # Some systems (solaris) also require this to be part of LDFLAGS + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstack-protector-strong to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -fstack-protector-strong to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-fstack-protector-strong"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + ;; +esac +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fcf-protection=full to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fcf-protection=full to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fcf-protection=full $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fcf-protection=full $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -mbranch-protection=standard to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -mbranch-protection=standard to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -mbranch-protection=standard $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-mbranch-protection=standard $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fexceptions to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fexceptions to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fexceptions $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fexceptions $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-overflow to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-overflow to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-overflow $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fno-strict-overflow $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-delete-null-pointer-checks to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-delete-null-pointer-checks to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-delete-null-pointer-checks $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fno-delete-null-pointer-checks $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fno-strict-aliasing to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fno-strict-aliasing $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fno-strict-aliasing $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -ftrivial-auto-var-init=zero to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -ftrivial-auto-var-init=zero to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -ftrivial-auto-var-init=zero $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-ftrivial-auto-var-init=zero $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=3 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=3 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=3 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstrict-flex-arrays=3 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + if test "X$can_enable_flag" = "Xfalse" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -fstrict-flex-arrays=2 to DED_CFLAGS (via CFLAGS)" >&5 +printf %s "checking if we can add -fstrict-flex-arrays=2 to DED_CFLAGS (via CFLAGS)... " >&6; } + saved_CFLAGS=$CFLAGS; + CFLAGS="-Werror -fstrict-flex-arrays=2 $DED_CFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$saved_CFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_CFLAGS="-fstrict-flex-arrays=2 $DED_CFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +else case e in #( + e) if test "X$can_enable_flag" != "Xtrue" +then : + exit 1 +fi + ;; +esac +fi + +fi + + + if test "$ossf_security_hardening" = "yes" +then : + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,noexecstack to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,noexecstack to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,noexecstack"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,relro to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,relro to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,relro"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,-z,now to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,-z,now to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,-z,now"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--as-needed to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--as-needed to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--as-needed"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can add -Wl,--no-copy-dt-needed-entries to DED_LDFLAGS (via LDFLAGS)" >&5 +printf %s "checking if we can add -Wl,--no-copy-dt-needed-entries to DED_LDFLAGS (via LDFLAGS)... " >&6; } + saved_LDFLAGS=$LDFLAGS; + saved_LDFLAG="-Wl,--no-copy-dt-needed-entries"; + LDFLAGS="$saved_LDFLAG $DED_LDFLAGS"; + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + can_enable_flag=true +else case e in #( + e) can_enable_flag=false + ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$saved_LDFLAGS; + if test "X$can_enable_flag" = "Xtrue" +then : + + DED_LDFLAGS="$saved_LDFLAG $DED_LDFLAGS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; +esac +fi + + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for static compiler flags" >&5 printf %s "checking for static compiler flags... " >&6; } DED_STATIC_CFLAGS="$DED_WERRORFLAGS $DED_WARN_FLAGS $DED_THR_DEFS $DED_STATIC_CFLAGS"