9d5223d9615d63950a2b1b5eebdecbc2da1f8cee
[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.3, adam@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 if test "$enable_shared" = "yes"; then
30         AC_DEFINE([HAVE_DL_SUPPORT],[1],
31                 [Define to 1 if you have shared module support])
32 fi
33
34 # Checks for libraries.
35 AC_CHECK_LIB(dl,dlopen)
36
37 AC_CHECK_LIB(boost_thread, main, [],[
38         AC_MSG_NOTICE([boost thread library not found.])
39         AC_MSG_ERROR([Install libboost-thread-dev (or similar)])
40 ])
41
42 AC_CHECK_LIB(boost_date_time, main, [],[
43         AC_MSG_NOTICE([boost date_time library not found.])
44         AC_MSG_ERROR([Install libboost-date-time-dev (or similar)])
45 ])
46
47 AC_CHECK_LIB(boost_program_options, main, [],[
48         AC_MSG_NOTICE([boost program options library not found.])
49         AC_MSG_ERROR([Install libboost-program-options-dev (or similar)])
50 ])
51
52 AC_CHECK_LIB(boost_regex, main, [],[
53         AC_MSG_NOTICE([boost regex library not found.])
54         AC_MSG_ERROR([Install libboost-regex-dev (or similar)])
55 ])
56
57 AC_CHECK_HEADER(boost/test/auto_unit_test.hpp,,[
58         AC_MSG_NOTICE([boost test unit header not found.])
59         AC_MSG_ERROR([Install libboost-test-dev (or similar)])
60 ])
61
62 AC_MSG_CHECKING([whether boost_unit_test_framework works])
63 OLIBS=$LIBS
64 LIBS="$LIBS -lboost_unit_test_framework"
65 AC_TRY_LINK([
66 #define BOOST_AUTO_TEST_MAIN
67 #include <boost/test/auto_unit_test.hpp> 
68 BOOST_AUTO_UNIT_TEST( test )
69 {
70  BOOST_CHECK(true);
71 }
72 ],[],
73 [
74         AC_MSG_RESULT([yes])
75         LIBS=$OLIBS
76 ],
77 [
78         AC_MSG_RESULT([no])
79         AC_MSG_NOTICE([Boost unit test framework does not appear to work])
80         AC_MSG_ERROR([Consult config.log for details])
81 ])
82
83 ## YAZPP checks
84 YAZPP_INIT(threads,1.0)
85 if test -z "$YAZPPLIB"; then
86         AC_MSG_ERROR([YAZ++ development libraries missing])
87 fi
88 ##YAZ_DOC
89
90 ## libxslt checks
91 AC_SUBST(XSLT_LIBS)
92 AC_SUBST(XSLT_CFLAGS)
93 xsltdir=default
94 AC_ARG_WITH(xslt,[[  --with-xslt[=PREFIX]    use libxslt in PREFIX]],xsltdir=$withval)
95 if test "$xsltdir" = "yes" -o "$xsltdir" = "default"; then
96         for d in /usr /usr/local; do
97                 if test -x $d/bin/xslt-config; then
98                         xsltdir=$d
99                 fi
100         done
101 fi
102 if test "$xsltdir" != "no"; then
103         AC_MSG_CHECKING(for libXSLT)
104         if test -x $xsltdir/bin/xslt-config; then
105                 XSLT_LIBS=`$xsltdir/bin/xslt-config --libs`
106                 XSLT_CFLAGS=`$xsltdir/bin/xslt-config --cflags`
107                 XSLT_VER=`$xsltdir/bin/xslt-config --version`
108                 AC_MSG_RESULT($XSLT_VER)
109                 AC_DEFINE([HAVE_XSLT],[1],
110                 [Define to 1 if you have libxslt installed])
111         else
112                 AC_MSG_RESULT(Not found)
113                 AC_MSG_ERROR([libxslt required.])
114         fi
115 fi
116
117
118 # Checks for header files.
119 ##AC_HEADER_STDC
120 ##AC_HEADER_SYS_WAIT
121 ##AC_HEADER_TIME 
122 AC_CHECK_HEADERS(sys/select.h sys/socket.h iostream list vector stdexcept)
123 AC_CHECK_HEADERS(boost/thread/mutex.hpp \ 
124                  boost/date_time/posix_time/posix_time.hpp \
125                  boost/regex.hpp \
126                  boost/test/auto_unit_test.hpp)
127
128 # Checks for typedefs, structures, and compiler characteristics.
129 ##AC_TYPE_SIZE_T 
130 ##AC_CHECK_SIZEOF(int)
131 ##AC_CHECK_SIZEOF(long int)
132
133
134 # Checks for library functions.
135
136 AC_CONFIG_FILES([
137         Doxyfile
138         Makefile
139         src/Makefile
140         src/Jamfile
141 ])
142
143 AC_OUTPUT
144
145
146 # postamble
147
148 echo \
149 "------------------------------------------------------------------------
150 Configuration:
151
152   Source code location:       ${srcdir}
153   CPP Preprocessor flags:     ${CPPFLAGS}
154   CXX Compiler:               ${CXX}
155   CXX Compiler flags:         ${CXXFLAGS}
156   Linker flags:               ${LDFLAGS}
157   Linked libs:                ${LIBS}
158   Host System Type:           ${host}
159   Install path:               ${prefix}
160   Automake:                   ${AUTOMAKE}
161
162 ------------------------------------------------------------------------"