added full RelaxNG based config file syntax checking
[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.6], [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.1)
80 if test -z "$YAZPPLIB"; then
81         AC_MSG_ERROR([YAZ++ development libraries missing])
82 fi
83 YAZ_DOC
84
85 # Checks for header files.
86 ##AC_HEADER_STDC
87 ##AC_HEADER_SYS_WAIT
88 ##AC_HEADER_TIME 
89 AC_CHECK_HEADERS(sys/select.h sys/socket.h iostream list vector stdexcept)
90 AC_CHECK_HEADERS(boost/thread/mutex.hpp \ 
91                  boost/date_time/posix_time/posix_time.hpp \
92                  boost/regex.hpp \
93                  boost/test/auto_unit_test.hpp)
94
95 # Checks for typedefs, structures, and compiler characteristics.
96 ##AC_TYPE_SIZE_T 
97 ##AC_CHECK_SIZEOF(int)
98 ##AC_CHECK_SIZEOF(long int)
99
100
101 # Checks for library functions.
102
103 AC_CONFIG_FILES([
104         Doxyfile
105         Makefile
106         src/Makefile
107         src/Jamfile
108         xml/Makefile
109         xml/schema/Makefile
110         xml/xslt/Makefile
111         doc/Makefile
112         doc/local.ent
113         doc/common/Makefile
114         doc/common/print.dsl
115         etc/Makefile
116 ])
117
118 AC_OUTPUT
119
120
121 # postamble
122
123
124 echo \
125 "------------------------------------------------------------------------
126
127   Package:                    ${PACKAGE}
128   Version:                    ${VERSION}
129   Source code location:       ${srcdir}
130   CPP Preprocessor:           ${CPP}
131   CPP Preprocessor flags:     ${CPPFLAGS}
132   CXX Compiler:               ${CXX}
133   CXX Compiler flags:         ${CXXFLAGS}
134   Linker flags:               ${LDFLAGS}
135   Linked libs:                ${LIBS}
136   Host System Type:           ${host}
137   Install path:               ${prefix}
138   Automake:                   ${AUTOMAKE}
139   Archiver:                   ${AR}
140   Ranlib:                     ${RANLIB}
141   YAZPP Version:              ${YAZPPVERSION}
142   YAZPP Include:              ${YAZPPINC}
143   YAZPP La Lib:               ${YAZPPLALIB}
144   YAZPP Lib:                  ${YAZPPLIB}
145   Bugreport:                  ${PACKAGE_BUGREPORT}
146
147 ------------------------------------------------------------------------"