[gupnp-tools] build: Update included m4 macros



commit 94a44295545a108dc2ba5e1000e97943fc685f47
Author: Jens Georg <mail jensge org>
Date:   Sat Mar 26 17:00:42 2016 +0100

    build: Update included m4 macros
    
    Signed-off-by: Jens Georg <mail jensge org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758779

 m4/ax_append_compile_flags.m4   |    8 ++-
 m4/ax_append_flag.m4            |    4 +-
 m4/ax_check_enable_debug.m4     |  153 +++++++++++++++++++++------------------
 m4/ax_compiler_flags_ldflags.m4 |   10 ++--
 4 files changed, 94 insertions(+), 81 deletions(-)
---
diff --git a/m4/ax_append_compile_flags.m4 b/m4/ax_append_compile_flags.m4
index dc7b866..2bb27ef 100644
--- a/m4/ax_append_compile_flags.m4
+++ b/m4/ax_append_compile_flags.m4
@@ -4,7 +4,7 @@
 #
 # SYNOPSIS
 #
-#   AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS])
+#   AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
 #
 # DESCRIPTION
 #
@@ -20,6 +20,8 @@
 #   the flags: "CFLAGS EXTRA-FLAGS FLAG".  This can for example be used to
 #   force the compiler to issue an error when a bad flag is given.
 #
+#   INPUT gives an alternative input source to AC_COMPILE_IFELSE.
+#
 #   NOTE: This macro depends on the AX_APPEND_FLAG and
 #   AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
 #   AX_APPEND_LINK_FLAGS.
@@ -54,12 +56,12 @@
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-#serial 4
+#serial 5
 
 AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
 [AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
 AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
 for flag in $1; do
-  AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3])
+  AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4])
 done
 ])dnl AX_APPEND_COMPILE_FLAGS
diff --git a/m4/ax_append_flag.m4 b/m4/ax_append_flag.m4
index aeab899..08f2e07 100644
--- a/m4/ax_append_flag.m4
+++ b/m4/ax_append_flag.m4
@@ -49,7 +49,7 @@
 #   modified version of the Autoconf Macro, you may extend this special
 #   exception to the GPL to apply to your modified version as well.
 
