Commit 5928ea9c authored by Yang Tse's avatar Yang Tse
Browse files

improve presentation of accepted/rejected debug/optimizer options

parent 47548800
Loading
Loading
Loading
Loading
+45 −35
Original line number Original line Diff line number Diff line
@@ -16,7 +16,7 @@
#***************************************************************************
#***************************************************************************


# File version for 'aclocal' use. Keep it a single number.
# File version for 'aclocal' use. Keep it a single number.
# serial 6
# serial 9




dnl CARES_CHECK_COMPILER
dnl CARES_CHECK_COMPILER
@@ -419,32 +419,37 @@ AC_DEFUN([CARES_SET_COMPILER_DEBUG_OPTS], [
  #
  #
  if test "$compiler_id" != "unknown"; then
  if test "$compiler_id" != "unknown"; then
    #
    #
    ac_save_CFLAGS="$CFLAGS"
    tmp_save_CFLAGS="$CFLAGS"
    ac_save_CPPFLAGS="$CPPFLAGS"
    tmp_save_CPPFLAGS="$CPPFLAGS"
    #
    tmp_options=""
    tmp_CFLAGS="$CFLAGS"
    tmp_CPPFLAGS="$CPPFLAGS"
    CARES_VAR_STRIP([tmp_CFLAGS],[$flags_dbg_all])
    CARES_VAR_STRIP([tmp_CPPFLAGS],[$flags_dbg_all])
    #
    #
    honor_debug_option="yes"
    CARES_VAR_STRIP([CFLAGS],[${flags_dbg_all}])
    CARES_VAR_STRIP([CPPFLAGS],[${flags_dbg_all}])
    if test "$want_debug" = "yes"; then
    if test "$want_debug" = "yes"; then
      CFLAGS="$CFLAGS $flags_dbg_yes"
      AC_MSG_CHECKING([if compiler accepts debug enabling options])
      AC_MSG_CHECKING([if compiler accepts debug enabling flags $flags_dbg_yes])
      tmp_options="$flags_dbg_yes"
    fi
    fi
    if test "$want_debug" = "no"; then
    if test "$want_debug" = "no"; then
      CFLAGS="$CFLAGS $flags_dbg_off"
      AC_MSG_CHECKING([if compiler accepts debug disabling options])
      AC_MSG_CHECKING([if compiler accepts debug disabling flags $flags_dbg_off])
      tmp_options="$flags_dbg_off"
    fi
    fi
    #
    CPPFLAGS=`eval echo $tmp_CPPFLAGS`
    CFLAGS=`eval echo $tmp_CFLAGS $tmp_options`
    CARES_COMPILER_WORKS_IFELSE([
    CARES_COMPILER_WORKS_IFELSE([
      AC_MSG_RESULT([yes])
      AC_MSG_RESULT([yes])
      AC_MSG_NOTICE([compiler options added: $tmp_options])
    ],[
    ],[
      AC_MSG_RESULT([no])
      AC_MSG_RESULT([no])
      honor_debug_option="no"
      AC_MSG_NOTICE([compiler options rejected: $tmp_options])
      dnl restore initial settings
      CPPFLAGS="$tmp_save_CPPFLAGS"
      CFLAGS="$tmp_save_CFLAGS"
    ])
    ])
    #
    #
    if test "$honor_debug_option" = "no"; then
      CFLAGS="$ac_save_CFLAGS"
      CPPFLAGS="$ac_save_CPPFLAGS"
    fi
    #
  fi
  fi
])
])


