Towards 1.0.8
[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.59)
6 AC_INIT([metaproxy],[1.0.8],[metaproxy-help@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 boostdir="yes"
38 AC_ARG_WITH(boost, [ ---with-boost=PREFIX     Boost library in PREFIX],[boostdir=$withval])
39
40 if test "$boostdir" != "yes"; then
41         CPPFLAGS="-I${boostdir}/include"
42         LIBS="-L${boostdir}/lib"
43 fi
44
45 AC_CHECK_LIB(pthread, main)
46
47 AC_CHECK_LIB(boost_thread, main, [],[
48         AC_MSG_NOTICE([boost thread library not found.])
49         AC_MSG_ERROR([Install libboost-thread-dev (or similar)])
50 ])
51
52 AC_CHECK_LIB(boost_date_time, main, [],[
53         AC_MSG_NOTICE([boost date_time library not found.])
54         AC_MSG_ERROR([Install libboost-date-time-dev (or similar)])
55 ])
56
57 AC_CHECK_LIB(boost_program_options, main, [],[
58         AC_MSG_NOTICE([boost program options library not found.])
59         AC_MSG_ERROR([Install libboost-program-options-dev (or similar)])
60 ])
61
62 AC_CHECK_HEADER(boost/test/auto_unit_test.hpp,,[
63         AC_MSG_NOTICE([boost test unit header not found.])
64         AC_MSG_ERROR([Install libboost-test-dev (or similar)])
65 ])
66
67 AC_MSG_CHECKING([whether boost_unit_test_framework works])
68 OLIBS=$LIBS
69 LIBS="$LIBS -lboost_unit_test_framework"
70 AC_TRY_LINK([
71 #define BOOST_AUTO_TEST_MAIN
72 #include <boost/test/auto_unit_test.hpp> 
73 BOOST_AUTO_UNIT_TEST( test )
74 {
75  BOOST_CHECK(true);
76 }
77 ],[],
78 [
79         AC_MSG_RESULT([yes])
80         LIBS=$OLIBS
81 ],
82 [
83         AC_MSG_RESULT([no])
84         AC_MSG_NOTICE([Boost unit test framework does not appear to work])
85         AC_MSG_ERROR([Consult config.log for details])
86 ])
87
88 ## YAZPP checks
89 YAZPP_INIT(threads,1.0.1)
90 if test -z "$YAZPPLIB"; then
91         AC_MSG_ERROR([YAZ++ development libraries missing])
92 fi
93 YAZ_DOC
94
95 # Checks for header files.
96 ##AC_HEADER_STDC
97 ##AC_HEADER_SYS_WAIT
98 ##AC_HEADER_TIME 
99 AC_CHECK_HEADERS(sys/select.h sys/socket.h iostream list vector stdexcept)
100 AC_CHECK_HEADERS(boost/thread/mutex.hpp \ 
101                  boost/date_time/posix_time/posix_time.hpp \
102                  boost/regex.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         src/Jamfile
118         xml/Makefile
119         xml/schema/Makefile
120         xml/xslt/Makefile
121         doc/Makefile
122         doc/local.ent
123         doc/common/Makefile
124         doc/common/print.dsl
125         etc/Makefile
126 ])
127
128 AC_OUTPUT
129
130
131 # postamble
132
133
134 echo \
135 "------------------------------------------------------------------------
136
137   Package:                    ${PACKAGE}
138   Version:                    ${VERSION}
139   Source code location:       ${srcdir}
140   CPP Preprocessor:           ${CPP}
141   CPP Preprocessor flags:     ${CPPFLAGS}
142   CXX Compiler:               ${CXX}
143   CXX Compiler flags:         ${CXXFLAGS}
144   Linker flags:               ${LDFLAGS}
145   Linked libs:                ${LIBS}
146   Host System Type:           ${host}
147   Install path:               ${prefix}
148   Automake:                   ${AUTOMAKE}
149   Archiver:                   ${AR}
150   Ranlib:                     ${RANLIB}
151   YAZPP Version:              ${YAZPPVERSION}
152   YAZPP Include:              ${YAZPPINC}
153   YAZPP La Lib:               ${YAZPPLALIB}
154   YAZPP Lib:                  ${YAZPPLIB}
155   Bugreport:                  ${PACKAGE_BUGREPORT}
156
157 ------------------------------------------------------------------------"