1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

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.
This commit is contained in:
Neil Conway
2004-10-20 02:12:07 +00:00
parent a1bc728cf9
commit 857e210ea9
4 changed files with 175 additions and 60 deletions

View File

@ -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:
#