enable.m4 1.1 KB

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