@@ -841,7 +841,7 @@ Optional Features:
841841 --enable-nls[=LANGUAGES] enable Native Language Support
842842 --disable-shared do not build shared libraries
843843 --disable-rpath do not embed shared library search path in executables
844- --disable-spinlocks do not useSpinlocks
844+ --disable-spinlocks do not usespinlocks
845845 --enable-debug build with debugging symbols (-g)
846846 --enable-depend turn on automatic dependency tracking
847847 --enable-cassert enable assertion checks (for debugging)
@@ -2384,40 +2384,105 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
23842384ac_compiler_gnu=$ac_cv_c_compiler_gnu
23852385
23862386
2387+ pgac_CFLAGS_before_template=$CFLAGS
2388+
23872389#
23882390# Read the template
23892391#
23902392. "$srcdir/src/template/$template" || exit
23912393
2392- # The template may have supplied a default setting for CFLAGS.
2393- # Override this if CFLAGS was set in the original environment.
2394+ # CFLAGS are selected so:
2395+ # If the user specifies something in the environment, that is used.
2396+ # else: If the template file set something, that is used.
2397+ # else: If the compiler is GCC, then we use -O2.
2398+ # else: If the compiler is something else, then we use -0.
2399+
23942400if test "$ac_env_CFLAGS_set" = set; then
23952401 CFLAGS=$ac_env_CFLAGS_value
2402+ elif test "$pgac_CFLAGS_before_template" != "$CFLAGS"; then
2403+ : # (keep what template set)
2404+ elif test "$GCC" = yes; then
2405+ CFLAGS="-O2"
23962406else
2397- # autoconf already set the default CFLAGS for gcc to be -O2, but we
2398- # need to specify -fno-strict-aliasing too in case it's gcc 3.3 or later.
2399- if test "$GCC" = yes; then
2400- CFLAGS="$CFLAGS -fno-strict-aliasing"
2401- fi
2407+ CFLAGS="-O"
2408+ fi
2409+
2410+ # Need to specify -fno-strict-aliasing too in case it's gcc 3.3 or later.
2411+ echo "$as_me:$LINENO: checking how to turn off strict aliasing in $CC" >&5
2412+ echo $ECHO_N "checking how to turn off strict aliasing in $CC... $ECHO_C" >&6
2413+ if test "${pgac_cv_prog_cc_no_strict_aliasing+set}" = set; then
2414+ echo $ECHO_N "(cached) $ECHO_C" >&6
2415+ else
2416+ pgac_save_CFLAGS=$CFLAGS
2417+ if test "$GCC" = yes; then
2418+ pgac_try="-fno-strict-aliasing"
2419+ else
2420+ # Maybe fill in later...
2421+ pgac_try=
2422+ fi
2423+
2424+ for pgac_flag in $pgac_try; do
2425+ CFLAGS="$pgac_save_CFLAGS $pgac_flag"
2426+ cat >conftest.$ac_ext <<_ACEOF
2427+ #line $LINENO "configure"
2428+ #include "confdefs.h"
2429+
2430+ #ifdef F77_DUMMY_MAIN
2431+ # ifdef __cplusplus
2432+ extern "C"
2433+ # endif
2434+ int F77_DUMMY_MAIN() { return 1; }
2435+ #endif
2436+ int
2437+ main ()
2438+ {
2439+
2440+ ;
2441+ return 0;
2442+ }
2443+ _ACEOF
2444+ rm -f conftest.$ac_objext
2445+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2446+ (eval $ac_compile) 2>&5
2447+ ac_status=$?
2448+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
2449+ (exit $ac_status); } &&
2450+ { ac_try='test -s conftest.$ac_objext'
2451+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2452+ (eval $ac_try) 2>&5
2453+ ac_status=$?
2454+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
2455+ (exit $ac_status); }; }; then
2456+ pgac_cv_prog_cc_no_strict_aliasing=$pgac_try
2457+ break
2458+ else
2459+ echo "$as_me: failed program was:" >&5
2460+ cat conftest.$ac_ext >&5
2461+ fi
2462+ rm -f conftest.$ac_objext conftest.$ac_ext
2463+ done
2464+
2465+ CFLAGS=$pgac_save_CFLAGS
2466+
24022467fi
2468+ echo "$as_me:$LINENO: result: $pgac_cv_prog_cc_no_strict_aliasing" >&5
2469+ echo "${ECHO_T}$pgac_cv_prog_cc_no_strict_aliasing" >&6
2470+
2471+ if test "$ac_env_CFLAGS_set" != set; then
2472+ CFLAGS="$CFLAGS $pgac_cv_prog_cc_no_strict_aliasing"
2473+ fi
2474+
24032475# supply -g if --enable-debug
24042476if test "$enable_debug" = yes -a "$ac_cv_prog_cc_g" = yes; then
24052477 CFLAGS="$CFLAGS -g"
24062478fi
2407- # default to -O rather than empty CFLAGS; this path will not be taken for
2408- # gcc (since autoconf supplies -O2), nor if --enable-debug (because -O -g
2409- # doesn't work on most non-gcc compilers), nor if the template provided
2410- # some CFLAGS.
2411- if test "$ac_env_CFLAGS_set" != set -a x"$CFLAGS" = x""; then
2412- CFLAGS="-O"
2413- fi
2479+
24142480{ echo "$as_me:$LINENO: using CFLAGS=$CFLAGS" >&5
24152481echo "$as_me: using CFLAGS=$CFLAGS" >&6;}
24162482
24172483# We already have this in Makefile.win32, but configure needs it too
2418- if test "$PORTNAME" = "win32"
2419- then
2420- CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32"
2484+ if test "$PORTNAME" = "win32"; then
2485+ CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32"
24212486fi
24222487
24232488# Check if the compiler still works with the template settings