-#serial 5
+#serial 6
 
 AC_DEFUN([AX_APPEND_FLAG],
 [dnl
@@ -59,7 +59,7 @@ AS_VAR_SET_IF(FLAGS,[
   AS_CASE([" AS_VAR_GET(FLAGS) "],
     [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
     [
-     AS_VAR_APPEND(FLAGS," $1")
+     AS_VAR_APPEND(FLAGS,[" $1"])
      AC_RUN_LOG([: FLAGS="$FLAGS"])
     ])
   ],
diff --git a/m4/ax_check_enable_debug.m4 b/m4/ax_check_enable_debug.m4
index 37add91..f99d75f 100644
--- a/m4/ax_check_enable_debug.m4
+++ b/m4/ax_check_enable_debug.m4
@@ -1,48 +1,49 @@
 # ===========================================================================
-#         http://autoconf-archive.cryp.to/ax_check_enable_debug.html
+#   http://www.gnu.org/software/autoconf-archive/ax_check_enable_debug.html
 # ===========================================================================
 #
 # SYNOPSIS
 #
-#   Check for the presence of an --enable-debug option to configure and
-#   allow/avoid compiled debugging flags appropriately.
-#
-#   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
 #
-#   Check for the presence of an --enable-debug option to configure, with the
-#   specified default value used when the option is not present.  Return the
-#   value in the variable $ax_enable_debug.
+#   Check for the presence of an --enable-debug option to configure, with
+#   the specified default value used when the option is not present.  Return
+#   the value in the variable $ax_enable_debug.
 #
-#   Specifying 'yes' adds '-g -O0' to the compilation flags for all languages.
-#   Specifying 'info' adds '-g' to the compilation flags.  Specifying 'profile'
-#   adds '-g -pg' to the compilation flags and '-pg' to the linking flags.
-#   Otherwise, nothing is added.
+#   Specifying 'yes' adds '-g -O0' to the compilation flags for all
+#   languages. Specifying 'info' adds '-g' to the compilation flags.
+#   Specifying 'profile' adds '-g -pg' to the compilation flags and '-pg' to
+#   the linking flags. Otherwise, nothing is added.
 #
 #   Define the variables listed in the second argument if debug is enabled,
 #   defaulting to no variables.  Defines the variables listed in the third
 #   argument if debug is disabled, defaulting to NDEBUG.  All lists of
 #   variables should be space-separated.
 #
-#   If debug is not enabled, ensure AC_PROG_* will not add debugging flags.
+#   If debug is not enabled, ensure AC_PROG_* will not add debugging flags.
 #   Should be invoked prior to any AC_PROG_* compiler checks.
 #
-# LAST MODIFICATION
+#   IS-RELEASE can be used to change the default to 'no' when making a
+#   release.  Set IS-RELEASE to 'yes' or 'no' as appropriate. By default, it
+#   uses the value of $ax_is_release, so if you are using the AX_IS_RELEASE
+#   macro, there is no need to pass this parameter.
 #
-#   2014-05-12
+#     AX_IS_RELEASE([git-directory])
+#     AX_CHECK_ENABLE_DEBUG()
 #
-# COPYLEFT
+# LICENSE
 #
 #   Copyright (c) 2011 Rhys Ulerich <rhys ulerich gmail com>
-#   Copyright © 2014 Philip Withnall <philip tecnocode co uk>
+#   Copyright (c) 2014, 2015 Philip Withnall <philip tecnocode co uk>
 #
 #   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 5
+
 AC_DEFUN([AX_CHECK_ENABLE_DEBUG],[
     AC_BEFORE([$0],[AC_PROG_CC])dnl
     AC_BEFORE([$0],[AC_PROG_CXX])dnl
@@ -51,63 +52,73 @@ 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])))
+    ax_enable_debug_is_release=m4_tolower(m4_normalize(ifelse([$4],,
+                                                              [$ax_is_release],
+                                                              [$4])))
+
+    # If this is a release, override the default.
+    AS_IF([test "$ax_enable_debug_is_release" = "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)
-    if test "x$enable_debug" = "xyes" || test "x$enable_debug" = "x"; then
-        AC_MSG_RESULT(yes)
-        CFLAGS="${CFLAGS} -g -O0"
-        CXXFLAGS="${CXXFLAGS} -g -O0"
-        FFLAGS="${FFLAGS} -g -O0"
-        FCFLAGS="${FCFLAGS} -g -O0"
-        OBJCFLAGS="${OBJCFLAGS} -g -O0"
+       [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"],
+      [enable_debug="yes"])
 
-        dnl Define various variables if debugging is enabled.
-        m4_map_args_w(ax_enable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is enabled])])
-    else
-        if test "x$enable_debug" = "xinfo"; then
-            AC_MSG_RESULT(info)
-            CFLAGS="${CFLAGS} -g"
-            CXXFLAGS="${CXXFLAGS} -g"
-            FFLAGS="${FFLAGS} -g"
-            FCFLAGS="${FCFLAGS} -g"
-            OBJCFLAGS="${OBJCFLAGS} -g"
-        elif test "x$enable_debug" = "xprofile"; then
-            AC_MSG_RESULT(profile)
-            CFLAGS="${CFLAGS} -g -pg"
-            CXXFLAGS="${CXXFLAGS} -g -pg"
-            FFLAGS="${FFLAGS} -g -pg"
-            FCFLAGS="${FCFLAGS} -g -pg"
-            OBJCFLAGS="${OBJCFLAGS} -g -pg"
-            LDFLAGS="${LDFLAGS} -pg"
-        else
-            AC_MSG_RESULT(no)
-            dnl Ensure AC_PROG_CC/CXX/F77/FC/OBJC will not enable debug flags
-            dnl by setting any unset environment flag variables
-            if test "x${CFLAGS+set}" != "xset"; then
-                CFLAGS=""
-            fi
-            if test "x${CXXFLAGS+set}" != "xset"; then
-                CXXFLAGS=""
-            fi
-            if test "x${FFLAGS+set}" != "xset"; then
-                FFLAGS=""
-            fi
-            if test "x${FCFLAGS+set}" != "xset"; then
-                FCFLAGS=""
-            fi
-            if test "x${OBJCFLAGS+set}" != "xset"; then
-                OBJCFLAGS=""
-            fi
-        fi
+    # case of debug
+    AS_CASE([$enable_debug],
+      [yes],[
+       AC_MSG_RESULT(yes)
+       CFLAGS="${CFLAGS} -g -O0"
+       CXXFLAGS="${CXXFLAGS} -g -O0"
+       FFLAGS="${FFLAGS} -g -O0"
+       FCFLAGS="${FCFLAGS} -g -O0"
+       OBJCFLAGS="${OBJCFLAGS} -g -O0"
+      ],
+      [info],[
+       AC_MSG_RESULT(info)
+       CFLAGS="${CFLAGS} -g"
+       CXXFLAGS="${CXXFLAGS} -g"
+       FFLAGS="${FFLAGS} -g"
+       FCFLAGS="${FCFLAGS} -g"
+       OBJCFLAGS="${OBJCFLAGS} -g"
+      ],
+      [profile],[
+       AC_MSG_RESULT(profile)
+       CFLAGS="${CFLAGS} -g -pg"
+       CXXFLAGS="${CXXFLAGS} -g -pg"
+       FFLAGS="${FFLAGS} -g -pg"
+       FCFLAGS="${FCFLAGS} -g -pg"
+       OBJCFLAGS="${OBJCFLAGS} -g -pg"
+       LDFLAGS="${LDFLAGS} -pg"
+      ],
+      [
+       AC_MSG_RESULT(no)
+       dnl Ensure AC_PROG_CC/CXX/F77/FC/OBJC will not enable debug flags
+       dnl by setting any unset environment flag variables
+       AS_IF([test "x${CFLAGS+set}" != "xset"],
+         [CFLAGS=""])
+       AS_IF([test "x${CXXFLAGS+set}" != "xset"],
+         [CXXFLAGS=""])
+       AS_IF([test "x${FFLAGS+set}" != "xset"],
+         [FFLAGS=""])
+       AS_IF([test "x${FCFLAGS+set}" != "xset"],
+         [FCFLAGS=""])
+       AS_IF([test "x${OBJCFLAGS+set}" != "xset"],
+         [OBJCFLAGS=""])
+      ])
 
-        dnl Define various variables if debugging is disabled.
-        dnl assert.h is a NOP if NDEBUG is defined, so define it by default.
-        m4_map_args_w(ax_disable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is disabled])])
-    fi
+    dnl Define various variables if debugging is disabled.
+    dnl assert.h is a NOP if NDEBUG is defined, so define it by default.
+    AS_IF([test "x$enable_debug" = "xyes"],
+      [m4_map_args_w(ax_enable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is enabled])])],
+      [m4_map_args_w(ax_disable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is disabled])])])
     ax_enable_debug=$enable_debug
 ])
