Do not let external specification of CFLAGS stop us from adding

-fno-strict-aliasing.
This commit is contained in:
Tom Lane 2004-02-02 04:08:12 +00:00
parent a60442a446
commit 3c373885fa
3 changed files with 103 additions and 2 deletions

View File

@ -1,5 +1,5 @@
# Macros to detect C compiler features
# $Header: /cvsroot/pgsql/config/c-compiler.m4,v 1.5 2002/03/29 17:32:53 petere Exp $
# $Header: /cvsroot/pgsql/config/c-compiler.m4,v 1.5.2.1 2004/02/02 04:08:02 tgl Exp $
# PGAC_C_SIGNED
@ -92,3 +92,32 @@ AC_DEFINE_UNQUOTED(AS_TR_CPP(alignof_$1),
[$AS_TR_SH([pgac_cv_alignof_$1])],
[The alignment requirement of a `$1'])
])# PGAC_CHECK_ALIGNOF
# 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

67
configure vendored
View File

@ -2437,6 +2437,73 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "$ac_env_CFLAGS_set" = set; then
CFLAGS=$ac_env_CFLAGS_value
fi
# Need to specify -fno-strict-aliasing too in case it's gcc 3.3 or later.
echo "$as_me:$LINENO: checking how to turn off strict aliasing in $CC" >&5
echo $ECHO_N "checking how to turn off strict aliasing in $CC... $ECHO_C" >&6
if test "${pgac_cv_prog_cc_no_strict_aliasing+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
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"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
pgac_cv_prog_cc_no_strict_aliasing=$pgac_try
break
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
done
CFLAGS=$pgac_save_CFLAGS
fi
echo "$as_me:$LINENO: result: $pgac_cv_prog_cc_no_strict_aliasing" >&5
echo "${ECHO_T}$pgac_cv_prog_cc_no_strict_aliasing" >&6
if test x"$pgac_cv_prog_cc_no_strict_aliasing" != x""; then
CFLAGS="$CFLAGS $pgac_cv_prog_cc_no_strict_aliasing"
fi
# supply -g if --enable-debug
if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
CFLAGS="$CFLAGS -g"
fi

View File

@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
dnl $Header: /cvsroot/pgsql/configure.in,v 1.217.2.11 2003/12/02 16:23:03 tgl Exp $
dnl $Header: /cvsroot/pgsql/configure.in,v 1.217.2.12 2004/02/02 04:08:12 tgl Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
@ -249,6 +249,11 @@ AC_PROG_CC([$pgac_cc_list])
if test "$ac_env_CFLAGS_set" = set; then
CFLAGS=$ac_env_CFLAGS_value
fi
# Need to specify -fno-strict-aliasing too in case it's gcc 3.3 or later.
PGAC_PROG_CC_NO_STRICT_ALIASING
# supply -g if --enable-debug
if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
CFLAGS="$CFLAGS -g"
fi