From 65206ee9bc2d4ae3245cf7042bc3ac90437ace63 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 11 Feb 2015 08:47:35 +0000 Subject: build: Add is-release support to AX_CHECK_ENABLE_DEBUG Now fatal warnings are automatically disabled when doing release builds. --- configure.ac | 2 +- m4/ax_check_enable_debug.m4 | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index c5f6cb37..edcbd5b9 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ AM_MAINTAINER_MODE([enable]) AM_SILENT_RULES([yes]) AX_IS_RELEASE([git-directory]) -AX_CHECK_ENABLE_DEBUG([info], [YELP_DEBUG]) +AX_CHECK_ENABLE_DEBUG([info], [YELP_DEBUG], [$ax_is_release]) # Check for programs AC_PROG_CC diff --git a/m4/ax_check_enable_debug.m4 b/m4/ax_check_enable_debug.m4 index e433fc6d..147ffd22 100644 --- a/m4/ax_check_enable_debug.m4 +++ b/m4/ax_check_enable_debug.m4 @@ -4,7 +4,7 @@ # # SYNOPSIS # -# AX_CHECK_ENABLE_DEBUG([enable by default=yes/info/profile/no], [ENABLE DEBUG VARIABLES ...], [DISABLE DEBUG VARIABLES NDEBUG ...]) +# AX_CHECK_ENABLE_DEBUG([enable by default=yes/info/profile/no], [ENABLE DEBUG VARIABLES ...], [DISABLE DEBUG VARIABLES NDEBUG ...], [IS-RELEASE]) # # DESCRIPTION # @@ -25,16 +25,23 @@ # If debug is not enabled, ensure AC_PROG_* will not add debugging flags. # Should be invoked prior to any AC_PROG_* compiler checks. # +# IS-RELEASE can be used to change the default to 'no' when making a +# release. Set IS-RELEASE to 'yes' or 'no' as appropriate, for example by +# using the AX_IS_RELEASE macro: +# +# AX_IS_RELEASE([git-directory]) +# AX_CHECK_ENABLE_DEBUG(,,,[$ax_is_release]) +# # LICENSE # # Copyright (c) 2011 Rhys Ulerich -# Copyright (c) 2014 Philip Withnall +# Copyright (c) 2014, 2015 Philip Withnall # # Copying and distribution of this file, with or without modification, are # permitted in any medium without royalty provided the copyright notice # and this notice are preserved. -#serial 3 +#serial 4 AC_DEFUN([AX_CHECK_ENABLE_DEBUG],[ AC_BEFORE([$0],[AC_PROG_CC])dnl @@ -44,13 +51,18 @@ AC_DEFUN([AX_CHECK_ENABLE_DEBUG],[ AC_MSG_CHECKING(whether to enable debugging) - m4_define(ax_enable_debug_default,[m4_tolower(m4_normalize(ifelse([$1],,[no],[$1])))]) + ax_enable_debug_default=m4_tolower(m4_normalize(ifelse([$1],,[no],[$1]))) + + # If this is a release, override the default. + AS_IF([test "$4" = "yes"], + [ax_enable_debug_default="no"]) + m4_define(ax_enable_debug_vars,[m4_normalize(ifelse([$2],,,[$2]))]) m4_define(ax_disable_debug_vars,[m4_normalize(ifelse([$3],,[NDEBUG],[$3]))]) AC_ARG_ENABLE(debug, - [AS_HELP_STRING([--enable-debug]@<:@=ax_enable_debug_default@:>@,[compile with debugging; one of yes/info/profile/no])], - [],enable_debug=ax_enable_debug_default) + [AS_HELP_STRING([--enable-debug=]@<:@yes/info/profile/no@:>@,[compile with debugging])], + [],enable_debug=$ax_enable_debug_default) # empty mean debug yes AS_IF([test "x$enable_debug" = "x"], -- cgit v1.2.1