diff --git a/m4/ax_compiler_flags_ldflags.m4 b/m4/ax_compiler_flags_ldflags.m4
index f393ba4..228471e 100644
--- a/m4/ax_compiler_flags_ldflags.m4
+++ b/m4/ax_compiler_flags_ldflags.m4
@@ -25,10 +25,10 @@
 #   and this notice are preserved.  This file is offered as-is, without any
 #   warranty.
 
-#serial 4
+#serial 5
 
 AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[
-    AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
+    AX_REQUIRE_DEFINED([AX_APPEND_LINK_FLAGS])
     AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
     AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
 
@@ -48,14 +48,14 @@ AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[
     ])
 
     # Base flags
-    AX_APPEND_COMPILE_FLAGS([ dnl
+    AX_APPEND_LINK_FLAGS([ dnl
         -Wl,--no-as-needed dnl
         $3 dnl
     ],ax_warn_ldflags_variable,[$ax_compiler_flags_test])
 
     AS_IF([test "$ax_enable_compile_warnings" != "no"],[
         # "yes" flags
-        AX_APPEND_COMPILE_FLAGS([$4 $5 $6 $7],
+        AX_APPEND_LINK_FLAGS([$4 $5 $6 $7],
                                 ax_warn_ldflags_variable,
                                 [$ax_compiler_flags_test])
     ])
@@ -65,7 +65,7 @@ AC_DEFUN([AX_COMPILER_FLAGS_LDFLAGS],[
         #
         # suggest-attribute=format is disabled because it gives too many false
         # positives
-        AX_APPEND_COMPILE_FLAGS([ dnl
+        AX_APPEND_LINK_FLAGS([ dnl
             -Wl,--fatal-warnings dnl
         ],ax_warn_ldflags_variable,[$ax_compiler_flags_test])
     ])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]