summaryrefslogtreecommitdiff
path: root/config/argenable.m4
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2004-08-24 18:40:21 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2004-08-24 18:40:21 +0000
commit7af47907be46a19187fdceaa774dbc2e2ead9c9e (patch)
treef22262420b08a56c6e1ec7dc196d3fea9b2175f7 /config/argenable.m4
parentab270dc35c39f00cc5d69c96515477a1fbbd6d62 (diff)
downloadtinyproxy-7af47907be46a19187fdceaa774dbc2e2ead9c9e.tar.gz
tinyproxy-7af47907be46a19187fdceaa774dbc2e2ead9c9e.zip
Initial checkin of the TP_ARG_ENABLE macro. This macro extends the
default AC_ARG_ENABLE macro to do better error checking of the input values.
Diffstat (limited to '')
-rw-r--r--config/argenable.m419
1 files changed, 19 insertions, 0 deletions
diff --git a/config/argenable.m4 b/config/argenable.m4
new file mode 100644
index 0000000..ed5d7f0
--- /dev/null
+++ b/config/argenable.m4
@@ -0,0 +1,19 @@
+dnl $Id: argenable.m4,v 1.1 2004-08-24 18:40:21 rjkaes Exp $
+dnl
+dnl Define a new AC_ARG_ENABLE like macro which handles invalid inputs
+dnl correctly. The macro takes three arguments:
+dnl 1) the option name (used like --enable-option)
+dnl 2) the help string
+dnl 3) the default value (either yes or no)
+dnl
+dnl This macro also defines on variable in the form "option_enabled"
+dnl set to either "yes" or "no".
+dnl
+AC_DEFUN(TP_ARG_ENABLE,
+[AC_ARG_ENABLE([$1],
+ AS_HELP_STRING([--enable-$1], [$2]),
+ [case "${enableval}" in
+ yes) $1_enabled=yes ;;
+ no) $1_enabled=no ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-$1]) ;;
+ esac],[$1_enabled=$3])])