comparison configure.in @ 1998:1d23b62cc251

[xemacs-hg @ 2004-04-07 17:43:31 by stephent] fix warning flags computation <87ekqzeln2.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Wed, 07 Apr 2004 17:43:32 +0000
parents f02e47602886
children 1ea9c87af805
comparison
equal deleted inserted replaced
1997:f02e47602886 1998:1d23b62cc251
2008 fi 2008 fi
2009 2009
2010 dnl #### This may need to be overhauled so that all of XEMACS_CC's flags 2010 dnl #### This may need to be overhauled so that all of XEMACS_CC's flags
2011 dnl are handled separately, not just the xe_cflags_warning stuff. 2011 dnl are handled separately, not just the xe_cflags_warning stuff.
2012 2012
2013 dnl Calculate value of CFLAGS: 2013 AC_MSG_CHECKING([for preferred CFLAGS])
2014
2014 dnl Use either command line flag, environment var, or autodetection 2015 dnl Use either command line flag, environment var, or autodetection
2015 if test "$cflags_specified" = "no"; then 2016 if test "$cflags_specified" = "no"; then
2016 dnl Following values of CFLAGS are known to work well. 2017 dnl Following values of CFLAGS are known to work well.
2017 dnl Should we take debugging options into consideration? 2018 dnl Should we take debugging options into consideration?
2018 if test "$GCC" = "yes"; then 2019 if test "$GCC" = "yes"; then
2031 dnl ### Add optimal CFLAGS support for other compilers HERE! 2032 dnl ### Add optimal CFLAGS support for other compilers HERE!
2032 else 2033 else
2033 CFLAGS="-O" ;dnl The only POSIX-approved flag 2034 CFLAGS="-O" ;dnl The only POSIX-approved flag
2034 fi 2035 fi
2035 fi 2036 fi
2037 AC_MSG_RESULT([${CFLAGS}])
2036 2038
2037 dnl Calculate warning flags. We separate the flags for warnings from 2039 dnl Calculate warning flags. We separate the flags for warnings from
2038 dnl the other flags because we want to force the warnings to be seen 2040 dnl the other flags because we want to force the warnings to be seen
2039 dnl by everyone who doesn't specifically override them. 2041 dnl by everyone who doesn't specifically override them.
2042
2043 AC_MSG_CHECKING([for preferred warning flags for XEMACS_CC])
2040 2044
2041 dnl If this stays nil, it will be set to cflags_warning before use. 2045 dnl If this stays nil, it will be set to cflags_warning before use.
2042 xe_cflags_warning="" 2046 xe_cflags_warning=""
2043 2047
2044 if test "$cflags_warning_specified" = "no"; then 2048 if test "$cflags_warning_specified" = "no"; then
2055 cflags_warning="$cflags_warning -Wsign-compare" 2059 cflags_warning="$cflags_warning -Wsign-compare"
2056 cflags_warning="$cflags_warning -Wundef -Wstrict-prototypes" 2060 cflags_warning="$cflags_warning -Wundef -Wstrict-prototypes"
2057 if test "$__GCC3" = "yes"; then 2061 if test "$__GCC3" = "yes"; then
2058 cflags_warning="$cflags_warning -Wpacked" 2062 cflags_warning="$cflags_warning -Wpacked"
2059 fi 2063 fi
2060 dnl Warning flags for the XEMACS_CC compiler 2064 dnl glibc is intentionally not `-Wpointer-arith'-clean.
2065 dnl Ulrich Drepper has rejected patches to fix the glibc header files.
2066 test "$have_glibc" != "yes" && \
2067 cflags_warning="$cflags_warning -Wpointer-arith"
2068 dnl Warning flags that may differ for gcc and g++ (xemacs_compiler)
2061 dnl With g++, -Wshadow produces five zillion utterly random warnings -- 2069 dnl With g++, -Wshadow produces five zillion utterly random warnings --
2062 dnl a local var named `buffer' conflicts with `struct buffer' for 2070 dnl a local var named `buffer' conflicts with `struct buffer' for
2063 dnl example. Even with gcc, -Wshadow is questionable because of its 2071 dnl example. Even with gcc, -Wshadow is questionable because of its
2064 dnl complaints about parameters with the same names as global functions. 2072 dnl complaints about parameters with the same names as global functions.
2065 dnl There is no -Wmissing-declarations under g++. 2073 dnl There is no -Wmissing-declarations under g++.
2066 dnl But gcc warns about -Weffc++ in C compiles. 2074 dnl But gcc warns about -Weffc++ in C compiles.
2067 test "$xemacs_compiler" = "g++" && \ 2075 test "$xemacs_compiler" = "g++" && \
2068 xe_cflags_warning="$cflags_warning -Weffc++" 2076 xe_cflags_warning="$cflags_warning -Weffc++"
2069 cflags_warning="$cflags_warning -Wshadow -Wmissing-declarations" 2077 cflags_warning="$cflags_warning -Wshadow -Wmissing-declarations"
2070 dnl glibc is intentionally not `-Wpointer-arith'-clean. 2078 dnl **** If more gcc/g++ flags are added, from here on must handle
2071 dnl Ulrich Drepper has rejected patches to fix the glibc header files. 2079 dnl **** cflags_warning and xe_cflags_warning in parallel
2072 test "$have_glibc" != "yes" && \
2073 cflags_warning="$cflags_warning -Wpointer-arith"
2074 elif test "$__ICC" = "yes"; then 2080 elif test "$__ICC" = "yes"; then
2075 cflags_warning="-Wall -w1" 2081 cflags_warning="-Wall -w1"
2076 dnl **** If more gcc/g++ flags are added, from here on must handle
2077 dnl **** cflags_warning and xe_cflags_warning in parallel
2078 dnl ### Add optimal cflags_warning support for other compilers HERE! 2082 dnl ### Add optimal cflags_warning support for other compilers HERE!
2079 fi 2083 fi
2080 fi 2084 fi
2085 test -z "$xe_cflags_warning" && xe_cflags_warning="$cflags_warning"
2086 AC_MSG_RESULT([${xe_cflags_warning}])
2087
2088 AC_MSG_CHECKING([for preferred warning flags for CC])
2089 AC_MSG_RESULT([${cflags_warning}])
2081 2090
2082 dnl Now combine all C flags. Put the warning flags first so that 2091 dnl Now combine all C flags. Put the warning flags first so that
2083 dnl user-specified flags will override. 2092 dnl user-specified flags will override.
2084 dnl Do XE_CFLAGS before adding warning flags to CFLAGS. 2093 dnl Do XE_CFLAGS before adding warning flags to CFLAGS.
2085 dnl Flags for XEMACS_CC: 2094 dnl Flags for XEMACS_CC:
2086 test -z "xe_cflags_warning" && xe_cflags_warning=cflags_warning
2087 XE_CFLAGS="$xe_cflags_warning $CFLAGS" 2095 XE_CFLAGS="$xe_cflags_warning $CFLAGS"
2088 dnl Flags for CC: 2096 dnl Flags for CC:
2089 CFLAGS="$cflags_warning $CFLAGS" 2097 CFLAGS="$cflags_warning $CFLAGS"
2090 2098
2091 dnl Search for GCC specific build problems we know about 2099 dnl Search for GCC specific build problems we know about