autoconf-archive-maintainers | |
[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 7/7] Implement AX_*_CHECK_FLAG on top of ax_check_flag.m4 macros
From: |
Maarten Bosmans |
Subject: |
[PATCH 7/7] Implement AX_*_CHECK_FLAG on top of ax_check_flag.m4 macros |
Date: |
Mon, 20 Jun 2011 11:24:10 +0200 |
The PROLOGUE and BODY arguments were almost never used, so there's no need to
keep them. Just emit a warning if they are nonempty.
---
m4/ax_c_check_flag.m4 | 50 ++++++++++++-------------------------------
m4/ax_cpp_check_flag.m4 | 50 ++++++++++++-------------------------------
m4/ax_cxx_check_flag.m4 | 50 ++++++++++++-------------------------------
m4/ax_cxxcpp_check_flag.m4 | 50 ++++++++++++-------------------------------
m4/ax_ld_check_flag.m4 | 49 ++++++++++--------------------------------
5 files changed, 68 insertions(+), 181 deletions(-)
diff --git a/m4/ax_c_check_flag.m4 b/m4/ax_c_check_flag.m4
index d96df54..5d75b1e 100644
--- a/m4/ax_c_check_flag.m4
+++ b/m4/ax_c_check_flag.m4
@@ -16,6 +16,10 @@
# This code is inspired from KDE_CHECK_COMPILER_FLAG macro. Thanks to
# Bogdan Drozdowski <address@hidden> for testing and bug fixes.
#
+# This macro is deprecated. Use
+#
AX_CHECK_COMPILE_FLAG(FLAG-TO-CHECK,[ACTION-IF-SUCCESS],[ACTION-IF-FAILURE])
+# directly. The PROLOGUE and BODY arguments cannot be used anymore.
+#
# LICENSE
#
# Copyright (c) 2008 Francesco Salvestrini <address@hidden>
@@ -46,41 +50,15 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 6
+#serial 7
-AC_DEFUN([AX_C_CHECK_FLAG],[
- AC_PREREQ([2.61])
+AU_DEFUN([AX_C_CHECK_FLAG],[dnl
+m4_ifnblank([$2], [AC_WARNING([PROLOGUE argument ($2) dropped after converting
from AX_C_CHECK_FLAG to AX_CHECK_COMPILE_FLAG.])
+])dnl
+m4_ifnblank([$3], [AC_WARNING([BODY argument ($3) dropped after converting
from AX_C_CHECK_FLAG to AX_CHECK_COMPILE_FLAG.])
+])dnl
AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_PROG_SED])
-
- flag=`echo "$1" | $SED 'y% .=/+-(){}<>:*,%_______________%'`
-
- AC_CACHE_CHECK([whether the C compiler accepts the $1 flag],
- [ax_cv_c_check_flag_$flag],[
-
- AC_LANG_PUSH([C])
-
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $1"
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([$2],[$3])
- ],[
- eval "ax_cv_c_check_flag_$flag=yes"
- ],[
- eval "ax_cv_c_check_flag_$flag=no"
- ])
-
- CFLAGS="$save_CFLAGS"
-
- AC_LANG_POP
-
- ])
-
- AS_IF([eval "test \"`echo '$ax_cv_c_check_flag_'$flag`\" = yes"],[
- :
- $4
- ],[
- :
- $5
- ])
-])
+ AC_LANG_PUSH([C])
+ AX_CHECK_COMPILE_FLAG([$1], [$4], [$5])
+ AC_LANG_POP
+],[You might want to remove some superfluous AC_REQUIRE([AC_PROG_CC]) and
AC_LANG_PUSH/POP macros])dnl AX_C_CHECK_FLAG
diff --git a/m4/ax_cpp_check_flag.m4 b/m4/ax_cpp_check_flag.m4
index 62ca065..5793e98 100644
--- a/m4/ax_cpp_check_flag.m4
+++ b/m4/ax_cpp_check_flag.m4
@@ -16,6 +16,10 @@
# This code is inspired from KDE_CHECK_COMPILER_FLAG macro. Thanks to
# Bogdan Drozdowski <address@hidden> for testing and bug fixes.
#
+# This macro is deprecated. Use
+#
AX_CHECK_PREPROC_FLAG(FLAG-TO-CHECK,[ACTION-IF-SUCCESS],[ACTION-IF-FAILURE])
+# directly. The PROLOGUE and BODY arguments cannot be used anymore.
+#
# LICENSE
#
# Copyright (c) 2008 Francesco Salvestrini <address@hidden>
@@ -46,41 +50,15 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 6
+#serial 7
-AC_DEFUN([AX_CPP_CHECK_FLAG],[
- AC_PREREQ([2.61])
+AU_DEFUN([AX_CPP_CHECK_FLAG],[dnl
+m4_ifnblank([$2], [AC_WARNING([PROLOGUE argument ($2) dropped after converting
from AX_CPP_CHECK_FLAG to AX_CHECK_PREPROC_FLAG.])
+])dnl
+m4_ifnblank([$3], [AC_WARNING([BODY argument ($3) dropped after converting
from AX_CPP_CHECK_FLAG to AX_CHECK_PREPROC_FLAG.])
+])dnl
AC_REQUIRE([AC_PROG_CPP])
- AC_REQUIRE([AC_PROG_SED])
-
- flag=`echo "$1" | $SED 'y% .=/+-(){}<>:*,%_______________%'`
-
- AC_CACHE_CHECK([whether the C preprocessor accepts the $1 flag],
- [ax_cv_cpp_check_flag_$flag],[
-
- AC_LANG_PUSH([C])
-
- save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $1"
- AC_PREPROC_IFELSE([
- AC_LANG_PROGRAM([$2],[$3])
- ],[
- eval "ax_cv_cpp_check_flag_$flag=yes"
- ],[
- eval "ax_cv_cpp_check_flag_$flag=no"
- ])
-
- CPPFLAGS="$save_CPPFLAGS"
-
- AC_LANG_POP
-
- ])
-
- AS_IF([eval "test \"`echo '$ax_cv_cpp_check_flag_'$flag`\" = yes"],[
- :
- $4
- ],[
- :
- $5
- ])
-])
+ AC_LANG_PUSH([C])
+ AX_CHECK_PREPROC_FLAG([$1], [$4], [$5])
+ AC_LANG_POP
+],[You might want to remove some superfluous AC_REQUIRE([AC_PROG_CC]) and
AC_LANG_PUSH/POP macros])dnl AX_CPP_CHECK_FLAG
diff --git a/m4/ax_cxx_check_flag.m4 b/m4/ax_cxx_check_flag.m4
index cb3e924..10482d9 100644
--- a/m4/ax_cxx_check_flag.m4
+++ b/m4/ax_cxx_check_flag.m4
@@ -16,6 +16,10 @@
# This code is inspired from KDE_CHECK_COMPILER_FLAG macro. Thanks to
# Bogdan Drozdowski <address@hidden> for testing and bug fixes.
#
+# This macro is deprecated. Use
+#
AX_CHECK_COMPILE_FLAG(FLAG-TO-CHECK,[ACTION-IF-SUCCESS],[ACTION-IF-FAILURE])
+# directly. The PROLOGUE and BODY arguments cannot be used anymore.
+#
# LICENSE
#
# Copyright (c) 2008 Francesco Salvestrini <address@hidden>
@@ -46,41 +50,15 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 6
+#serial 7
-AC_DEFUN([AX_CXX_CHECK_FLAG],[
- AC_PREREQ([2.61])
+AU_DEFUN([AX_CXX_CHECK_FLAG],[dnl
+m4_ifnblank([$2], [AC_WARNING([PROLOGUE argument ($2) dropped after converting
from AX_CXX_CHECK_FLAG to AX_CHECK_COMPILE_FLAG.])
+])dnl
+m4_ifnblank([$3], [AC_WARNING([BODY argument ($3) dropped after converting
from AX_CXX_CHECK_FLAG to AX_CHECK_COMPILE_FLAG.])
+])dnl
AC_REQUIRE([AC_PROG_CXX])
- AC_REQUIRE([AC_PROG_SED])
-
- flag=`echo "$1" | $SED 'y% .=/+-(){}<>:*,%_______________%'`
-
- AC_CACHE_CHECK([whether the C++ compiler accepts the $1 flag],
- [ax_cv_cxx_check_flag_$flag],[
-
- AC_LANG_PUSH([C++])
-
- save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $1"
- AC_COMPILE_IFELSE([
- AC_LANG_PROGRAM([$2],[$3])
- ],[
- eval "ax_cv_cxx_check_flag_$flag=yes"
- ],[
- eval "ax_cv_cxx_check_flag_$flag=no"
- ])
-
- CXXFLAGS="$save_CXXFLAGS"
-
- AC_LANG_POP
-
- ])
-
- AS_IF([eval "test \"`echo '$ax_cv_cxx_check_flag_'$flag`\" = yes"],[
- :
- $4
- ],[
- :
- $5
- ])
-])
+ AC_LANG_PUSH([C++])
+ AX_CHECK_COMPILE_FLAG([$1], [$4], [$5])
+ AC_LANG_POP
+],[You might want to remove some superfluous AC_REQUIRE([AC_PROG_CC]) and
AC_LANG_PUSH/POP macros])dnl AX_CXX_CHECK_FLAG
diff --git a/m4/ax_cxxcpp_check_flag.m4 b/m4/ax_cxxcpp_check_flag.m4
index 9204707..4426170 100644
--- a/m4/ax_cxxcpp_check_flag.m4
+++ b/m4/ax_cxxcpp_check_flag.m4
@@ -16,6 +16,10 @@
# This code is inspired from KDE_CHECK_COMPILER_FLAG macro. Thanks to
# Bogdan Drozdowski <address@hidden> for testing and bug fixes.
#
+# This macro is deprecated. Use
+#
AX_CHECK_PREPROC_FLAG(FLAG-TO-CHECK,[ACTION-IF-SUCCESS],[ACTION-IF-FAILURE])
+# directly. The PROLOGUE and BODY arguments cannot be used anymore.
+#
# LICENSE
#
# Copyright (c) 2008 Francesco Salvestrini <address@hidden>
@@ -46,41 +50,15 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 6
+#serial 7
-AC_DEFUN([AX_CXXCPP_CHECK_FLAG],[
- AC_PREREQ([2.61])
+AU_DEFUN([AX_CXXCPP_CHECK_FLAG],[dnl
+m4_ifnblank([$2], [AC_WARNING([PROLOGUE argument ($2) dropped after converting
from AX_CXXCPP_CHECK_FLAG to AX_CHECK_PREPROC_FLAG.])
+])dnl
+m4_ifnblank([$3], [AC_WARNING([BODY argument ($3) dropped after converting
from AX_CXXCPP_CHECK_FLAG to AX_CHECK_PREPROC_FLAG.])
+])dnl
AC_REQUIRE([AC_PROG_CXXCPP])
- AC_REQUIRE([AC_PROG_SED])
-
- flag=`echo "$1" | $SED 'y% .=/+-(){}<>:*,%_______________%'`
-
- AC_CACHE_CHECK([whether the C++ preprocessor accepts the $1 flag],
- [ax_cv_cxxcpp_check_flag_$flag],[
-
- AC_LANG_PUSH([C++])
-
- save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $1"
- AC_PREPROC_IFELSE([
- AC_LANG_PROGRAM([$2],[$3])
- ],[
- eval "ax_cv_cxxcpp_check_flag_$flag=yes"
- ],[
- eval "ax_cv_cxxcpp_check_flag_$flag=no"
- ])
-
- CXXFLAGS="$save_CXXFLAGS"
-
- AC_LANG_POP
-
- ])
-
- AS_IF([eval "test \"`echo '$ax_cv_cxxcpp_check_flag_'$flag`\" = yes"],[
- :
- $4
- ],[
- :
- $5
- ])
-])
+ AC_LANG_PUSH([C++])
+ AX_CHECK_PREPROC_FLAG([$1], [$4], [$5])
+ AC_LANG_POP
+],[You might want to remove some superfluous AC_REQUIRE([AC_PROG_CC]) and
AC_LANG_PUSH/POP macros])dnl AX_CXXCPP_CHECK_FLAG
diff --git a/m4/ax_ld_check_flag.m4 b/m4/ax_ld_check_flag.m4
index c674f52..6f986c0 100644
--- a/m4/ax_ld_check_flag.m4
+++ b/m4/ax_ld_check_flag.m4
@@ -24,6 +24,10 @@
# This code is inspired from KDE_CHECK_COMPILER_FLAG macro. Thanks to
# Bogdan Drozdowski <address@hidden> for testing and bug fixes.
#
+# This macro is deprecated. Use
+# AX_CHECK_LINK_FLAG(FLAG-TO-CHECK,[ACTION-IF-SUCCESS],[ACTION-IF-FAILURE])
+# directly. The PROLOGUE and BODY arguments cannot be used anymore.
+#
# LICENSE
#
# Copyright (c) 2008 Francesco Salvestrini <address@hidden>
@@ -54,41 +58,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 6
-
-AC_DEFUN([AX_LD_CHECK_FLAG],[
- AC_PREREQ([2.61])
- AC_REQUIRE([AC_PROG_CXX])
- AC_REQUIRE([AC_PROG_SED])
-
- flag=`echo "$1" | $SED 'y% .=/+-(){}<>:*,%_______________%'`
-
- AC_CACHE_CHECK([whether the linker accepts the $1 flag],
- [ax_cv_ld_check_flag_$flag],[
-
- #AC_LANG_PUSH([C])
-
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $1"
- AC_LINK_IFELSE([
- AC_LANG_PROGRAM([$2],[$3])
- ],[
- eval "ax_cv_ld_check_flag_$flag=yes"
- ],[
- eval "ax_cv_ld_check_flag_$flag=no"
- ])
-
- LDFLAGS="$save_LDFLAGS"
-
- #AC_LANG_POP
-
- ])
+#serial 7
- AS_IF([eval "test \"`echo '$ax_cv_ld_check_flag_'$flag`\" = yes"],[
- :
- $4
- ],[
- :
- $5
- ])
-])
+AU_DEFUN([AX_LD_CHECK_FLAG],[dnl
+m4_ifnblank([$2], [AC_WARNING([PROLOGUE argument ($2) dropped after converting
from AX_LD_CHECK_FLAG to AX_CHECK_LINK_FLAG.])
+])dnl
+m4_ifnblank([$3], [AC_WARNING([BODY argument ($3) dropped after converting
from AX_LD_CHECK_FLAG to AX_CHECK_LINK_FLAG.])
+])dnl
+ AX_CHECK_LINK_FLAG([$1], [$4], [$5])dnl
+])dnl AX_LD_CHECK_FLAG
--
1.7.4.1
- Patches for implementing checking for valid CFLAGS, LDFLAGS, etc., Maarten Bosmans, 2011/06/20
- [PATCH 1/7] ax_cflags_*_option.m4: Consolidate _OLD and _NEW macros, Maarten Bosmans, 2011/06/20
- [PATCH 2/7] ax_cflags_*_option.m4: Consolidate CFLAGS and CXXFLAGS macros, Maarten Bosmans, 2011/06/20
- [PATCH 4/7] ax_cflags_*_option.m4: Use AX_CHECK_COMPILE_FLAG macro to do most of the work, Maarten Bosmans, 2011/06/20
- [PATCH 5/7] ax_cflags_*_option.m4: Use AX_APPEND_FLAG macro to append the flag, Maarten Bosmans, 2011/06/20
- [PATCH 3/7] Add ax_check_flag.m4, Maarten Bosmans, 2011/06/20
- [PATCH 7/7] Implement AX_*_CHECK_FLAG on top of ax_check_flag.m4 macros,
Maarten Bosmans <=
- [PATCH 6/7] Implement AX_CHECK_*_FLAGS on top of ax_check_flag.m4 macros, Maarten Bosmans, 2011/06/20
- Re: Patches for implementing checking for valid CFLAGS, LDFLAGS, etc., Peter Simons, 2011/06/25
- Re: Patches for implementing checking for valid CFLAGS, LDFLAGS, etc., Maarten Bosmans, 2011/06/25
- Re: Patches for implementing checking for valid CFLAGS, LDFLAGS, etc., Peter Simons, 2011/06/28
- Re: Patches for implementing checking for valid CFLAGS, LDFLAGS, etc., Maarten Bosmans, 2011/06/28
- Re: Patches for implementing checking for valid CFLAGS, LDFLAGS, etc., Peter Simons, 2011/06/30