summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorPeter Eisentraut2000-11-04 14:29:26 +0000
committerPeter Eisentraut2000-11-04 14:29:26 +0000
commitdabe897940a04863f86ea61c24c6336f1d6c4ad7 (patch)
treed18de8ae8d741871e65da66be287c343b8ea9584 /configure.in
parent4aa1aabd7ab4b20f9a4c3eae2d33b381c9b05990 (diff)
If CFLAGS was specified in the environment, use that, not what the template
says.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in29
1 files changed, 20 insertions, 9 deletions
diff --git a/configure.in b/configure.in
index a008e478361..2845ff6de68 100644
--- a/configure.in
+++ b/configure.in
@@ -252,6 +252,13 @@ AC_SUBST(enable_rpath)
#
+# --enable-debug adds -g to compiler flags
+#
+PGAC_ARG_BOOL(enable, debug, no,
+ [ --enable-debug build with debugging symbols (-g)])
+
+
+#
# C compiler
#
@@ -263,9 +270,20 @@ PGAC_ARG_REQ(with, CC, [], [CC=$with_CC])
# On AIX, default compiler to xlc.
if test "$template" = aix && test -z "$CC" ; then CC=xlc; fi
+# Save CFLAGS from the environment
+has_environ_CFLAGS="${CFLAGS+yes}"
+save_CFLAGS=$CFLAGS
+
AC_PROG_CC
# Read the template
. "$srcdir/src/template/$template" || exit
+
+if test "$has_environ_CFLAGS" = yes; then
+ CFLAGS=$save_CFLAGS
+fi
+if test "$enable_debug" = yes && test "$ac_cv_prog_cc_g" = yes; then
+ CFLAGS="$CFLAGS -g"
+fi
echo "using CFLAGS=$CFLAGS"
# Check if the compiler still works with the template settings
AC_PROG_CC_WORKS
@@ -292,13 +310,6 @@ AC_SUBST(autodepend)
#
-# --enable-debug adds -g to compiler flags
-#
-PGAC_ARG_BOOL(enable, debug, no, [ --enable-debug build with debugging symbols (-g)],
- [CFLAGS="$CFLAGS -g"])
-
-
-#
# Enable assert checks
#
PGAC_ARG_BOOL(enable, cassert, no, [ --enable-cassert enable assertion checks (for debugging)],
@@ -548,9 +559,9 @@ PGAC_ARG_OPTARG(with, CXX, [ --with-CXX build C++ modules (libpq++
# If the user has specified CXXFLAGS in the environment, leave it
# alone, else use a default.
- has_cmdline_CXXFLAGS="${CXXFLAGS+yes}"
+ has_environ_CXXFLAGS="${CXXFLAGS+yes}"
AC_PROG_CXX
- if test "$has_cmdline_CXXFLAGS" != yes; then
+ if test "$has_environ_CXXFLAGS" != yes; then
if test "$GXX" = yes; then
CXXFLAGS=-O2
else