1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-25 01:28:51 -05:00

configure: do not strip out debug flags

To allow users to set them when invoking configure without using
--with-debug.

Reported-by: Alex Xu
Fixes #7216
Closes #7267
This commit is contained in:
Daniel Stenberg 2021-06-16 14:14:54 +02:00
parent fa34353d07
commit 6dd35dd3b5
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
# Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
@ -33,9 +33,7 @@ AC_DEFUN([CURL_CHECK_COMPILER], [
compiler_id="unknown"
compiler_num="0"
#
flags_dbg_all="unknown"
flags_dbg_yes="unknown"
flags_dbg_off="unknown"
flags_opt_all="unknown"
flags_opt_yes="unknown"
flags_opt_off="unknown"
@ -106,16 +104,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_CLANG], [
clangvhi=`echo $clangver | cut -d . -f1`
clangvlo=`echo $clangver | cut -d . -f2`
compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
flags_dbg_all="-g -g0 -g1 -g2 -g3"
flags_dbg_all="$flags_dbg_all -ggdb"
flags_dbg_all="$flags_dbg_all -gstabs"
flags_dbg_all="$flags_dbg_all -gstabs+"
flags_dbg_all="$flags_dbg_all -gcoff"
flags_dbg_all="$flags_dbg_all -gxcoff"
flags_dbg_all="$flags_dbg_all -gdwarf-2"
flags_dbg_all="$flags_dbg_all -gvms"
flags_dbg_yes="-g"
flags_dbg_off=""
flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4"
flags_opt_yes="-Os"
flags_opt_off="-O0"
@ -137,9 +126,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_DEC_C], [
test "$curl_cv_have_def___DECC_VER" = "yes"; then
AC_MSG_RESULT([yes])
compiler_id="DEC_C"
flags_dbg_all="-g -g0 -g1 -g2 -g3"
flags_dbg_yes="-g2"
flags_dbg_off=""
flags_opt_all="-O -O0 -O1 -O2 -O3 -O4"
flags_opt_yes="-O1"
flags_opt_off="-O0"
@ -175,16 +162,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_GNU_C], [
gccvhi=`echo $gccver | cut -d . -f1`
gccvlo=`echo $gccver | cut -d . -f2`
compiler_num=`(expr $gccvhi "*" 100 + $gccvlo) 2>/dev/null`
flags_dbg_all="-g -g0 -g1 -g2 -g3"
flags_dbg_all="$flags_dbg_all -ggdb"
flags_dbg_all="$flags_dbg_all -gstabs"
flags_dbg_all="$flags_dbg_all -gstabs+"
flags_dbg_all="$flags_dbg_all -gcoff"
flags_dbg_all="$flags_dbg_all -gxcoff"
flags_dbg_all="$flags_dbg_all -gdwarf-2"
flags_dbg_all="$flags_dbg_all -gvms"
flags_dbg_yes="-g"
flags_dbg_off=""
flags_opt_all="-O -O0 -O1 -O2 -O3 -Os -Og -Ofast"
flags_opt_yes="-O2"
flags_opt_off="-O0"
@ -205,9 +183,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_HPUX_C], [
if test "$curl_cv_have_def___HP_cc" = "yes"; then
AC_MSG_RESULT([yes])
compiler_id="HP_UX_C"
flags_dbg_all="-g -s"
flags_dbg_yes="-g"
flags_dbg_off="-s"
flags_opt_all="-O +O0 +O1 +O2 +O3 +O4"
flags_opt_yes="+O2"
flags_opt_off="+O0"
@ -227,9 +203,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_IBM_C], [
if test "$curl_cv_have_def___IBMC__" = "yes"; then
AC_MSG_RESULT([yes])
compiler_id="IBM_C"
flags_dbg_all="-g -g0 -g1 -g2 -g3"
flags_dbg_yes="-g"
flags_dbg_off=""
flags_opt_all="-O -O0 -O1 -O2 -O3 -O4 -O5"
flags_opt_all="$flags_opt_all -qnooptimize"
flags_opt_all="$flags_opt_all -qoptimize=0"
@ -261,24 +235,13 @@ AC_DEFUN([CURL_CHECK_COMPILER_INTEL_C], [
CURL_CHECK_DEF([__unix__], [], [silent])
if test "$curl_cv_have_def___unix__" = "yes"; then
compiler_id="INTEL_UNIX_C"
flags_dbg_all="-g -g0"
flags_dbg_yes="-g"
flags_dbg_off=""
flags_opt_all="-O -O0 -O1 -O2 -O3 -Os"
flags_opt_yes="-O2"
flags_opt_off="-O0"
else
compiler_id="INTEL_WINDOWS_C"
flags_dbg_all="/ZI /Zi /zI /zi /ZD /Zd /zD /zd /Z7 /z7 /Oy /Oy-"
flags_dbg_all="$flags_dbg_all /debug"
flags_dbg_all="$flags_dbg_all /debug:none"
flags_dbg_all="$flags_dbg_all /debug:minimal"
flags_dbg_all="$flags_dbg_all /debug:partial"
flags_dbg_all="$flags_dbg_all /debug:full"
flags_dbg_all="$flags_dbg_all /debug:semantic_stepping"
flags_dbg_all="$flags_dbg_all /debug:extended"
flags_dbg_yes="/Zi /Oy-"
flags_dbg_off="/debug:none /Oy-"
flags_opt_all="/O /O0 /O1 /O2 /O3 /Od /Og /Og- /Oi /Oi-"
flags_opt_yes="/O2"
flags_opt_off="/Od"
@ -299,9 +262,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_LCC], [
if test "$curl_cv_have_def___LCC__" = "yes"; then
AC_MSG_RESULT([yes])
compiler_id="LCC"
flags_dbg_all="-g"
flags_dbg_yes="-g"
flags_dbg_off=""
flags_opt_all=""
flags_opt_yes=""
flags_opt_off=""
@ -325,9 +286,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPS_C], [
test "$compiler_id" = "unknown"; then
AC_MSG_RESULT([yes])
compiler_id="SGI_MIPS_C"
flags_dbg_all="-g -g0 -g1 -g2 -g3"
flags_dbg_yes="-g"
flags_dbg_off=""
flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
flags_opt_yes="-O2"
flags_opt_off="-O0"
@ -352,9 +311,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_SGI_MIPSPRO_C], [
test "$curl_cv_have_def__COMPILER_VERSION" = "yes"); then
AC_MSG_RESULT([yes])
compiler_id="SGI_MIPSPRO_C"
flags_dbg_all="-g -g0 -g1 -g2 -g3"
flags_dbg_yes="-g"
flags_dbg_off=""
flags_opt_all="-O -O0 -O1 -O2 -O3 -Ofast"
flags_opt_yes="-O2"
flags_opt_off="-O0"
@ -374,9 +331,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_SUNPRO_C], [
if test "$curl_cv_have_def___SUNPRO_C" = "yes"; then
AC_MSG_RESULT([yes])
compiler_id="SUNPRO_C"
flags_dbg_all="-g -s"
flags_dbg_yes="-g"
flags_dbg_off="-s"
flags_opt_all="-O -xO -xO1 -xO2 -xO3 -xO4 -xO5"
flags_opt_yes="-xO2"
flags_opt_off=""
@ -396,9 +351,7 @@ AC_DEFUN([CURL_CHECK_COMPILER_TINY_C], [
if test "$curl_cv_have_def___TINYC__" = "yes"; then
AC_MSG_RESULT([yes])
compiler_id="TINY_C"
flags_dbg_all="-g -b"
flags_dbg_yes="-g"
flags_dbg_off=""
flags_opt_all=""
flags_opt_yes=""
flags_opt_off=""
@ -420,17 +373,13 @@ AC_DEFUN([CURL_CHECK_COMPILER_WATCOM_C], [
CURL_CHECK_DEF([__UNIX__], [], [silent])
if test "$curl_cv_have_def___UNIX__" = "yes"; then
compiler_id="WATCOM_UNIX_C"
flags_dbg_all="-g1 -g1+ -g2 -g3"
flags_dbg_yes="-g2"
flags_dbg_off=""
flags_opt_all="-O0 -O1 -O2 -O3"
flags_opt_yes="-O2"
flags_opt_off="-O0"
else
compiler_id="WATCOM_WINDOWS_C"
flags_dbg_all=""
flags_dbg_yes=""
flags_dbg_off=""
flags_opt_all=""
flags_opt_yes=""
flags_opt_off=""
@ -745,17 +694,11 @@ AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [
tmp_options=""
tmp_CFLAGS="$CFLAGS"
tmp_CPPFLAGS="$CPPFLAGS"
CURL_VAR_STRIP([tmp_CFLAGS],[$flags_dbg_all])
CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_dbg_all])
#
if test "$want_debug" = "yes"; then
AC_MSG_CHECKING([if compiler accepts debug enabling options])
tmp_options="$flags_dbg_yes"
fi
if test "$want_debug" = "no"; then
AC_MSG_CHECKING([if compiler accepts debug disabling options])
tmp_options="$flags_dbg_off"
fi
#
if test "$flags_prefer_cppflags" = "yes"; then
CPPFLAGS="$tmp_CPPFLAGS $tmp_options"
@ -766,17 +709,6 @@ AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [
fi
squeeze CPPFLAGS
squeeze CFLAGS
CURL_COMPILER_WORKS_IFELSE([
AC_MSG_RESULT([yes])
AC_MSG_NOTICE([compiler options added: $tmp_options])
],[
AC_MSG_RESULT([no])
AC_MSG_WARN([compiler options rejected: $tmp_options])
dnl restore initial settings
CPPFLAGS="$tmp_save_CPPFLAGS"
CFLAGS="$tmp_save_CFLAGS"
])
#
fi
])