Hi,

AC_LIB_HAVE_LINKFLAGS is broken for cross building, it looks
in $prefix/lib, which is usually /usr/lib/, which is usually
right.

When cross building using a cross compiler for a different
host root, say /home/janneke/vc/gub/target/mingw/root, things
go horribly wrong.

I found this cross building guile 1.9 and sent the attached
patch and suggestion to revert back to AC_CHECK_LIB

Greetings,
Jan

-- 
Jan Nieuwenhuizen <jann...@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ®  http://AvatarAcademy.nl  
>From 4aeb4bb48423d87001b598030afed0a2dc03e747 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <jann...@gnu.org>
Date: Sat, 29 Jan 2011 19:42:46 +0100
Subject: [PATCH 2/4] Use AC_CHECK_LIB rather than AC_LIB_HAVE_LINKFLAGS.  Fixes cross configuring.

AC_LIB_HAVE_LINKFLAGS is broken; it blondly looks in $prefix etc. for
libraries.  Not only is that unnecessary, it also breaks cross
building.

Here's what config.log says:

    configure:33053: i686-mingw32-gcc -mms-bitfields -std=gnu99 -o conftest.exe -O2 -DHAVE_CONFIG_H=1 -I/home/janneke/vc/gub/target/mingw/build/guile-1.9.14 -I/home/janneke/vc/gub/target/mingw/root/usr/include -L/home/janneke/vc/gub/target/mingw/root/usr/lib -L/home/janneke/vc/gub/target/mingw/root/usr/bin -L/home/janneke/vc/gub/target/mingw/root/usr/lib/w32api conftest.c /usr/lib/libltdl.a /usr/lib/libdl.a  >&5
    /tmp/cc5v8vq5.o:conftest.c:(.text+0x1e): undefined reference to `_lt_dlopenext'

note that using -lltdl -ldl instead of /usr/lib/libltdl.a
/usr/lib/libdl.la works fine.
---
 configure.ac |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5fa6cf4..0684e6b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,11 +76,7 @@ AC_LIBTOOL_DLOPEN
 AC_PROG_LIBTOOL
 
 dnl Check for libltdl.
-AC_LIB_HAVE_LINKFLAGS([ltdl], [], [#include <ltdl.h>],
-  [lt_dlopenext ("foo");])
-if test "x$HAVE_LIBLTDL" != "xyes"; then
-  AC_MSG_ERROR([GNU libltdl (Libtool) not found, see README.])
-fi
+AC_CHECK_LIB(ltdl, lt_dlopenext, [HAVE_LIBLTDL=yes AC_SUBST(HAVE_LIBLTDL) LTLIBLTDL="-lltdl" AC_SUBST(LTLIBLTDL)])
 
 AC_CHECK_PROG(have_makeinfo, makeinfo, yes, no)
 AM_CONDITIONAL(HAVE_MAKEINFO, test "$have_makeinfo" = yes)
@@ -854,10 +850,7 @@ fi
 
 
 dnl GMP tests
-AC_LIB_HAVE_LINKFLAGS([gmp],
-  [],
-  [#include <gmp.h>],
-  [mpz_import (0, 0, 0, 0, 0, 0, 0);])
+AC_CHECK_LIB(gmp, main, [HAVE_LIBGMP=yes AC_SUBST(HAVE_LIBGMP) LTLIBGMP="-lgmp" AC_SUBST(LTLIBGMP)])
 
 if test "x$HAVE_LIBGMP" != "xyes"; then
   AC_MSG_ERROR([GNU MP 4.1 or greater not found, see README])
-- 
1.7.1

Reply via email to