diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-04-02 11:52:47 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-05-05 05:42:38 -0400 |
commit | 7ffbdc3fa603c6411249ba9b758cf8f109c5fb30 (patch) | |
tree | 8a05d6e03ce2790e6e59651c824e569fee088d33 /m4/fp_default_choice_override_check.m4 | |
parent | 6acadb79afe685c635fd255f90551a0fbfcbe3dc (diff) | |
download | haskell-7ffbdc3fa603c6411249ba9b758cf8f109c5fb30.tar.gz |
Break up aclocal.m4
Diffstat (limited to 'm4/fp_default_choice_override_check.m4')
-rw-r--r-- | m4/fp_default_choice_override_check.m4 | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/m4/fp_default_choice_override_check.m4 b/m4/fp_default_choice_override_check.m4 new file mode 100644 index 0000000000..7c265fcfd4 --- /dev/null +++ b/m4/fp_default_choice_override_check.m4 @@ -0,0 +1,41 @@ +# FP_DEFAULT_CHOICE_OVERRIDE_CHECK( +# flag, name, anti name, var name, help string, +# [var true val], [var false val], [flag true val]) +# --------------------------------------------------- +# Helper for when there is a automatic detection and an explicit flag for the +# user to override disable a feature, but not override enable a feature. +# +# $1 = flag of feature +# $2 = name of feature +# $3 = name of anti feature +# $4 = name of variable +# $5 = help string +# $6 = when true +# $7 = when false +# $8 = default explicit case (yes/no). Used for handle "backwards" legacy +# options where enabling makes fewer assumptions than disabling. +AC_DEFUN([FP_DEFAULT_CHOICE_OVERRIDE_CHECK], + [AC_ARG_ENABLE( + [$1], + [AS_HELP_STRING( + [--enable-$1], + [$5])], + [AS_IF( + [test x"$enableval" = x"m4_default([$8],yes)"], + [AS_CASE( + [x"$$4Default"], + [x"m4_default([$6],YES)"], + [AC_MSG_NOTICE([user chose $2 matching default for platform])], + [x"m4_default([$7],NO)"], + [AC_MSG_ERROR([user chose $2 overriding only supported option for platform])], + [AC_MSG_ERROR([invalid default])]) + $4=m4_default([$6],YES)], + [AS_CASE( + [x"$$4Default"], + [x"m4_default([$6],YES)"], + [AC_MSG_NOTICE([user chose $3 overriding for platform])], + [x"m4_default([$7],NO)"], + [AC_MSG_NOTICE([user chose $3 matching default for platform])], + [AC_MSG_ERROR([invalid default])]) + $4=m4_default([$7],NO)])], + [$4="$$4Default"])]) |