Skip to contentSkip to conversation

Get rid of ax_check_compile_flag.m4

PATCH In review Steffan Karger 2 participants 2 messages Feb 20, 2018 – Feb 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Get rid of ax_check_compile_flag.m4

The macro was too new for some of the platforms we still support. In particular, centos/rhel 6 and opensolaris 10. To work around that, we introduce our own simpler and more tailored ACL_CHECK_ADD_COMPILE_FLAGS macro, that not only checks but also sets the flags in CFLAGS if it is accepted. Since this doesn't use new-and-shine autoconf features, it should also work on the legacy platforms.

---
 configure.ac                | 18 ++++++-----
 m4/ax_check_compile_flag.m4 | 74 ---------------------------------------------
 2 files changed, 10 insertions(+), 82 deletions(-)
 delete mode 100644 m4/ax_check_compile_flag.m4
configure.ac +10 -8
index 1496fd55..626b4dd4 100644
@@ -1292,15 +1292,17 @@ if test "${enable_pkcs11}" = "yes"; then
 	)
 fi
 
-AX_CHECK_COMPILE_FLAG(
-	[-Wno-unused-function],
-	[CFLAGS="-Wno-unused-function ${CFLAGS}"]
+AC_DEFUN([ACL_CHECK_ADD_COMPILE_FLAGS], [
+    old_cflags="$CFLAGS"
+    CFLAGS="$1 $CFLAGS"
+    AC_MSG_CHECKING([whether the compiler acceppts $1])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [AC_MSG_RESULT([yes])],
+        [AC_MSG_RESULT([no]); CFLAGS="$old_cflags"])]
 )
-AX_CHECK_COMPILE_FLAG(
-	[-Wno-unused-parameter],
-	[CFLAGS="-Wno-unused-parameter ${CFLAGS}"]
-)
-AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="-Wall ${CFLAGS}"])
+
+ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-unused-function])
+ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-unused-parameter])
+ACL_CHECK_ADD_COMPILE_FLAGS([-Wall])
 
 if test "${enable_pedantic}" = "yes"; then
 	enable_strict="yes"
m4/ax_check_compile_flag.m4 deleted +0 -74

74 lines not on this page · raw message

Signature · 1 line
2.14.1
Acked-by on v1 1/1
#1 lore raw

Tested on OpenSolaris (since this one of my buildslaves), and the problem goes away. So I assume Centos6 should be fine, too.

AIX7 is still working :)

Your patch has been applied to the master and release/2.4 branch.

commit 6a5d10e96b9ad2f9a9472aeee8cdb7c02fe4d050 (master) commit fc70bc8b30eab2bea5e9486182184b1b6b7ceb60 (release/2.4)

Author: Steffan Karger
Date:   Tue Feb 20 21:25:08 2018 +0100
     Get rid of ax_check_compile_flag.m4

     Signed-off-by: Steffan Karger <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg16515.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering