summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2005-02-01 00:17:14 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:40:51 -0400
commit5ac1f9716fea3bfab4acbb34421875d430c8316c (patch)
tree612e2f5660e61e43ca29ed4945b93a6c7b4a8eb9
parent45091a4918087b0879ba961b08878eb01e9ab93e (diff)
downloadfork-ledger-5ac1f9716fea3bfab4acbb34421875d430c8316c.tar.gz
fork-ledger-5ac1f9716fea3bfab4acbb34421875d430c8316c.tar.bz2
fork-ledger-5ac1f9716fea3bfab4acbb34421875d430c8316c.zip
Changed all of the library tests into actual compile/link tests, to
ensure that the compilation environment is what it needs to be. Also, added a test to make sure the C++ compiler has some basic features, since gcc2.95 will not work.
-rw-r--r--configure.in90
1 files changed, 74 insertions, 16 deletions
diff --git a/configure.in b/configure.in
index 583de185..dd4c1882 100644
--- a/configure.in
+++ b/configure.in
@@ -2,8 +2,8 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
-AC_INIT(ledger, 2.1, johnw@newartisans.com)
-AM_INIT_AUTOMAKE(ledger, 2.1)
+AC_INIT(ledger, 2.2, johnw@newartisans.com)
+AM_INIT_AUTOMAKE(ledger, 2.2)
AC_CONFIG_SRCDIR([main.cc])
AC_CONFIG_HEADER([acconf.h])
@@ -11,12 +11,70 @@ AC_CONFIG_HEADER([acconf.h])
AC_PROG_CXX
AC_PROG_MAKE_SET
AC_PROG_RANLIB
+#AC_PROG_LIBTOOL
+#AM_PROG_LIBTOOL
-# Checks for libraries.
-AC_CHECK_LIB([gmp], [__gmpz_add], [],
- AC_MSG_FAILURE("Could not find gmp (GNU multi-precision) library"))
-AC_CHECK_LIB([pcre], [pcre_compile], [],
- AC_MSG_FAILURE("Could not find pcre (Perl regular expression) library"))
+# check for C++ compiler compatibility
+AC_CACHE_CHECK(
+ [if C++ compiler is compatible],
+ [cc_compat],
+ [AC_LANG_PUSH(C++)
+ AC_TRY_LINK(
+ [#include <cctype>
+ #include <iostream>],
+ [if (std::isspace(' ') || std::isdigit(' '))
+ std::cout << std::left << std::right << "Hello";],
+ [cc_compat=true],
+ [cc_compat=false])
+ AC_LANG_POP])
+
+if [test x$cc_compat = xfalse ]; then
+ AC_MSG_FAILURE("System's C++ compiler is not compatible (need to use gcc3?)")
+fi
+
+# check for gmp
+AC_CACHE_CHECK(
+ [if libgmp is available],
+ [libgmp_avail],
+ [libgmp_save_libs=$LIBS
+ LIBS="-lgmp $LIBS"
+ AC_LANG_PUSH(C++)
+ AC_TRY_LINK(
+ [#include <gmp.h>],
+ [mpz_t bar;
+ mpz_init(bar);
+ mpz_clear(bar);],
+ [libgmp_avail=true],
+ [libgmp_avail=false])
+ AC_LANG_POP
+ LIBS=$libgmp_save_libs])
+
+if [test x$libgmp_avail = xtrue ]; then
+ AM_CONDITIONAL(HAVE_GMP, true)
+else
+ AC_MSG_FAILURE("Could not find gmp library (set CPPFLAGS and LDFLAGS?)")
+fi
+
+# check for pcre
+AC_CACHE_CHECK(
+ [if libpcre is available],
+ [libpcre_avail],
+ [libpcre_save_libs=$LIBS
+ LIBS="-lpcre $LIBS"
+ AC_LANG_PUSH(C++)
+ AC_TRY_LINK(
+ [#include <pcre.h>],
+ [pcre_free((pcre *)NULL);],
+ [libpcre_avail=true],
+ [libpcre_avail=false])
+ AC_LANG_POP
+ LIBS=$libpcre_save_libs])
+
+if [test x$libpcre_avail = xtrue ]; then
+ AM_CONDITIONAL(HAVE_PCRE, true)
+else
+ AC_MSG_FAILURE("Could not find pcre library (set CPPFLAGS and LDFLAGS?)")
+fi
# check for xmlparse
AC_ARG_ENABLE(xml,
@@ -35,14 +93,14 @@ if [test x$xml = xtrue ]; then
[libxmlparse_save_libs=$LIBS
LIBS="-lxmlparse -lxmltok $LIBS"
AC_LANG_PUSH(C++)
- AC_TRY_COMPILE(
- [extern "C" {
- #include <xmlparse.h> // expat XML parser
- }
- class foo {};],
- [return 0],
- [libxmlparse_avail=true],
- [libxmlparse_avail=false])
+ AC_TRY_LINK(
+ [extern "C" {
+ #include <xmlparse.h> // expat XML parser
+ }],
+ [XML_Parser parser = XML_ParserCreate(NULL);
+ return parser != NULL;],
+ [libxmlparse_avail=true],
+ [libxmlparse_avail=false])
AC_LANG_POP
LIBS=$libxmlparse_save_libs])
AM_CONDITIONAL(HAVE_XMLPARSE, test x$libxmlparse_avail = xtrue)
@@ -69,7 +127,7 @@ if [test x$python = xtrue ]; then
[boost_python_save_libs=$LIBS
LIBS="-lboost_python $LIBS"
AC_LANG_PUSH(C++)
- AC_TRY_COMPILE(
+ AC_TRY_LINK(
[#include <boost/python.hpp>
using namespace boost::python;
class foo {};