Skip to content

Commit c70c4e3

Browse files
committed
I hope this is what you had in mind:
--enable-debug adds -g (unconditionally) --disable-debug removes -g (if it was already in there somehow) (giving neither does nothing) Since none of the templates default CFLAGS with a -g you're not likely to end up with two -g flags. Not that they'd hurt though. It doesn't do anything about C++. Peter Eisentraut
1 parent 48049b4 commit c70c4e3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/configure.in

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,27 @@ echo "- setting CPPFLAGS=$CPPFLAGS"
411411
LDFLAGS="$LDFLAGS $PGSQL_LDFLAGS"
412412
echo "- setting LDFLAGS=$LDFLAGS"
413413

414+
dnl --enable-debug adds -g to compiler flags
415+
dnl --disable-debug will forcefully remove it
416+
AC_MSG_CHECKING(setting debug compiler flag)
417+
AC_ARG_ENABLE(
418+
debug,
419+
[ --enable-debug build with debugging symbols (-g) ],
420+
[
421+
case "$enableval" in
422+
y | ye | yes)
423+
CFLAGS="$CFLAGS -g"
424+
AC_MSG_RESULT(enabled)
425+
;;
426+
*)
427+
CFLAGS=`echo "$CFLAGS" | sed -e 's/ -g/ /g' | sed -e 's/^-g//'`
428+
AC_MSG_RESULT(disabled)
429+
;;
430+
esac
431+
],
432+
AC_MSG_RESULT(using default)
433+
)
434+
414435
# Assume system is ELF if it predefines __ELF__ as 1,
415436
# otherwise believe "elf" setting from check of host_os above.
416437
AC_EGREP_CPP(yes,

0 commit comments

Comments
 (0)