i3lock-color

The world's most popular non-default computer lockscreen.
Index Commits Files Refs README LICENSE
m4/ax_check_enable_debug.m4 (4568B)
   1 # ===========================================================================
   2 #   http://www.gnu.org/software/autoconf-archive/ax_check_enable_debug.html
   3 # ===========================================================================
   4 #
   5 # SYNOPSIS
   6 #
   7 #   AX_CHECK_ENABLE_DEBUG([enable by default=yes/info/profile/no], [ENABLE DEBUG VARIABLES ...], [DISABLE DEBUG VARIABLES NDEBUG ...], [IS-RELEASE])
   8 #
   9 # DESCRIPTION
  10 #
  11 #   Check for the presence of an --enable-debug option to configure, with
  12 #   the specified default value used when the option is not present.  Return
  13 #   the value in the variable $ax_enable_debug.
  14 #
  15 #   Specifying 'yes' adds '-g -O0' to the compilation flags for all
  16 #   languages. Specifying 'info' adds '-g' to the compilation flags.
  17 #   Specifying 'profile' adds '-g -pg' to the compilation flags and '-pg' to
  18 #   the linking flags. Otherwise, nothing is added.
  19 #
  20 #   Define the variables listed in the second argument if debug is enabled,
  21 #   defaulting to no variables.  Defines the variables listed in the third
  22 #   argument if debug is disabled, defaulting to NDEBUG.  All lists of
  23 #   variables should be space-separated.
  24 #
  25 #   If debug is not enabled, ensure AC_PROG_* will not add debugging flags.
  26 #   Should be invoked prior to any AC_PROG_* compiler checks.
  27 #
  28 #   IS-RELEASE can be used to change the default to 'no' when making a
  29 #   release.  Set IS-RELEASE to 'yes' or 'no' as appropriate. By default, it
  30 #   uses the value of $ax_is_release, so if you are using the AX_IS_RELEASE
  31 #   macro, there is no need to pass this parameter.
  32 #
  33 #     AX_IS_RELEASE([git-directory])
  34 #     AX_CHECK_ENABLE_DEBUG()
  35 #
  36 # LICENSE
  37 #
  38 #   Copyright (c) 2011 Rhys Ulerich <rhys.ulerich@gmail.com>
  39 #   Copyright (c) 2014, 2015 Philip Withnall <philip@tecnocode.co.uk>
  40 #
  41 #   Copying and distribution of this file, with or without modification, are
  42 #   permitted in any medium without royalty provided the copyright notice
  43 #   and this notice are preserved.
  44 
  45 #serial 5
  46 
  47 AC_DEFUN([AX_CHECK_ENABLE_DEBUG],[
  48     AC_BEFORE([$0],[AC_PROG_CC])dnl
  49     AC_BEFORE([$0],[AC_PROG_CXX])dnl
  50     AC_BEFORE([$0],[AC_PROG_F77])dnl
  51     AC_BEFORE([$0],[AC_PROG_FC])dnl
  52 
  53     AC_MSG_CHECKING(whether to enable debugging)
  54 
  55     ax_enable_debug_default=m4_tolower(m4_normalize(ifelse([$1],,[no],[$1])))
  56     ax_enable_debug_is_release=m4_tolower(m4_normalize(ifelse([$4],,
  57                                                               [$ax_is_release],
  58                                                               [$4])))
  59 
  60     # If this is a release, override the default.
  61     AS_IF([test "$ax_enable_debug_is_release" = "yes"],
  62       [ax_enable_debug_default="no"])
  63 
  64     m4_define(ax_enable_debug_vars,[m4_normalize(ifelse([$2],,,[$2]))])
  65     m4_define(ax_disable_debug_vars,[m4_normalize(ifelse([$3],,[NDEBUG],[$3]))])
  66 
  67     AC_ARG_ENABLE(debug,
  68     [AS_HELP_STRING([--enable-debug=]@<:@yes/info/profile/no@:>@,[compile with debugging])],
  69     [],enable_debug=$ax_enable_debug_default)
  70 
  71     # empty mean debug yes
  72     AS_IF([test "x$enable_debug" = "x"],
  73       [enable_debug="yes"])
  74 
  75     # case of debug
  76     AS_CASE([$enable_debug],
  77       [yes],[
  78     AC_MSG_RESULT(yes)
  79     CFLAGS="${CFLAGS} -g -O0"
  80     CXXFLAGS="${CXXFLAGS} -g -O0"
  81     FFLAGS="${FFLAGS} -g -O0"
  82     FCFLAGS="${FCFLAGS} -g -O0"
  83     OBJCFLAGS="${OBJCFLAGS} -g -O0"
  84       ],
  85       [info],[
  86     AC_MSG_RESULT(info)
  87     CFLAGS="${CFLAGS} -g"
  88     CXXFLAGS="${CXXFLAGS} -g"
  89     FFLAGS="${FFLAGS} -g"
  90     FCFLAGS="${FCFLAGS} -g"
  91     OBJCFLAGS="${OBJCFLAGS} -g"
  92       ],
  93       [profile],[
  94     AC_MSG_RESULT(profile)
  95     CFLAGS="${CFLAGS} -g -pg"
  96     CXXFLAGS="${CXXFLAGS} -g -pg"
  97     FFLAGS="${FFLAGS} -g -pg"
  98     FCFLAGS="${FCFLAGS} -g -pg"
  99     OBJCFLAGS="${OBJCFLAGS} -g -pg"
 100     LDFLAGS="${LDFLAGS} -pg"
 101       ],
 102       [
 103     AC_MSG_RESULT(no)
 104     dnl Ensure AC_PROG_CC/CXX/F77/FC/OBJC will not enable debug flags
 105     dnl by setting any unset environment flag variables
 106     AS_IF([test "x${CFLAGS+set}" != "xset"],
 107       [CFLAGS=""])
 108     AS_IF([test "x${CXXFLAGS+set}" != "xset"],
 109       [CXXFLAGS=""])
 110     AS_IF([test "x${FFLAGS+set}" != "xset"],
 111       [FFLAGS=""])
 112     AS_IF([test "x${FCFLAGS+set}" != "xset"],
 113       [FCFLAGS=""])
 114     AS_IF([test "x${OBJCFLAGS+set}" != "xset"],
 115       [OBJCFLAGS=""])
 116       ])
 117 
 118     dnl Define various variables if debugging is disabled.
 119     dnl assert.h is a NOP if NDEBUG is defined, so define it by default.
 120     AS_IF([test "x$enable_debug" = "xyes"],
 121       [m4_map_args_w(ax_enable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is enabled])])],
 122       [m4_map_args_w(ax_disable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is disabled])])])
 123     ax_enable_debug=$enable_debug
 124 ])