1 dnl This file is part of the Zebra server.
2 dnl Copyright (C) 2004-2013 Index Data
6 m4_esyscmd([. ./IDMETA; echo $VERSION|tr -d '\n']),
7 [zebra-help@indexdata.dk])
8 AC_CONFIG_HEADERS([include/config.h])
9 AC_CONFIG_SRCDIR([configure.ac])
10 AC_CONFIG_AUX_DIR([config])
11 AM_INIT_AUTOMAKE([1.9])
13 AC_SUBST(PACKAGE_SUFFIX)
14 dnl http://www.gnu.org/software/libtool/manual.html#Versioning
15 ZEBRALIBS_VERSION_INFO=0:1:0
16 AC_SUBST([ZEBRALIBS_VERSION_INFO])
17 main_zebralib=index/libidzebra${PACKAGE_SUFFIX}.la
18 AC_SUBST(main_zebralib)
19 dnl ------ Substitutions
20 AC_SUBST([TCL_INCLUDE])
22 AC_SUBST([ZEBRA_CFLAGS])
24 dnl ------ Checking programs
30 AC_CHECK_HEADERS([sys/resource.h sys/time.h sys/wait.h sys/utsname.h unistd.h])
32 AC_CHECK_LIB([crypt],[crypt])
33 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
34 AC_CHECK_HEADERS([crypt.h])
38 YAZ_INIT([server icu],[3.0.47])
39 if test "$YAZVERSION" = "NONE"; then
40 AC_MSG_ERROR([YAZ development libraries required])
43 dnl ------ Look for Tcl
44 dnl See if user has specified location of tclConfig.sh; otherwise
45 dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
50 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR tclConfig.sh in DIR], [tclconfig=$withval])
51 if test "x$tclconfig" = xNONE; then
53 AC_PREFIX_PROGRAM(tclsh)
54 tclconfig=${prefix}/lib
56 if test ! -r ${tclconfig}/tclConfig.sh; then
57 # Not found, try search for Tcl on Debian systems.
58 for d in /usr/lib/tcl*; do
59 if test -f $d/tclConfig.sh; then
65 AC_MSG_CHECKING(for Tcl)
66 if test -r ${tclconfig}/tclConfig.sh; then
67 . ${tclconfig}/tclConfig.sh
68 if test -r ${tclconfig}/../generic/tcl.h; then
69 TCL_INCLUDE=-I${tclconfig}/../generic
70 TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
71 elif test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION}; then
72 TCL_INCLUDE=-I${TCL_PREFIX}/include/tcl${TCL_VERSION}
73 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
75 TCL_INCLUDE=-I${TCL_PREFIX}/include
76 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
78 TCL_LIB=`echo $TCL_LIB|sed 's%-L/usr/lib%%g'`
79 SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
80 SHLIB_LD=$TCL_SHLIB_LD
81 SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
82 SHLIB_VERSION=$TCL_SHLIB_VERSION
83 AC_MSG_RESULT($TCL_VERSION)
85 old_CPPFLAGS=$CPPFLAGS
86 CPPFLAGS="${TCL_INCLUDE} $CPPFLAGS"
87 AC_CHECK_HEADERS(tcl.h)
88 CPPFLAGS=${old_CPPFLAGS}
90 # The Mac OSX -framework causes problems with Libtool
91 # and dependancy libs.. so apply Tcl libs everywhere bug #461
94 LIBS="$LIBS $TCL_LIB";
99 AC_MSG_RESULT(Not found)
100 AC_DEFINE(HAVE_TCL_H,0)
103 dnl ------ various functions
104 AC_CHECK_FUNCS(mkstemp atoll)
107 AC_ARG_WITH(iconv, [ --with-iconv[=DIR] iconv library in DIR])
108 if test "$with_iconv" != "no"; then
109 AC_MSG_CHECKING(for iconv)
111 oldCPPFLAGS="${CPPFLAGS}"
112 if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
113 LIBS="$LIBS -L${with_iconv}/lib"
114 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
119 iconv_t t = iconv_open("", "");
121 AC_DEFINE([HAVE_ICONV_H],[1],[Whether iconv.h is defined])
128 iconv_t t = iconv_open("", "");
130 AC_DEFINE([HAVE_ICONV_H],[1])
134 CPPFLAGS="$oldCPPFLAGS"
141 AC_CHECK_LIB(bz2,bzCompressInit)
142 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
143 AC_CHECK_HEADERS(bzlib.h)
145 AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
146 if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
147 AC_CHECK_HEADERS(bzlib.h)
152 AC_CHECK_LIB([z],[compress2])
153 if test "$ac_cv_lib_z_compress2" = "yes"; then
154 AC_CHECK_HEADERS([zlib.h])
157 AC_CHECK_LIB([m], [sqrt])
159 AC_CHECK_LIB([dl], [dlopen])
163 AC_SUBST([EXPAT_LIBS])
164 AC_ARG_WITH(expat, [ --with-expat[=DIR] EXPAT library in DIR],[expat=$withval])
165 if test "$expat" != "no"; then
168 if test "$expat" != "yes"; then
169 EXPAT_CFLAGS="-I$expat/include"
170 EXPAT_LIBS="-L$expat/lib"
171 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
172 LIBS="$EXPAT_LIBS $LIBS"
174 AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="$EXPAT_LIBS -lexpat"])
175 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
176 AC_CHECK_HEADERS(expat.h)
182 dnl ------- 64 bit files
184 AC_CHECK_TYPES([long long])
185 if test "${ac_cv_type_long_long}" = "yes"; then
190 ZEBRA_CFLAGS="-DZEBRA_ZINT=${ZINT_VALUE}"
191 AC_DEFINE_UNQUOTED([ZEBRA_ZINT],${ZINT_VALUE},[Whehter zint is long long])
193 AC_SUBST([SHARED_MODULE_LA])
195 AC_SUBST([STATIC_MODULE_OBJ])
197 AC_SUBST([STATIC_MODULE_LADD])
198 STATIC_MODULE_LADD=""
199 AC_DEFUN([ZEBRA_MODULE],[
200 AC_ARG_ENABLE(mod-$1,[$3],[myen=$enableval],[myen=$2])
201 AC_MSG_CHECKING([for module $1])
202 if test "$myen" = "yes"; then
205 if test "$enable_shared" != "yes"; then
206 if test "$myen" = "shared"; then
211 if test "$myen" = "no" -o "$myen" = "disabled"; then
212 AC_MSG_RESULT([disabled])
213 elif test "$2" = "disabled"; then
214 AC_MSG_RESULT([disabled])
215 AC_MSG_ERROR([Cannot enable mod-$1 because of missing libs (XML, etc)])
216 elif test "$myen" = "shared"; then
217 AC_MSG_RESULT([shared])
218 SHARED_MODULE_LA="${SHARED_MODULE_LA} mod-$1.la"
219 elif test "$myen" = "static"; then
220 AC_MSG_RESULT([static])
221 STATIC_MODULE_OBJ="${STATIC_MODULE_OBJ} \$(mod_${m}_la_OBJECTS)"
222 STATIC_MODULE_LADD="${STATIC_MODULE_LADD} \$(mod_${m}_la_LADD)"
223 modcpp=`echo $1|tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`
224 AC_DEFINE_UNQUOTED([IDZEBRA_STATIC_$modcpp])
226 AC_MSG_RESULT([$myen])
227 AC_MSG_ERROR([invalid --enable-mod-$1 value. Use on,off,static or shared])
231 AC_DEFINE([IDZEBRA_STATIC_GRS_SGML],[1],[Whether module grs.sgml is static])
232 AC_DEFINE([IDZEBRA_STATIC_TEXT],[0],[Whether module text is static])
233 ZEBRA_MODULE(text,shared, [ --enable-mod-text Text filter])
234 AC_DEFINE([IDZEBRA_STATIC_GRS_REGX],[0],[Whether module grs.regx is static])
235 ZEBRA_MODULE(grs-regx,shared,[ --enable-mod-grs-regx REGX/TCL filter])
236 AC_DEFINE([IDZEBRA_STATIC_GRS_MARC],[0],[Whether module grs.marc is static])
237 ZEBRA_MODULE(grs-marc,shared,[ --enable-mod-grs-marc MARC filter])
238 if test "$ac_cv_header_expat_h" = "yes"; then
243 AC_DEFINE([IDZEBRA_STATIC_GRS_XML],[0],[Whether module grs.xml is static])
244 ZEBRA_MODULE(grs-xml,[$def], [ --enable-mod-grs-xml XML filter (Expat based)])
245 oldCPPFLAGS="$CPPFLAGS"
246 CPPFLAGS="$CPPFLAGS $YAZINC"
250 #include <libxml/xmlversion.h>
251 #include <libxml/parser.h>
252 #include <libxml/tree.h>
253 #include <libxml/xmlIO.h>
254 #include <libxslt/transform.h>
255 #include <libxslt/xsltutils.h>
257 #error Libxml2 not available
260 #if LIBXML_VERSION < 20615
261 #error Libxml2 version < 2.6.15. xmlreader not reliable/present
266 CPPFLAGS=$oldCPPFLAGS
267 AC_DEFINE([IDZEBRA_STATIC_DOM],[0],[Whether module dom is static])
268 ZEBRA_MODULE(dom,[$def], [ --enable-mod-dom XML/XSLT filter (Requires libxslt)])
269 AC_DEFINE([IDZEBRA_STATIC_ALVIS],[0],[Whether module alvis is static])
270 ZEBRA_MODULE(alvis,[$def], [ --enable-mod-alvis ALVIS filter (Requires libxslt)])
271 AC_DEFINE([IDZEBRA_STATIC_SAFARI],[0],[Whether module safari is static])
272 ZEBRA_MODULE(safari,shared,[ --enable-mod-safari Safari filter (DBC)])
274 dnl ------ ANSI C Header files
276 if test "$ac_cv_header_stdc" = "no"; then
277 AC_MSG_WARN([Your system does not seem to support ANSI C])
279 AC_SUBST([IDZEBRA_SRC_ROOT])
280 AC_SUBST([IDZEBRA_BUILD_ROOT])
281 IDZEBRA_SRC_ROOT=`cd ${srcdir}; pwd`
282 IDZEBRA_BUILD_ROOT=`pwd`
284 dnl ------ versioning
286 WIN_FILEVERSION=`echo $PACKAGE_VERSION | $AWK 'BEGIN { FS = "."; } { m = $4; printf("%d,%d,%d,%d", $1, $2, $3 == "" ? "0" : $3, $4 == "" ? "1" : $4);}'`
287 AC_SUBST([WIN_FILEVERSION])
288 VERSION_HEX=`echo $PACKAGE_VERSION | $AWK 'BEGIN { FS = "."; } { printf("%x", ($1 * 256 + $2) * 256 + $3);}'`
289 AC_SUBST([VERSION_HEX])
290 if test -d ${srcdir}/.git; then
291 VERSION_SHA1=`git show --pretty=format:%H|head -1`
293 VERSION_SHA1=`head -1 ${srcdir}/ChangeLog|awk '{print $2}'`
295 AC_SUBST([VERSION_SHA1])
297 dnl ------ Create Makefiles
311 include/Makefile include/idzebra/Makefile
317 test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
320 test/rusmarc/Makefile test/cddb/Makefile test/malxml/Makefile
323 test/dmoz/Makefile test/zsh/Makefile
324 test/marcxml/Makefile test/charmap/Makefile test/codec/Makefile
326 test/filters/Makefile
328 examples/gils/Makefile
329 examples/marc21/Makefile
330 examples/marcxml/Makefile
331 examples/oai-pmh/Makefile
332 examples/zthes/Makefile
336 include/idzebra/version.h
338 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
339 diff doc/local.ent doc/local0.ent >/dev/null 2>/dev/null \
340 || cp doc/local0.ent doc/local.ent
344 "------------------------------------------------------------------------
346 ZEBRA Package: ${PACKAGE}
347 ZEBRA Version: ${VERSION}
348 Source code location: ${srcdir}
349 C Preprocessor: ${CPP}
350 C Preprocessor flags: ${CPPFLAGS}
352 C Compiler flags: ${CFLAGS}
353 Linker flags: ${LDFLAGS}
355 Host System Type: ${host}
356 Install path: ${prefix}
357 Automake: ${AUTOMAKE}
360 YAZ Version: ${YAZVERSION}
361 YAZ Include: ${YAZINC}
362 YAZ La Lib: ${YAZLALIB}
364 Bugreport: ${PACKAGE_BUGREPORT}
366 ------------------------------------------------------------------------"
368 dnl mode:shell-script
370 dnl sh-basic-offset: 4