Skip to contentSkip to conversation

autoconf: change AX_ARG_{DISABLE/ENABLE}_AND_EXPORT to make more sense

PATCH In review Roger Pau Monne 3 participants 3 messages Feb 23, 2012 – Apr 3, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 autoconf: change AX_ARG_{DISABLE/ENABLE}_AND_EXPORT to make more sense

# HG changeset patch
# User Roger Pau Monne <[email protected]>
# Date 1329981765 -3600
# Node ID 50317ae2a56d66e39079b8758ee2755fac268748
# Parent 64f5cd4aa2a273d4b84c382b8ef484eab7905631
autoconf: change AX_ARG_{DISABLE/ENABLE}_AND_EXPORT to make more sense

Change disable/enable feature macros to have a more significative name of what they actually do, to avoid confusions.

New macros have the following names:

AX_ARG_DEFAULT_ENABLE: feature is enabled by default, provides the --disable-{feature} option to disable it.

AX_ARG_DEFAULT_DISABLE: feature is disabled by default, provides the --enable-{feature] option to enable it.

Changes since v1:

* Change comment to "dnl"

* Change xapi to xenapi

* Add help string regarding default value of enable/disable options

config/Tools.mk.in +1 -1
diff -r 64f5cd4aa2a2 -r 50317ae2a56d config/Tools.mk.in
@@ -32,7 +32,7 @@ GIT_HTTP            := @githttp@
 # Optional components
 XENSTAT_XENTOP      := @monitors@
 VTPM_TOOLS          := @vtpm@
-LIBXENAPI_BINDINGS  := @xapi@
+LIBXENAPI_BINDINGS  := @xenapi@
 PYTHON_TOOLS        := @pythontools@
 OCAML_TOOLS         := @ocamltools@
 CONFIG_MINITERM     := @miniterm@
tools/configure +78 -55

247 lines not on this page · raw message

tools/configure.ac +10 -12
diff -r 64f5cd4aa2a2 -r 50317ae2a56d tools/configure.ac
@@ -23,8 +23,7 @@ AC_USE_SYSTEM_EXTENSIONS
 AC_CANONICAL_HOST
 
 # M4 Macro includes
-m4_include([m4/enable_feature.m4])
-m4_include([m4/disable_feature.m4])
+m4_include([m4/features.m4])
 m4_include([m4/path_or_fail.m4])
 m4_include([m4/python_version.m4])
 m4_include([m4/python_devel.m4])
@@ -36,16 +35,15 @@ m4_include([m4/pkg.m4])
 m4_include([m4/curses.m4])
 
 # Enable/disable options
-AX_ARG_ENABLE_AND_EXPORT([githttp], [Download GIT repositories via HTTP])
-AX_ARG_DISABLE_AND_EXPORT([monitors],
-    [Disable xenstat and xentop monitoring tools])
-AX_ARG_ENABLE_AND_EXPORT([vtpm], [Enable Virtual Trusted Platform Module])
-AX_ARG_ENABLE_AND_EXPORT([xapi], [Enable Xen API Bindings])
-AX_ARG_DISABLE_AND_EXPORT([pythontools], [Disable Python tools])
-AX_ARG_DISABLE_AND_EXPORT([ocamltools], [Disable Ocaml tools])
-AX_ARG_ENABLE_AND_EXPORT([miniterm], [Enable miniterm])
-AX_ARG_ENABLE_AND_EXPORT([lomount], [Enable lomount])
-AX_ARG_DISABLE_AND_EXPORT([debug], [Disable debug build of tools])
+AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
+AX_ARG_DEFAULT_ENABLE([monitors], [Disable xenstat and xentop monitoring tools])
+AX_ARG_DEFAULT_DISABLE([vtpm], [Enable Virtual Trusted Platform Module])
+AX_ARG_DEFAULT_DISABLE([xenapi], [Enable Xen API Bindings])
+AX_ARG_DEFAULT_ENABLE([pythontools], [Disable Python tools])
+AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
+AX_ARG_DEFAULT_DISABLE([miniterm], [Enable miniterm])
+AX_ARG_DEFAULT_DISABLE([lomount], [Enable lomount])
+AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of tools])
 
 AC_ARG_VAR([PREPEND_INCLUDES],
     [List of include folders to prepend to CFLAGS (without -I)])
