diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-11-27 19:41:11 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2021-11-27 19:41:11 +0000 |
commit | 13ef345ce8ccb8d135659bf341c12ad39a688708 (patch) | |
tree | 77d344493fe6f30fe2161bce74dd9b92cf33f14b /m4 | |
parent | 02372be119bd1a4e7099d2c7d5bb3de096e99409 (diff) | |
download | haskell-13ef345ce8ccb8d135659bf341c12ad39a688708.tar.gz |
Factor our `FP_CAPITALIZE_YES_NO`
This deduplicates converting from yes/no to YES/NO in the configure
scripts while also making it safer.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/fp_capitalize_yes_no.m4 | 13 | ||||
-rw-r--r-- | m4/fp_gmp.m4 | 4 | ||||
-rw-r--r-- | m4/fp_prog_ld_build_id.m4 | 6 | ||||
-rw-r--r-- | m4/fp_prog_ld_filelist.m4 | 6 | ||||
-rw-r--r-- | m4/fp_prog_ld_no_compact_unwind.m4 | 6 |
5 files changed, 18 insertions, 17 deletions
diff --git a/m4/fp_capitalize_yes_no.m4 b/m4/fp_capitalize_yes_no.m4 new file mode 100644 index 0000000000..195729f5d0 --- /dev/null +++ b/m4/fp_capitalize_yes_no.m4 @@ -0,0 +1,13 @@ +# FP_CAPITALIZE_YES_NO(scrutinee, out_var) +# --------------------------------------------------- +# Helper for converting a yes/no to a YES/NO. +# +# $1 = shell expression evaluating to yes/no. +# $2 = name of variable to set wit YES/NO. +AC_DEFUN([FP_CAPITALIZE_YES_NO], +[AS_CASE( + [x$1], + [x"yes"], [$2=YES], + [x"no"], [$2=NO], + [AC_MSG_ERROR([invalid value:] $1 [is not "yes" or "no"])]) +]) diff --git a/m4/fp_gmp.m4 b/m4/fp_gmp.m4 index bbf054910a..587049d85f 100644 --- a/m4/fp_gmp.m4 +++ b/m4/fp_gmp.m4 @@ -19,13 +19,13 @@ AC_DEFUN([FP_GMP], AC_ARG_WITH([intree-gmp], [AS_HELP_STRING([--with-intree-gmp], [force using the in-tree GMP])], - [GMP_FORCE_INTREE=YES], + [FP_CAPITALIZE_YES_NO(["$withval"], [GMP_FORCE_INTREE])], [GMP_FORCE_INTREE=NO]) AC_ARG_WITH([gmp-framework-preferred], [AS_HELP_STRING([--with-gmp-framework-preferred], [on OSX, prefer the GMP framework to the gmp lib])], - [GMP_PREFER_FRAMEWORK=YES], + [FP_CAPITALIZE_YES_NO(["$withval"], [GMP_PREFER_FRAMEWORK])], [GMP_PREFER_FRAMEWORK=NO]) AC_SUBST(GMP_INCLUDE_DIRS) diff --git a/m4/fp_prog_ld_build_id.m4 b/m4/fp_prog_ld_build_id.m4 index 7260bd4529..e0a9ddd7b7 100644 --- a/m4/fp_prog_ld_build_id.m4 +++ b/m4/fp_prog_ld_build_id.m4 @@ -13,11 +13,7 @@ else fp_cv_ld_build_id=no fi rm -rf conftest*]) -if test "$fp_cv_ld_build_id" = yes; then - LdHasBuildId=YES -else - LdHasBuildId=NO -fi +FP_CAPITALIZE_YES_NO(["$fp_cv_ld_build_id"], [LdHasBuildId]) AC_SUBST([LdHasBuildId]) ])# FP_PROG_LD_BUILD_ID diff --git a/m4/fp_prog_ld_filelist.m4 b/m4/fp_prog_ld_filelist.m4 index 60e206baa4..a61cb3103c 100644 --- a/m4/fp_prog_ld_filelist.m4 +++ b/m4/fp_prog_ld_filelist.m4 @@ -20,10 +20,6 @@ AC_CACHE_CHECK([whether ld understands -filelist], [fp_cv_ld_has_filelist], fi rm -rf conftest* ]) -if test "$fp_cv_ld_has_filelist" = yes; then - LdHasFilelist=YES -else - LdHasFilelist=NO -fi +FP_CAPITALIZE_YES_NO(["$fp_cv_ld_has_filelist"], [LdHasFilelist]) AC_SUBST([LdHasFilelist]) ])# FP_PROG_LD_FILELIST diff --git a/m4/fp_prog_ld_no_compact_unwind.m4 b/m4/fp_prog_ld_no_compact_unwind.m4 index 152037658d..b80ac854c5 100644 --- a/m4/fp_prog_ld_no_compact_unwind.m4 +++ b/m4/fp_prog_ld_no_compact_unwind.m4 @@ -13,10 +13,6 @@ else fp_cv_ld_no_compact_unwind=no fi rm -rf conftest*]) -if test "$fp_cv_ld_no_compact_unwind" = yes; then - LdHasNoCompactUnwind=YES -else - LdHasNoCompactUnwind=NO -fi +FP_CAPITALIZE_YES_NO(["$fp_cv_ld_no_compact_unwind"], [LdHasNoCompactUnwind]) AC_SUBST([LdHasNoCompactUnwind]) ])# FP_PROG_LD_NO_COMPACT_UNWIND |