]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Use macros to define --with options
authorMartin Willi <martin@strongswan.org>
Mon, 7 Sep 2009 10:07:57 +0000 (12:07 +0200)
committerMartin Willi <martin@strongswan.org>
Mon, 7 Sep 2009 13:00:45 +0000 (15:00 +0200)
16 files changed:
configure.in
m4/macros/with.m4 [new file with mode: 0644]
src/_updown/Makefile.am
src/_updown/_updown.in
src/charon/Makefile.am
src/charon/plugins/eap_sim/Makefile.am
src/charon/plugins/kernel_klips/Makefile.am
src/charon/plugins/kernel_netlink/Makefile.am
src/charon/plugins/kernel_netlink/kernel_netlink_net.c
src/charon/plugins/kernel_pfkey/Makefile.am
src/charon/plugins/kernel_pfroute/Makefile.am
src/libstrongswan/plugins/random/Makefile.am
src/pluto/Makefile.am
src/starter/Makefile.am
testing/Makefile.am
testing/do-tests.in

index 2f80f5e0e2ce24d58e8a3179ecb3726b0369e220..b5d86d41b8c1c82057be0ce16a907fa50d9bcc20 100644 (file)
@@ -26,12 +26,22 @@ dnl =================================
 dnl  check --enable-xxx & --with-xxx
 dnl =================================
 
