From a5bc2579afac3268c31626777406c295c7e67755 Mon Sep 17 00:00:00 2001 From: Reid Barton Date: Mon, 12 Jan 2015 10:59:11 -0500 Subject: Move libffi configuration after basic toolchain setup Summary: The relevant aspect is that the libffi configuration's AC_CHECK_LIB and AC_CHECK_HEADERS are moved after FIND_GCC. There are two reasons to do this: 1. We should detect the presence of libffi using the C compiler that we are eventually going to use to build GHC. 2. Running AC_CHECK_HEADERS before FIND_GCC pollutes the CPP variable with "gcc -E" (wrong when cross-compiling), and CPP is not reset by FIND_GCC. Thus this patch fixes x86_64 -> i386 cross-compilation of integer-gmp2. Test Plan: Local x86_64 -> i386 cross-compiling validate; Harbormaster Reviewers: austin Reviewed By: austin Subscribers: erikd, carter, thomie Differential Revision: https://phabricator.haskell.org/D597 --- configure.ac | 112 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 56 insertions(+), 56 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 8fadf30352..16d160518e 100644 --- a/configure.ac +++ b/configure.ac @@ -355,62 +355,6 @@ then fi fi -# system libffi - -AC_ARG_WITH([system-libffi], -[AC_HELP_STRING([--with-system-libffi], - [Use system provided libffi for RTS [default=no]]) -]) - -AS_IF([test "x$with_system_libffi" = "xyes"], - [UseSystemLibFFI="YES"], [UseSystemLibFFI="NO"] -) - - -AC_SUBST(UseSystemLibFFI) - -AC_ARG_WITH([ffi-includes], -[AC_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], -[AC_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" - AC_CHECK_LIB(ffi, ffi_call, - [AC_CHECK_HEADERS([ffi.h], [break], []) - AC_DEFINE([HAVE_LIBFFI], [1], [Define to 1 if you have libffi.])], - [AC_MSG_ERROR([Cannot find system libffi])]) - CFLAGS="$CFLAGS2" - LDFLAGS="$LDFLAGS2" -]) - FP_ICONV FP_GMP @@ -855,6 +799,62 @@ dnl ################################################################ dnl Check for libraries dnl ################################################################ +# system libffi + +AC_ARG_WITH([system-libffi], +[AC_HELP_STRING([--with-system-libffi], + [Use system provided libffi for RTS [default=no]]) +]) + +AS_IF([test "x$with_system_libffi" = "xyes"], + [UseSystemLibFFI="YES"], [UseSystemLibFFI="NO"] +) + + +AC_SUBST(UseSystemLibFFI) + +AC_ARG_WITH([ffi-includes], +[AC_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], +[AC_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" + AC_CHECK_LIB(ffi, ffi_call, + [AC_CHECK_HEADERS([ffi.h], [break], []) + AC_DEFINE([HAVE_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) -- cgit v1.2.1