diff options
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 299 |
1 files changed, 228 insertions, 71 deletions
diff --git a/configure.in b/configure.in index 038e80aa..c42a8c0b 100644 --- a/configure.in +++ b/configure.in @@ -1,9 +1,12 @@ -# -*- Autoconf -*- +# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_PREREQ(2.59) -AC_INIT(ledger, 2.6.0.90, johnw@newartisans.com) -AM_INIT_AUTOMAKE(ledger, 2.6.0.90) +AC_PREREQ(2.61) + +AC_INIT([ledger],[2.7],[johnw@newartisans.com]) +AC_CONFIG_SRCDIR(ledger) +AM_INIT_AUTOMAKE([dist-bzip2]) + AC_CONFIG_SRCDIR([main.cc]) AC_CONFIG_HEADER([acconf.h]) @@ -16,39 +19,68 @@ AM_PROG_LIBTOOL # Checks for emacs lisp path AM_PATH_LISPDIR +# 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) + +AC_ARG_ENABLE(pch, + [ --enable-pch Use GCC 4.x pre-compiled headers], + [case "${enableval}" in + yes) pch=true ;; + no) pch=false ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-pch) ;; + esac],[pch=false]) + +AM_CONDITIONAL(USE_PCH, test x$pch = xtrue) + +AC_ARG_WITH(boost-suffix, + [ --with-boost-suffix=X Append X to the Boost library names], + [BOOST_SUFFIX="-${withval}"], + [BOOST_SUFFIX=""]) + +AC_SUBST([BOOST_SUFFIX], $BOOST_SUFFIX) + # check if UNIX pipes are available AC_CACHE_CHECK( [if pipes can be used], [pipes_avail_cv_], [AC_LANG_PUSH(C++) - AC_TRY_LINK( - [#include <sys/types.h> - #include <sys/wait.h> - #include <unistd.h> - #include <stdlib.h> - #include <string.h> - #include <stdio.h>], - [int status, pfd[2]; - status = pipe(pfd); - status = fork(); - if (status < 0) { - ; - } else if (status == 0) { - char *arg0; - - status = dup2(pfd[0], STDIN_FILENO); - - close(pfd[1]); - close(pfd[0]); - - execlp("", arg0, (char *)0); - perror("execl"); - exit(1); - } else { - close(pfd[0]); - }], - [pipes_avail_cv_=true], - [pipes_avail_cv_=false]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <sys/types.h> + #include <sys/wait.h> + #include <unistd.h> + #include <stdlib.h> + #include <string.h> + #include <stdio.h>]], + [[int status, pfd[2]; + status = pipe(pfd); + status = fork(); + if (status < 0) { + ; + } else if (status == 0) { + char *arg0; + + status = dup2(pfd[0], STDIN_FILENO); + + close(pfd[1]); + close(pfd[0]); + + execlp("", arg0, (char *)0); + perror("execl"); + exit(1); + } else { + close(pfd[0]); + }]])], + [pipes_avail=true], + [pipes_avail=false]) AC_LANG_POP]) if [test x$pipes_avail_cv_ = xtrue ]; then @@ -62,18 +94,13 @@ AC_CACHE_CHECK( [libgmp_save_libs=$LIBS LIBS="-lgmp $LIBS" AC_LANG_PUSH(C++) - AC_TRY_LINK( - [#include <gmp.h>], - [mpz_t bar; + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gmp.h>]], [[mpz_t bar; mpz_init(bar); - mpz_clear(bar);], - [libgmp_avail_cv_=true], - [libgmp_avail_cv_=false]) + mpz_clear(bar);]])],[libgmp_avail=true],[libgmp_avail=false]) AC_LANG_POP LIBS=$libgmp_save_libs]) -if [test x$libgmp_avail_cv_ = xtrue ]; then - AM_CONDITIONAL(HAVE_GMP, true) +if [test x$libgmp_avail = xtrue ]; then LIBS="-lgmp $LIBS" else AC_MSG_FAILURE("Could not find gmp library (set CPPFLAGS and LDFLAGS?)") @@ -173,6 +200,112 @@ else AM_CONDITIONAL(HAVE_XMLPARSE, false) fi +# check for boost_regex +AC_CACHE_CHECK( + [if boost_regex is available], + [boost_regex_avail], + [boost_regex_save_libs=$LIBS + LIBS="-lboost_regex$BOOST_SUFFIX $LIBS" + AC_LANG_PUSH(C++) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <boost/regex.hpp>]], + [[boost::regex foo_regexp("Hello, world!");]])], + [boost_regex_avail=true], + [boost_regex_avail=false]) + AC_LANG_POP + LIBS=$boost_regex_save_libs]) + +if [test x$boost_regex_avail = xtrue ]; then + LIBS="-lboost_regex$BOOST_SUFFIX $LIBS" +else + AC_MSG_FAILURE("Could not find boost_regex library (set CPPFLAGS and LDFLAGS?)") +fi + +# check for boost_date_time +AC_CACHE_CHECK( + [if boost_date_time is available], + [boost_date_time_cpplib_avail], + [boost_date_time_save_libs=$LIBS + LIBS="-lboost_date_time$BOOST_SUFFIX $LIBS" + AC_LANG_PUSH(C++) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <boost/date_time/posix_time/posix_time.hpp> + #include <boost/date_time/gregorian/gregorian.hpp> + #include <boost/date_time/local_time_adjustor.hpp> + #include <boost/date_time/time_duration.hpp> + + using namespace boost::posix_time; + using namespace boost::date_time; + + #include <ctime> + + inline ptime time_to_system_local(const ptime& when) { + struct std::tm tm_gmt = to_tm(when); + return from_time_t(mktime(&tm_gmt)); + }]], + [[ptime t10 = ptime(boost::gregorian::from_string("2007-01-15"), + ptime::time_duration_type()); + + ptime t12 = time_to_system_local(t10); + + return t10 != t12;]])], + [boost_date_time_cpplib_avail=true], + [boost_date_time_cpplib_avail=false]) + AC_LANG_POP + LIBS=$boost_date_time_save_libs]) + +if [test x$boost_date_time_cpplib_avail = xtrue ]; then + LIBS="-lboost_date_time$BOOST_SUFFIX $LIBS" +else + AC_MSG_FAILURE("Could not find boost_date_time library (set CPPFLAGS and LDFLAGS?)") +fi + +# check for boost_filesystem +AC_CACHE_CHECK( + [if boost_filesystem is available], + [boost_filesystem_cpplib_avail], + [boost_filesystem_save_libs=$LIBS + LIBS="-lboost_filesystem$BOOST_SUFFIX -lboost_system$BOOST_SUFFIX $LIBS" + AC_LANG_PUSH(C++) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <boost/filesystem/path.hpp>]], + [[boost::filesystem::path this_path("Hello");]])], + [boost_filesystem_cpplib_avail=true], + [boost_filesystem_cpplib_avail=false]) + AC_LANG_POP + LIBS=$boost_filesystem_save_libs]) + +if [test x$boost_filesystem_cpplib_avail = xtrue ]; then + LIBS="-lboost_filesystem$BOOST_SUFFIX -lboost_system$BOOST_SUFFIX $LIBS" +else + AC_MSG_FAILURE("Could not find boost_filesystem library (set CPPFLAGS and LDFLAGS?)") +fi + +## check for boost_signals +#AC_CACHE_CHECK( +# [if boost_signals is available], +# [boost_signals_cpplib_avail], +# [boost_signals_save_libs=$LIBS +# LIBS="-lboost_signals$BOOST_SUFFIX $LIBS" +# AC_LANG_PUSH(C++) +# AC_LINK_IFELSE( +# [AC_LANG_PROGRAM( +# [[#include <boost/signal.hpp>]], +# [[boost::signal<void (void)> this_signal;]])], +# [boost_signals_cpplib_avail=true], +# [boost_signals_cpplib_avail=false]) +# AC_LANG_POP +# LIBS=$boost_signals_save_libs]) +# +#if [test x$boost_signals_cpplib_avail = xtrue ]; then +# LIBS="-lboost_signals$BOOST_SUFFIX $LIBS" +#else +# AC_MSG_FAILURE("Could not find boost_signals library (set CPPFLAGS and LDFLAGS?)") +#fi + # check for libofx AC_ARG_ENABLE(ofx, [ --enable-ofx Turn on support for OFX/OCF parsing], @@ -181,6 +314,7 @@ AC_ARG_ENABLE(ofx, no) ofx=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-ofx) ;; esac],[ofx=true]) + AM_CONDITIONAL(USE_OFX, test x$ofx = xtrue) if [test x$ofx = xtrue ]; then @@ -190,11 +324,12 @@ if [test x$ofx = xtrue ]; then [libofx_save_libs=$LIBS LIBS="-lofx $LIBS" AC_LANG_PUSH(C++) - AC_TRY_LINK( - [#include <libofx.h>], - [ LibofxContextPtr libofx_context = libofx_get_new_context();], - [libofx_avail_cv_=true], - [libofx_avail_cv_=false]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <libofx.h>]], + [[LibofxContextPtr libofx_context = libofx_get_new_context();]])], + [libofx_avail=true], + [libofx_avail=false]) AC_LANG_POP LIBS=$libofx_save_libs]) @@ -216,6 +351,7 @@ AC_ARG_ENABLE(python, 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 @@ -225,23 +361,25 @@ if [test x$python = xtrue ]; then [if boost_python is available], [boost_python_cpplib_avail_cv_], [boost_python_save_libs=$LIBS - LIBS="-lboost_python -lpython$PYTHON_VERSION $LIBS" + LIBS="-lboost_python$BOOST_SUFFIX -lpython$PYTHON_VERSION $LIBS" AC_LANG_PUSH(C++) - AC_TRY_LINK( - [#include <boost/python.hpp> - using namespace boost::python; - class foo {}; - BOOST_PYTHON_MODULE(samp) { - class_< foo > ("foo") ; - }], - [return 0], - [boost_python_cpplib_avail_cv_=true], - [boost_python_cpplib_avail_cv_=false]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <boost/python.hpp> + 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]) - if [test x$boost_python_cpplib_avail_cv_ = xtrue ]; then + + if [test x$boost_python_cpplib_avail = xtrue ]; then AM_CONDITIONAL(HAVE_BOOST_PYTHON, true) - LIBS="-lboost_python -lpython$PYTHON_VERSION $LIBS" + LIBS="-lboost_python$BOOST_SUFFIX -lpython$PYTHON_VERSION $LIBS" else AM_CONDITIONAL(HAVE_BOOST_PYTHON, false) fi @@ -252,19 +390,39 @@ 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) +# check for CppUnit +AC_CACHE_CHECK( + [if cppunit is available], + [cppunit_avail], + [cppunit_save_libs=$LIBS + LIBS="-lcppunit $LIBS" + AC_LANG_PUSH(C++) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <cppunit/CompilerOutputter.h> + #include <cppunit/TestResult.h> + #include <cppunit/TestResultCollector.h> + #include <cppunit/TestRunner.h> + #include <cppunit/TextTestProgressListener.h> + #include <cppunit/BriefTestProgressListener.h> + #include <cppunit/XmlOutputter.h> + #include <cppunit/extensions/TestFactoryRegistry.h>]], + [[CPPUNIT_NS::TestResult controller; + CPPUNIT_NS::TestResultCollector result;]])], + [cppunit_avail=true], + [cppunit_avail=false]) + AC_LANG_POP + LIBS=$cppunit_save_libs]) + +if [test x$cppunit_avail = xtrue ]; then + AM_CONDITIONAL(HAVE_CPPUNIT, true) +else + AM_CONDITIONAL(HAVE_CPPUNIT, false) +fi # Checks for header files. -AC_STDC_HEADERS -AC_HAVE_HEADERS(sys/stat.h) +AC_HEADER_STDC +AC_CHECK_HEADERS([sys/stat.h langinfo.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL @@ -272,9 +430,8 @@ 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 getpwuid getpwnam]) +AC_CHECK_FUNCS([access mktime realpath getpwuid getpwnam nl_langinfo]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT |