1 dnl Zebra, Index Data ApS, 1995-2006
2 dnl $Id: configure.ac,v 1.19 2006-06-26 15:11:19 marc Exp $
5 AC_INIT([idzebra],[2.0.0],[adam@indexdata.dk])
6 AC_CONFIG_SRCDIR(configure.ac)
7 AC_CONFIG_AUX_DIR(config)
8 AM_INIT_AUTOMAKE([1.8])
10 AC_SUBST(ZEBRAPKG_VERSION)
11 ZEBRALIBS_VERSION=2:0:0
12 AC_SUBST(ZEBRALIBS_VERSION)
14 dnl ------ Substitutions
17 AC_SUBST(READLINE_LIBS)
19 dnl ------ Checking programs
26 AC_CHECK_HEADERS(sys/resource.h sys/times.h sys/time.h sys/wait.h unistd.h)
28 AC_CHECK_LIB(crypt, crypt)
29 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
30 AC_CHECK_HEADERS(crypt.h)
34 AC_ARG_ENABLE(threads, [ --disable-threads disable threads],[enable_threads=$enableval],[enable_threads=yes])
35 if test "$enable_threads" = "yes"; then
42 YAZ_INIT($yazflag,2.1.20)
43 if test "$YAZVERSION" = "NONE"; then
44 AC_MSG_ERROR([YAZ development libraries required])
51 AC_ARG_WITH(xslt,[[ --with-xslt[=PREFIX] use libxslt in PREFIX]],xsltdir=$withval)
52 if test "$xsltdir" = "yes"; then
53 for d in /usr /usr/local; do
54 if test -x $d/bin/xslt-config; then
59 if test "$xsltdir" != "no"; then
60 AC_MSG_CHECKING(for libXSLT)
62 if test -x $xsltdir/bin/xslt-config; then
63 XSLT_VER=`$xsltdir/bin/xslt-config --version`
64 AC_MSG_RESULT($XSLT_VER)
65 have_xslt_version=`echo "$XSLT_VER" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
66 if test $have_xslt_version -lt 1001011; then
67 AC_MSG_WARN([libXSLT too old. Use 1.1.11 or later.])
70 XSLT_LIBS=`$xsltdir/bin/xslt-config --libs`
71 XSLT_CFLAGS=`$xsltdir/bin/xslt-config --cflags`
75 AC_MSG_RESULT(Not found)
78 dnl ------ Look for Tcl
79 dnl See if user has specified location of tclConfig.sh; otherwise
80 dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
85 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR tclConfig.sh in DIR], [tclconfig=$withval])
86 if test "x$tclconfig" = xNONE; then
88 AC_PREFIX_PROGRAM(tclsh)
89 tclconfig=${prefix}/lib
91 if test ! -r ${tclconfig}/tclConfig.sh; then
92 # Not found, try search for Tcl on Debian systems.
93 for d in /usr/lib/tcl*; do
94 if test -f $d/tclConfig.sh; then
100 AC_MSG_CHECKING(for Tcl)
101 if test -r ${tclconfig}/tclConfig.sh; then
102 . ${tclconfig}/tclConfig.sh
103 if test -r ${tclconfig}/../generic/tcl.h; then
104 TCL_INCLUDE=-I${tclconfig}/../generic
105 TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
106 elif test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION}; then
107 TCL_INCLUDE=-I${TCL_PREFIX}/include/tcl${TCL_VERSION}
108 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
110 TCL_INCLUDE=-I${TCL_PREFIX}/include
111 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
113 TCL_LIB=`echo $TCL_LIB|sed 's%-L/usr/lib%%g'`
114 SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
115 SHLIB_LD=$TCL_SHLIB_LD
116 SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
117 SHLIB_VERSION=$TCL_SHLIB_VERSION
118 AC_MSG_RESULT($TCL_VERSION)
119 AC_DEFINE(HAVE_TCL_H,1)
121 # The Mac OSX -framework causes problems with Libtool
122 # and dependancy libs.. so apply Tcl libs everywhere bug #461
125 LIBS="$LIBS $TCL_LIB";
130 AC_MSG_RESULT(Not found)
131 AC_DEFINE(HAVE_TCL_H,0)
135 AC_CHECK_FUNCS(mkstemp)
137 dnl ------ GNU Readline
138 READLINE_SHARED_LIBADD=""
139 AC_CHECK_LIB(ncurses, tgetent, [READLINE_SHARED_LIBADD="-lncurses"],
140 AC_CHECK_LIB(termcap, tgetent, [READLINE_SHARED_LIBADD="-ltermcap"])
143 AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline $READLINE_SHARED_LIBADD"],,$READLINE_SHARED_LIBADD)
144 AC_CHECK_LIB(history, add_history, [READLINE_LIBS="$READLINE_LIBS -lhistory"])
145 if test "$ac_cv_lib_readline_readline" = "yes"; then
146 AC_CHECK_HEADERS(readline/readline.h readline/history.h)
148 LIBS="$LIBS $READLINE_LIBS"
151 #include <readline/readline.h>
153 rl_attempted_completion_over = 0;
154 ],AC_DEFINE(HAVE_READLINE_COMPLETION_OVER))
157 #include <readline/readline.h>
159 rl_completion_matches (0, 0);
160 ],AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES))
165 AC_ARG_WITH(iconv, [ --with-iconv[=DIR] iconv library in DIR])
166 if test "$with_iconv" != "no"; then
167 AC_MSG_CHECKING(for iconv)
169 oldCPPFLAGS="${CPPFLAGS}"
170 if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
171 LIBS="$LIBS -L${with_iconv}/lib"
172 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
177 iconv_t t = iconv_open("", "");
179 AC_DEFINE(HAVE_ICONV_H)
186 iconv_t t = iconv_open("", "");
188 AC_DEFINE(HAVE_ICONV_H)
192 CPPFLAGS="$oldCPPFLAGS"
199 AC_CHECK_LIB(bz2,bzCompressInit)
200 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
201 AC_CHECK_HEADERS(bzlib.h)
203 AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
204 if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
205 AC_CHECK_HEADERS(bzlib.h)
212 AC_CHECK_LIB(dl,dlopen)
217 AC_ARG_WITH(expat, [ --with-expat[=DIR] EXPAT library in DIR],[expat=$withval])
218 if test "$expat" != "no"; then
221 if test "$expat" != "yes"; then
222 EXPAT_CFLAGS="-I$expat/include"
223 EXPAT_LIBS="-L$expat/lib"
224 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
225 LIBS="$EXPAT_LIBS $LIBS"
227 AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="$EXPAT_LIBS -lexpat"])
228 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
229 AC_CHECK_HEADERS(expat.h)
235 dnl ------- 64 bit files
236 AC_MSG_CHECKING(for LFS)
237 AC_TRY_RUN([#define _FILE_OFFSET_BITS 64
238 #include <sys/types.h>
244 int main(int argc, char **argv)
250 if (sizeof(off_t) != 8)
253 sprintf (tmp_str, "%Ld", o+o+o);
254 if (strcmp (tmp_str, "6000000000"))
256 fd = creat ("config.tmp", 0644);
259 area.l_type = F_WRLCK;
260 area.l_whence = SEEK_SET;
261 area.l_len = area.l_start = 0L;
262 if (fcntl(fd, F_SETLKW, &area))
265 unlink ("config.tmp");
268 ],bits=64,bits=32,bits=32)
269 if test "$bits" = "64"; then
270 AC_DEFINE(_FILE_OFFSET_BITS,64)
275 AC_CHECK_SIZEOF([off_t])
276 AC_CHECK_SIZEOF([long long])
277 AC_CHECK_SIZEOF([long])
279 AC_SUBST(SHARED_MODULE_LA)
281 AC_SUBST(STATIC_MODULE_OBJ)
283 AC_SUBST(STATIC_MODULE_LADD)
284 STATIC_MODULE_LADD=""
285 AC_DEFUN([ZEBRA_MODULE],[
286 AC_ARG_ENABLE(mod-$1,[$3],[myen=$enableval],[myen=$2])
287 AC_MSG_CHECKING([for module $1])
288 if test "$myen" = "yes"; then
291 if test "$enable_shared" != "yes"; then
292 if test "$myen" = "shared"; then
297 if test "$myen" = "no" -o "$myen" = "disabled"; then
298 AC_MSG_RESULT([disabled])
299 elif test "$2" = "disabled"; then
300 AC_MSG_RESULT([disabled])
301 AC_MSG_ERROR([Cannot enable mod-$1 because of missing libs (XML, etc)])
302 elif test "$myen" = "shared"; then
303 AC_MSG_RESULT([shared])
304 SHARED_MODULE_LA="${SHARED_MODULE_LA} mod-$1.la"
305 elif test "$myen" = "static"; then
306 AC_MSG_RESULT([static])
307 STATIC_MODULE_OBJ="${STATIC_MODULE_OBJ} \$(mod_${m}_la_OBJECTS)"
308 STATIC_MODULE_LADD="${STATIC_MODULE_LADD} \$(mod_${m}_la_LADD)"
309 modcpp=`echo $1|tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`
310 AC_DEFINE_UNQUOTED([IDZEBRA_STATIC_$modcpp])
312 AC_MSG_RESULT([$myen])
313 AC_MSG_ERROR([invalid --enable-mod-$1 value. Use on,off,static or shared])
317 ZEBRA_MODULE(text,static, [ --enable-mod-text Text filter])
318 ZEBRA_MODULE(grs-sgml,static,[ --enable-mod-grs-sgml Simple SGML/XML filter])
319 ZEBRA_MODULE(grs-regx,shared,[ --enable-mod-grs-regx REGX/TCL filter])
320 ZEBRA_MODULE(grs-marc,shared,[ --enable-mod-grs-marc MARC filter])
321 ZEBRA_MODULE(safari,shared, [ --enable-mod-safari Safari filter (DBC)])
322 if test "$ac_cv_header_expat_h" = "yes"; then
327 ZEBRA_MODULE(grs-xml,[$def], [ --enable-mod-grs-xml XML filter (Expat based)])
328 if test "$XSLT_VER"; then
333 ZEBRA_MODULE(alvis,[$def], [ --enable-mod-alvis ALVIS filter (Requires libxslt)])
334 dnl ------ ANSI C Header files
336 if test "$ac_cv_header_stdc" = "no"; then
337 AC_MSG_WARN(Your system doesn't seem to support ANSI C)
339 AC_SUBST(IDZEBRA_SRC_ROOT)
340 AC_SUBST(IDZEBRA_BUILD_ROOT)
341 IDZEBRA_SRC_ROOT=`cd ${srcdir}; pwd`
342 IDZEBRA_BUILD_ROOT=`pwd`
343 dnl ------ Create Makefiles
357 include/Makefile include/idzebra/Makefile
363 test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
366 test/rusmarc/Makefile test/cddb/Makefile test/malxml/Makefile
368 test/config/Makefile test/sort2/Makefile
370 test/dmoz/Makefile test/sort/Makefile test/zsh/Makefile
371 test/marcxml/Makefile test/charmap/Makefile test/codec/Makefile
373 test/filters/Makefile
374 examples/Makefile examples/gils/Makefile examples/zthes/Makefile
375 examples/marc21/Makefile examples/marcxml/Makefile
376 examples/alvis-oai/Makefile
380 ],[sed s%idzebra_echo_source=yes%idzebra_echo_source=no%g < idzebra-config > util/idzebra-config && chmod +x idzebra-config util/idzebra-config])
383 "------------------------------------------------------------------------
385 ZEBRA Package: ${PACKAGE}
386 ZEBRA Version: ${VERSION}
387 Source code location: ${srcdir}
388 C Preprocessor: ${CPP}
389 C Preprocessor flags: ${CPPFLAGS}
391 C Compiler flags: ${CFLAGS}
392 Linker flags: ${LDFLAGS}
394 Host System Type: ${host}
395 Install path: ${prefix}
396 Automake: ${AUTOMAKE}
399 YAZ Version: ${YAZVERSION}
400 YAZ Include: ${YAZINC}
401 YAZ La Lib: ${YAZLALIB}
403 Bugreport: ${PACKAGE_BUGREPORT}
405 ------------------------------------------------------------------------"
407 dnl mode:shell-script
409 dnl sh-basic-offset: 4