xref: /netbsd-src/external/gpl3/gdb/dist/config/enable.m4 (revision 597410b885db36aad6d0b047f8fbdde1708a2ff4)
1*597410b8Schristosdnl ----------------------------------------------------------------------
2*597410b8Schristosdnl This whole bit snagged from libstdc++-v3.
3*597410b8Schristos
4*597410b8Schristosdnl
5*597410b8Schristosdnl GCC_ENABLE
6*597410b8Schristosdnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
7*597410b8Schristosdnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
8*597410b8Schristosdnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
9*597410b8Schristosdnl
10*597410b8Schristosdnl See docs/html/17_intro/configury.html#enable for documentation.
11*597410b8Schristosdnl
12*597410b8SchristosAC_DEFUN([GCC_ENABLE],[dnl
13*597410b8Schristosm4_define([_g_switch],[--enable-$1])dnl
14*597410b8Schristosm4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
15*597410b8Schristos AC_ARG_ENABLE($1,_g_help,
16*597410b8Schristos  m4_bmatch([$5],
17*597410b8Schristos   [^permit ],
18*597410b8Schristos     [[
19*597410b8Schristos      case "$enableval" in
20*597410b8Schristos       m4_bpatsubst([$5],[permit ])) ;;
21*597410b8Schristos       *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
22*597410b8Schristos          dnl Idea for future:  generate a URL pointing to
23*597410b8Schristos          dnl "onlinedocs/configopts.html#whatever"
24*597410b8Schristos      esac
25*597410b8Schristos     ]],
26*597410b8Schristos   [^$],
27*597410b8Schristos     [[
28*597410b8Schristos      case "$enableval" in
29*597410b8Schristos       yes|no) ;;
30*597410b8Schristos       *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
31*597410b8Schristos      esac
32*597410b8Schristos     ]],
33*597410b8Schristos   [[$5]]),
34*597410b8Schristos  [enable_]m4_bpatsubst([$1],-,_)[=][$2])
35*597410b8Schristosm4_undefine([_g_switch])dnl
36*597410b8Schristosm4_undefine([_g_help])dnl
37*597410b8Schristos])
38*597410b8Schristos
39