]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
(AC_ARG_ENABLE, AC_ARG_WITH): Factor out common code
authorStepan Kasal <kasal@ucw.cz>
Mon, 22 Aug 2005 14:49:01 +0000 (14:49 +0000)
committerStepan Kasal <kasal@ucw.cz>
Mon, 22 Aug 2005 14:49:01 +0000 (14:49 +0000)
ChangeLog
lib/autoconf/general.m4

index 7b4fa7a480b127d3fd04a79907c58f5819808656..36a98c1af35e2158aa71ae8598177b6660d94669 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-08-22  Stepan Kasal  <kasal@ucw.cz>
+
+       * lib/autoconf/general.m4 (AC_ARG_ENABLE, AC_ARG_WITH): Factor out
+         common code to...
+       (_AC_ENABLE_IF, _AC_ENABLE_IF_ACTION): ... these new macros.
+
 2005-08-21  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * doc/autoconf.texi (Using Autotest, testsuite Scripts)
index d66e3374bdc0dc465646e8802cc1cbc179d2bf94..636f61f43e6d4dda3722d60fb4eeacd62ff9fb46 100644 (file)
@@ -1337,10 +1337,23 @@ AC_LANG_PUSH(C)
 
 
 
-## ----------------------------- ##
-## Selecting optional features.  ##
-## ----------------------------- ##
+## ------------------------------------------------------------- ##
+## Selecting optional features, working with optional software.  ##
+## ------------------------------------------------------------- ##
+
+
+# _AC_ENABLE_IF(OPTION, FEATURE, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+# -------------------------------------------------------------------
+# Common code for AC_ARG_ENABLE and AC_ARG_WITH.
+# OPTION is either "enable" or "with".
+#
+m4_define([_AC_ENABLE_IF],
+[# Check whether --$1-$2 was given.
+_AC_ENABLE_IF_ACTION([$1], m4_bpatsubst([$2], -, _), [$3], [$4])[]dnl
+])
 
+m4_define([_AC_ENABLE_IF_ACTION],
+[AS_IF([test "${$1_$2+set}" = set], [$1val=$$1_$2; $3], [$4])])
 
 # AC_ARG_ENABLE(FEATURE, HELP-STRING, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
 # ------------------------------------------------------------------------
@@ -1350,13 +1363,7 @@ Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]]])dnl
 m4_divert_once([HELP_ENABLE], [$2])dnl
-[#] Check whether --enable-$1 or --disable-$1 was given.
-if test "[${enable_]m4_bpatsubst([$1], -, _)+set}" = set; then
-  enableval="[$enable_]m4_bpatsubst([$1], -, _)"
-  $3
-m4_ifvaln([$4], [else
-  $4])dnl
-fi; dnl
+_AC_ENABLE_IF([enable], [$1], [$3], [$4])
 ])# AC_ARG_ENABLE
 
 
@@ -1364,12 +1371,6 @@ AU_DEFUN([AC_ENABLE],
 [AC_ARG_ENABLE([$1], [  --enable-$1], [$2], [$3])])
 
 
-## ------------------------------ ##
-## Working with optional software ##
-## ------------------------------ ##
-
-
-
 # AC_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE, [ACTION-IF-FALSE])
 # --------------------------------------------------------------------
 AC_DEFUN([AC_ARG_WITH],
@@ -1378,13 +1379,7 @@ Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)]])
 m4_divert_once([HELP_WITH], [$2])dnl
-[#] Check whether --with-$1 or --without-$1 was given.
-if test "[${with_]m4_bpatsubst([$1], -, _)+set}" = set; then
-  withval="[$with_]m4_bpatsubst([$1], -, _)"
-  $3
-m4_ifvaln([$4], [else
-  $4])dnl
-fi; dnl
+_AC_ENABLE_IF([with], [$1], [$3], [$4])
 ])# AC_ARG_WITH
 
 AU_DEFUN([AC_WITH],