with.m4 705 B

123456789101112131415161718192021222324
  1. # ARG_WITH_SUBST(option, default, help)
  2. # -----------------------------------
  3. # Create a --with-$1 option with helptext, AC_SUBST($1) to $withval/default
  4. AC_DEFUN([ARG_WITH_SUBST],
  5. [AC_ARG_WITH(
  6. [$1],
  7. AS_HELP_STRING([--with-$1=arg], [$3 (default: $2).]),
  8. [AC_SUBST(patsubst([$1], [-], [_]), ["$withval"])],
  9. [AC_SUBST(patsubst([$1], [-], [_]), ["$2"])]
  10. )]
  11. )
  12. # ARG_WITH_SET(option, default, help)
  13. # -----------------------------------
  14. # Create a --with-$1 option with helptext, set a variable $1 to $withval/default
  15. AC_DEFUN([ARG_WITH_SET],
  16. [AC_ARG_WITH(
  17. [$1],
  18. AS_HELP_STRING([--with-$1=arg], [$3 (default: $2).]),
  19. patsubst([$1], [-], [_])="$withval",
  20. patsubst([$1], [-], [_])=$2
  21. )]
  22. )