diff options
Diffstat (limited to 'configure.in')
| -rw-r--r-- | configure.in | 29 |
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 |
