diff options
author | Neil Conway <neilc@samurai.com> | 2004-10-20 02:12:07 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2004-10-20 02:12:07 +0000 |
commit | 857e210ea9dd3488c26356901301a3f466f7dbbf (patch) | |
tree | ea510dd6919d7e72bfc5d228525f7a965e589bfd /config | |
parent | a1bc728cf92c0df4477d80ff845c6e81d2ccf501 (diff) | |
download | postgresql-857e210ea9dd3488c26356901301a3f466f7dbbf.tar.gz |
When using GCC, change the default CFLAGS to:
-O2 -Wall -Wmissing-prototypes -Wpointer-arith
Check whether the version of GCC we are using supports any of:
-Wdeclaration-after-statement
-Wendif-labels
-Wold-style-definition
And add the supported flags to CFLAGS.
Diffstat (limited to 'config')
-rw-r--r-- | config/c-compiler.m4 | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index 2acd3cd04a..98081bee25 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -1,5 +1,5 @@ # Macros to detect C compiler features -# $PostgreSQL: pgsql/config/c-compiler.m4,v 1.12 2004/02/02 04:07:18 tgl Exp $ +# $PostgreSQL: pgsql/config/c-compiler.m4,v 1.13 2004/10/20 02:12:07 neilc Exp $ # PGAC_C_SIGNED @@ -121,35 +121,19 @@ AC_DEFINE(HAVE_FUNCNAME__FUNCTION, 1, fi fi])# PGAC_C_FUNCNAME_SUPPORT - -# PGAC_PROG_CC_NO_STRICT_ALIASING -# ------------------------------- -# Find out how to turn off strict aliasing in the C compiler. -AC_DEFUN([PGAC_PROG_CC_NO_STRICT_ALIASING], -[AC_CACHE_CHECK([how to turn off strict aliasing in $CC], - pgac_cv_prog_cc_no_strict_aliasing, -[pgac_save_CFLAGS=$CFLAGS -if test "$GCC" = yes; then - pgac_try="-fno-strict-aliasing" -else - # Maybe fill in later... - pgac_try= -fi - -for pgac_flag in $pgac_try; do - CFLAGS="$pgac_save_CFLAGS $pgac_flag" - _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], - [pgac_cv_prog_cc_no_strict_aliasing=$pgac_try -break]) -done - -CFLAGS=$pgac_save_CFLAGS -]) - -if test x"$pgac_cv_prog_cc_no_strict_aliasing" != x""; then - CFLAGS="$CFLAGS $pgac_cv_prog_cc_no_strict_aliasing" -fi])# PGAC_PROG_CC_NO_STRICT_ALIASING - +# PGAC_PROG_CC_CFLAGS_OPT +# ----------------------- +# Given a string, check if the compiler supports the string as a +# command-line option. If it does, add the string to CFLAGS. +AC_DEFUN([PGAC_PROG_CC_CFLAGS_OPT], +[AC_MSG_CHECKING([if $CC supports $1]) +pgac_save_CFLAGS=$CFLAGS +CFLAGS="$pgac_save_CFLAGS $1" +_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + AC_MSG_RESULT(yes), + [CFLAGS="$pgac_save_CFLAGS" + AC_MSG_RESULT(no)]) +])# PGAC_PROG_CC_CFLAGS_OPT # The below backpatches the following Autoconf change: # |