Update ddm4
authorBrian Aker <brian@tangent.org>
Wed, 12 Dec 2012 07:48:32 +0000 (02:48 -0500)
committerBrian Aker <brian@tangent.org>
Wed, 12 Dec 2012 07:48:32 +0000 (02:48 -0500)
m4/ax_assert.m4
m4/ax_debug.m4
m4/ax_harden_compiler_flags.m4

index 8750674b830bcbb38ad7f7e70eed5e5144da1481..88741293e176246e41f424f0dd92b1eabd72c01e 100644 (file)
@@ -43,7 +43,7 @@
 #  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-#serial 5
+#serial 6
 
 AC_DEFUN([AX_ASSERT],
     [AC_PREREQ([2.63])dnl
index ba1a9615e06da76a48a2b7de983eb05751221b60..e066bf6e3d06b6b0224645d2b3909deddf8de183 100644 (file)
@@ -43,7 +43,7 @@
 #  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-#serial 3
+#serial 4
 
 AC_DEFUN([AX_DEBUG],
     [AC_PREREQ([2.63])dnl
index 754955e0296f31f79439773c26b05d2629caddc5..91d58b393518ecd50dcd7bd716c4009c388ba5ce 100644 (file)
 
 #serial 7
 
+AC_DEFUN([_WARNINGS_AS_ERRORS],
+    [AC_CACHE_CHECK([if all warnings into errors],[ac_cv_warnings_as_errors],
+      [AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ac_cv_warnings_as_errors=yes],
+        [ac_cv_warnings_as_errors=no])
+      ])
+    ])
+
 AC_DEFUN([_APPEND_LINK_FLAGS_ERROR],
          [AC_REQUIRE([AX_APPEND_LINK_FLAGS])
          AX_APPEND_LINK_FLAGS([$1],[LIB],[-Werror])
@@ -64,11 +71,13 @@ AC_DEFUN([_APPEND_COMPILE_FLAGS_ERROR],
          AX_APPEND_COMPILE_FLAGS([$1],,[-Werror])
          ])
 
+# Everything above this does the heavy lifting, while what follows does the specifics.
+
 AC_DEFUN([_HARDEN_LINKER_FLAGS],
          [_APPEND_LINK_FLAGS_ERROR([-z relro -z now])
          _APPEND_LINK_FLAGS_ERROR([-pie])
          AS_IF([test "x$ac_cv_warnings_as_errors" = xyes],
-               [_APPEND_LINK_FLAGS_ERROR([-Werror])])
+               [AX_APPEND_LINK_FLAGS([-Werror])])
          ])
 
 AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS],
@@ -148,6 +157,9 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS],
                [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])],
                [_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])])
 
+         AS_IF([test "x$ac_cv_warnings_as_errors" = xyes],
+             [AX_APPEND_FLAG([-Werror])])
+
           AC_LANG_POP([C])
   ])
 
@@ -222,7 +234,7 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS],
                         ])])])
 
             AS_IF([test "x$ac_cv_warnings_as_errors" = xyes],
-                  [_APPEND_COMPILE_FLAGS_ERROR([-Werror])])
+                  [AX_APPEND_FLAG([-Werror])])
             AC_LANG_POP([C++])
   ])
 
@@ -238,6 +250,7 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS],
 # _HARDEN_CC_COMPILER_FLAGS, _HARDEN_CXX_COMPILER_FLAGS, _CC_OTHER_FLAGS
   AC_DEFUN([AX_HARDEN_COMPILER_FLAGS],
            [AC_PREREQ([2.63])dnl
+           AC_REQUIRE([_WARNINGS_AS_ERRORS])
            AC_REQUIRE([AX_APPEND_LINK_FLAGS])
            AC_REQUIRE([AX_COMPILER_VERSION])
            AC_REQUIRE([AX_DEBUG])
@@ -246,11 +259,6 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS],
            AC_REQUIRE([gl_VISIBILITY])
            AS_IF([test -n "$CFLAG_VISIBILITY"],[CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"])
 
-           AC_CACHE_CHECK([if all warnings into errors],[ac_cv_warnings_as_errors],
-                          [AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[ac_cv_warnings_as_errors=yes],
-                                 [ac_cv_warnings_as_errors=no])
-                          ])
-
            AC_REQUIRE([_HARDEN_LINKER_FLAGS])
            AC_REQUIRE([_HARDEN_CC_COMPILER_FLAGS])
            AC_REQUIRE([_HARDEN_CXX_COMPILER_FLAGS])