diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-11-05 04:49:05 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-11-08 19:35:12 -0500 |
commit | ba9fdc51d6db174b6973109def8acba773f04d50 (patch) | |
tree | fc2e3c11d7cc2d045aee6ffd10518c6c7e950000 /configure.ac | |
parent | 3f103b1ae4018cf35dabc00d4c9f77eaf8a35ff0 (diff) | |
download | haskell-ba9fdc51d6db174b6973109def8acba773f04d50.tar.gz |
Factor out FP_FIND_LIBFFI and use in RTS configure too
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 66 |
1 files changed, 4 insertions, 62 deletions
diff --git a/configure.ac b/configure.ac index 33ed0751f1..8bab372e81 100644 --- a/configure.ac +++ b/configure.ac @@ -1046,72 +1046,14 @@ dnl ################################################################ dnl Check for libraries dnl ################################################################ -# system libffi - -AC_ARG_WITH([system-libffi], -[AS_HELP_STRING([--with-system-libffi], - [Use system provided libffi for RTS [default=no]]) -]) - +FP_FIND_LIBFFI +AC_SUBST(UseSystemLibFFI) AS_IF([test "x$with_system_libffi" = "xyes"], - [UseSystemLibFFI="YES"; CabalUseSystemLibFFI="True"], - [UseSystemLibFFI="NO"; CabalUseSystemLibFFI="False"] + [CabalUseSystemLibFFI="True"], + [CabalUseSystemLibFFI="False"] ) - -AC_SUBST(UseSystemLibFFI) AC_SUBST(CabalUseSystemLibFFI) -AC_ARG_WITH([ffi-includes], -[AS_HELP_STRING([--with-ffi-includes=ARG], - [Find includes for libffi in ARG [default=system default]]) -], -[ - if test "x$UseSystemLibFFI" != "xYES"; then - AC_MSG_WARN([--with-ffi-includes will be ignored, --with-system-libffi not set]) - else - FFIIncludeDir="$withval" - LIBFFI_CFLAGS="-I$withval" - fi -]) - -AC_SUBST(FFIIncludeDir) - -AC_ARG_WITH([ffi-libraries], -[AS_HELP_STRING([--with-ffi-libraries=ARG], - [Find libffi in ARG [default=system default]]) -], -[ - if test "x$UseSystemLibFFI" != "xYES"; then - AC_MSG_WARN([--with-ffi-libraries will be ignored, --with-system-libffi not set]) - else - FFILibDir="$withval" LIBFFI_LDFLAGS="-L$withval" - fi -]) - -AC_SUBST(FFILibDir) - -AS_IF([test "$UseSystemLibFFI" = "YES"], [ - CFLAGS2="$CFLAGS" - CFLAGS="$LIBFFI_CFLAGS $CFLAGS" - LDFLAGS2="$LDFLAGS" - LDFLAGS="$LIBFFI_LDFLAGS $LDFLAGS" - if test "$HostOS" = "openbsd"; - then - # OpenBSD's libffi is not directly linked to the libpthread but - # still requires pthread functionality. This means that any client - # binary which links with libffi also needs to link with - # libpthread. If it does not, then linking fails with unresolved - # symbols. - LDFLAGS="$LDFLAGS -lpthread" - fi - AC_CHECK_LIB(ffi, ffi_call, - [AC_CHECK_HEADERS([ffi.h], [break], []) - AC_DEFINE([HAVE_SYSTEM_LIBFFI], [1], [Define to 1 if you have libffi.])], - [AC_MSG_ERROR([Cannot find system libffi])]) - CFLAGS="$CFLAGS2" - LDFLAGS="$LDFLAGS2" -]) - dnl ** check whether we need -ldl to get dlopen() AC_CHECK_LIB([dl], [dlopen]) AC_CHECK_LIB([dl], [dlopen], [AC_SUBST([CabalHaveLibdl], [True])], [AC_SUBST([CabalHaveLibdl], [False])]) |