]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Implemented SQUID_YESNO
authorFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 26 Dec 2009 13:57:28 +0000 (14:57 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Sat, 26 Dec 2009 13:57:28 +0000 (14:57 +0100)
Streamlined some --enable and --disable options' handling

acinclude/squid-util.m4
configure.in

index af545e849834a7442479184725411e533c74940f..57732b6bb7e7fb32c3d7249fc0e146bdea41d873 100644 (file)
@@ -170,3 +170,11 @@ ifelse([$#],3,
 )
 unset squid_tmp_define
 ])
+
+dnl aborts with an error specified as the second argument if the first argument doesn't
+dnl contain either "yes" or "no"
+AC_DEFUN([SQUID_YESNO],[
+if test "$1" != "yes" -a "$1" != "no" ; then
+  AC_MSG_ERROR([$2])
+fi
+])
index 70db0b342b09cba1f39da3c5ebbf5b3cf8472e9d..816e07f19a674de514c736675a6399058e3e5271 100644 (file)
@@ -949,31 +949,32 @@ dnl   fi
 dnl ])
 
 
+squid_opt_useragent_log="no"
 AC_ARG_ENABLE(useragent-log,
   AS_HELP_STRING([--enable-useragent-log],[Enable logging of User-Agent header]), [ 
-  if test "$enableval" = "yes" ; then
-    AC_MSG_NOTICE([User-Agent logging enabled])
-    AC_DEFINE(USE_USERAGENT_LOG,1,
-              [If you want to log User-Agent request header values, define this.])
-  fi
+  SQUID_YESNO([$enableval],[unrecognized argument to --enable-useragent-log: $enableval])
+  squid_opt_useragent_log=$enableval
 ])
+AC_MSG_NOTICE([User-Agent logging enabled: $squid_opt_useragent_log])
+SQUID_DEFINE_UNQUOTED(USE_USERAGENT_LOG,$squid_opt_useragent_log,
+    [If you want to log User-Agent request header values, define this.])
 
+squid_opt_referer_log="no"
 AC_ARG_ENABLE(referer-log,
-  AS_HELP_STRING([--enable-referer-log],[Enable logging of Referer header]),
-[ if test "$enableval" = "yes" ; then
-    AC_MSG_NOTICE([Referer logging enabled])
-    AC_DEFINE(USE_REFERER_LOG,1,
-              [If you want to log Referer request header values, define this.
-               By default, they are written to referer.log in the Squid log directory.])
-  fi
+  AS_HELP_STRING([--enable-referer-log],[Enable logging of Referer header]), [ 
+  SQUID_YESNO([$enableval],[unrecognized argument to --enable-referer-log: $enableval])
+  squid_opt_referer_log=$enableval
 ])
+AC_MSG_NOTICE([Referer logging enabled: $squid_opt_referer_log])
+SQUID_DEFINE_UNQUOTED(USE_REFERER_LOG,$squid_opt_referer_log,
+       [If you want to log Referer request header values, define this.
+        By default, they are written to referer.log in the Squid log directory.])
 
 squid_opt_use_wccp="yes"
 AC_ARG_ENABLE(wccp,
   AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]), [
-if test "$enableval" = "no" ; then
-    squid_opt_use_wccp="no"
-  fi
+  SQUID_YESNO([$enableval],[unrecognized argument to --disable-wccp: $enableval])
+  squid_opt_use_wccp=$enableval
 ])
 AC_MSG_NOTICE([Web Cache Coordination Protocol enabled: $squid_opt_use_wccp])
 SQUID_DEFINE_UNQUOTED(USE_WCCP, $squid_opt_use_wccp, [Define to enable WCCP])
@@ -981,20 +982,17 @@ SQUID_DEFINE_UNQUOTED(USE_WCCP, $squid_opt_use_wccp, [Define to enable WCCP])
 squid_opt_use_wccp_v2="yes"
 AC_ARG_ENABLE(wccpv2,
   AS_HELP_STRING([--disable-wccpv2],[Disable Web Cache Coordination V2 Protocol]), [ 
-if test "$enableval" = "no" ; then
-    squid_opt_use_wccp_v2=yes
-  fi
+  SQUID_YESNO([$enableval],[unrecognized argument to --disable-wccpv2: $enableval])
+  squid_opt_use_wccp_v2=$enableval
 ])
 AC_MSG_NOTICE([Web Cache Coordination V2 Protocol enabled: $squid_opt_use_wccp_v2])
 SQUID_DEFINE_UNQUOTED(USE_WCCPv2,$squid_opt_use_wccp_v2,[Define to enable WCCP V2])
 
-
 squid_opt_kill_parent="no"
 AC_ARG_ENABLE(kill-parent-hack,
   AS_HELP_STRING([--enable-kill-parent-hack],[Kill parent on shutdown]), [ 
-  if test "$enableval" = "yes" ; then
-    squid_opt_kill_parent="yes"
-  fi
+  SQUID_YESNO([$enableval],[unrecognized argument to --enable-kill-parent-hack: $enableval])
+  squid_opt_kill_parent=$enableval
 ])
 AC_MSG_NOTICE([Kill parent on shutdown hack enabled: $squid_opt_kill_parent])
 SQUID_DEFINE_UNQUOTED(KILL_PARENT_OPT,$squid_opt_kill_parent,
@@ -1002,14 +1000,11 @@ SQUID_DEFINE_UNQUOTED(KILL_PARENT_OPT,$squid_opt_kill_parent,
                    (presumably the RunCache script) upon receipt of SIGTERM or SIGINT.
                    Use with caution.])
 
-
 squid_opt_enable_snmp="yes"
 AC_ARG_ENABLE(snmp,
-  AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]), [ 
-  if test "$enableval" = "no" ; then
-    AC_MSG_NOTICE([SNMP monitoring disabled])
-    squid_opt_enable_snmp="no"
-  fi
+  AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]), [
+  SQUID_YESNO([$enableval],[unrecognized argument to --disable-snmp: $enableval])
+  squid_opt_enable_snmp=$enableval
 ])
 if test "$squid_opt_enable_snmp" = "yes"; then
     SNMPLIB='../snmplib/libsnmp.a'
@@ -1024,21 +1019,21 @@ AC_SUBST(makesnmplib)
 AC_ARG_ENABLE(cachemgr-hostname,
   AS_HELP_STRING([--enable-cachemgr-hostname=hostname],
                  [Make cachemgr.cgi default to this host.
-                  If unspecified, uses the name of the build-host]),
-[  case $enableval in
-   yes)
-       AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
-       [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
-       AC_MSG_NOTICE([Cachemgr default hostname == host where cachemgr runs])
-       ;;
-   no)
-       : # Nothing to do..
-       ;;
-   *)
-       AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
-       AC_MSG_NOTICE([Cachemgr default hostname set to ${enableval}])
-       ;;
-   esac
+                  If unspecified, uses the name of the build-host]), [
+  case $enableval in
+  yes)
+    AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
+    [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
+    AC_MSG_NOTICE([Cachemgr default hostname == host where cachemgr runs])
+    ;;
+  no)
+    : # Nothing to do..
+   ;;
+  *)
+    AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
+    AC_MSG_NOTICE([Cachemgr default hostname set to ${enableval}])
+    ;;
+  esac
 ])
 
 AM_CONDITIONAL(USE_SQUID_EUI, false)