Fix CFLAGS selection to actually work. Add test to detect whether gcc's
option -fno-strict-aliasing is available.
This commit is contained in:
parent
6db0a6b035
commit
378f59904a
@ -1,5 +1,5 @@
|
|||||||
# Macros to detect C compiler features
|
# Macros to detect C compiler features
|
||||||
# $Header: /cvsroot/pgsql/config/c-compiler.m4,v 1.8 2003/04/24 21:16:42 tgl Exp $
|
# $Header: /cvsroot/pgsql/config/c-compiler.m4,v 1.9 2003/10/25 15:32:11 petere Exp $
|
||||||
|
|
||||||
|
|
||||||
# PGAC_C_SIGNED
|
# PGAC_C_SIGNED
|
||||||
@ -97,7 +97,7 @@ AC_DEFINE_UNQUOTED(AS_TR_CPP(alignof_$1),
|
|||||||
|
|
||||||
|
|
||||||
# PGAC_C_FUNCNAME_SUPPORT
|
# PGAC_C_FUNCNAME_SUPPORT
|
||||||
# -------------
|
# -----------------------
|
||||||
# Check if the C compiler understands __func__ (C99) or __FUNCTION__ (gcc).
|
# Check if the C compiler understands __func__ (C99) or __FUNCTION__ (gcc).
|
||||||
# Define HAVE_FUNCNAME__FUNC or HAVE_FUNCNAME__FUNCTION accordingly.
|
# Define HAVE_FUNCNAME__FUNC or HAVE_FUNCNAME__FUNCTION accordingly.
|
||||||
AC_DEFUN([PGAC_C_FUNCNAME_SUPPORT],
|
AC_DEFUN([PGAC_C_FUNCNAME_SUPPORT],
|
||||||
@ -120,3 +120,32 @@ AC_DEFINE(HAVE_FUNCNAME__FUNCTION, 1,
|
|||||||
[Define to 1 if your compiler understands __FUNCTION__.])
|
[Define to 1 if your compiler understands __FUNCTION__.])
|
||||||
fi
|
fi
|
||||||
fi])# PGAC_C_FUNCNAME_SUPPORT
|
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 "$ac_env_CFLAGS_set" != set; then
|
||||||
|
CFLAGS="$CFLAGS $pgac_cv_prog_cc_no_strict_aliasing"
|
||||||
|
fi])# PGAC_PROG_CC_NO_STRICT_ALIASING
|
||||||
|
101
configure
vendored
101
configure
vendored
@ -841,7 +841,7 @@ Optional Features:
|
|||||||
--enable-nls[=LANGUAGES] enable Native Language Support
|
--enable-nls[=LANGUAGES] enable Native Language Support
|
||||||
--disable-shared do not build shared libraries
|
--disable-shared do not build shared libraries
|
||||||
--disable-rpath do not embed shared library search path in executables
|
--disable-rpath do not embed shared library search path in executables
|
||||||
--disable-spinlocks do not use Spinlocks
|
--disable-spinlocks do not use spinlocks
|
||||||
--enable-debug build with debugging symbols (-g)
|
--enable-debug build with debugging symbols (-g)
|
||||||
--enable-depend turn on automatic dependency tracking
|
--enable-depend turn on automatic dependency tracking
|
||||||
--enable-cassert enable assertion checks (for debugging)
|
--enable-cassert enable assertion checks (for debugging)
|
||||||
@ -2384,40 +2384,105 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
|
|||||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||||
|
|
||||||
|
|
||||||
|
pgac_CFLAGS_before_template=$CFLAGS
|
||||||
|
|
||||||
#
|
#
|
||||||
# Read the template
|
# Read the template
|
||||||
#
|
#
|
||||||
. "$srcdir/src/template/$template" || exit
|
. "$srcdir/src/template/$template" || exit
|
||||||
|
|
||||||
# The template may have supplied a default setting for CFLAGS.
|
# CFLAGS are selected so:
|
||||||
# Override this if CFLAGS was set in the original environment.
|
# If the user specifies something in the environment, that is used.
|
||||||
|
# else: If the template file set something, that is used.
|
||||||
|
# else: If the compiler is GCC, then we use -O2.
|
||||||
|
# else: If the compiler is something else, then we use -0.
|
||||||
|
|
||||||
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
|
||||||
|
elif test "$pgac_CFLAGS_before_template" != "$CFLAGS"; then
|
||||||
|
: # (keep what template set)
|
||||||
|
elif test "$GCC" = yes; then
|
||||||
|
CFLAGS="-O2"
|
||||||
else
|
else
|
||||||
# autoconf already set the default CFLAGS for gcc to be -O2, but we
|
CFLAGS="-O"
|
||||||
# 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
|
||||||
|
|
||||||
|
# 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 "$ac_env_CFLAGS_set" != set; then
|
||||||
|
CFLAGS="$CFLAGS $pgac_cv_prog_cc_no_strict_aliasing"
|
||||||
|
fi
|
||||||
|
|
||||||
# supply -g if --enable-debug
|
# supply -g if --enable-debug
|
||||||
if test "$enable_debug" = yes -a "$ac_cv_prog_cc_g" = yes; then
|
if test "$enable_debug" = yes -a "$ac_cv_prog_cc_g" = yes; then
|
||||||
CFLAGS="$CFLAGS -g"
|
CFLAGS="$CFLAGS -g"
|
||||||
fi
|
fi
|
||||||
# default to -O rather than empty CFLAGS; this path will not be taken for
|
|
||||||
# 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"
|
|
||||||
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;}
|
||||||
|
|
||||||
# We already have this in Makefile.win32, but configure needs it too
|
# We already have this in Makefile.win32, but configure needs it too
|
||||||
if test "$PORTNAME" = "win32"
|
if test "$PORTNAME" = "win32"; then
|
||||||
then
|
CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32"
|
||||||
CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the compiler still works with the template settings
|
# Check if the compiler still works with the template settings
|
||||||
|
41
configure.in
41
configure.in
@ -1,5 +1,5 @@
|
|||||||
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.297 2003/10/22 04:16:39 pgsql Exp $
|
dnl $Header: /cvsroot/pgsql/configure.in,v 1.298 2003/10/25 15:32:11 petere Exp $
|
||||||
dnl
|
dnl
|
||||||
dnl Developers, please strive to achieve this order:
|
dnl Developers, please strive to achieve this order:
|
||||||
dnl
|
dnl
|
||||||
@ -203,7 +203,7 @@ AC_SUBST(enable_rpath)
|
|||||||
# Spinlocks
|
# Spinlocks
|
||||||
#
|
#
|
||||||
PGAC_ARG_BOOL(enable, spinlocks, yes,
|
PGAC_ARG_BOOL(enable, spinlocks, yes,
|
||||||
[ --disable-spinlocks do not use Spinlocks])
|
[ --disable-spinlocks do not use spinlocks])
|
||||||
|
|
||||||
#
|
#
|
||||||
# --enable-debug adds -g to compiler flags
|
# --enable-debug adds -g to compiler flags
|
||||||
@ -229,39 +229,42 @@ esac
|
|||||||
|
|
||||||
AC_PROG_CC([$pgac_cc_list])
|
AC_PROG_CC([$pgac_cc_list])
|
||||||
|
|
||||||
|
pgac_CFLAGS_before_template=$CFLAGS
|
||||||
|
|
||||||
#
|
#
|
||||||
# Read the template
|
# Read the template
|
||||||
#
|
#
|
||||||
. "$srcdir/src/template/$template" || exit
|
. "$srcdir/src/template/$template" || exit
|
||||||
|
|
||||||
# The template may have supplied a default setting for CFLAGS.
|
# CFLAGS are selected so:
|
||||||
# Override this if CFLAGS was set in the original environment.
|
# If the user specifies something in the environment, that is used.
|
||||||
|
# else: If the template file set something, that is used.
|
||||||
|
# else: If the compiler is GCC, then we use -O2.
|
||||||
|
# else: If the compiler is something else, then we use -0.
|
||||||
|
|
||||||
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
|
||||||
|
elif test "$pgac_CFLAGS_before_template" != "$CFLAGS"; then
|
||||||
|
: # (keep what template set)
|
||||||
|
elif test "$GCC" = yes; then
|
||||||
|
CFLAGS="-O2"
|
||||||
else
|
else
|
||||||
# autoconf already set the default CFLAGS for gcc to be -O2, but we
|
CFLAGS="-O"
|
||||||
# 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
|
||||||
|
|
||||||
|
# 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
|
# supply -g if --enable-debug
|
||||||
if test "$enable_debug" = yes -a "$ac_cv_prog_cc_g" = yes; then
|
if test "$enable_debug" = yes -a "$ac_cv_prog_cc_g" = yes; then
|
||||||
CFLAGS="$CFLAGS -g"
|
CFLAGS="$CFLAGS -g"
|
||||||
fi
|
fi
|
||||||
# default to -O rather than empty CFLAGS; this path will not be taken for
|
|
||||||
# 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"
|
|
||||||
fi
|
|
||||||
AC_MSG_NOTICE([using CFLAGS=$CFLAGS])
|
AC_MSG_NOTICE([using CFLAGS=$CFLAGS])
|
||||||
|
|
||||||
# We already have this in Makefile.win32, but configure needs it too
|
# We already have this in Makefile.win32, but configure needs it too
|
||||||
if test "$PORTNAME" = "win32"
|
if test "$PORTNAME" = "win32"; then
|
||||||
then
|
CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32"
|
||||||
CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if the compiler still works with the template settings
|
# Check if the compiler still works with the template settings
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
if test "$GCC" != yes ; then
|
if test "$GCC" != yes ; then
|
||||||
case $host_os in
|
case $host_os in
|
||||||
aix3.2.5 | aix4.1*) ;;
|
aix3.2.5 | aix4.1*) ;;
|
||||||
*) CFLAGS="$CFLAGS -O2 -qlonglong";;
|
*) CFLAGS="-O2 -qlonglong";;
|
||||||
esac
|
esac
|
||||||
CFLAGS="$CFLAGS -qmaxmem=16384 -qsrcmsg"
|
CFLAGS="-O -qmaxmem=16384 -qsrcmsg"
|
||||||
fi
|
fi
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
case $host_cpu in
|
|
||||||
i?86) CFLAGS="$CFLAGS -m486";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case $host_os in
|
case $host_os in
|
||||||
bsdi2.0 | bsdi2.1 | bsdi3*) CC=gcc2;;
|
bsdi2.0 | bsdi2.1 | bsdi3*) CC=gcc2;;
|
||||||
esac
|
esac
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
case $host_cpu in
|
case $host_cpu in
|
||||||
alpha*) CFLAGS="$CFLAGS -O";; # alpha has problems with -O2
|
alpha*) CFLAGS="-O";; # alpha has problems with -O2
|
||||||
esac
|
esac
|
||||||
|
|
||||||
THREAD_SUPPORT=yes
|
THREAD_SUPPORT=yes
|
||||||
|
@ -2,5 +2,5 @@ CPPFLAGS="-D_XOPEN_SOURCE_EXTENDED"
|
|||||||
|
|
||||||
if test "$GCC" != yes ; then
|
if test "$GCC" != yes ; then
|
||||||
CC="$CC -Ae"
|
CC="$CC -Ae"
|
||||||
CFLAGS="$CFLAGS +O2"
|
CFLAGS="+O2"
|
||||||
fi
|
fi
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
if test "$GCC" != yes ; then
|
if test "$GCC" != yes ; then
|
||||||
CC="$CC -std"
|
CC="$CC -std"
|
||||||
CFLAGS="$CFLAGS -O4 -Olimit 2000"
|
CFLAGS="-O4 -Olimit 2000"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
THREAD_SUPPORT=yes
|
THREAD_SUPPORT=yes
|
||||||
|
@ -1,2 +1 @@
|
|||||||
CFLAGS="$CFLAGS -I/usr/local/include"
|
|
||||||
LIBS="-lunix"
|
LIBS="-lunix"
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
if test "$GCC" != yes ; then
|
if test "$GCC" != yes ; then
|
||||||
CC="$CC -Xa" # relaxed ISO C mode
|
CC="$CC -Xa" # relaxed ISO C mode
|
||||||
CFLAGS="$CFLAGS -O -v" # -v is like gcc -Wall
|
CFLAGS="-O -v" # -v is like gcc -Wall
|
||||||
fi
|
fi
|
||||||
|
|
||||||
THREAD_SUPPORT=yes
|
THREAD_SUPPORT=yes
|
||||||
NEED_REENTRANT_FUNCS=yes # 5.6 2003-09-13
|
NEED_REENTRANT_FUNCS=yes # 5.6 2003-09-13
|
||||||
THREAD_LIBS="-pthread"
|
THREAD_LIBS="-pthread"
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
CFLAGS="$CFLAGS -v -O -K i486,host,inline,loop_unroll -Dsvr4"
|
CFLAGS="-v -O -K i486,host,inline,loop_unroll -Dsvr4"
|
||||||
LIBS="-lc89"
|
LIBS="-lc89"
|
||||||
|
@ -4,7 +4,7 @@ else
|
|||||||
# the -Kno_host is temporary for a bug in the compiler. See -hackers
|
# the -Kno_host is temporary for a bug in the compiler. See -hackers
|
||||||
# discussion on 7-8/Aug/2003.
|
# discussion on 7-8/Aug/2003.
|
||||||
# when the 7.1.3UP3 or later compiler is out, we can do a version check.
|
# when the 7.1.3UP3 or later compiler is out, we can do a version check.
|
||||||
CFLAGS="$CFLAGS -O -Kinline,no_host"
|
CFLAGS="-O -Kinline,no_host"
|
||||||
THREAD_CPPFLAGS="-K pthread"
|
THREAD_CPPFLAGS="-K pthread"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user