tools/m4/disable_feature.m4 deleted +0 -13
diff -r 64f5cd4aa2a2 -r 50317ae2a56d tools/m4/disable_feature.m4
@@ -1,13 +0,0 @@
-AC_DEFUN([AX_ARG_DISABLE_AND_EXPORT],
-[AC_ARG_ENABLE([$1],
-    AS_HELP_STRING([--disable-$1], [$2]))
-
-AS_IF([test "x$enable_$1" = "xno"], [
-    ax_cv_$1="n"
-], [test "x$enable_$1" = "xyes"], [
-    ax_cv_$1="y"
-], [test -z $ax_cv_$1], [
-    ax_cv_$1="y"
-])
-$1=$ax_cv_$1
-AC_SUBST($1)])
tools/m4/enable_feature.m4 deleted +0 -13
diff -r 64f5cd4aa2a2 -r 50317ae2a56d tools/m4/enable_feature.m4
@@ -1,13 +0,0 @@
-AC_DEFUN([AX_ARG_ENABLE_AND_EXPORT],
-[AC_ARG_ENABLE([$1],
-    AS_HELP_STRING([--enable-$1], [$2]))
-
-AS_IF([test "x$enable_$1" = "xyes"], [
-    ax_cv_$1="y"
-], [test "x$enable_$1" = "xno"], [
-    ax_cv_$1="n"
-], [test -z $ax_cv_$1], [
-    ax_cv_$1="n"
-])
-$1=$ax_cv_$1
-AC_SUBST($1)])
tools/m4/features.m4 new file +21 -0
diff -r 64f5cd4aa2a2 -r 50317ae2a56d tools/m4/features.m4
@@ -0,0 +1,21 @@
+AC_DEFUN([AX_ARG_DEFAULT_ENABLE], [
+AC_ARG_ENABLE([$1], AS_HELP_STRING([--disable-$1], [$2 (default is ENABLED)]))
+AX_PARSE_VALUE([$1], [y])
+])
+
+AC_DEFUN([AX_ARG_DEFAULT_DISABLE], [
+AC_ARG_ENABLE([$1], AS_HELP_STRING([--enable-$1], [$2 (default is DISABLED)]))
+AX_PARSE_VALUE([$1], [n])
+])
+
+dnl This function should not be called outside of this file
+AC_DEFUN([AX_PARSE_VALUE], [
+AS_IF([test "x$enable_$1" = "xno"], [
+    ax_cv_$1="n"
+], [test "x$enable_$1" = "xyes"], [
+    ax_cv_$1="y"
+], [test -z $ax_cv_$1], [
+    ax_cv_$1="$2"
+])
+$1=$ax_cv_$1
+AC_SUBST($1)])
Acked-by on v2 1/1
#1 lore raw
Quoted 20 lines · Roger Pau Monne

# HG changeset patch
# User Roger Pau Monne <[email protected]>
# Date 1329981765 -3600
# Node ID 50317ae2a56d66e39079b8758ee2755fac268748
# Parent 64f5cd4aa2a273d4b84c382b8ef484eab7905631
autoconf: change AX_ARG_{DISABLE/ENABLE}_AND_EXPORT to make more sense

Change disable/enable feature macros to have a more significative name of what they actually do, to avoid confusions.

New macros have the following names:

AX_ARG_DEFAULT_ENABLE: feature is enabled by default, provides the --disable-{feature} option to disable it.

AX_ARG_DEFAULT_DISABLE: feature is disabled by default, provides the --enable-{feature] option to enable it.

Changes since v1:

Quoted 8 lines

* Change comment to "dnl"

* Change xapi to xenapi

* Add help string regarding default value of enable/disable options

#2 lore raw

Re: [PATCH v2] autoconf: change AX_ARG_{DISABLE/ENABLE}_AND_EXPORT to make more sense [and 1 more messages]

In reply to Roger Pau Monne

Roger Pau Monne writes ("[Xen-devel] [PATCH v2] autoconf: change AX_ARG_{DISABLE/ENABLE}_AND_EXPORT to make more sense"):

Quoted 1 line

autoconf: change AX_ARG_{DISABLE/ENABLE}_AND_EXPORT to make more sense