Commit 37278c06 authored by Tom Lane's avatar Tom Lane

Cause the default CFLAGS to be -O2 -fno-strict-aliasing when using gcc,

per recent pghackers discussions.  Also ensure that explicitly setting
CFLAGS in the configure environment will be honored.
parent 3992f1c5
...@@ -2389,17 +2389,27 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ...@@ -2389,17 +2389,27 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# #
. "$srcdir/src/template/$template" || exit . "$srcdir/src/template/$template" || exit
# adjust CFLAGS per template # The template may have supplied a default setting for CFLAGS.
# Override this if CFLAGS was set in the original environment.
if test "$ac_env_CFLAGS_set" = set; then if test "$ac_env_CFLAGS_set" = set; then
CFLAGS=$ac_env_CFLAGS_value CFLAGS=$ac_env_CFLAGS_value
else
# autoconf already set the default CFLAGS for gcc to be -O2, but we
# need to specify -fno-strict-aliasing too in case it's gcc 3.3 or later.
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -fno-strict-aliasing"
fi
fi fi
if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then # supply -g if --enable-debug
if test "$enable_debug" = yes -a "$ac_cv_prog_cc_g" = yes; then
CFLAGS="$CFLAGS -g" CFLAGS="$CFLAGS -g"
else fi
# configure sets CFLAGS to -O2 for gcc, so this is only for non-gcc # default to -O rather than empty CFLAGS; this path will not be taken for
if test x"$CFLAGS" = x""; then # gcc (since autoconf supplies -O2), nor if --enable-debug (because -O -g
# doesn't work on most non-gcc compilers), nor if the template provided
# some CFLAGS.
if test "$ac_env_CFLAGS_set" != set -a x"$CFLAGS" = x""; then
CFLAGS="-O" CFLAGS="-O"
fi
fi fi
{ echo "$as_me:$LINENO: using CFLAGS=$CFLAGS" >&5 { echo "$as_me:$LINENO: using CFLAGS=$CFLAGS" >&5
echo "$as_me: using CFLAGS=$CFLAGS" >&6;} echo "$as_me: using CFLAGS=$CFLAGS" >&6;}
...@@ -2457,7 +2467,7 @@ echo "$as_me: error: cannot proceed" >&2;} ...@@ -2457,7 +2467,7 @@ echo "$as_me: error: cannot proceed" >&2;}
fi fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
# Defend against gcc -ffastmath # Defend against gcc -ffast-math
if test "$GCC" = yes; then if test "$GCC" = yes; then
cat >conftest.$ac_ext <<_ACEOF cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure" #line $LINENO "configure"
......
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
dnl $Header: /cvsroot/pgsql/configure.in,v 1.295 2003/10/14 00:48:09 momjian Exp $ dnl $Header: /cvsroot/pgsql/configure.in,v 1.296 2003/10/15 22:23:56 tgl Exp $
dnl dnl
dnl Developers, please strive to achieve this order: dnl Developers, please strive to achieve this order:
dnl dnl
...@@ -234,17 +234,27 @@ AC_PROG_CC([$pgac_cc_list]) ...@@ -234,17 +234,27 @@ AC_PROG_CC([$pgac_cc_list])
# #
. "$srcdir/src/template/$template" || exit . "$srcdir/src/template/$template" || exit
# adjust CFLAGS per template # The template may have supplied a default setting for CFLAGS.
# Override this if CFLAGS was set in the original environment.
if test "$ac_env_CFLAGS_set" = set; then if test "$ac_env_CFLAGS_set" = set; then
CFLAGS=$ac_env_CFLAGS_value CFLAGS=$ac_env_CFLAGS_value
else
# autoconf already set the default CFLAGS for gcc to be -O2, but we
# need to specify -fno-strict-aliasing too in case it's gcc 3.3 or later.
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -fno-strict-aliasing"
fi
fi fi
if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then # supply -g if --enable-debug
if test "$enable_debug" = yes -a "$ac_cv_prog_cc_g" = yes; then
CFLAGS="$CFLAGS -g" CFLAGS="$CFLAGS -g"
else fi
# configure sets CFLAGS to -O2 for gcc, so this is only for non-gcc # default to -O rather than empty CFLAGS; this path will not be taken for
if test x"$CFLAGS" = x""; then # gcc (since autoconf supplies -O2), nor if --enable-debug (because -O -g
# doesn't work on most non-gcc compilers), nor if the template provided
# some CFLAGS.
if test "$ac_env_CFLAGS_set" != set -a x"$CFLAGS" = x""; then
CFLAGS="-O" CFLAGS="-O"
fi
fi fi
AC_MSG_NOTICE([using CFLAGS=$CFLAGS]) AC_MSG_NOTICE([using CFLAGS=$CFLAGS])
...@@ -261,7 +271,7 @@ AC_TRY_LINK([], [return 0;], ...@@ -261,7 +271,7 @@ AC_TRY_LINK([], [return 0;],
[AC_MSG_RESULT(no) [AC_MSG_RESULT(no)
AC_MSG_ERROR([cannot proceed])]) AC_MSG_ERROR([cannot proceed])])
# Defend against gcc -ffastmath # Defend against gcc -ffast-math
if test "$GCC" = yes; then if test "$GCC" = yes; then
AC_TRY_COMPILE([], [@%:@ifdef __FAST_MATH__ AC_TRY_COMPILE([], [@%:@ifdef __FAST_MATH__
choke me choke me
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment