diff --git a/config.lib b/config.lib index 7df1964ae8..cb5e4c44a2 100644 --- a/config.lib +++ b/config.lib @@ -99,6 +99,7 @@ set_default() { with_bfd_extra_debug="1" with_self_gdb_debug="1" with_self_lldb_debug="1" + with_sigaltstack="1" save_params_array=" build @@ -180,6 +181,7 @@ set_default() { with_bfd_extra_debug with_self_gdb_debug with_self_lldb_debug + with_sigaltstack CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD PKG_CONFIG_PATH PKG_CONFIG_LIBDIR" } @@ -491,6 +493,10 @@ detect_params() { --with-self-lldb-debug) with_self_lldb_debug="1";; --with-self-lldb-debug=*) with_self_lldb_debug="$optarg";; + --without-sigaltstack) with_sigaltstack="0";; + --with-sigaltstack) with_sigaltstack="1";; + --with-sigaltstack=*) with_sigaltstack="$optarg";; + CC=* | --CC=*) CC="$optarg";; CXX=* | --CXX=*) CXX="$optarg";; CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";; @@ -1817,27 +1823,31 @@ EOL CFLAGS="$CFLAGS -DWITH_UCONTEXT" fi - log 2 "executing $cc_host $CFLAGS $CFLAGS_ENV $LDFLAGS $LDFLAGS_ENV $STATIC_FLAGS -o tmp.config.sigaltstack -x c++ - -ldl" - "$cc_host" $CFLAGS $CFLAGS_ENV $LDFLAGS $LDFLAGS_ENV $STATIC_FLAGS -o tmp.config.sigaltstack -x c++ - -ldl 2> /dev/null << EOL - #include - #include - int main() { - stack_t ss; - ss.ss_sp = calloc(SIGSTKSZ, 1); - ss.ss_size = SIGSTKSZ; - ss.ss_flags = 0; - sigaltstack(&ss, nullptr); - return 0; - } + if [ "$with_sigaltstack" = "1" ]; then + log 2 "executing $cc_host $CFLAGS $CFLAGS_ENV $LDFLAGS $LDFLAGS_ENV $STATIC_FLAGS -o tmp.config.sigaltstack -x c++ - -ldl" + "$cc_host" $CFLAGS $CFLAGS_ENV $LDFLAGS $LDFLAGS_ENV $STATIC_FLAGS -o tmp.config.sigaltstack -x c++ - -ldl 2> /dev/null << EOL + #include + #include + int main() { + stack_t ss; + ss.ss_sp = calloc(SIGSTKSZ, 1); + ss.ss_size = SIGSTKSZ; + ss.ss_flags = 0; + sigaltstack(&ss, nullptr); + return 0; + } EOL - ret=$? - rm -f tmp.config.sigaltstack - log 2 " exit code $ret" - if [ $ret -ne 0 ]; then - log 1 "checking sigaltstack... no" + ret=$? + rm -f tmp.config.sigaltstack + log 2 " exit code $ret" + if [ $ret -ne 0 ]; then + log 1 "checking sigaltstack... no" + else + log 1 "checking sigaltstack... found" + CFLAGS="$CFLAGS -DWITH_SIGALTSTACK" + fi else - log 1 "checking sigaltstack... found" - CFLAGS="$CFLAGS -DWITH_SIGALTSTACK" + log 1 "checking sigaltstack... disabled" fi fi