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