Update m4
authorBrian Aker <brian@tangent.org>
Mon, 5 Nov 2012 01:43:17 +0000 (20:43 -0500)
committerBrian Aker <brian@tangent.org>
Mon, 5 Nov 2012 01:43:17 +0000 (20:43 -0500)
configure.ac
m4/ax_compiler_version.m4
m4/ax_harden_compiler_flags.m4
m4/ax_libevent.m4
m4/ax_platform.m4

index e5c536bc32b19c30bfcfa8e4e3cb31ecc2f39a45..0d421155b193b60771b7b578714ed3a27cae74d3 100644 (file)
@@ -286,7 +286,6 @@ AS_IF([test "x$enable_static" = "xyes"],
 PANDORA_ENABLE_DTRACE
 AX_ENDIAN
 AX_ASSERT
-AX_CXX_COMPILER_VERSION
 AX_HARDEN_COMPILER_FLAGS
 
 AX_AM_JOBSERVER([yes])
index 9dce45d2e4ae4aa4e944ab82b9cdcc7eb7ae6a6c..e074cf743c662e3b4ddd82a7acdb54386a3598ce 100644 (file)
@@ -4,8 +4,7 @@
 #
 # SYNOPSIS
 #
-#   AX_C_COMPILER_VERSION()
-#   AX_CXX_COMPILER_VERSION()
+#   AX_COMPILER_VERSION()
 #
 # DESCRIPTION
 #
 #  (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 4
+#serial 5
+AC_DEFUN([_C_COMPILER_VERSION],
+    [AC_MSG_CHECKING([C Compiler version])
 
-  AC_DEFUN([AX_C_COMPILER_VERSION],
-      [AC_REQUIRE([AX_COMPILER_VENDOR])
-      AC_MSG_CHECKING([C Compiler version])
+    AS_CASE(["$ax_cv_c_compiler_vendor"],
+      [sun],[ax_c_compiler_version=`$CC -V 2>&1 | sed 1q`],
+      [intel],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`],
+      [clang],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`],
+      [gnu],[ax_c_compiler_version=`$CC --version | sed 1q`],
+      [mingw],[ax_c_compiler_version=`$CC --version | sed 1q`],
+      [ax_c_compiler_version="unknown: $ax_cv_c_compiler_vendor"])
 
-      ax_c_compiler_version_vendor="$ax_c_compiler_vendor"
+    AC_MSG_RESULT(["$ax_c_compiler_version"])
+    AC_SUBST([CC_VERSION_VENDOR],["$ax_cv_c_compiler_vendor"])
+    AC_SUBST([CC_VERSION],["$ax_c_compiler_version"])
+  ])
 
-      AC_CHECK_DECL([__GNUC_PATCHLEVEL__],
-        [GNUCC=yes
-        ax_c_compiler_version_gcc="`$CC --dumpversion`"],
-        [GNUCC=no])
-      AC_MSG_CHECKING([GNUCC])
-      AC_MSG_RESULT([$GNUCC])
+AC_DEFUN([_CXX_COMPILER_VERSION],
+    [AC_MSG_CHECKING([C++ Compiler version])
 
-      AC_CHECK_DECL([__SUNPRO_C],[SUNCC=yes],[SUNCC=no])
-      AC_MSG_CHECKING([SUNCC])
-      AC_MSG_RESULT([$SUNCC])
+    AS_CASE(["$ax_cv_c_compiler_vendor"],
+      [sun],[ax_cxx_compiler_version=`$CXX -V 2>&1 | sed 1q`],
+      [intel],[ax_cxx_compiler_version=`$CXX --version 2>&1 | sed 1q`],
+      [clang],[ax_cxx_compiler_version=`$CXX --version 2>&1 | sed 1q`],
+      [gnu],[ax_cxx_compiler_version=`$CXX --version | sed 1q`],
+      [mingw],[ax_cxx_compiler_version=`$CXX --version | sed 1q`],
+      [ax_cxx_compiler_version="unknown: $ax_cv_c_compiler_vendor"])
 
-      AC_CHECK_DECL([__ICC],[INTELCC=yes],[INTELCC=no])
-      AC_MSG_CHECKING([INTELCC])
-      AC_MSG_RESULT([$INTELCC])
+    AC_MSG_RESULT(["$ax_cxx_compiler_version"])
+    AC_SUBST([CXX_VERSION_VENDOR],["$ax_cv_c_compiler_vendor"])
+    AC_SUBST([CXX_VERSION],["$ax_cxx_compiler_version"])
+    ])
 
-      AC_CHECK_DECL([__clang__],[CLANG=yes],[CLANG=no])
-      AC_MSG_CHECKING([CLANG])
-      AC_MSG_RESULT([$CLANG])
+AC_DEFUN([AX_COMPILER_VERSION],
+    [AC_REQUIRE([AX_COMPILER_VENDOR])
 
-      AC_CHECK_DECL([__MINGW32__],
-          [MINGW=yes
-          ax_c_compiler_version_vendor=mingw],
-          [MINGW=no])
-      AC_MSG_CHECKING([MINGW])
-      AC_MSG_RESULT([$MINGW])
+    AC_MSG_CHECKING([MINGW])
+    AC_CHECK_DECL([__MINGW32__],
+      [MINGW=yes
+      ax_c_compiler_version_vendor=mingw],
+      [MINGW=no])
+    AC_MSG_RESULT([$MINGW])
 
-      AS_CASE(["$ax_c_compiler_version_vendor"],
-              [sun],[ax_c_compiler_version="`$CC -V 2>&1 | sed 1q`"],
-              [intel],[ax_c_compiler_version="`$CC --version 2>&1 | sed 1q`"],
-              [clang],[ax_c_compiler_version="`$CC --version 2>&1 | sed 1q`"],
-              [gnu],[ax_c_compiler_version="`$CC --version | sed 1q`"],
-              [mingw],[ax_c_compiler_version="`$CC --version | sed 1q`"],
-              [ax_c_compiler_version=unknown])
-
-      AC_MSG_RESULT(["$ax_c_compiler_version"])
-      AC_SUBST([CC_VERSION_VENDOR],["$ax_c_compiler_version_vendor"])
-      AC_SUBST([CC_VERSION],["$ax_c_compiler_version"])
-
-      AS_IF([test "$GCC" = "yes"],
-          [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 2))
+    AC_REQUIRE([_C_COMPILER_VERSION])
+    AC_REQUIRE([_CXX_COMPILER_VERSION])
+    AS_IF([test "x$GCC" = xyes],
+      [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 7))
 # error GCC is Too Old!
 #endif
-              ]])],
-            [ac_c_gcc_recent=yes],
-            [ac_c_gcc_recent=no])])
-      ])
-
-  AC_DEFUN([AX_CXX_COMPILER_VERSION],
-      [AC_REQUIRE([AX_C_COMPILER_VERSION])
-      AC_MSG_CHECKING([C++ Compiler version])
-
-      AS_CASE(["$ax_c_compiler_version_vendor"],
-        [sun],[ax_cxx_compiler_version="`$CC -V 2>&1 | sed 1q`"],
-        [intel],[ax_cxx_compiler_version="`$CC --version 2>&1 | sed 1q`"],
-        [clang],[ax_cxx_compiler_version="`$CC --version 2>&1 | sed 1q`"],
-        [gnu],[ax_cxx_compiler_version="`$CC --version | sed 1q`"],
-        [mingw],[ax_cxx_compiler_version="`$CC --version | sed 1q`"],
-        [ax_cxx_compiler_version=unknown])
-
-      AC_MSG_RESULT(["$ax_cxx_compiler_version"])
-      AC_SUBST([CXX_VERSION_VENDOR],["$ax_c_compiler_version_vendor"])
-      AC_SUBST([CXX_VERSION],["$ax_cxx_compiler_version"])
+          ]])],
+        [ac_c_gcc_recent=yes],
+        [ac_c_gcc_recent=no])
       ])
