2017-08-06 Andrew Pinski <apinski@cavium.com>
[official-gcc.git] / config / enable.m4
blob88b29b8aa7fb0d68b113969e8bc84388e4d2634e
1 dnl ----------------------------------------------------------------------
2 dnl This whole bit snagged from libstdc++-v3.
4 dnl
5 dnl GCC_ENABLE
6 dnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
7 dnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
8 dnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
9 dnl
10 dnl See docs/html/17_intro/configury.html#enable for documentation.
11 dnl
12 AC_DEFUN([GCC_ENABLE],[dnl
13 m4_define([_g_switch],[--enable-$1])dnl
14 m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
15  AC_ARG_ENABLE($1,_g_help,
16   m4_bmatch([$5],
17    [^permit ],
18      [[
19       case "$enableval" in
20        m4_bpatsubst([$5],[permit ])) ;;
21        *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
22           dnl Idea for future:  generate a URL pointing to
23           dnl "onlinedocs/configopts.html#whatever"
24       esac
25      ]],
26    [^$],
27      [[
28       case "$enableval" in
29        yes|no) ;;
30        *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
31       esac
32      ]],
33    [[$5]]),
34   [enable_]m4_bpatsubst([$1],-,_)[=][$2])
35 m4_undefine([_g_switch])dnl
36 m4_undefine([_g_help])dnl