perform gmp/unistring compile checks with AC_LIB_HAVE_LINKFLAGS
authorAndy Wingo <wingo@pobox.com>
Tue, 4 Aug 2009 19:16:32 +0000 (21:16 +0200)
committerAndy Wingo <wingo@pobox.com>
Tue, 4 Aug 2009 19:16:32 +0000 (21:16 +0200)
* configure.ac: Rework gmp and unistring checks to use
  AC_LIB_HAVE_LINKFLAGS, so that the compilation checks run with the
  right -L/-l flags.

* libguile/Makefile.am (libguile_la_LIBADD): Adapt to need to add
  $(LIBGMP) and $(LIBUNISTRING) here.

Hopefully this solves
http://article.gmane.org/gmane.lisp.guile.bugs/4288.

configure.ac
libguile/Makefile.am

index 53049eb..dae8295 100644 (file)
@@ -827,22 +827,19 @@ fi
 
 
 dnl GMP tests
-AC_LIB_LINKFLAGS(gmp)
-AC_CHECK_LIB([gmp], [__gmpz_init], ,
-  [AC_MSG_ERROR([GNU MP not found, see README])])
-
-# mpz_import is a macro so we need to include <gmp.h>
-AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gmp.h>]],
-                               [[mpz_import (0, 0, 0, 0, 0, 0, 0); ]])],
+AC_LIB_HAVE_LINKFLAGS(gmp,
   [],
-  [AC_MSG_ERROR([At least GNU MP 4.1 is required, see README])])
+  [#include <gmp.h>],
+  [mpz_import (0, 0, 0, 0, 0, 0, 0);],
+  AC_MSG_ERROR([GNU MP 4.1 or greater not found, see README]))
 
 dnl GNU libunistring tests.
-if test "x$LTLIBUNISTRING" != "x"; then
-   LIBS="$LTLIBUNISTRING $LIBS"
-else
-   AC_MSG_ERROR([GNU libunistring is required, please install it.])
-fi
+AC_LIB_HAVE_LINKFLAGS(unistring,
+  [],
+  [#include <unistr.h>],
+  [u8_check ("foo", 3)]
+  AC_MSG_ERROR([GNU libunistring not found, see README]))
+
 
 dnl i18n tests
 #AC_CHECK_HEADERS([libintl.h])
index 8c9c598..dfaa65a 100644 (file)
@@ -220,7 +220,7 @@ noinst_HEADERS = convert.i.c                                        \
 noinst_HEADERS += vm-engine.c vm-i-system.c vm-i-scheme.c vm-i-loader.c
 
 libguile_la_DEPENDENCIES = @LIBLOBJS@
-libguile_la_LIBADD = @LIBLOBJS@ $(gnulib_library)
+libguile_la_LIBADD = @LIBLOBJS@ $(gnulib_library) $(LTLIBGMP) $(LTLIBUNISTRING)
 libguile_la_LDFLAGS = @LTLIBINTL@ -version-info @LIBGUILE_INTERFACE_CURRENT@:@LIBGUILE_INTERFACE_REVISION@:@LIBGUILE_INTERFACE_AGE@ -export-dynamic -no-undefined
 
 # These are headers visible as <guile/mumble.h>