diff options
Diffstat (limited to 'gcc/configure.ac')
-rw-r--r-- | gcc/configure.ac | 118 |
1 files changed, 15 insertions, 103 deletions
diff --git a/gcc/configure.ac b/gcc/configure.ac index 0f13e99fd40..a6cde5bc47a 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -319,105 +319,18 @@ AC_CHECK_TYPES([__int64], [AC_CHECK_SIZEOF(__int64)]) # * overlong strings # So, we only use -pedantic if we can disable those warnings. -AC_CACHE_CHECK( - [whether ${CC} accepts -Wno-long-long], - [ac_cv_prog_cc_w_no_long_long], - [save_CFLAGS="$CFLAGS" - CFLAGS="-Wno-long-long" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], - [ac_cv_prog_cc_w_no_long_long=yes], - [ac_cv_prog_cc_w_no_long_long=no]) - CFLAGS="$save_CFLAGS" - ]) - -AC_CACHE_CHECK( - [whether ${CC} accepts -Wno-variadic-macros], - [ac_cv_prog_cc_w_no_variadic_macros], - [save_CFLAGS="$CFLAGS" - CFLAGS="-Wno-variadic-macros" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], - [ac_cv_prog_cc_w_no_variadic_macros=yes], - [ac_cv_prog_cc_w_no_variadic_macros=no]) - CFLAGS="$save_CFLAGS" - ]) - -AC_CACHE_CHECK( - [whether ${CC} accepts -Wno-overlength-strings], - [ac_cv_prog_cc_w_no_overlength_strings], - [save_CFLAGS="$CFLAGS" - CFLAGS="-Wno-overlength-strings" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], - [ac_cv_prog_cc_w_no_overlength_strings=yes], - [ac_cv_prog_cc_w_no_overlength_strings=no]) - CFLAGS="$save_CFLAGS" - ]) - -strict_warn= -if test $ac_cv_prog_cc_w_no_long_long = yes \ - && test $ac_cv_prog_cc_w_no_variadic_macros = yes \ - && test $ac_cv_prog_cc_w_no_overlength_strings = yes ; then - strict_warn="-pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings" -fi - -# Add -Wold-style-definition if it's accepted -AC_CACHE_CHECK( - [whether ${CC} accepts -Wold-style-definition], - [ac_cv_prog_cc_w_old_style_definition], - [save_CFLAGS="$CFLAGS" - CFLAGS="-Wold-style-definition" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], - [ac_cv_prog_cc_w_old_style_definition=yes], - [ac_cv_prog_cc_w_old_style_definition=no]) - CFLAGS="$save_CFLAGS" - ]) -if test $ac_cv_prog_cc_w_old_style_definition = yes ; then - strict_warn="${strict_warn} -Wold-style-definition" -fi - -# Add -Wmissing-format-attribute if it's accepted -AC_CACHE_CHECK( - [whether ${CC} accepts -Wmissing-format-attribute], - [ac_cv_prog_cc_w_missing_format_attribute], - [save_CFLAGS="$CFLAGS" - CFLAGS="-Wmissing-format-attribute" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], - [ac_cv_prog_cc_w_missing_format_attribute=yes], - [ac_cv_prog_cc_w_missing_format_attribute=no]) - CFLAGS="$save_CFLAGS" - ]) -if test $ac_cv_prog_cc_w_missing_format_attribute = yes ; then - strict_warn="${strict_warn} -Wmissing-format-attribute" -fi - -# Enable -Werror, period. -AC_ARG_ENABLE(werror_always, -[ --enable-werror-always enable -Werror always], [], -[enable_werror_always=no]) -if test x${enable_werror_always} = xyes ; then - strict_warn="${strict_warn} -Werror" -fi -AC_SUBST(strict_warn) - -# Get C++ compatibility warning flag, if supported. -AC_CACHE_CHECK( - [whether ${CC} accepts -Wc++-compat], - [ac_cv_prog_cc_w_cxx_compat], - [save_CFLAGS="$CFLAGS" - CFLAGS="-Wc++-compat" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], - [ac_cv_prog_cc_w_cxx_compat=yes], - [ac_cv_prog_cc_w_cxx_compat=no]) - CFLAGS="$save_CFLAGS" - ]) -if test x${ac_cv_prog_cc_w_cxx_compat} = xyes; then - cxx_compat_warn="-Wc++-compat" -fi -AC_SUBST(cxx_compat_warn) - - -# If the native compiler is GCC, we can enable warnings even in stage1. -# That's useful for people building cross-compilers, or just running a -# quick `make'. +ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \ + -Wmissing-prototypes], [loose_warn]) +ACX_PROG_CC_WARNING_OPTS([-Wc++-compat], [cxx_compat_warn]) +ACX_PROG_CC_WARNING_OPTS([-Wold-style-definition \ + -Wmissing-format-attribute], [strict_warn]) +ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long -Wno-variadic-macros \ + -Wno-overlength-strings], [strict_warn]) +ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual], [strict_warn]) + +# The above macros do nothing if the compiler is not GCC. However, the +# Makefile has more goo to add other flags, so this variabl is used to +# enables warnings only for GCC. warn_cflags= if test "x$GCC" = "xyes"; then warn_cflags='$(GCC_WARN_CFLAGS)' @@ -888,15 +801,12 @@ gcc_AC_PROG_CMP_IGNORE_INITIAL # See if we have the mktemp command. AC_CHECK_PROG(have_mktemp_command, mktemp, yes, no) -MISSING="${CONFIG_SHELL-/bin/sh} $srcdir/../missing" - # See if makeinfo has been installed and is modern enough # that we can use it. -gcc_AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version, +ACX_CHECK_PROG_VER(MAKEINFO, makeinfo, --version, [GNU texinfo.* \([0-9][0-9.]*\)], [4.[4-9]*]) if test $gcc_cv_prog_makeinfo_modern = no; then - MAKEINFO="$MISSING makeinfo" AC_MSG_WARN([ *** Makeinfo is missing or too old. *** Info documentation will not be built.]) @@ -917,6 +827,8 @@ else fi AC_SUBST(GENERATED_MANPAGES) +MISSING="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing" + # How about lex? dnl Don't use AC_PROG_LEX; we insist on flex. dnl LEXLIB is not useful in gcc. |