+    ])
index 3be78b18274e705896f1aace0db842f66be1463e..caab7853d1fd3240e60e65203297b23d2f3a9f95 100644 (file)
@@ -4,10 +4,7 @@
 #
 # SYNOPSIS
 #
-#   AX_HARDEN_COMPILER_FLAGS()
-#   AX_HARDEN_LINKER_FLAGS()
-#   AX_HARDEN_CC_COMPILER_FLAGS()
-#   AX_HARDEN_CXX_COMPILER_FLAGS()
+#   AX_HARDEN_COMPILER_FLAGS() AX_HARDEN_LINKER_FLAGS()
 #
 # DESCRIPTION
 #
 
 # The Following flags are not checked for
 # -Wdeclaration-after-statement is counter to C99
-# AX_APPEND_COMPILE_FLAGS_ERROR([-std=c++11]) -- Not ready yet
-# AX_APPEND_COMPILE_FLAGS_ERROR([-pedantic]) -- ?
-# AX_APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector]) -- Issues on 32bit compile
-# AX_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all]) -- Issues on 32bit compile
-# AX_APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) -- Don't turn on for compatibility issues memcached_stat_st
+# _APPEND_COMPILE_FLAGS_ERROR([-std=c++11]) -- Not ready yet
+# _APPEND_COMPILE_FLAGS_ERROR([-pedantic]) --
+# ?  _APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) -- Don't turn on for
+# compatibility issues memcached_stat_st
 
