1 dnl This file is part of the Zebra server.
2 dnl Copyright (C) 1994-2011 Index Data
5 AC_INIT([idzebra],[2.0.48],[zebra-help@indexdata.dk])
6 AC_CONFIG_HEADERS([include/config.h])
7 AC_CONFIG_SRCDIR([configure.ac])
8 AC_CONFIG_AUX_DIR([config])
9 AM_INIT_AUTOMAKE([1.9])
11 AC_SUBST(PACKAGE_SUFFIX)
12 dnl http://www.gnu.org/software/libtool/manual.html#Versioning
13 ZEBRALIBS_VERSION_INFO=0:1:0
14 AC_SUBST([ZEBRALIBS_VERSION_INFO])
15 main_zebralib=index/libidzebra${PACKAGE_SUFFIX}.la
16 AC_SUBST(main_zebralib)
17 dnl ------ Substitutions
18 AC_SUBST([TCL_INCLUDE])
20 AC_SUBST([ZEBRA_CFLAGS])
22 dnl ------ Checking programs
28 AC_CHECK_HEADERS([sys/resource.h sys/time.h sys/wait.h sys/utsname.h unistd.h])
30 AC_CHECK_LIB([crypt],[crypt])
31 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
32 AC_CHECK_HEADERS([crypt.h])
36 YAZ_INIT([server icu],[3.0.47])
37 if test "$YAZVERSION" = "NONE"; then
38 AC_MSG_ERROR([YAZ development libraries required])
41 dnl ------ Look for Tcl
42 dnl See if user has specified location of tclConfig.sh; otherwise
43 dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
48 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR tclConfig.sh in DIR], [tclconfig=$withval])
49 if test "x$tclconfig" = xNONE; then
51 AC_PREFIX_PROGRAM(tclsh)
52 tclconfig=${prefix}/lib
54 if test ! -r ${tclconfig}/tclConfig.sh; then
55 # Not found, try search for Tcl on Debian systems.
56 for d in /usr/lib/tcl*; do
57 if test -f $d/tclConfig.sh; then
63 AC_MSG_CHECKING(for Tcl)
64 if test -r ${tclconfig}/tclConfig.sh; then
65 . ${tclconfig}/tclConfig.sh
66 if test -r ${tclconfig}/../generic/tcl.h; then
67 TCL_INCLUDE=-I${tclconfig}/../generic
68 TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
69 elif test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION}; then
70 TCL_INCLUDE=-I${TCL_PREFIX}/include/tcl${TCL_VERSION}
71 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
73 TCL_INCLUDE=-I${TCL_PREFIX}/include
74 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
76 TCL_LIB=`echo $TCL_LIB|sed 's%-L/usr/lib%%g'`
77 SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
78 SHLIB_LD=$TCL_SHLIB_LD
79 SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
80 SHLIB_VERSION=$TCL_SHLIB_VERSION
81 AC_MSG_RESULT($TCL_VERSION)
83 old_CPPFLAGS=$CPPFLAGS
84 CPPFLAGS="${TCL_INCLUDE} $CPPFLAGS"
85 AC_CHECK_HEADERS(tcl.h)
86 CPPFLAGS=${old_CPPFLAGS}
88 # The Mac OSX -framework causes problems with Libtool
89 # and dependancy libs.. so apply Tcl libs everywhere bug #461
92 LIBS="$LIBS $TCL_LIB";
97 AC_MSG_RESULT(Not found)
98 AC_DEFINE(HAVE_TCL_H,0)
101 dnl ------ various functions
102 AC_CHECK_FUNCS(mkstemp atoll)
105 AC_ARG_WITH(iconv, [ --with-iconv[=DIR] iconv library in DIR])
106 if test "$with_iconv" != "no"; then
107 AC_MSG_CHECKING(for iconv)
109 oldCPPFLAGS="${CPPFLAGS}"
110 if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
111 LIBS="$LIBS -L${with_iconv}/lib"
112 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
117 iconv_t t = iconv_open("", "");
119 AC_DEFINE([HAVE_ICONV_H],[1],[Whether iconv.h is defined])
126 iconv_t t = iconv_open("", "");
128 AC_DEFINE([HAVE_ICONV_H],[1])
132 CPPFLAGS="$oldCPPFLAGS"
139 AC_CHECK_LIB(bz2,bzCompressInit)
140 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
141 AC_CHECK_HEADERS(bzlib.h)
143 AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
144 if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
145 AC_CHECK_HEADERS(bzlib.h)
150 AC_CHECK_LIB([z],[compress2])
151 if test "$ac_cv_lib_z_compress2" = "yes"; then
152 AC_CHECK_HEADERS([zlib.h])
155 AC_CHECK_LIB([m], [sqrt])
157 AC_CHECK_LIB([dl], [dlopen])
161 AC_SUBST([EXPAT_LIBS])
162 AC_ARG_WITH(expat, [ --with-expat[=DIR] EXPAT library in DIR],[expat=$withval])
163 if test "$expat" != "no"; then
166 if test "$expat" != "yes"; then
167 EXPAT_CFLAGS="-I$expat/include"
168 EXPAT_LIBS="-L$expat/lib"
169 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
170 LIBS="$EXPAT_LIBS $LIBS"
172 AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="$EXPAT_LIBS -lexpat"])
173 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
174 AC_CHECK_HEADERS(expat.h)
180 dnl ------- 64 bit files
182 AC_CHECK_TYPES([long long])
183 if test "${ac_cv_type_long_long}" = "yes"; then
188 ZEBRA_CFLAGS="-DZEBRA_ZINT=${ZINT_VALUE}"
189 AC_DEFINE_UNQUOTED([ZEBRA_ZINT],${ZINT_VALUE},[Whehter zint is long long])
191 AC_SUBST([SHARED_MODULE_LA])
193 AC_SUBST([STATIC_MODULE_OBJ])
195 AC_SUBST([STATIC_MODULE_LADD])
196 STATIC_MODULE_LADD=""
197 AC_DEFUN([ZEBRA_MODULE],[
198 AC_ARG_ENABLE(mod-$1,[$3],[myen=$enableval],[myen=$2])
199 AC_MSG_CHECKING([for module $1])
200 if test "$myen" = "yes"; then
203 if test "$enable_shared" != "yes"; then
204 if test "$myen" = "shared"; then
209 if test "$myen" = "no" -o "$myen" = "disabled"; then
210 AC_MSG_RESULT([disabled])
211 elif test "$2" = "disabled"; then
212 AC_MSG_RESULT([disabled])
213 AC_MSG_ERROR([Cannot enable mod-$1 because of missing libs (XML, etc)])
214 elif test "$myen" = "shared"; then
215 AC_MSG_RESULT([shared])
216 SHARED_MODULE_LA="${SHARED_MODULE_LA} mod-$1.la"
217 elif test "$myen" = "static"; then
218 AC_MSG_RESULT([static])
219 STATIC_MODULE_OBJ="${STATIC_MODULE_OBJ} \$(mod_${m}_la_OBJECTS)"
220 STATIC_MODULE_LADD="${STATIC_MODULE_LADD} \$(mod_${m}_la_LADD)"
221 modcpp=`echo $1|tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`
222 AC_DEFINE_UNQUOTED([IDZEBRA_STATIC_$modcpp])
224 AC_MSG_RESULT([$myen])
225 AC_MSG_ERROR([invalid --enable-mod-$1 value. Use on,off,static or shared])
229 AC_DEFINE([IDZEBRA_STATIC_GRS_SGML],[1],[Whether module grs.sgml is static])
230 AC_DEFINE([IDZEBRA_STATIC_TEXT],[0],[Whether module text is static])
231 ZEBRA_MODULE(text,shared, [ --enable-mod-text Text filter])
232 AC_DEFINE([IDZEBRA_STATIC_GRS_REGX],[0],[Whether module grs.regx is static])
233 ZEBRA_MODULE(grs-regx,shared,[ --enable-mod-grs-regx REGX/TCL filter])
234 AC_DEFINE([IDZEBRA_STATIC_GRS_MARC],[0],[Whether module grs.marc is static])
235 ZEBRA_MODULE(grs-marc,shared,[ --enable-mod-grs-marc MARC filter])
236 if test "$ac_cv_header_expat_h" = "yes"; then
241 AC_DEFINE([IDZEBRA_STATIC_GRS_XML],[0],[Whether module grs.xml is static])
242 ZEBRA_MODULE(grs-xml,[$def], [ --enable-mod-grs-xml XML filter (Expat based)])
243 oldCPPFLAGS="$CPPFLAGS"
244 CPPFLAGS="$CPPFLAGS $YAZINC"
248 #include <libxml/xmlversion.h>
249 #include <libxml/parser.h>
250 #include <libxml/tree.h>
251 #include <libxml/xmlIO.h>
252 #include <libxslt/transform.h>
253 #include <libxslt/xsltutils.h>
255 #error Libxml2 not available
258 #if LIBXML_VERSION < 20615
259 #error Libxml2 version < 2.6.15. xmlreader not reliable/present
264 CPPFLAGS=$oldCPPFLAGS
265 AC_DEFINE([IDZEBRA_STATIC_DOM],[0],[Whether module dom is static])
266 ZEBRA_MODULE(dom,[$def], [ --enable-mod-dom XML/XSLT filter (Requires libxslt)])
267 AC_DEFINE([IDZEBRA_STATIC_ALVIS],[0],[Whether module alvis is static])
268 ZEBRA_MODULE(alvis,[$def], [ --enable-mod-alvis ALVIS filter (Requires libxslt)])
269 AC_DEFINE([IDZEBRA_STATIC_SAFARI],[0],[Whether module safari is static])
270 ZEBRA_MODULE(safari,shared,[ --enable-mod-safari Safari filter (DBC)])
272 dnl ------ ANSI C Header files
274 if test "$ac_cv_header_stdc" = "no"; then
275 AC_MSG_WARN([Your system does not seem to support ANSI C])
277 AC_SUBST([IDZEBRA_SRC_ROOT])
278 AC_SUBST([IDZEBRA_BUILD_ROOT])
279 IDZEBRA_SRC_ROOT=`cd ${srcdir}; pwd`
280 IDZEBRA_BUILD_ROOT=`pwd`
282 dnl ------ versioning
284 WIN_FILEVERSION=`echo $PACKAGE_VERSION | $AWK 'BEGIN { FS = "."; } { m = $4; printf("%d,%d,%d,%d", $1, $2, $3 == "" ? "0" : $3, $4 == "" ? "1" : $4);}'`
285 AC_SUBST([WIN_FILEVERSION])
286 VERSION_HEX=`echo $PACKAGE_VERSION | $AWK 'BEGIN { FS = "."; } { printf("%x", ($1 * 256 + $2) * 256 + $3);}'`
287 AC_SUBST([VERSION_HEX])
288 if test -d ${srcdir}/.git; then
289 VERSION_SHA1=`git show --pretty=format:%H|head -1`
291 VERSION_SHA1=`head -1 ${srcdir}/ChangeLog|awk '{print $2}'`
293 AC_SUBST([VERSION_SHA1])
295 dnl ------ Create Makefiles
309 include/Makefile include/idzebra/Makefile
315 test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
318 test/rusmarc/Makefile test/cddb/Makefile test/malxml/Makefile
321 test/dmoz/Makefile test/zsh/Makefile
322 test/marcxml/Makefile test/charmap/Makefile test/codec/Makefile
324 test/filters/Makefile
326 examples/gils/Makefile
327 examples/marc21/Makefile
328 examples/marcxml/Makefile
329 examples/oai-pmh/Makefile
330 examples/zthes/Makefile
334 include/idzebra/version.h
335 ],[sed s%echo_source=yes%echo_source=no%g < idzebra-config-2.0 > util/idzebra-config-2.0 && chmod +x idzebra-config-2.0 util/idzebra-config-2.0])
338 "------------------------------------------------------------------------
340 ZEBRA Package: ${PACKAGE}
341 ZEBRA Version: ${VERSION}
342 Source code location: ${srcdir}
343 C Preprocessor: ${CPP}
344 C Preprocessor flags: ${CPPFLAGS}
346 C Compiler flags: ${CFLAGS}
347 Linker flags: ${LDFLAGS}
349 Host System Type: ${host}
350 Install path: ${prefix}
351 Automake: ${AUTOMAKE}
354 YAZ Version: ${YAZVERSION}
355 YAZ Include: ${YAZINC}
356 YAZ La Lib: ${YAZLALIB}
358 Bugreport: ${PACKAGE_BUGREPORT}
360 ------------------------------------------------------------------------"
362 dnl mode:shell-script
364 dnl sh-basic-offset: 4