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