@@ -460,8 +465,13 @@ AC_DEFUN([CARES_SET_COMPILER_OPTIMIZE_OPTS], [
  #
  #
  if test "$compiler_id" != "unknown"; then
  if test "$compiler_id" != "unknown"; then
    #
    #
    ac_save_CFLAGS="$CFLAGS"
    tmp_save_CFLAGS="$CFLAGS"
    ac_save_CPPFLAGS="$CPPFLAGS"
    tmp_save_CPPFLAGS="$CPPFLAGS"
    #
    tmp_options=""
    tmp_CFLAGS="$CFLAGS"
    tmp_CPPFLAGS="$CPPFLAGS"
    honor_optimize_option="yes"
    #
    #
    dnl If optimization request setting has not been explicitly specified,
    dnl If optimization request setting has not been explicitly specified,
    dnl it has been derived from the debug setting and initially assumed.
    dnl it has been derived from the debug setting and initially assumed.
@@ -469,14 +479,13 @@ AC_DEFUN([CARES_SET_COMPILER_OPTIMIZE_OPTS], [
    dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies
    dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies
    dnl that an initially assumed optimizer setting might not be honored.
    dnl that an initially assumed optimizer setting might not be honored.
    #
    #
    honor_optimize_option="yes"
    if test "$want_optimize" = "assume_no" ||
    if test "$want_optimize" = "assume_no" ||
       test "$want_optimize" = "assume_yes"; then
       test "$want_optimize" = "assume_yes"; then
      AC_MSG_CHECKING([if compiler optimizer assumed setting might be used])
      AC_MSG_CHECKING([if compiler optimizer assumed setting might be used])
      CARES_VAR_MATCH_IFELSE([CFLAGS],[${flags_opt_all}],[
      CARES_VAR_MATCH_IFELSE([tmp_CFLAGS],[$flags_opt_all],[
        honor_optimize_option="no"
        honor_optimize_option="no"
      ])
      ])
      CARES_VAR_MATCH_IFELSE([CPPFLAGS],[${flags_opt_all}],[
      CARES_VAR_MATCH_IFELSE([tmp_CPPFLAGS],[$flags_opt_all],[
        honor_optimize_option="no"
        honor_optimize_option="no"
      ])
      ])
      AC_MSG_RESULT([$honor_optimize_option])
      AC_MSG_RESULT([$honor_optimize_option])
@@ -491,29 +500,30 @@ AC_DEFUN([CARES_SET_COMPILER_OPTIMIZE_OPTS], [
    fi
    fi
    #
    #
    if test "$honor_optimize_option" = "yes"; then
    if test "$honor_optimize_option" = "yes"; then
      CARES_VAR_STRIP([CFLAGS],[${flags_opt_all}])
      CARES_VAR_STRIP([tmp_CFLAGS],[$flags_opt_all])
      CARES_VAR_STRIP([CPPFLAGS],[${flags_opt_all}])
      CARES_VAR_STRIP([tmp_CPPFLAGS],[$flags_opt_all])
      if test "$want_optimize" = "yes"; then
      if test "$want_optimize" = "yes"; then
        CFLAGS="$CFLAGS $flags_opt_yes"
        AC_MSG_CHECKING([if compiler accepts optimizer enabling options])
        AC_MSG_CHECKING([if compiler accepts optimizer enabling flags $flags_opt_yes])
        tmp_options="$flags_opt_yes"
      fi
      fi
      if test "$want_optimize" = "no"; then
      if test "$want_optimize" = "no"; then
        CFLAGS="$CFLAGS $flags_opt_off"
        AC_MSG_CHECKING([if compiler accepts optimizer disabling options])
        AC_MSG_CHECKING([if compiler accepts optimizer disabling flags $flags_opt_off])
        tmp_options="$flags_opt_off"
      fi
      fi
      CPPFLAGS=`eval echo $tmp_CPPFLAGS`
      CFLAGS=`eval echo $tmp_CFLAGS $tmp_options`
      CARES_COMPILER_WORKS_IFELSE([
      CARES_COMPILER_WORKS_IFELSE([
        AC_MSG_RESULT([yes])
        AC_MSG_RESULT([yes])
        AC_MSG_NOTICE([compiler options added: $tmp_options])
      ],[
      ],[
        AC_MSG_RESULT([no])
        AC_MSG_RESULT([no])
        honor_optimize_option="no"
        AC_MSG_NOTICE([compiler options rejected: $tmp_options])
        dnl restore initial settings
        CPPFLAGS="$tmp_save_CPPFLAGS"
        CFLAGS="$tmp_save_CFLAGS"
      ])
      ])
    fi
    fi
    #
    #
    if test "$honor_optimize_option" = "no"; then
      CFLAGS="$ac_save_CFLAGS"
      CPPFLAGS="$ac_save_CPPFLAGS"
    fi
    #
  fi
  fi
])
])


@@ -672,7 +682,7 @@ dnl is considered positive, otherwise false.


AC_DEFUN([CARES_VAR_MATCH], [
AC_DEFUN([CARES_VAR_MATCH], [
  ac_var_match_word="no"
  ac_var_match_word="no"
  for word1 in "${[$1]}"; do
  for word1 in "$[$1]"; do
    for word2 in "[$2]"; do
    for word2 in "[$2]"; do
      if test "$word1" = "$word2"; then
      if test "$word1" = "$word2"; then
        ac_var_match_word="yes"
        ac_var_match_word="yes"
@@ -707,7 +717,7 @@ dnl from VALUE is removed from VARNAME when present.


AC_DEFUN([CARES_VAR_STRIP], [
AC_DEFUN([CARES_VAR_STRIP], [
  ac_var_stripped=""
  ac_var_stripped=""
  for word1 in "${[$1]}"; do
  for word1 in "$[$1]"; do
    ac_var_strip_word="no"
    ac_var_strip_word="no"
    for word2 in "[$2]"; do
    for word2 in "[$2]"; do
      if test "$word1" = "$word2"; then
      if test "$word1" = "$word2"; then
+45 −35
Original line number Original line Diff line number Diff line
@@ -22,7 +22,7 @@
#***************************************************************************
#***************************************************************************


# File version for 'aclocal' use. Keep it a single number.
# File version for 'aclocal' use. Keep it a single number.
# serial 5
# serial 8




dnl CURL_CHECK_COMPILER
dnl CURL_CHECK_COMPILER
@@ -425,32 +425,37 @@ AC_DEFUN([CURL_SET_COMPILER_DEBUG_OPTS], [
  #
  #
  if test "$compiler_id" != "unknown"; then
  if test "$compiler_id" != "unknown"; then
    #
    #
    ac_save_CFLAGS="$CFLAGS"
    tmp_save_CFLAGS="$CFLAGS"
    ac_save_CPPFLAGS="$CPPFLAGS"
    tmp_save_CPPFLAGS="$CPPFLAGS"
    #
    tmp_options=""
    tmp_CFLAGS="$CFLAGS"
    tmp_CPPFLAGS="$CPPFLAGS"
    CURL_VAR_STRIP([tmp_CFLAGS],[$flags_dbg_all])
    CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_dbg_all])
    #
    #
    honor_debug_option="yes"
    CURL_VAR_STRIP([CFLAGS],[${flags_dbg_all}])
    CURL_VAR_STRIP([CPPFLAGS],[${flags_dbg_all}])
    if test "$want_debug" = "yes"; then
    if test "$want_debug" = "yes"; then
      CFLAGS="$CFLAGS $flags_dbg_yes"
      AC_MSG_CHECKING([if compiler accepts debug enabling options])
      AC_MSG_CHECKING([if compiler accepts debug enabling flags $flags_dbg_yes])
      tmp_options="$flags_dbg_yes"
    fi
    fi
    if test "$want_debug" = "no"; then
    if test "$want_debug" = "no"; then
      CFLAGS="$CFLAGS $flags_dbg_off"
      AC_MSG_CHECKING([if compiler accepts debug disabling options])
      AC_MSG_CHECKING([if compiler accepts debug disabling flags $flags_dbg_off])
      tmp_options="$flags_dbg_off"
    fi
    fi
    #
    CPPFLAGS=`eval echo $tmp_CPPFLAGS`
    CFLAGS=`eval echo $tmp_CFLAGS $tmp_options`
    CURL_COMPILER_WORKS_IFELSE([
    CURL_COMPILER_WORKS_IFELSE([
      AC_MSG_RESULT([yes])
      AC_MSG_RESULT([yes])
      AC_MSG_NOTICE([compiler options added: $tmp_options])
    ],[
    ],[
      AC_MSG_RESULT([no])
      AC_MSG_RESULT([no])
      honor_debug_option="no"
      AC_MSG_NOTICE([compiler options rejected: $tmp_options])
      dnl restore initial settings
      CPPFLAGS="$tmp_save_CPPFLAGS"
      CFLAGS="$tmp_save_CFLAGS"
    ])
    ])
    #
    #
    if test "$honor_debug_option" = "no"; then
      CFLAGS="$ac_save_CFLAGS"
      CPPFLAGS="$ac_save_CPPFLAGS"
    fi
    #
  fi
  fi
])
])


@@ -466,8 +471,13 @@ AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
  #
  #
  if test "$compiler_id" != "unknown"; then
  if test "$compiler_id" != "unknown"; then
    #
    #
    ac_save_CFLAGS="$CFLAGS"
    tmp_save_CFLAGS="$CFLAGS"
    ac_save_CPPFLAGS="$CPPFLAGS"
    tmp_save_CPPFLAGS="$CPPFLAGS"
    #
    tmp_options=""
    tmp_CFLAGS="$CFLAGS"
    tmp_CPPFLAGS="$CPPFLAGS"
    honor_optimize_option="yes"
    #
    #
    dnl If optimization request setting has not been explicitly specified,
    dnl If optimization request setting has not been explicitly specified,
    dnl it has been derived from the debug setting and initially assumed.
    dnl it has been derived from the debug setting and initially assumed.
@@ -475,14 +485,13 @@ AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
    dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies
    dnl if CFLAGS or CPPFLAGS already hold optimizer flags. This implies
    dnl that an initially assumed optimizer setting might not be honored.
    dnl that an initially assumed optimizer setting might not be honored.
    #
    #
    honor_optimize_option="yes"
    if test "$want_optimize" = "assume_no" ||
    if test "$want_optimize" = "assume_no" ||
       test "$want_optimize" = "assume_yes"; then
       test "$want_optimize" = "assume_yes"; then
      AC_MSG_CHECKING([if compiler optimizer assumed setting might be used])
      AC_MSG_CHECKING([if compiler optimizer assumed setting might be used])
      CURL_VAR_MATCH_IFELSE([CFLAGS],[${flags_opt_all}],[
      CURL_VAR_MATCH_IFELSE([tmp_CFLAGS],[$flags_opt_all],[
        honor_optimize_option="no"
        honor_optimize_option="no"
      ])
      ])
      CURL_VAR_MATCH_IFELSE([CPPFLAGS],[${flags_opt_all}],[
      CURL_VAR_MATCH_IFELSE([tmp_CPPFLAGS],[$flags_opt_all],[
        honor_optimize_option="no"
        honor_optimize_option="no"
      ])
      ])
      AC_MSG_RESULT([$honor_optimize_option])
      AC_MSG_RESULT([$honor_optimize_option])
@@ -497,29 +506,30 @@ AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
    fi
    fi
    #
    #
    if test "$honor_optimize_option" = "yes"; then
    if test "$honor_optimize_option" = "yes"; then
      CURL_VAR_STRIP([CFLAGS],[${flags_opt_all}])
      CURL_VAR_STRIP([tmp_CFLAGS],[$flags_opt_all])
      CURL_VAR_STRIP([CPPFLAGS],[${flags_opt_all}])
      CURL_VAR_STRIP([tmp_CPPFLAGS],[$flags_opt_all])
      if test "$want_optimize" = "yes"; then
      if test "$want_optimize" = "yes"; then
        CFLAGS="$CFLAGS $flags_opt_yes"
        AC_MSG_CHECKING([if compiler accepts optimizer enabling options])
        AC_MSG_CHECKING([if compiler accepts optimizer enabling flags $flags_opt_yes])
        tmp_options="$flags_opt_yes"
      fi
      fi
      if test "$want_optimize" = "no"; then
      if test "$want_optimize" = "no"; then
        CFLAGS="$CFLAGS $flags_opt_off"
        AC_MSG_CHECKING([if compiler accepts optimizer disabling options])
        AC_MSG_CHECKING([if compiler accepts optimizer disabling flags $flags_opt_off])
        tmp_options="$flags_opt_off"
      fi
      fi
      CPPFLAGS=`eval echo $tmp_CPPFLAGS`
      CFLAGS=`eval echo $tmp_CFLAGS $tmp_options`
      CURL_COMPILER_WORKS_IFELSE([
      CURL_COMPILER_WORKS_IFELSE([
        AC_MSG_RESULT([yes])
        AC_MSG_RESULT([yes])
        AC_MSG_NOTICE([compiler options added: $tmp_options])
      ],[
      ],[
        AC_MSG_RESULT([no])
        AC_MSG_RESULT([no])
        honor_optimize_option="no"
        AC_MSG_NOTICE([compiler options rejected: $tmp_options])
        dnl restore initial settings
        CPPFLAGS="$tmp_save_CPPFLAGS"
        CFLAGS="$tmp_save_CFLAGS"
      ])
      ])
    fi
    fi
    #
    #
    if test "$honor_optimize_option" = "no"; then
      CFLAGS="$ac_save_CFLAGS"
      CPPFLAGS="$ac_save_CPPFLAGS"
    fi
    #
  fi
  fi
])
])


@@ -664,7 +674,7 @@ dnl is considered positive, otherwise false.


AC_DEFUN([CURL_VAR_MATCH], [
AC_DEFUN([CURL_VAR_MATCH], [
  ac_var_match_word="no"
  ac_var_match_word="no"
  for word1 in "${[$1]}"; do
  for word1 in "$[$1]"; do
    for word2 in "[$2]"; do
    for word2 in "[$2]"; do
      if test "$word1" = "$word2"; then
      if test "$word1" = "$word2"; then
        ac_var_match_word="yes"
        ac_var_match_word="yes"
@@ -699,7 +709,7 @@ dnl from VALUE is removed from VARNAME when present.


AC_DEFUN([CURL_VAR_STRIP], [
AC_DEFUN([CURL_VAR_STRIP], [
  ac_var_stripped=""
  ac_var_stripped=""
  for word1 in "${[$1]}"; do
  for word1 in "$[$1]"; do
    ac_var_strip_word="no"
    ac_var_strip_word="no"
    for word2 in "[$2]"; do
    for word2 in "[$2]"; do
      if test "$word1" = "$word2"; then
      if test "$word1" = "$word2"; then