configure: add check for YAZ version
[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.60])
6 AC_INIT([metaproxy],[1.3.9],[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
14 AM_INIT_AUTOMAKE([1.9])
15
16 AC_PROG_CXX
17 AC_PROG_CXXCPP
18 AC_PROG_INSTALL
19 AC_PROG_LN_S
20 AC_PROG_MAKE_SET
21 AC_PROG_RANLIB
22 AM_PROG_LIBTOOL
23
24 # Default language to use for tests (some tests may switch to C++)
25 AC_LANG([C])
26
27 if test "$enable_shared" = "yes"; then
28     AC_DEFINE([HAVE_DL_SUPPORT],[1],
29         [Define to 1 if you have shared module support])
30 fi
31
32 # Checks for libraries.
33 AC_CHECK_LIB([dl],[dlopen])
34 AC_CHECK_LIB([m],[main])
35
36 AC_CHECK_FUNCS([localtime_r])
37
38 ## YAZPP checks
39 YAZPP_INIT([threads],[1.2.7])
40 if test -z "$YAZPPLIB"; then
41     AC_MSG_ERROR([YAZ++ development libraries missing])
42 fi
43 CPPFLAGS="$YAZPPINC $CPPFLAGS"
44 AC_MSG_CHECKING([if YAZ is version 4.2.14 or later])
45 AC_COMPILE_IFELSE(
46         [AC_LANG_PROGRAM([[#include <yaz/yaz-version.h>]],
47                          [[
48 #if YAZ_VERSIONL < 0x4020e
49 #error too old
50 #endif
51 ]])],
52         [AC_MSG_RESULT([yes])],
53         [AC_MSG_RESULT([no])
54          AC_MSG_ERROR([newer version of YAZ required])]
55 )
56 YAZ_DOC
57
58 ID_BOOST([thread test regex],[1.33])
59 if test -z "${BOOST_THREAD_LIB}"; then
60     AC_MSG_ERROR([Boost thread development libraries required])
61 fi
62 if test -z "${BOOST_TEST_LIB}"; then
63     AC_MSG_ERROR([Boost unit test framework libraries required])
64 fi
65 if test -z "${BOOST_REGEX_LIB}"; then
66     AC_MSG_ERROR([Boost regex development libraries required])
67 fi
68
69 xml_avail=false
70 xslt_avail=false
71 YAZ_LIBXML2([xml_avail=true])
72 if $xml_avail; then
73     YAZ_LIBXSLT([xslt_avail=true])
74 else
75     AC_MSG_ERROR([Libxml2 development files not found])
76 fi
77 if $xslt_avail; then
78     :
79 else
80     AC_MSG_ERROR([Libxslt development files not found])
81 fi
82
83 AC_CHECK_HEADERS([sys/select.h sys/socket.h])
84
85 if test -d ${srcdir}/.git; then
86     SHA1=`git show --pretty=format:%H|head -1`
87 else
88     SHA1=`head -1 ${srcdir}/ChangeLog|awk '{print $2}'`
89 fi
90 AC_DEFINE_UNQUOTED([VERSION_SHA1], "$SHA1", [SHA-1 from Git])
91
92 AC_CONFIG_FILES([
93         metaproxy-config
94         Doxyfile
95         Makefile
96         include/Makefile include/metaproxy/Makefile
97         src/Makefile
98         xml/Makefile
99         xml/schema/Makefile
100         xml/xslt/Makefile
101         doc/Makefile
102         doc/local.ent
103         doc/common/Makefile
104         doc/common/print.dsl
105         etc/Makefile
106 ],[
107         sed s%echo_source=yes%echo_source=no%g < metaproxy-config > src/metaproxy-config && chmod +x metaproxy-config src/metaproxy-config
108
109 ])
110
111 AC_OUTPUT
112
113
114 # postamble
115
116
117 echo \
118 "------------------------------------------------------------------------
119
120   Package:                    ${PACKAGE}
121   Version:                    ${VERSION}
122   Source code location:       ${srcdir}
123   CPP Preprocessor:           ${CPP}
124   CPP Preprocessor flags:     ${CPPFLAGS}
125   CXX Compiler:               ${CXX}
126   CXX Compiler flags:         ${CXXFLAGS}
127   Linker flags:               ${LDFLAGS}
128   Linked libs:                ${LIBS}
129   Host System Type:           ${host}
130   Install path:               ${prefix}
131   Automake:                   ${AUTOMAKE}
132   Archiver:                   ${AR}
133   Ranlib:                     ${RANLIB}
134   Boost Version:              ${BOOST_VERSION}               
135   Boost Include:              ${BOOST_CPPFLAGS}               
136   Boost linker flags:         ${BOOST_LDFLAGS}               
137   Boost Libs:                 ${BOOST_DATE_TIME_LIB} ${BOOST_THREAD_LIB}               
138   YAZPP Version:              ${YAZPPVERSION}
139   YAZPP Include:              ${YAZPPINC}
140   YAZPP La Lib:               ${YAZPPLALIB}
141   YAZPP Lib:                  ${YAZPPLIB}
142   Bugreport:                  ${PACKAGE_BUGREPORT}
143
144 ------------------------------------------------------------------------"
145 dnl Local Variables:
146 dnl mode:shell-script
147 dnl sh-indentation: 2
148 dnl sh-basic-offset: 4
149 dnl End: