summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2012-01-31 11:40:15 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2012-01-31 11:40:15 +1100
commit3faab64581680951334a83eba52334b505e6e338 (patch)
treed104470a5988cfd9b65a21922d311d15c3adb9a6
parentebdc8d2d085bfd08a9392f826c9b863ab1dc1b22 (diff)
downloadmongo-3faab64581680951334a83eba52334b505e6e338.tar.gz
Don't modify CFLAGS if set before configure was run.
-rw-r--r--build_posix/configure.ac.in16
1 files changed, 12 insertions, 4 deletions
diff --git a/build_posix/configure.ac.in b/build_posix/configure.ac.in
index 38d65061b33..bd19c05b79e 100644
--- a/build_posix/configure.ac.in
+++ b/build_posix/configure.ac.in
@@ -14,10 +14,10 @@ AC_CONFIG_SRCDIR([dist/RELEASE])
AM_INIT_AUTOMAKE
AM_OPTIONS
-if test "$wt_cv_enable_debug" = "yes"; then
- CFLAGS="$CFLAGS -g"
-else
- CFLAGS="$CFLAGS -O3"
+# If CFLAGS was not set on entry and we are not debugging, default to -O3
+wt_test_CFLAGS=${CFLAGS+set}
+if test "$wt_test_CFLAGS" != set && test "$wt_cv_enable_debug" != "yes"; then
+ CFLAGS="-O3"
fi
define([AC_LIBTOOL_LANG_CXX_CONFIG], [:])dnl
@@ -28,6 +28,14 @@ AC_SUBST([LIBTOOL_DEPS])
AC_PROG_CC(cc gcc)
# AC_PROG_CXX(c++ g++)
+# Add debugging flags if requested and not already in CFLAGS
+if test "$wt_cv_enable_debug" = "yes"; then
+ case "$CFLAGS" in
+ *-g*) ;;
+ *) AM_CFLAGS="$AM_CFLAGS -g" ;;
+ esac
+fi
+
if test "$GCC" = "yes"; then
# The Solaris gcc compiler gets the additional -pthreads flag.
if test "`uname -s`" = "SunOS"; then