Specify minimal automake version in AM_INIT_AUTOMAKE. Use
[metaproxy-moved-to-github.git] / configure.ac
1 ## -*- Autoconf -*-
2 ## Process this file with autoconf to produce a configure script.
3
4 # Autoconf and automake setup
5 AC_PREREQ(2.57)
6 AC_INIT(yp2, 0.0.1, marc@indexdata.dk)
7
8 AC_CONFIG_HEADERS(src/config.hpp)
9
10 AC_CONFIG_SRCDIR(configure.ac) 
11 AC_CONFIG_AUX_DIR(config)
12 AC_CANONICAL_SYSTEM
13 ##AC_PREFIX_DEFAULT(`pwd`/install) 
14
15 AM_INIT_AUTOMAKE(1.8)
16
17 # Checks for programs.
18 AC_PROG_CXX
19 AC_PROG_CXXCPP
20 AC_PROG_INSTALL
21 AC_PROG_LN_S
22 AC_PROG_MAKE_SET
23 AC_PROG_RANLIB
24 AM_PROG_LIBTOOL
25
26 # Use C++ compilers only for tests
27 AC_LANG(C++)
28
29 # Checks for libraries.
30 AC_CHECK_LIB(boost_thread, main, [],[
31         AC_MSG_ERROR([boost thread library not found. Install libboost-thread-dev (or similar)])
32 ])
33
34 AC_CHECK_LIB(boost_date_time, main, [],[
35         AC_MSG_ERROR([boost date_time library not found. Install libboost-date-time-dev (or similar)])
36 ])
37
38 AC_MSG_CHECKING([for boost_unit_test_framework presence])
39 OLIBS=$LIBS
40 LIBS="$LIBS -lboost_unit_test_framework"
41 AC_TRY_LINK([
42 #define BOOST_AUTO_TEST_MAIN
43 #include <boost/test/auto_unit_test.hpp> 
44 BOOST_AUTO_TEST_CASE( test )
45 {
46  BOOST_CHECK(true);
47 }
48 ],[],
49 [
50         AC_MSG_RESULT([yes])
51         LIBS=$OLIBS
52 ],
53 [
54         AC_MSG_RESULT([no])
55         AC_MSG_ERROR([Install libboost-test-dev (or similar)])
56 ])
57
58 ## YAZPP checks
59 YAZPP_INIT(threads,1.0)
60 if test -z "$YAZPPLIB"; then
61         AC_MSG_ERROR([YAZ++ development libraries missing])
62 fi
63 ##YAZ_DOC
64
65 ## libxslt checks
66 AC_SUBST(XSLT_LIBS)
67 AC_SUBST(XSLT_CFLAGS)
68 xsltdir=default
69 AC_ARG_WITH(xslt,[[  --with-xslt[=PREFIX]    use libxslt in PREFIX]],xsltdir=$withval)
70 if test "$xsltdir" = "yes" -o "$xsltdir" = "default"; then
71         for d in /usr /usr/local; do
72                 if test -x $d/bin/xslt-config; then
73                         xsltdir=$d
74                 fi
75         done
76 fi
77 if test "$xsltdir" != "no"; then
78         AC_MSG_CHECKING(for libXSLT)
79         if test -x $xsltdir/bin/xslt-config; then
80                 XSLT_LIBS=`$xsltdir/bin/xslt-config --libs`
81                 XSLT_CFLAGS=`$xsltdir/bin/xslt-config --cflags`
82                 XSLT_VER=`$xsltdir/bin/xslt-config --version`
83                 AC_MSG_RESULT($XSLT_VER)
84                 AC_DEFINE([HAVE_XSLT],[1],
85                 [Define to 1 if you have libxslt installed])
86         else
87                 AC_MSG_RESULT(Not found)
88                 if test "$xsltdir" = "default"; then
89                         AC_MSG_WARN([Libxslt development libraries not found.])
90                 else
91                         AC_MSG_ERROR([libxslt development libraries not found.])                fi
92         fi
93 fi
94
95
96 # Checks for header files.
97 ##AC_HEADER_STDC
98 ##AC_HEADER_SYS_WAIT
99 ##AC_HEADER_TIME 
100 AC_CHECK_HEADERS(iostream list vector stdexcept)
101 AC_CHECK_HEADERS(boost/thread/mutex.hpp \ 
102                  boost/date_time/posix_time/posix_time.hpp \
103                  boost/test/auto_unit_test.hpp)
104
105 # Checks for typedefs, structures, and compiler characteristics.
106 ##AC_TYPE_SIZE_T 
107 ##AC_CHECK_SIZEOF(int)
108 ##AC_CHECK_SIZEOF(long int)
109
110
111 # Checks for library functions.
112
113 AC_CONFIG_FILES([
114         Doxyfile
115         Makefile
116         src/Makefile
117 ])
118
119 AC_OUTPUT
120
121
122 # postamble
123
124 echo \
125 "------------------------------------------------------------------------
126 Configuration:
127
128   Source code location:       ${srcdir}
129   CPP Preprocessor flags:     ${CPPFLAGS}
130   CXX Compiler:               ${CXX}
131   CXX Compiler flags:         ${CXXFLAGS}
132   Linker flags:               ${LDFLAGS}
133   Linked libs:                ${LIBS}
134   Host System Type:           ${host}
135   Install path:               ${prefix}
136   Automake:                   ${AUTOMAKE}
137
138 ------------------------------------------------------------------------"