summaryrefslogtreecommitdiff
path: root/configure.in
blob: 583de185ed4639b5f4a0df4c827f369b13c14e62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#                                               -*- Autoconf -*-
# 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_CONFIG_SRCDIR([main.cc])
AC_CONFIG_HEADER([acconf.h])

# Checks for programs.
AC_PROG_CXX
AC_PROG_MAKE_SET
AC_PROG_RANLIB

# 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 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_COMPILE(
	 [extern "C" {
	    #include <xmlparse.h>           // expat XML parser
	  }
	  class foo {};],
	 [return 0],
	 [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_COMPILE(
	 [#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])
    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_FUNC_MALLOC
#AC_FUNC_MKTIME
#AC_FUNC_STAT
#AC_FUNC_STRFTIME
AC_CHECK_FUNCS([memset strchr strstr access mktime stat strftime strptime])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT