1
1
dnl Process this file with autoconf to produce a configure script.
2
- dnl $Header: /cvsroot/pgsql/configure.in,v 1.295 2003/10/14 00:48:09 momjian Exp $
2
+ dnl $Header: /cvsroot/pgsql/configure.in,v 1.296 2003/10/15 22:23:56 tgl Exp $
3
3
dnl
4
4
dnl Developers, please strive to achieve this order:
5
5
dnl
@@ -234,18 +234,28 @@ AC_PROG_CC([$pgac_cc_list])
234
234
#
235
235
. "$srcdir/src/template/$template" || exit
236
236
237
- # adjust CFLAGS per template
237
+ # The template may have supplied a default setting for CFLAGS.
238
+ # Override this if CFLAGS was set in the original environment.
238
239
if test "$ac_env_CFLAGS_set" = set; then
239
240
CFLAGS=$ac_env_CFLAGS_value
240
- fi
241
- if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
242
- CFLAGS="$CFLAGS -g"
243
241
else
244
- # configure sets CFLAGS to -O2 for gcc, so this is only for non-gcc
245
- if test x"$CFLAGS" = x""; then
246
- CFLAGS="-O"
242
+ # autoconf already set the default CFLAGS for gcc to be -O2, but we
243
+ # need to specify -fno-strict-aliasing too in case it's gcc 3.3 or later.
244
+ if test "$GCC" = yes; then
245
+ CFLAGS="$CFLAGS -fno-strict-aliasing"
247
246
fi
248
247
fi
248
+ # supply -g if --enable-debug
249
+ if test "$enable_debug" = yes -a "$ac_cv_prog_cc_g" = yes; then
250
+ CFLAGS="$CFLAGS -g"
251
+ fi
252
+ # default to -O rather than empty CFLAGS; this path will not be taken for
253
+ # gcc (since autoconf supplies -O2), nor if --enable-debug (because -O -g
254
+ # doesn't work on most non-gcc compilers), nor if the template provided
255
+ # some CFLAGS.
256
+ if test "$ac_env_CFLAGS_set" != set -a x"$CFLAGS" = x""; then
257
+ CFLAGS="-O"
258
+ fi
249
259
AC_MSG_NOTICE([using CFLAGS=$CFLAGS])
250
260
251
261
# We already have this in Makefile.win32, but configure needs it too
@@ -261,7 +271,7 @@ AC_TRY_LINK([], [return 0;],
261
271
[AC_MSG_RESULT(no)
262
272
AC_MSG_ERROR([cannot proceed])])
263
273
264
- # Defend against gcc -ffastmath
274
+ # Defend against gcc -ffast-math
265
275
if test "$GCC" = yes; then
266
276
AC_TRY_COMPILE([], [@%:@ifdef __FAST_MATH__
267
277
choke me
0 commit comments