From 3f103b1ae4018cf35dabc00d4c9f77eaf8a35ff0 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 5 Nov 2021 03:45:27 +0000 Subject: Factor out GHC_ADJUSTORS_METHOD m4 macro --- configure.ac | 53 +++++----------------------------------------- m4/ghc_adjustors_method.m4 | 48 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 48 deletions(-) create mode 100644 m4/ghc_adjustors_method.m4 diff --git a/configure.ac b/configure.ac index 79e0de904b..33ed0751f1 100644 --- a/configure.ac +++ b/configure.ac @@ -1261,56 +1261,13 @@ AC_DEFINE_UNQUOTED([RTS_LINKER_USE_MMAP], [$RtsLinkerUseMmap], [Use mmap in the runtime linker]) -dnl ** Use libffi for adjustors? -dnl -------------------------------------------------------------- - -case ${TargetArch} in - i386|x86_64) - # We have native adjustor support on these platforms - HaveNativeAdjustor=yes - ;; - *) - HaveNativeAdjustor=no - ;; -esac - -AC_ARG_ENABLE(libffi-adjustors, - [AS_HELP_STRING( - [--enable-libffi-adjustors], - [Force use of libffi for adjustors, even on platforms which have support for more efficient, native adjustors.])], - UseLibffiForAdjustors=$enableval, - dnl do nothing +GHC_ADJUSTORS_METHOD([Target]) +AC_SUBST([UseLibffiForAdjustors]) +AS_IF([test x"${UseLibffiForAdjustors}" = x"YES"], + [CabalLibffiAdjustors=True], + [CabalLibffiAdjustors=False] ) - -AC_MSG_CHECKING([whether to use libffi for adjustors]) -AC_MSG_RESULT([$UseLibffiForAdjustors]) -if test "$UseLibffiForAdjustors" = "yes" ; then - # Use libffi is the user explicitly requested it - AdjustorType="libffi" -elif test "$HaveNativeAdjustor" = "yes"; then - # Otherwise if we have a native adjustor implementation use that - AdjustorType="native" -else - # If we don't have a native adjustor implementation then default to libffi - AdjustorType="libffi" -fi - -case "$AdjustorType" in -libffi) - CabalLibffiAdjustors=True - UseLibffiForAdjustors=YES - ;; -native) - CabalLibffiAdjustors=False - UseLibffiForAdjustors=NO - ;; -*) - AC_MSG_ERROR([Internal error: Invalid AdjustorType]) - exit 1 -esac - AC_SUBST([CabalLibffiAdjustors]) -AC_SUBST([UseLibffiForAdjustors]) dnl ** Other RTS features dnl -------------------------------------------------------------- diff --git a/m4/ghc_adjustors_method.m4 b/m4/ghc_adjustors_method.m4 new file mode 100644 index 0000000000..3371c3d11d --- /dev/null +++ b/m4/ghc_adjustors_method.m4 @@ -0,0 +1,48 @@ +dnl GHC_ADJUSTORS_METHOD(Platform) +dnl -------------------------------------------------------------- +dnl Use libffi for adjustors? +AC_DEFUN([GHC_ADJUSTORS_METHOD], +[ + case [$]{$1[Arch]} in + i386|x86_64) + # We have native adjustor support on these platforms + HaveNativeAdjustor=yes + ;; + *) + HaveNativeAdjustor=no + ;; + esac + + AC_ARG_ENABLE(libffi-adjustors, + [AS_HELP_STRING( + [--enable-libffi-adjustors], + [Force use of libffi for adjustors, even on platforms which have support for more efficient, native adjustors.])], + UseLibffiForAdjustors=$enableval, + dnl do nothing + ) + + AC_MSG_CHECKING([whether to use libffi for adjustors]) + AC_MSG_RESULT([$UseLibffiForAdjustors]) + if test "$UseLibffiForAdjustors" = "yes" ; then + # Use libffi is the user explicitly requested it + AdjustorType="libffi" + elif test "$HaveNativeAdjustor" = "yes"; then + # Otherwise if we have a native adjustor implementation use that + AdjustorType="native" + else + # If we don't have a native adjustor implementation then default to libffi + AdjustorType="libffi" + fi + + case "$AdjustorType" in + libffi) + UseLibffiForAdjustors=YES + ;; + native) + UseLibffiForAdjustors=NO + ;; + *) + AC_MSG_ERROR([Internal error: Invalid AdjustorType]) + exit 1 + esac +]) -- cgit v1.2.1