diff --git a/Makefile.am b/Makefile.am index 4a0849c..d584e5d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,8 +5,12 @@ ################################################################ AM_CPPFLAGS = -D$(OS) -AM_CFLAGS = -pedantic +if DEBUG +AM_CFLAGS = -pedantic -O0 -g3 -DDEBUG_BUILD +else +AM_CFLAGS = -pedantic -O3 -fno-strict-aliasing +endif ################################################################ ## docs ## @@ -31,6 +35,8 @@ EXTRA_DIST = .travis.yml doc/iodine-server.service \ ################################################################ sbin_PROGRAMS = iodine iodined +iodine_CFLAGS = $(AM_CFLAGS) +iodined_CFLAGS = $(AM_CFLAGS) COMMONSRC0 = src/base32.c src/base64.c src/common.c src/dns.c \ src/encoding.c src/login.c src/md5.c src/read.c src/window.c \ diff --git a/configure.ac b/configure.ac index e1bada3..48a3f7b 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ # Prologue AC_PREREQ([2.69]) -AC_INIT([iodine],[0.7.0],[erik@kryo.se],[],[http://dev.kryo.se/iodine/]) +AC_INIT([iodine],[0.8.0],[erik@kryo.se],[],[http://dev.kryo.se/iodine/]) AC_CONFIG_SRCDIR([src/iodine.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([autotools]) @@ -56,6 +56,15 @@ AC_DEFINE_UNQUOTED([GITREVISION],["${GITREVISION}"], # Checks for programs +AC_MSG_CHECKING([whether configure should try to set CFLAGS]) +if test "x${CFLAGS+set}" = xset; then + enable_cflags_setting=no +else + enable_cflags_setting=yes + CFLAGS_ORIG="$CFLAGS" +fi +AC_MSG_RESULT($enable_cflags_setting) + AC_PROG_CC AC_PROG_CC_STDC AS_IF([test "x${ac_cv_prog_cc_stdc}" = xno], @@ -67,6 +76,9 @@ AC_USE_SYSTEM_EXTENSIONS AX_CFLAGS_WARN_ALL AC_PROG_INSTALL +# Restore CFLAGS (preserve debug flags) +test "x$enable_cflags_setting" = xyes && CFLAGS="$CFLAGS_ORIG" + # Process options AC_ARG_ENABLE([systemd], @@ -78,6 +90,18 @@ AC_ARG_ENABLE([selinux], [AS_HELP_STRING([--enable-selinux], [enable selinux support @<:@default=check@:>@])],, [enable_selinux=check]) + +AC_ARG_ENABLE(debug, +AS_HELP_STRING([--enable-debug], + [enable debugging, default: no]), +[case "${enableval}" in + yes) debug=true ;; + no) debug=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;; +esac], +[debug=false]) + +AM_CONDITIONAL(DEBUG, test x"$debug" = x"true") # Checks for libraries