[librsvgmm] Modernize DK_ARG_ENABLE_WARNINGS() macro
- From: Daniel Elstner <daniel src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [librsvgmm] Modernize DK_ARG_ENABLE_WARNINGS() macro
- Date: Sun, 2 Aug 2009 23:41:55 +0000 (UTC)
commit 8eece1282f871571c5aae9d5cabcf7ff67453391
Author: Daniel Elstner <daniel kitta gmail com>
Date: Sun Jul 19 00:38:06 2009 +0200
Modernize DK_ARG_ENABLE_WARNINGS() macro
* build/dk-warn.m4 (DK_ARG_ENABLE_WARNINGS): Overhaul implementation
and make use of more recent Autoconf functionality.
build/dk-warn.m4 | 73 ++++++++++++++++++++----------------------------------
1 files changed, 27 insertions(+), 46 deletions(-)
---
diff --git a/build/dk-warn.m4 b/build/dk-warn.m4
index 788d5a4..a131b85 100644
--- a/build/dk-warn.m4
+++ b/build/dk-warn.m4
@@ -15,7 +15,7 @@
## You should have received a copy of the GNU General Public License along
## with danielk's Autostuff; if not, see <http://www.gnu.org/licenses/>.
-#serial 20090528
+#serial 20090718
## DK_ARG_ENABLE_WARNINGS(variable, min-flags, max-flags, [deprecation-prefixes])
##
@@ -31,48 +31,33 @@
##
AC_DEFUN([DK_ARG_ENABLE_WARNINGS],
[dnl
-m4_if([$3],, [AC_FATAL([3 arguments expected])])[]dnl
-dnl
-AC_ARG_ENABLE([warnings], [AS_HELP_STRING(
- [--enable-warnings=@<:@min|max|fatal|no@:>@],
- [control compiler pickyness @<:@min@:>@])],
- [dk_enable_warnings=$enableval],
- [dk_enable_warnings=min])[]dnl
+m4_assert([$# >= 3])[]dnl
+AC_ARG_ENABLE([warnings],
+ [AS_HELP_STRING([[--enable-warnings[=min|max|fatal|no]]],
+ [set compiler pedantry level [default=min]])],
+ [dk_enable_warnings=$enableval],
+ [dk_enable_warnings=min])[]dnl
-dk_lang=
-case $ac_compile in
- *'$CXXFLAGS '*)
- dk_lang='C++'
- dk_cc=$CXX
- dk_conftest=conftest.${ac_ext-cc}
- ;;
- *'$CFLAGS '*)
- dk_lang=C
- dk_cc=$CC
- dk_conftest=conftest.${ac_ext-c}
- ;;
-esac
+AS_CASE([$ac_compile],
+ [*'$CXXFLAGS '*], [dk_lang='C++' dk_cc=$CXX dk_conftest=conftest.${ac_ext-cc}],
+ [*'$CFLAGS '*], [dk_lang=C dk_cc=$CC dk_conftest=conftest.${ac_ext-c}],
+ [dk_lang=])[]dnl
AS_IF([test "x$dk_lang" != x],
[
AC_MSG_CHECKING([which $dk_lang compiler warning flags to use])
-
dk_deprecation_flags=
dk_tested_flags=
- case $dk_enable_warnings in
- no) dk_warning_flags=;;
- max) dk_warning_flags="$3";;
- fatal) dk_warning_flags="$3 -Werror"
-m4_if([$4],,, [dnl
- for dk_prefix in $4
- do
- dk_deprecation_flags="${dk_deprecation_flags}-D${dk_prefix}_DISABLE_DEPRECATED "
- done
-])[]dnl
- ;;
- *) dk_warning_flags="$2";;
- esac
+ AS_CASE([$dk_enable_warnings],
+ [no], [dk_warning_flags=],
+ [max], [dk_warning_flags="$3"],
+ [fatal], [dk_warning_flags="$3 -Werror"][m4_ifval([$4], [
+ for dk_prefix in $4
+ do
+ dk_deprecation_flags="${dk_deprecation_flags}-D${dk_prefix}_DISABLE_DEPRECATED "
+ done])],
+ [dk_warning_flags="$2"])[]dnl
AS_IF([test "x$dk_warning_flags" != x],
[
@@ -90,21 +75,17 @@ m4_if([$4],,, [dnl
rm -f "conftest.${OBJEXT-o}"
AS_IF([test "x$dk_cc_out" = x],
- [
- AS_IF([test "x$dk_tested_flags" = x],
- [dk_tested_flags=$dk_flag],
- [dk_tested_flags="$dk_tested_flags $dk_flag"])
- ], [
- echo "$dk_cc_out" >&AS_MESSAGE_LOG_FD
- ])
+ [AS_IF([test "x$dk_tested_flags" = x],
+ [dk_tested_flags=$dk_flag],
+ [dk_tested_flags="$dk_tested_flags $dk_flag"])],
+ [echo "$dk_cc: $dk_cc_out" >&AS_MESSAGE_LOG_FD])
done
-
rm -f "$dk_conftest"
])
dk_all_flags=$dk_deprecation_flags$dk_tested_flags
- AC_SUBST([$1], [$dk_all_flags])
+ AC_SUBST([$1], [$dk_all_flags])[]dnl
test "x$dk_all_flags" != x || dk_all_flags=none
- AC_MSG_RESULT([$dk_all_flags])
-])
+ AC_MSG_RESULT([$dk_all_flags])[]dnl
+])[]dnl
])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]