Set a xy_given variable for a --enable/disable-xy option
[strongswan.git] / m4 / macros / enable-disable.m4
1
2 # ARG_ENABL_SET(option, help)
3 # ---------------------------
4 # Create a --enable-$1 option with helptext, set a variable $1 to true/false
5 AC_DEFUN([ARG_ENABL_SET],
6         [AC_ARG_ENABLE(
7                 [$1],
8                 AS_HELP_STRING([--enable-$1], [$2]),
9                 [patsubst([$1], [-], [_])_given=true
10                 if test x$enableval = xyes; then
11                         patsubst([$1], [-], [_])=true
12                  else
13                         patsubst([$1], [-], [_])=false
14                 fi],
15                 [patsubst([$1], [-], [_])=false
16                 patsubst([$1], [-], [_])_given=false]
17         )]
18 )
19
20 # ARG_DISBL_SET(option, help)
21 # ---------------------------
22 # Create a --disable-$1 option with helptext, set a variable $1 to true/false
23 AC_DEFUN([ARG_DISBL_SET],
24         [AC_ARG_ENABLE(
25                 [$1],
26                 AS_HELP_STRING([--disable-$1], [$2]),
27                 [patsubst([$1], [-], [_])_given=true
28                 if test x$enableval = xyes; then
29                         patsubst([$1], [-], [_])=true
30                  else
31                         patsubst([$1], [-], [_])=false
32                 fi],
33                 [patsubst([$1], [-], [_])=true
34                 patsubst([$1], [-], [_])_given=false]
35         )]
36 )