-AC_ARG_WITH(
-       [default-pkcs11],
-       AS_HELP_STRING([--with-default-pkcs11=lib],[set the default PKCS11 library other than "/usr/lib/opensc-pkcs11.so"]),
-       [AC_DEFINE_UNQUOTED(PKCS11_DEFAULT_LIB, "$withval")],
-       [AC_DEFINE_UNQUOTED(PKCS11_DEFAULT_LIB, "/usr/lib/opensc-pkcs11.so")]
-)
+m4_include(m4/macros/with.m4)
+
+ARG_WITH_SUBST([default-pkcs11],     [/usr/lib/opensc-pkcs11.so], [set the default PKCS11 library])
+ARG_WITH_SUBST([random-device],      [/dev/random], [set the device to read real random data from])
+ARG_WITH_SUBST([urandom-device],     [/dev/urandom], [set the device to read pseudo random data from])
+ARG_WITH_SUBST([strongswan-conf],    [${sysconfdir}/strongswan.conf], [set the strongswan.conf file location])
+ARG_WITH_SUBST([resolv-conf],        [${sysconfdir}/resolv.conf], [set the file to use in DNS handler plugin])
+ARG_WITH_SUBST([piddir],             [/var/run], [set path for PID and UNIX socket files])
+ARG_WITH_SUBST([ipsecdir],           [${libexecdir%/}/ipsec], [set installation path for ipsec tools])
+ARG_WITH_SUBST([plugindir],          [${ipsecdir%/}/plugins], [set the installation path of plugins])
+ARG_WITH_SUBST([sim-reader],         [${plugindir%/}/libeapsim-file.so], [set library containing the sim_run_alg()/sim_get_triplet() functions for EAP-SIM])
+ARG_WITH_SUBST([linux-headers],      [\${top_srcdir}/src/include], [set directory of linux header files to use])
+ARG_WITH_SUBST([routing-table],      [220], [set routing table to use for IPsec routes])
+ARG_WITH_SUBST([routing-table-prio], [220], [set priority for IPsec routing table])
+
+ARG_WITH_SET([capabilities],         [no], [set capability dropping library. Currenlty only the value "libcap" is supported])
 
 AC_ARG_WITH(
        [xauth-module],
@@ -39,91 +49,6 @@ AC_ARG_WITH(
        [AC_DEFINE_UNQUOTED(XAUTH_DEFAULT_LIB, "$withval")],
 )
 
-AC_ARG_WITH(
-       [random-device],
-       AS_HELP_STRING([--with-random-device=dev],[set the device for real random data other than "/dev/random"]),
-       [AC_DEFINE_UNQUOTED(DEV_RANDOM, "$withval")],
-       [AC_DEFINE_UNQUOTED(DEV_RANDOM, "/dev/random")]
-)
-AC_ARG_WITH(
-       [resolv-conf],
-       AS_HELP_STRING([--with-resolv-conf=file],[set the file to use in DNS handler plugin other than "sysconfdir/resolv.conf"]),
-       [AC_SUBST(resolv_conf, "$withval")],
-       [AC_SUBST(resolv_conf, "${sysconfdir}/resolv.conf")]
-)
-
-AC_ARG_WITH(
-       [strongswan-conf],
-       AS_HELP_STRING([--with-strongswan-conf=file],[strongswan.conf file other than "sysconfdir/strongswan.conf"]),
-       [AC_SUBST(strongswan_conf, "$withval")],
-       [AC_SUBST(strongswan_conf, "${sysconfdir}/strongswan.conf")]
-)
-
-AC_ARG_WITH(
-       [urandom-device],
-       AS_HELP_STRING([--with-urandom-device=dev],[set the device for pseudo random data other than "/dev/urandom"]),
-       [AC_DEFINE_UNQUOTED(DEV_URANDOM, "$withval")],
-       [AC_DEFINE_UNQUOTED(DEV_URANDOM, "/dev/urandom")]
-)
-
-AC_ARG_WITH(
-       [piddir],
-       AS_HELP_STRING([--with-piddir=dir],[path for PID and UNIX socket files other than "/var/run"]),
-       [AC_SUBST(piddir, "$withval")],
-       [AC_SUBST(piddir, "/var/run")]
-)
-
-AC_ARG_WITH(
-       [ipsecdir],
-       AS_HELP_STRING([--with-ipsecdir=dir],[installation path for ipsec tools other than "libexecdir/ipsec"]),
-       [AC_SUBST(ipsecdir, "$withval")],
-       [AC_SUBST(ipsecdir, "${libexecdir%/}/ipsec")]
-)
-AC_SUBST(plugindir, "${ipsecdir%/}/plugins")
-
-AC_ARG_WITH(
-       [plugindir],
-       AS_HELP_STRING([--with-plugindir=dir],[installation path for plugins other than "ipsecdir/plugins"]),
-       [AC_SUBST(plugindir, "$withval")],
-       [AC_SUBST(plugindir, "${ipsecdir%/}/plugins")]
-)
-
-AC_ARG_WITH(
-       [sim-reader],
-       AS_HELP_STRING([--with-sim-reader=library.so],[library containing the sim_run_alg()/sim_get_triplet() function for EAP-SIM]),
-       [AC_SUBST(simreader, "$withval")],
-       [AC_SUBST(simreader, "${plugindir%/}/libeapsim-file.so")]
-)
-
-AC_ARG_WITH(
-       [linux-headers],
-       AS_HELP_STRING([--with-linux-headers=dir],[use the linux header files in dir instead of the supplied ones in "src/include"]),
-       [AC_SUBST(linuxdir, "$withval")], [AC_SUBST(linuxdir, "\${top_srcdir}/src/include")]
-)
-AC_SUBST(LINUX_HEADERS)
-
-AC_ARG_WITH(
-       [routing-table],
-       AS_HELP_STRING([--with-routing-table=num],[use routing table for IPsec routes (default: 220)]),
-       [AC_DEFINE_UNQUOTED(IPSEC_ROUTING_TABLE, $withval) AC_SUBST(IPSEC_ROUTING_TABLE, "$withval")], 
-       [AC_DEFINE_UNQUOTED(IPSEC_ROUTING_TABLE, 220) AC_SUBST(IPSEC_ROUTING_TABLE, "220")]
-)
-
-AC_ARG_WITH(
-       [routing-table-prio],
-       AS_HELP_STRING([--with-routing-table-prio=prio],[priority for IPsec routing table (default: 220)]),
-       [AC_DEFINE_UNQUOTED(IPSEC_ROUTING_TABLE_PRIO, $withval) AC_SUBST(IPSEC_ROUTING_TABLE_PRIO, "$withval")], 
-       [AC_DEFINE_UNQUOTED(IPSEC_ROUTING_TABLE_PRIO, 220) AC_SUBST(IPSEC_ROUTING_TABLE_PRIO, "220")]
-)
-
-AC_ARG_WITH(
-       [uid],,[AC_MSG_ERROR([--with-uid is gone, use --with-user instead!])]
-)
-
-AC_ARG_WITH(
-       [gid],,[AC_MSG_ERROR([--with-gid is gone, use --with-group instead!])]
-)
-
 AC_ARG_WITH(
        [user],
        AS_HELP_STRING([--with-user=user],[change user of the daemons to "user" after startup (default is "root").]),
@@ -138,14 +63,6 @@ AC_ARG_WITH(
        [AC_SUBST(ipsecgroup, "root")]
 )
 
-dnl Will be extended to --with-capabilities=libcap|libcap2
-AC_ARG_WITH(
-       [capabilities],
-       AS_HELP_STRING([--with-capabilities=libcap],[capability dropping using libcap. Currenlty only the value "libcap" is supported (default is NO).]),
-       [capabilities="$withval"],
-       [capabilities=no]
-)
-
 m4_include(m4/macros/enable-disable.m4)
 
 ARG_ENABL_SET([curl],           [enable CURL fetcher plugin to fetch files via libcurl. Requires libcurl.])
diff --git a/m4/macros/with.m4 b/m4/macros/with.m4
new file mode 100644 (file)
index 0000000..908333b
--- /dev/null
@@ -0,0 +1,24 @@
+
+# ARG_WITH_SUBST(option, default, help)
+# -----------------------------------
+# Create a --with-$1 option with helptext, AC_SUBST($1) to $withval/default
+AC_DEFUN([ARG_WITH_SUBST],
+       [AC_ARG_WITH(
+               [$1],
+               AS_HELP_STRING([--with-$1=arg], [$3 (default: $2).]),
+               [AC_SUBST(patsubst([$1], [-], [_]), ["$withval"])],
+               [AC_SUBST(patsubst([$1], [-], [_]), ["$2"])]
+       )]
+)
+
+# ARG_WITH_SET(option, default, help)
+# -----------------------------------
+# Create a --with-$1 option with helptext, set a variable $1 to $withval/default
+AC_DEFUN([ARG_WITH_SET],
+       [AC_ARG_WITH(
+               [$1],
+               AS_HELP_STRING([--with-$1=arg], [$3 (default: $2).]),
+               patsubst([$1], [-], [_])="$withval",
+               patsubst([$1], [-], [_])=$2
+       )]
+)
index 5fc04ab885206ab9f6b50f3b54df91c969747e9c..116322e1efb1c97182abd9d9a608a2b1bdc046c8 100644 (file)
@@ -5,8 +5,8 @@ EXTRA_DIST = _updown.in
 
 _updown : _updown.in
        sed \
-       -e "s:@IPSEC_SBINDIR@:$(sbindir):" \
-       -e "s:\@IPSEC_ROUTING_TABLE\@:$(IPSEC_ROUTING_TABLE):" \
-       -e "s:\@IPSEC_ROUTING_TABLE_PRIO\@:$(IPSEC_ROUTING_TABLE_PRIO):" \
+       -e "s:\@sbindir\@:$(sbindir):" \
+       -e "s:\@routing_table\@:$(routing_table):" \
+       -e "s:\@routing_table_prio\@:$(routing_table_prio):" \
        $(srcdir)/$@.in > $@
        chmod +x $@
index 2a63b2f494f8570a839b3d60debfd0cf9afa13cb..2cc311665101edeec74be9b25669161a35113db0 100644 (file)
 #
 
 # define a minimum PATH environment in case it is not set
-PATH="/sbin:/bin:/usr/sbin:/usr/bin:@IPSEC_SBINDIR@"
+PATH="/sbin:/bin:/usr/sbin:/usr/bin:@sbindir@"
 export PATH
 
 # uncomment to log VPN connections
@@ -139,10 +139,10 @@ FAC_PRIO=local0.notice
 # must be enabled
 #
 # special routing table for sourceip routes
-SOURCEIP_ROUTING_TABLE=@IPSEC_ROUTING_TABLE@
+SOURCEIP_ROUTING_TABLE=@routing_table@
 #
 # priority of the sourceip routing table
-SOURCEIP_ROUTING_TABLE_PRIO=@IPSEC_ROUTING_TABLE_PRIO@
+SOURCEIP_ROUTING_TABLE_PRIO=@routing_table_prio@
 
 # check interface version
 case "$PLUTO_VERSION" in
index ab9d47c3b1f95a1e1829e380cdc16e02a92776be..20ca08302b6a814e1a9d0137b9a54f7b3949151c 100644 (file)
@@ -102,7 +102,7 @@ credentials/sets/ocsp_response_wrapper.c credentials/sets/ocsp_response_wrapper.
 credentials/sets/cert_cache.c credentials/sets/cert_cache.h \
 credentials/credential_set.h
 
-INCLUDES = -I${linuxdir} -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
+INCLUDES = -I${linux_headers} -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
 AM_CFLAGS = -rdynamic \
   -DIPSEC_DIR=\"${ipsecdir}\" \
   -DIPSEC_PIDDIR=\"${piddir}\" \
index e503bddab3e7db4f25e8cc087c4f5286e82b60b0..49b72dc44d1ffe65d3fc97efe149f8907d598595 100644 (file)
@@ -1,7 +1,9 @@
 
 INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
 
-AM_CFLAGS = -rdynamic -DIPSEC_CONFDIR=\"${confdir}\" -DSIM_READER_LIB=\"${simreader}\"
+AM_CFLAGS = -rdynamic \
+       -DIPSEC_CONFDIR=\"${confdir}\" \
+       -DSIM_READER_LIB=\"${sim_reader}\"
 
 plugin_LTLIBRARIES = libstrongswan-eapsim.la
 
index 0c0987cca82271598d15d25846f22b7984d0f307..a7ae06df10b6e7f75805430ac44352015b2190d0 100644 (file)
@@ -1,5 +1,5 @@
 
-INCLUDES = -I${linuxdir} -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
+INCLUDES = -I${linux_headers} -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
 
 AM_CFLAGS = -rdynamic
 
index 6351280d694fd9dbc554384e569cb75109ebc38d..31d9c6d5ce18e520be618853c548a967e5cd40ae 100644 (file)
@@ -1,7 +1,9 @@
 
-INCLUDES = -I${linuxdir} -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
+INCLUDES = -I${linux_headers} -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
 
-AM_CFLAGS = -rdynamic
+AM_CFLAGS = -rdynamic \
+-DROUTING_TABLE=${routing_table} \
+-DROUTING_TABLE_PRIO=${routing_table_prio}
 
 plugin_LTLIBRARIES = libstrongswan-kernel-netlink.la
 
index 8fd25e96fc59ed3385312a43c97b86f9ea62708f..1037c8084933c997ae438153219d1b7142a8111c 100644 (file)
 /** delay before firing roam jobs (ms) */
 #define ROAM_DELAY 100
 
-/** routing table for routes installed by us */
-#ifndef IPSEC_ROUTING_TABLE
-#define IPSEC_ROUTING_TABLE 100
-#endif
-#ifndef IPSEC_ROUTING_TABLE_PRIO
-#define IPSEC_ROUTING_TABLE_PRIO 100
-#endif
-
 typedef struct addr_entry_t addr_entry_t;
 
 /**
@@ -1366,9 +1358,9 @@ kernel_netlink_net_t *kernel_netlink_net_create()
        this->condvar = condvar_create(CONDVAR_TYPE_DEFAULT);
        timerclear(&this->last_roam);
        this->routing_table = lib->settings->get_int(lib->settings,
-                                       "charon.routing_table", IPSEC_ROUTING_TABLE);
+                                       "charon.routing_table", ROUTING_TABLE);
        this->routing_table_prio = lib->settings->get_int(lib->settings,
-                                       "charon.routing_table_prio", IPSEC_ROUTING_TABLE_PRIO);
+                                       "charon.routing_table_prio", ROUTING_TABLE_PRIO);
        this->process_route = lib->settings->get_bool(lib->settings,
                                        "charon.process_route", TRUE);
        this->install_virtual_ip = lib->settings->get_bool(lib->settings,
index e03a0ca02df2b3e28d7557c58353fa310b68657a..a72c6a999dc88d7e7a9ff07aa04e2fc33845c6c4 100644 (file)
@@ -1,5 +1,5 @@
 
-INCLUDES = -I${linuxdir} -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
+INCLUDES = -I${linux_headers} -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
 
 AM_CFLAGS = -rdynamic
 
index b6e6587a7d37702a3cd167a6cd33a94e9af7ddcc..0065d9b0a9140e6566fc5fa7c6b89bb46036c0eb 100644 (file)
@@ -1,5 +1,5 @@
 
-INCLUDES = -I${linuxdir} -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
+INCLUDES = -I${linux_headers} -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/charon
 
 AM_CFLAGS = -rdynamic
 
index 9a11b8567aeee2ca55bc0b2e7c8a1e0d956cac28..7c2283ae726204d0e52132d916a63ec08a20bc77 100644 (file)
@@ -1,7 +1,9 @@
 
 INCLUDES = -I$(top_srcdir)/src/libstrongswan
 
-AM_CFLAGS = -rdynamic
+AM_CFLAGS = -rdynamic \
+-DDEV_RANDOM=\"${random_device}\" \
+-DDEV_URANDOM=\"${urandom_device}\"
 
 plugin_LTLIBRARIES = libstrongswan-random.la
 
index 81677b3147d4f3e34004553db3dc3f9c27f539ea..0e384f82006606700fa1d8b27ef7360bcac0f7b5 100644 (file)
@@ -58,7 +58,7 @@ LIBSTRONGSWANDIR=$(top_builddir)/src/libstrongswan
 LIBFREESWANDIR=$(top_builddir)/src/libfreeswan
 
 INCLUDES = \
--I${linuxdir} \
+-I${linux_headers} \
 -I$(top_srcdir)/src/libstrongswan \
 -I$(top_srcdir)/src/libfreeswan \
 -I$(top_srcdir)/src/whack
@@ -71,6 +71,7 @@ AM_CFLAGS = \
 -DIPSEC_PLUGINDIR=\"${plugindir}\" \
 -DPLUGINS=\""${pluto_plugins}\"" \
 -DSTRONGSWAN_CONF=\"${strongswan_conf}\" \
+-DPKCS11_DEFAULT_LIB=\"${default_pkcs11}\" \
 -DKERNEL26_SUPPORT -DKERNEL26_HAS_KAME_DUPLICATES \
 -DPLUTO -DKLIPS -DDEBUG
 
index f72d2edbab3e7e635494d0825129e9b83f4afd62..a0ce6ae61c8690f2af0005eb77fd67f425ba4ea3 100644 (file)
@@ -6,7 +6,7 @@ keywords.c files.h keywords.h cmp.c starter.c cmp.h exec.c invokecharon.c \
 exec.h invokecharon.h lex.yy.c loglite.c klips.c klips.h
 
 INCLUDES = \
--I${linuxdir} \
+-I${linux_headers} \
 -I$(top_srcdir)/src/libstrongswan \
 -I$(top_srcdir)/src/libfreeswan \
 -I$(top_srcdir)/src/pluto \
@@ -18,6 +18,8 @@ AM_CFLAGS = \
 -DIPSEC_CONFDIR=\"${confdir}\" \
 -DIPSEC_PIDDIR=\"${piddir}\" \
 -DIPSEC_EAPDIR=\"${eapdir}\" \
+-DDEV_RANDOM=\"${random_device}\" \
+-DDEV_URANDOM=\"${urandom_device}\" \
 -DDEBUG
 
 starter_LDADD = defs.o $(top_builddir)/src/libfreeswan/libfreeswan.a $(top_builddir)/src/libstrongswan/libstrongswan.la $(SOCKLIB)
index ad8d5042af3867a154706b57bd5edb5a92a11547..130b87b432bb9a0f2f1766fb537880791b3f6bee 100644 (file)
@@ -5,7 +5,7 @@ EXTRA_DIST = do-tests.in make-testing start-testing stop-testing \
 
 do-tests : do-tests.in
        sed \
-       -e "s:\@IPSEC_ROUTING_TABLE\@:$(IPSEC_ROUTING_TABLE):" \
+       -e "s:\@routing_table\@:$(routing_table):" \
        $(srcdir)/$@.in > $@
        chmod +x $@
 
index 3a66f4548a78c433d12fa0d0894631fbd923f180..5c29e9b736aa134b3bda9a11abcf1e925dfd2f8d 100755 (executable)
@@ -46,7 +46,7 @@ TESTRESULTSHTML=$TODAYDIR/all.html
 INDEX=$TODAYDIR/index.html
 DEFAULTTESTSDIR=$UMLTESTDIR/testing/tests
 
-SOURCEIP_ROUTING_TABLE=@IPSEC_ROUTING_TABLE@
+SOURCEIP_ROUTING_TABLE=@routing_table@
 
 testnumber="0"
 failed_cnt="0"