-#serial 5
+#serial 6
 
-AC_DEFUN([AX_APPEND_LINK_FLAGS_ERROR],
-    [AC_PREREQ([2.63])dnl
-    AX_APPEND_LINK_FLAGS([$1],[LIB],[-Werror])
-    ])
+AC_DEFUN([_APPEND_LINK_FLAGS_ERROR],
+         [AC_REQUIRE([AX_APPEND_LINK_FLAGS])
+         AX_APPEND_LINK_FLAGS([$1],[LIB],[-Werror])
+         ])
 
-AC_DEFUN([AX_APPEND_COMPILE_FLAGS_ERROR],
-    [AC_PREREQ([2.63])dnl
-    AX_APPEND_COMPILE_FLAGS([$1],,[-Werror])
-    ])
+AC_DEFUN([_APPEND_COMPILE_FLAGS_ERROR],
+         [AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
+         AX_APPEND_COMPILE_FLAGS([$1],,[-Werror])
+         ])
 
-AC_DEFUN([AX_HARDEN_LINKER_FLAGS],
-    [AC_PREREQ([2.63])dnl
-    AC_REQUIRE([AX_APPEND_LINK_FLAGS])
-    AC_REQUIRE([AX_CXX_COMPILER_VERSION])
-    AC_REQUIRE([AX_DEBUG])
-    AC_REQUIRE([AX_VCS_CHECKOUT])
+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_ERROR([-z relro -z now])
-    AX_APPEND_LINK_FLAGS_ERROR([-pie])
+AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS],
+         [AC_LANG_PUSH([C])dnl
 
-    AS_IF([test "x$ac_cv_vcs_checkout" = xyes],[AX_APPEND_LINK_FLAGS_ERROR([-Werror])])
-    ])
+         _APPEND_COMPILE_FLAGS_ERROR([-g])
+         AS_IF([test "x$ax_enable_debug" = xyes],
+               [_APPEND_COMPILE_FLAGS_ERROR([-ggdb])
+               _APPEND_COMPILE_FLAGS_ERROR([-O0])],
+               [_APPEND_COMPILE_FLAGS_ERROR([-O2])])
 
-AC_DEFUN([AX_HARDEN_CC_COMPILER_FLAGS],
-    [AC_PREREQ([2.63])dnl
-    AC_REQUIRE([AX_APPEND_LINK_FLAGS])
-    AC_REQUIRE([AX_CXX_COMPILER_VERSION])
-    AC_REQUIRE([AX_DEBUG])
-    AC_REQUIRE([AX_VCS_CHECKOUT])
+         _APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])
+         _APPEND_COMPILE_FLAGS_ERROR([-Wall])
+         _APPEND_COMPILE_FLAGS_ERROR([-Wextra])
+         _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])
+         _APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail])
+         _APPEND_COMPILE_FLAGS_ERROR([-std=c99])
+# Anything below this comment please keep sorted.
+         _APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1])
+# _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes])
+          _APPEND_COMPILE_FLAGS_ERROR([-Waddress])
+          _APPEND_COMPILE_FLAGS_ERROR([-Warray-bounds])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wbad-function-cast])
+# Not in use -Wc++-compat
+          _APPEND_COMPILE_FLAGS_ERROR([-Wchar-subscripts])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wcomment])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wfloat-equal])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wformat-security])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wformat=2])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wlogical-op])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wmaybe-uninitialized])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-field-initializers])
+          AS_IF([test "x$MINGW" = xyes],
+                [_APPEND_COMPILE_FLAGS_ERROR([-Wno-missing-noreturn])],
+                [_APPEND_COMPILE_FLAGS_ERROR([-Wmissing-noreturn])])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-prototypes])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wnested-externs])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wnormalized=id])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wold-style-definition])
+          _APPEND_COMPILE_FLAGS_ERROR([-Woverride-init])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wpointer-arith])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wpointer-sign])
+          AS_IF([test "x$MINGW" = xyes],
+                [_APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=const])
+                _APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=noreturn])
+                _APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=pure])
+                _APPEND_COMPILE_FLAGS_ERROR([-Wno-redundant-decls])],
+                [_APPEND_COMPILE_FLAGS_ERROR([-Wredundant-decls])])
 
-    AC_LANG_PUSH([C])dnl
+          _APPEND_COMPILE_FLAGS_ERROR([-Wshadow])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wshorten-64-to-32])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wsign-compare])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-overflow=1])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-prototypes])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wswitch-enum])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wundef])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wunused])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wunused-variable])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wwrite-strings])
+          _APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all])
+          _APPEND_COMPILE_FLAGS_ERROR([-fwrapv])
+          _APPEND_COMPILE_FLAGS_ERROR([-fmudflapt])
 
