# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT(ledger, 2.2, johnw@newartisans.com) AM_INIT_AUTOMAKE(ledger, 2.2) AC_CONFIG_SRCDIR([main.cc]) AC_CONFIG_HEADER([acconf.h]) # Checks for programs. AC_PROG_CXX AC_PROG_MAKE_SET AC_PROG_RANLIB #AC_PROG_LIBTOOL #AM_PROG_LIBTOOL # check for C++ compiler compatibility AC_CACHE_CHECK( [if C++ compiler is compatible], [cc_compat], [AC_LANG_PUSH(C++) AC_TRY_LINK( [#include #include ], [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 ], [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) LIBS="-lgmp $LIBS" 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_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) LIBS="-lpcre $LIBS" else AC_MSG_FAILURE("Could not find pcre library (set CPPFLAGS and LDFLAGS?)") fi # check for xmlparse AC_ARG_ENABLE(xml, [ --enable-xml Turn on support for XML parsing], [case "${enableval}" in yes) xml=true ;; no) xml=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-xml) ;; esac],[xml=true]) AM_CONDITIONAL(USE_XML, test x$xml = xtrue) if [test x$xml = xtrue ]; then AC_CACHE_CHECK( [if libxmlparse is available], [libxmlparse_avail], [libxmlparse_save_libs=$LIBS LIBS="-lxmlparse -lxmltok $LIBS" AC_LANG_PUSH(C++) AC_TRY_LINK( [#include extern "C" { #include // 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) else AM_CONDITIONAL(HAVE_XMLPARSE, false) fi # check for Python AC_ARG_ENABLE(python, [ --enable-python Turn on Python support], [case "${enableval}" in yes) python=true ;; no) python=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;; esac],[python=false]) AM_CONDITIONAL(USE_PYTHON, test x$python = xtrue) if [test x$python = xtrue ]; then AM_PATH_PYTHON(2.2,, :) if [test "$PYTHON" != :]; then AC_CACHE_CHECK( [if boost_python is available], [boost_python_cpplib_avail], [boost_python_save_libs=$LIBS LIBS="-lboost_python $LIBS" AC_LANG_PUSH(C++) AC_TRY_LINK( [#include using namespace boost::python; class foo {}; BOOST_PYTHON_MODULE(samp) { class_< foo > ("foo") ; }], [return 0], [boost_python_cpplib_avail=true], [boost_python_cpplib_avail=false]) AC_LANG_POP LIBS=$boost_python_save_libs]) AM_CONDITIONAL(HAVE_BOOST_PYTHON, test x$boost_python_cpplib_avail = xtrue) else AM_CONDITIONAL(HAVE_BOOST_PYTHON, false) fi else AM_CONDITIONAL(HAVE_BOOST_PYTHON, false) fi # Check for options AC_ARG_ENABLE(debug, [ --enable-debug Turn on debugging], [case "${enableval}" in yes) debug=true ;; no) debug=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; esac],[debug=false]) AM_CONDITIONAL(DEBUG, test x$debug = xtrue) # Checks for header files. AC_STDC_HEADERS AC_HAVE_HEADERS(sys/stat.h) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL AC_TYPE_SIZE_T AC_STRUCT_TM # Checks for library functions. #AC_FUNC_ERROR_AT_LINE AC_HEADER_STDC AC_CHECK_FUNCS([access mktime realpath stat strftime strptime]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT