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.
This commit is contained in:
parent
45091a4918
commit
5ac1f9716f
1 changed files with 74 additions and 16 deletions
82
configure.in
82
configure.in
|
|
@ -2,8 +2,8 @@
|
||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
|
||||||
AC_PREREQ(2.59)
|
AC_PREREQ(2.59)
|
||||||
AC_INIT(ledger, 2.1, johnw@newartisans.com)
|
AC_INIT(ledger, 2.2, johnw@newartisans.com)
|
||||||
AM_INIT_AUTOMAKE(ledger, 2.1)
|
AM_INIT_AUTOMAKE(ledger, 2.2)
|
||||||
AC_CONFIG_SRCDIR([main.cc])
|
AC_CONFIG_SRCDIR([main.cc])
|
||||||
AC_CONFIG_HEADER([acconf.h])
|
AC_CONFIG_HEADER([acconf.h])
|
||||||
|
|
||||||
|
|
@ -11,12 +11,70 @@ AC_CONFIG_HEADER([acconf.h])
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
|
#AC_PROG_LIBTOOL
|
||||||
|
#AM_PROG_LIBTOOL
|
||||||
|
|
||||||
# Checks for libraries.
|
# check for C++ compiler compatibility
|
||||||
AC_CHECK_LIB([gmp], [__gmpz_add], [],
|
AC_CACHE_CHECK(
|
||||||
AC_MSG_FAILURE("Could not find gmp (GNU multi-precision) library"))
|
[if C++ compiler is compatible],
|
||||||
AC_CHECK_LIB([pcre], [pcre_compile], [],
|
[cc_compat],
|
||||||
AC_MSG_FAILURE("Could not find pcre (Perl regular expression) library"))
|
[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
|
# check for xmlparse
|
||||||
AC_ARG_ENABLE(xml,
|
AC_ARG_ENABLE(xml,
|
||||||
|
|
@ -35,12 +93,12 @@ if [test x$xml = xtrue ]; then
|
||||||
[libxmlparse_save_libs=$LIBS
|
[libxmlparse_save_libs=$LIBS
|
||||||
LIBS="-lxmlparse -lxmltok $LIBS"
|
LIBS="-lxmlparse -lxmltok $LIBS"
|
||||||
AC_LANG_PUSH(C++)
|
AC_LANG_PUSH(C++)
|
||||||
AC_TRY_COMPILE(
|
AC_TRY_LINK(
|
||||||
[extern "C" {
|
[extern "C" {
|
||||||
#include <xmlparse.h> // expat XML parser
|
#include <xmlparse.h> // expat XML parser
|
||||||
}
|
}],
|
||||||
class foo {};],
|
[XML_Parser parser = XML_ParserCreate(NULL);
|
||||||
[return 0],
|
return parser != NULL;],
|
||||||
[libxmlparse_avail=true],
|
[libxmlparse_avail=true],
|
||||||
[libxmlparse_avail=false])
|
[libxmlparse_avail=false])
|
||||||
AC_LANG_POP
|
AC_LANG_POP
|
||||||
|
|
@ -69,7 +127,7 @@ if [test x$python = xtrue ]; then
|
||||||
[boost_python_save_libs=$LIBS
|
[boost_python_save_libs=$LIBS
|
||||||
LIBS="-lboost_python $LIBS"
|
LIBS="-lboost_python $LIBS"
|
||||||
AC_LANG_PUSH(C++)
|
AC_LANG_PUSH(C++)
|
||||||
AC_TRY_COMPILE(
|
AC_TRY_LINK(
|
||||||
[#include <boost/python.hpp>
|
[#include <boost/python.hpp>
|
||||||
using namespace boost::python;
|
using namespace boost::python;
|
||||||
class foo {};
|
class foo {};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue