1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 06:01:15 +00:00

ensure that gmp and libffi are found when compiling with gcc dynamically

This commit is contained in:
Tomas Hlavaty 2015-03-28 01:57:00 +01:00 committed by Michael Raskin
parent 5281377fb5
commit a31471876d
2 changed files with 52 additions and 2 deletions

View file

@ -1,4 +1,5 @@
{stdenv, fetchurl
, libtool, autoconf, automake
, gmp, mpfr, libffi
, noUnicode ? false,
}:
@ -13,10 +14,10 @@ let
sha256="13wlxkd5prm93gcm2dhm7v52fl803yx93aa97lrb39z0y6xzziid";
};
buildInputs = [
libffi
libtool autoconf automake
];
propagatedBuildInputs = [
gmp mpfr
libffi gmp mpfr
];
in
stdenv.mkDerivation {
@ -25,8 +26,18 @@ stdenv.mkDerivation {
src = fetchurl {
inherit (s) url sha256;
};
patches = [ ./libffi-prefix.patch ];
preConfigure = ''
(cd src ; libtoolize -f)
(cd src ; autoheader -f)
(cd src ; aclocal)
(cd src ; automake --add-missing -c)
(cd src ; autoconf -f)
'';
configureFlags = [
"--enable-threads"
"--with-gmp-prefix=${gmp}"
"--with-libffi-prefix=${libffi}"
]
++
(stdenv.lib.optional (! noUnicode)

View file

@ -0,0 +1,39 @@
diff --git a/src/configure.in b/src/configure.in
index 434da49..642c66c 100644
--- ecl-15.3.7.orig/src/configure.ac
+++ ecl-15.3.7/src/configure.ac
@@ -191,6 +191,11 @@ AC_ARG_WITH(dffi,
[(system|included|auto|no, default=AUTO if libffi available)]),
[enable_libffi=${withval}], [enable_libffi=auto])
+AC_ARG_WITH(libffi-prefix,
+ AS_HELP_STRING( [--with-libffi-prefix=path],
+ [prefix for system LIBFFI includes and libraries] ),
+ [LIBFFI_INCDIR="$withval/include"; LIBFFI_LIBDIR="$withval/lib"], [])
+
AC_ARG_WITH(fpe,
AS_HELP_STRING( [--with-fpe],
[detect floating point exceptions]
@@ -368,6 +373,22 @@ else
INFOEXT=info
fi
+dnl libffi
+
+if test "x$LIBFFI_INCDIR" != "x"; then
+ LIBFFI_CPPFLAGS="-I$LIBFFI_INCDIR"
+fi
+if test "x$LIBFFI_LIBDIR" != "x"; then
+ LIBFFI_LDFLAGS="-L$LIBFFI_LIBDIR"
+ if test "$enable_rpath" = "yes"; then
+ if (echo "$ECL_LDRPATH" | grep '~A') > /dev/null; then
+ LIBFFI_LDFLAGS=`echo $ECL_LDRPATH | sed "s,~A,$LIBFFI_LIBDIR,"`" $LIBFFI_LDFLAGS"
+ fi
+ fi
+fi
+CPPFLAGS="$CPPFLAGS $LIBFFI_CPPFLAGS"
+LDFLAGS="$LDFLAGS $LIBFFI_LDFLAGS"
+
dnl ======================================================================
dnl GNU multiprecision library
dnl