-    AX_APPEND_COMPILE_FLAGS_ERROR([-g])
-    AS_IF([test "x$ax_enable_debug" = xyes],
-      [AX_APPEND_COMPILE_FLAGS_ERROR([-ggdb])
-      AX_APPEND_COMPILE_FLAGS_ERROR([-O0])],
-      [AX_APPEND_COMPILE_FLAGS_ERROR([-O2])])
+          AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
+                [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])
+                AS_IF([test "x$ac_c_gcc_recent" = xyes],
+                      [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2])
+                      _APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector])
+                      _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector])
+                      _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all])
+                      ])])
 
-    AX_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wall])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wextra])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-std=c99])
-# Anything below this comment please keep sorted.
-    AX_APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1])
-# -Wmissing-format-attribute
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Waddress])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Warray-bounds])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wbad-function-cast])
-# Not in use -Wc++-compat
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wchar-subscripts])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wcomment])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wfloat-equal])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wformat-security])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wformat=2])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wlogical-op])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wmaybe-uninitialized])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wmissing-field-initializers])
-    AS_IF([test "$MINGW" = "yes"],
-        [AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-missing-noreturn])],
-        [AX_APPEND_COMPILE_FLAGS_ERROR([-Wmissing-noreturn])])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wmissing-prototypes])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wnested-externs])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wnormalized=id])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wold-style-definition])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Woverride-init])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wpointer-arith])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wpointer-sign])
-    AS_IF([test "x$MINGW" = xyes],
-        [AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=const])
-        AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=noreturn])
-        AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=pure])
-        AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-redundant-decls])],
-        [AX_APPEND_COMPILE_FLAGS_ERROR([-Wredundant-decls])])
+         AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
+               [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])],
+               [_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])])
 
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wshadow])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wshorten-64-to-32])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wsign-compare])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wstrict-overflow=1])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wstrict-prototypes])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wswitch-enum])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wundef])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wunused])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wunused-result])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wunused-variable])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wwrite-strings])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-fwrapv])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-fmudflapt])
-    AS_IF([test "x$ac_cv_vcs_checkout" = xyes], [AX_APPEND_COMPILE_FLAGS_ERROR([-Werror])])
-    AC_LANG_POP([C])
+          AC_LANG_POP([C])
   ])
 
-AC_DEFUN([AX_HARDEN_CXX_COMPILER_FLAGS],
-    [AC_PREREQ([2.63])dnl
-    AC_REQUIRE([AX_APPEND_LINK_FLAGS])
-    AC_REQUIRE([AX_CXX_COMPILER_VERSION])
-    AC_REQUIRE([AX_DEBUG])
-    AC_REQUIRE([AX_VCS_CHECKOUT])
+AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS],
+         [AC_LANG_PUSH([C++])
+         AC_REQUIRE([_APPEND_COMPILE_FLAGS_ERROR])
 
-    AC_LANG_PUSH([C++])
+            _APPEND_COMPILE_FLAGS_ERROR([-g])
+            AS_IF([test "x$ax_enable_debug" = xyes],
+                  [_APPEND_COMPILE_FLAGS_ERROR([-O0])
+                  _APPEND_COMPILE_FLAGS_ERROR([-ggdb])],
+                  [_APPEND_COMPILE_FLAGS_ERROR([-O2])])
 
-    AX_APPEND_COMPILE_FLAGS_ERROR([-g])
-    AS_IF([test "x$ax_enable_debug" = xyes],
-      [AX_APPEND_COMPILE_FLAGS_ERROR([-O0])
-      AX_APPEND_COMPILE_FLAGS_ERROR([-ggdb])],
-      [AX_APPEND_COMPILE_FLAGS_ERROR([-O2])])
+            AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
+                  [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])],
+                  [_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])])
 
-    AS_IF([test "x$ac_c_gcc_recent" = xyes],
-      [AX_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2])])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wall])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wextra])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail])
+# Anything below this comment please keep sorted.
+            _APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1])
+# _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes])
+            _APPEND_COMPILE_FLAGS_ERROR([-Waddress])
+            _APPEND_COMPILE_FLAGS_ERROR([-Warray-bounds])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wchar-subscripts])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wcomment])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wctor-dtor-privacy])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wfloat-equal])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wformat=2])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wmaybe-uninitialized])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-field-initializers])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wlogical-op])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wnon-virtual-dtor])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wnormalized=id])
+            _APPEND_COMPILE_FLAGS_ERROR([-Woverloaded-virtual])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wpointer-arith])
+            AS_IF([test "x$MINGW" = xyes],
+                  [_APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=const])
+                  _APPEND_COMPILE_FLAGS_ERROR([-Wno-missing-noreturn])
+                  _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-noreturn])
+                  _APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=noreturn])
+                  _APPEND_COMPILE_FLAGS_ERROR([-Wno-error=suggest-attribute=noreturn])
+                  _APPEND_COMPILE_FLAGS_ERROR([-Wno-redundant-decls])],
+                  [_APPEND_COMPILE_FLAGS_ERROR([-Wredundant-decls])])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wshadow])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wshorten-64-to-32])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wsign-compare])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-overflow=1])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wswitch-enum])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wundef])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wc++11-compat])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wunused])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wunused-variable])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wwrite-strings])
+            _APPEND_COMPILE_FLAGS_ERROR([-Wformat-security])
+            _APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all])
+            _APPEND_COMPILE_FLAGS_ERROR([-fwrapv])
+            _APPEND_COMPILE_FLAGS_ERROR([-fmudflapt])
 
