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