-    AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
-      [AX_APPEND_COMPILE_FLAGS_ERROR([-Werror])
-      AX_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])],
-      [AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])])
+            AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
+                  [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])
+                  AS_IF([test "x$ac_c_gcc_recent" = xyes],
+                        [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2])
+                        _APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector])
+                        _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector])
+                        _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all])
+                        ])])
 
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wall])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wextra])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail])
-# Anything below this comment please keep sorted.
-    AX_APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1])
-# -Wmissing-format-attribute
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Waddress])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Warray-bounds])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wchar-subscripts])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wcomment])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wctor-dtor-privacy])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wfloat-equal])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wformat=2])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wmaybe-uninitialized])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wmissing-field-initializers])
-    AS_IF([test "x$MINGW" = xyes],
-        [AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-missing-noreturn])],
-        [AX_APPEND_COMPILE_FLAGS_ERROR([-Wmissing-noreturn])])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wlogical-op])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wnon-virtual-dtor])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wnormalized=id])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Woverloaded-virtual])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wpointer-arith])
-    AS_IF([test "x$MINGW" = xyes],
-        [AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=const])
-        AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-suggest-attribute=noreturn])
-        AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-error=suggest-attribute=noreturn])
-        AX_APPEND_COMPILE_FLAGS_ERROR([-Wno-redundant-decls])],
-        [AX_APPEND_COMPILE_FLAGS_ERROR([-Wredundant-decls])])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wshadow])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wshorten-64-to-32])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wsign-compare])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wstrict-overflow=1])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wswitch-enum])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wundef])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wc++11-compat])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wunused])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wunused-result])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wunused-variable])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wwrite-strings])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-Wformat-security])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-fwrapv])
-    AX_APPEND_COMPILE_FLAGS_ERROR([-fmudflapt])
-    AS_IF([test "x$ac_cv_vcs_checkout" = xyes], [AX_APPEND_COMPILE_FLAGS_ERROR([-Werror])])
-    AC_LANG_POP([C++])
+            AS_IF([test "x$ac_cv_warnings_as_errors" = xyes],
+                  [_APPEND_COMPILE_FLAGS_ERROR([-Werror])])
+            AC_LANG_POP([C++])
   ])
 
-  AC_DEFUN([AX_HARDEN_COMPILER_FLAGS],
-      [AC_PREREQ([2.63])dnl
-      AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
-      AC_REQUIRE([AX_APPEND_LINK_FLAGS])
-      AC_REQUIRE([AX_CXX_COMPILER_VERSION])
-      AC_REQUIRE([AX_DEBUG])
-      AC_REQUIRE([AX_VCS_CHECKOUT])
+  AC_DEFUN([_CC_OTHER_FLAGS],
+            [AC_REQUIRE([_APPEND_COMPILE_FLAGS_ERROR])
 
-      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_LANG_PUSH([C])
+            _APPEND_COMPILE_FLAGS_ERROR([-pipe])
+            AC_LANG_POP([C])
+            ])
 
-# All of the actual checks happen via these Macros
-      AC_REQUIRE([AX_HARDEN_LINKER_FLAGS])
-      AC_REQUIRE([AX_HARDEN_CC_COMPILER_FLAGS])
-      AC_REQUIRE([AX_HARDEN_CXX_COMPILER_FLAGS])
-      AC_REQUIRE([AX_CC_OTHER_FLAGS])
+# All of the heavy lifting happens in _HARDEN_LINKER_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([AX_APPEND_LINK_FLAGS])
+           AC_REQUIRE([AX_COMPILER_VERSION])
+           AC_REQUIRE([AX_DEBUG])
+           AC_REQUIRE([AX_VCS_CHECKOUT])
 
-      AC_REQUIRE([gl_VISIBILITY])
-      AS_IF([test -n "$CFLAG_VISIBILITY"],[CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"])
-      ])
+           AC_REQUIRE([gl_VISIBILITY])
+           AS_IF([test -n "$CFLAG_VISIBILITY"],[CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"])
 
-  AC_DEFUN([AX_CC_OTHER_FLAGS],
-      [AC_PREREQ([2.63])dnl
-      AC_REQUIRE([AX_APPEND_COMPILE_FLAGS_ERROR])
-      AC_REQUIRE([AX_HARDEN_CC_COMPILER_FLAGS])
+           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_LANG_PUSH([C])
-      AX_APPEND_COMPILE_FLAGS_ERROR([-pipe])
-      AC_LANG_POP([C])
-      ])
+           AC_REQUIRE([_HARDEN_LINKER_FLAGS])
+           AC_REQUIRE([_HARDEN_CC_COMPILER_FLAGS])
+           AC_REQUIRE([_HARDEN_CXX_COMPILER_FLAGS])
+           AC_REQUIRE([_CC_OTHER_FLAGS])
+           ])
index af4d97a06a1e26b761c12c484a0902256198d1d6..41392f9d975899178188bcf992ae0d551759be8f 100644 (file)
 #serial 2
  
 AC_DEFUN([AX_LIBEVENT],
-    [AC_PREREQ([2.63])dnl
-    AC_CACHE_CHECK([test for a working libevent], [ax_cv_libevent], [
-      AX_SAVE_FLAGS
-      LIBS="-levent $LIBS"
-      AC_LANG_PUSH([C])
-      AC_RUN_IFELSE([
-        AC_LANG_PROGRAM([
+         [AC_PREREQ([2.63])dnl
+         AC_CACHE_CHECK([test for a working libevent],[ax_cv_libevent],
+                        [AX_SAVE_FLAGS
+                        LIBS="-levent $LIBS"
+                        AC_LANG_PUSH([C])
+                        AC_RUN_IFELSE([
+                                      AC_LANG_PROGRAM([
 #include <sys/types.h>
 #include <sys/time.h>
 #include <stdlib.h>
 #include <event.h>
-          ], [
-          struct event_base *tmp_event= event_init();
-          event_base_free(tmp_event);
-          ])],
-        [ax_cv_libevent=yes],
-        [ax_cv_libevent=no],
-        [AC_MSG_WARN([test program execution failed])])
-      AC_LANG_POP
-      AX_RESTORE_FLAGS
-      ])
+                                                      ],[
+                                                      struct event_base *tmp_event= event_init();
+                                                      event_base_free(tmp_event);
+                                                      ])],
+                                      [ax_cv_libevent=yes],
+                                      [ax_cv_libevent=no],
+                                      [AC_MSG_WARN([test program execution failed])])
+                        AC_LANG_POP
+                        AX_RESTORE_FLAGS
+                        ])
 
-    AS_IF([test "x$ax_cv_libevent" = "xyes"],[
-        LIBEVENT_LDFLAGS="-levent"
-        AC_SUBST(LIBEVENT_LDFLAGS)
-        AC_DEFINE([HAVE_LIBEVENT],[1],[Define if event_init is present in event.h.])],[
-        AC_DEFINE([HAVE_LIBEVENT],[0],[Define if event_init is present in event.h.])
-        ])
+         AS_IF([test "x$ax_cv_libevent" = "xyes"],
+               [LIBEVENT_LDFLAGS="-levent"
+               AC_SUBST(LIBEVENT_LDFLAGS)
+               AC_DEFINE([HAVE_LIBEVENT],[1],[Define if event_init is present in event.h.])],
+               [AC_DEFINE([HAVE_LIBEVENT],[0],[Define if event_init is present in event.h.])])
 
-    AM_CONDITIONAL(HAVE_LIBEVENT, test "x$ax_cv_libevent" = "xyes")
-    ])
+         AM_CONDITIONAL(HAVE_LIBEVENT, test "x$ax_cv_libevent" = "xyes")
+         ])
 
-  AC_DEFUN([AX_LIBEVENT2],[
-      AC_REQUIRE([AX_LIBEVENT])
-      AC_CACHE_CHECK([test for a working libevent version 2], [ax_cv_libevent2], [
-        AX_SAVE_FLAGS
-        LIBS="-levent $LIBS"
-        AC_LANG_PUSH([C])
-        AC_RUN_IFELSE([
-          AC_LANG_PROGRAM([
+  AC_DEFUN([AX_LIBEVENT2],
+           [AC_REQUIRE([AX_LIBEVENT])
+           AC_CACHE_CHECK([test for a working libevent version 2],[ax_cv_libevent2],
+                          [AX_SAVE_FLAGS
+                          LIBS="-levent $LIBS"
+                          AC_LANG_PUSH([C])
+                          AC_RUN_IFELSE([
+                                        AC_LANG_PROGRAM([
 #include <sys/types.h>
 #include <sys/time.h>
 #include <stdlib.h>
 #include <event2/event.h>
-            ],[
-            struct event_base *tmp_event= event_init();
-            event_base_free(tmp_event);
-            ])],
-          [ax_cv_libevent2=yes],
-          [ax_cv_libevent2=no],
-          [AC_MSG_WARN([test program execution failed])])
-        AC_LANG_POP
-        AX_RESTORE_FLAGS
-        ])
+                                                        ],[
+                                                        struct event_base *tmp_event= event_init();
+                                                        event_base_free(tmp_event);
+                                                        ])],
+                                        [ax_cv_libevent2=yes],
+                                        [ax_cv_libevent2=no],
+                                        [AC_MSG_WARN([test program execution failed])])
+                          AC_LANG_POP
+                          AX_RESTORE_FLAGS
+                          ])
 
-      AS_IF([test "x$ax_cv_libevent2" = "xyes"],[
-        LIBEVENT2_LDFLAGS="-levent"
-        AC_SUBST(LIBEVENT2_LDFLAGS)
-        AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])],[
-        AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])
-        ])
+           AS_IF([test "x$ax_cv_libevent2" = xyes],
+                 [LIBEVENT2_LDFLAGS="-levent"
+                 AC_SUBST(LIBEVENT2_LDFLAGS)
+                 AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])],
+                 [AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])])
 
-      AM_CONDITIONAL(HAVE_LIBEVENT2, test "x$ax_cv_libevent2" = "xyes")
-      ])
+           AM_CONDITIONAL([HAVE_LIBEVENT2], [test "x$ax_cv_libevent2" = xyes])
+           ])
 
-  AC_DEFUN([AX_LIBEVENT2_EVHTTP],[
-      AC_REQUIRE([AX_LIBEVENT2])
-      AC_CACHE_CHECK([test for a working libevent2 evhttp interface], [ax_cv_libevent2_evhttp], [
-        AX_SAVE_FLAGS
-        LIBS="-levent $LIBS"
-        AC_LANG_PUSH([C])
-        AC_RUN_IFELSE([
-          AC_LANG_PROGRAM([
+  AC_DEFUN([AX_LIBEVENT2_EVHTTP],
+           [AC_REQUIRE([AX_LIBEVENT2])
+           AC_CACHE_CHECK([test for a working libevent2 evhttp interface], [ax_cv_libevent2_evhttp],
+                          [AX_SAVE_FLAGS
+                          LIBS="-levent $LIBS"
+                          AC_LANG_PUSH([C])
+                          AC_RUN_IFELSE([
+                                        AC_LANG_PROGRAM([
 #include <sys/types.h>
 #include <sys/time.h>
 #include <stdlib.h>
 #include <event2/event.h>
 #include <event2/http.h>
-            ],[
-            struct event_base *libbase= event_base_new();  
-            struct evhttp *libsrvr= evhttp_new(libbase);
-            ])],
-          [ax_cv_libevent2_evhttp=yes],
-          [ax_cv_libevent2_evhttp=no],
-          [AC_MSG_WARN([test program execution failed])])
-        AC_LANG_POP
-        AX_RESTORE_FLAGS
-        ])
+                                                        ],[
+                                                        struct event_base *libbase= event_base_new();  
+                                                        struct evhttp *libsrvr= evhttp_new(libbase);
+                                                        ])],
+                                        [ax_cv_libevent2_evhttp=yes],
+                                        [ax_cv_libevent2_evhttp=no],
+                                        [AC_MSG_WARN([test program execution failed])])
+                          AC_LANG_POP
+                          AX_RESTORE_FLAGS
+                          ])
 
-      AS_IF([test "x$ax_cv_libevent2_evhttp" = "xyes"],[
-        LIBEVENT2_LDFLAGS="-levent"
-        AC_SUBST(LIBEVENT2_LDFLAGS)
-        AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])],[
-        AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])
-        ])
+           AS_IF([test "x$ax_cv_libevent2_evhttp" = "xyes"],
+                 [LIBEVENT2_LDFLAGS="-levent"
+                 AC_SUBST(LIBEVENT2_LDFLAGS)
+                 AC_DEFINE([HAVE_LIBEVENT2],[1],[Define if event_init is present in event2/event.h.])],
+                 [AC_DEFINE([HAVE_LIBEVENT2],[0],[Define if event_init is present in event2/event.h.])])
 
-      AM_CONDITIONAL(HAVE_LIBEVENT2_EVHTTP, test "x$ax_cv_libevent2_evhttp" = "xyes")
-      ])
+           AM_CONDITIONAL([HAVE_LIBEVENT2_EVHTTP],[test "x$ax_cv_libevent2_evhttp" = xyes])
+           ])
index c1403b8c2e58b55d4e9ef7e6200bda2b54b37736..bf4ff0e455daac5993af77844a78b6c1defc3c94 100644 (file)
 #   warranty.
 
 #serial 1
-  AC_DEFUN([AX_PLATFORM],[
-      AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_DEFUN([AX_PLATFORM],
+      [AC_REQUIRE([AC_CANONICAL_HOST])
       AC_REQUIRE([AC_CANONICAL_TARGET])
 
-      AC_DEFINE_UNQUOTED([HOST_VENDOR], ["$host_vendor"],[Vendor of Build System])
-      AC_DEFINE_UNQUOTED([HOST_OS], ["$host_os"], [OS of Build System])
-      AC_DEFINE_UNQUOTED([HOST_CPU], ["$host_cpu"], [CPU of Build System])
+      AC_DEFINE_UNQUOTED([HOST_VENDOR],["$host_vendor"],[Vendor of Build System])
+      AC_DEFINE_UNQUOTED([HOST_OS],["$host_os"], [OS of Build System])
+      AC_DEFINE_UNQUOTED([HOST_CPU],["$host_cpu"], [CPU of Build System])
 
-      AC_DEFINE_UNQUOTED([TARGET_VENDOR], ["$target_vendor"],[Vendor of Target System])
-      AC_DEFINE_UNQUOTED([TARGET_OS], ["$target_os"], [OS of Target System])
-      AC_DEFINE_UNQUOTED([TARGET_CPU], ["$target_cpu"], [CPU of Target System])
+      AC_DEFINE_UNQUOTED([TARGET_VENDOR],["$target_vendor"],[Vendor of Target System])
+      AC_DEFINE_UNQUOTED([TARGET_OS],["$target_os"], [OS of Target System])
+      AC_DEFINE_UNQUOTED([TARGET_CPU],["$target_cpu"], [CPU of Target System])
 
-      AS_CASE([$target_os],[
-        *mingw32*],[
-        AC_DEFINE([TARGET_OS_WINDOWS], [1], [Whether we are building for Windows])
+      AS_CASE([$target_os],
+        [*mingw32*],
+        [AC_DEFINE([TARGET_OS_WINDOWS], [1], [Whether we are building for Windows])
         AC_DEFINE([WINVER], [WindowsXP], [Version of Windows])
         AC_DEFINE([_WIN32_WINNT], [0x0501], [Magical number to make things work])
         AC_DEFINE([EAI_SYSTEM], [11], [Another magical number])
 # define SHUT_WR SD_SEND
 # define SHUT_RDWR SD_BOTH
 #endif
-          ])
-          ],[
-        *freebsd*],[
-        AC_DEFINE([TARGET_OS_FREEBSD], [1], [Whether we are building for FreeBSD])
-        AC_DEFINE([__APPLE_CC__],[1],[Workaround for bug in FreeBSD headers])
-          ],[
-        *solaris*],[
-        AC_DEFINE([TARGET_OS_SOLARIS], [1], [Whether we are building for Solaris])
-          ],[
-        *darwin*],[
-        AC_DEFINE([TARGET_OS_OSX], [1], [Whether we build for OSX])
-          ],[
-        *linux*],[
-        AC_DEFINE([TARGET_OS_LINUX], [1], [Whether we build for Linux])
-        ])
+          ])],
+        [*freebsd*],[AC_DEFINE([TARGET_OS_FREEBSD],[1],[Whether we are building for FreeBSD])
+        AC_DEFINE([__APPLE_CC__],[1],[Workaround for bug in FreeBSD headers])],
+        [*solaris*],[AC_DEFINE([TARGET_OS_SOLARIS],[1],[Whether we are building for Solaris])],
+        [*darwin*],[AC_DEFINE([TARGET_OS_OSX],[1],[Whether we build for OSX])],
+        [*linux*],[AC_DEFINE([TARGET_OS_LINUX],[1],[Whether we build for Linux])])
 
-        AM_CONDITIONAL(BUILD_WIN32, [test "x${TARGET_WINDOWS}" = "xtrue"])
-        AM_CONDITIONAL(TARGET_OSX, [test "x${TARGET_OSX}" = "xtrue"])
-        AM_CONDITIONAL(TARGET_LINUX, [test "x${TARGET_LINUX}" = "xtrue"])
-        ])
+  AM_CONDITIONAL([BUILD_WIN32],[test "x${TARGET_WINDOWS}" = "xtrue"])
+  AM_CONDITIONAL([TARGET_OSX],[test "x${TARGET_OSX}" = "xtrue"])
+  AM_CONDITIONAL([TARGET_LINUX],[test "x${TARGET_LINUX}" = "xtrue"])
+  ])