1 dnl Zebra, Index Data ApS, 1995-2006
2 dnl $Id: configure.ac,v 1.22 2006-07-03 09:50:51 adam 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(PACKAGE_SUFFIX)
11 ZEBRALIBS_VERSION=2:0:0
12 AC_SUBST(ZEBRALIBS_VERSION)
13 dnl ------ Substitutions
16 AC_SUBST(READLINE_LIBS)
18 dnl ------ Checking programs
24 AC_CHECK_HEADERS(sys/resource.h sys/times.h sys/time.h sys/wait.h unistd.h)
26 AC_CHECK_LIB(crypt, crypt)
27 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
28 AC_CHECK_HEADERS(crypt.h)
32 AC_ARG_ENABLE(threads, [ --disable-threads disable threads],[enable_threads=$enableval],[enable_threads=yes])
33 if test "$enable_threads" = "yes"; then
40 YAZ_INIT($yazflag,2.1.20)
41 if test "$YAZVERSION" = "NONE"; then
42 AC_MSG_ERROR([YAZ development libraries required])
49 AC_ARG_WITH(xslt,[[ --with-xslt[=PREFIX] use libxslt in PREFIX]],xsltdir=$withval)
50 if test "$xsltdir" = "yes"; then
51 for d in /usr /usr/local; do
52 if test -x $d/bin/xslt-config; then
57 if test "$xsltdir" != "no"; then
58 AC_MSG_CHECKING(for libXSLT)
60 if test -x $xsltdir/bin/xslt-config; then
61 XSLT_VER=`$xsltdir/bin/xslt-config --version`
62 AC_MSG_RESULT($XSLT_VER)
63 have_xslt_version=`echo "$XSLT_VER" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
64 if test $have_xslt_version -lt 1001011; then
65 AC_MSG_WARN([libXSLT too old. Use 1.1.11 or later.])
68 XSLT_LIBS=`$xsltdir/bin/xslt-config --libs`
69 XSLT_CFLAGS=`$xsltdir/bin/xslt-config --cflags`
73 AC_MSG_RESULT(Not found)
76 dnl ------ Look for Tcl
77 dnl See if user has specified location of tclConfig.sh; otherwise
78 dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
83 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR tclConfig.sh in DIR], [tclconfig=$withval])
84 if test "x$tclconfig" = xNONE; then
86 AC_PREFIX_PROGRAM(tclsh)
87 tclconfig=${prefix}/lib
89 if test ! -r ${tclconfig}/tclConfig.sh; then
90 # Not found, try search for Tcl on Debian systems.
91 for d in /usr/lib/tcl*; do
92 if test -f $d/tclConfig.sh; then
98 AC_MSG_CHECKING(for Tcl)
99 if test -r ${tclconfig}/tclConfig.sh; then
100 . ${tclconfig}/tclConfig.sh
101 if test -r ${tclconfig}/../generic/tcl.h; then
102 TCL_INCLUDE=-I${tclconfig}/../generic
103 TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
104 elif test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION}; then
105 TCL_INCLUDE=-I${TCL_PREFIX}/include/tcl${TCL_VERSION}
106 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
108 TCL_INCLUDE=-I${TCL_PREFIX}/include
109 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
111 TCL_LIB=`echo $TCL_LIB|sed 's%-L/usr/lib%%g'`
112 SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
113 SHLIB_LD=$TCL_SHLIB_LD
114 SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
115 SHLIB_VERSION=$TCL_SHLIB_VERSION
116 AC_MSG_RESULT($TCL_VERSION)
117 AC_DEFINE(HAVE_TCL_H,1)
119 # The Mac OSX -framework causes problems with Libtool
120 # and dependancy libs.. so apply Tcl libs everywhere bug #461
123 LIBS="$LIBS $TCL_LIB";
128 AC_MSG_RESULT(Not found)
129 AC_DEFINE(HAVE_TCL_H,0)
132 dnl ------ various functions
133 AC_CHECK_FUNCS(mkstemp confstr)
135 dnl ------ GNU Readline
136 READLINE_SHARED_LIBADD=""
137 AC_CHECK_LIB(ncurses, tgetent, [READLINE_SHARED_LIBADD="-lncurses"],
138 AC_CHECK_LIB(termcap, tgetent, [READLINE_SHARED_LIBADD="-ltermcap"])
141 AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline $READLINE_SHARED_LIBADD"],,$READLINE_SHARED_LIBADD)
142 AC_CHECK_LIB(history, add_history, [READLINE_LIBS="$READLINE_LIBS -lhistory"])
143 if test "$ac_cv_lib_readline_readline" = "yes"; then
144 AC_CHECK_HEADERS(readline/readline.h readline/history.h)
146 LIBS="$LIBS $READLINE_LIBS"
149 #include <readline/readline.h>
151 rl_attempted_completion_over = 0;
152 ],AC_DEFINE(HAVE_READLINE_COMPLETION_OVER))
155 #include <readline/readline.h>
157 rl_completion_matches (0, 0);
158 ],AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES))
163 AC_ARG_WITH(iconv, [ --with-iconv[=DIR] iconv library in DIR])
164 if test "$with_iconv" != "no"; then
165 AC_MSG_CHECKING(for iconv)
167 oldCPPFLAGS="${CPPFLAGS}"
168 if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
169 LIBS="$LIBS -L${with_iconv}/lib"
170 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
175 iconv_t t = iconv_open("", "");
177 AC_DEFINE(HAVE_ICONV_H)
184 iconv_t t = iconv_open("", "");
186 AC_DEFINE(HAVE_ICONV_H)
190 CPPFLAGS="$oldCPPFLAGS"
197 AC_CHECK_LIB(bz2,bzCompressInit)
198 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
199 AC_CHECK_HEADERS(bzlib.h)
201 AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
202 if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
203 AC_CHECK_HEADERS(bzlib.h)
210 AC_CHECK_LIB(dl,dlopen)
215 AC_ARG_WITH(expat, [ --with-expat[=DIR] EXPAT library in DIR],[expat=$withval])
216 if test "$expat" != "no"; then
219 if test "$expat" != "yes"; then
220 EXPAT_CFLAGS="-I$expat/include"
221 EXPAT_LIBS="-L$expat/lib"
222 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
223 LIBS="$EXPAT_LIBS $LIBS"
225 AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="$EXPAT_LIBS -lexpat"])
226 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
227 AC_CHECK_HEADERS(expat.h)
233 dnl ------- 64 bit files
234 AC_MSG_CHECKING(for LFS)
235 AC_TRY_RUN([#define _FILE_OFFSET_BITS 64
236 #include <sys/types.h>
242 int main(int argc, char **argv)
248 if (sizeof(off_t) != 8)
251 sprintf (tmp_str, "%Ld", o+o+o);
252 if (strcmp (tmp_str, "6000000000"))
254 fd = creat ("config.tmp", 0644);
257 area.l_type = F_WRLCK;
258 area.l_whence = SEEK_SET;
259 area.l_len = area.l_start = 0L;
260 if (fcntl(fd, F_SETLKW, &area))
263 unlink ("config.tmp");
266 ],bits=64,bits=32,bits=32)
267 if test "$bits" = "64"; then
268 AC_DEFINE(_FILE_OFFSET_BITS,64)
273 AC_CHECK_SIZEOF([off_t])
274 AC_CHECK_SIZEOF([long long])
275 AC_CHECK_SIZEOF([long])
277 AC_SUBST(SHARED_MODULE_LA)
279 AC_SUBST(STATIC_MODULE_OBJ)
281 AC_SUBST(STATIC_MODULE_LADD)
282 STATIC_MODULE_LADD=""
283 AC_DEFUN([ZEBRA_MODULE],[
284 AC_ARG_ENABLE(mod-$1,[$3],[myen=$enableval],[myen=$2])
285 AC_MSG_CHECKING([for module $1])
286 if test "$myen" = "yes"; then
289 if test "$enable_shared" != "yes"; then
290 if test "$myen" = "shared"; then
295 if test "$myen" = "no" -o "$myen" = "disabled"; then
296 AC_MSG_RESULT([disabled])
297 elif test "$2" = "disabled"; then
298 AC_MSG_RESULT([disabled])
299 AC_MSG_ERROR([Cannot enable mod-$1 because of missing libs (XML, etc)])
300 elif test "$myen" = "shared"; then
301 AC_MSG_RESULT([shared])
302 SHARED_MODULE_LA="${SHARED_MODULE_LA} mod-$1.la"
303 elif test "$myen" = "static"; then
304 AC_MSG_RESULT([static])
305 STATIC_MODULE_OBJ="${STATIC_MODULE_OBJ} \$(mod_${m}_la_OBJECTS)"
306 STATIC_MODULE_LADD="${STATIC_MODULE_LADD} \$(mod_${m}_la_LADD)"
307 modcpp=`echo $1|tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`
308 AC_DEFINE_UNQUOTED([IDZEBRA_STATIC_$modcpp])
310 AC_MSG_RESULT([$myen])
311 AC_MSG_ERROR([invalid --enable-mod-$1 value. Use on,off,static or shared])
315 ZEBRA_MODULE(text,static, [ --enable-mod-text Text filter])
316 ZEBRA_MODULE(grs-sgml,static,[ --enable-mod-grs-sgml Simple SGML/XML filter])
317 ZEBRA_MODULE(grs-regx,shared,[ --enable-mod-grs-regx REGX/TCL filter])
318 ZEBRA_MODULE(grs-marc,shared,[ --enable-mod-grs-marc MARC filter])
319 ZEBRA_MODULE(safari,shared, [ --enable-mod-safari Safari filter (DBC)])
320 if test "$ac_cv_header_expat_h" = "yes"; then
325 ZEBRA_MODULE(grs-xml,[$def], [ --enable-mod-grs-xml XML filter (Expat based)])
326 if test "$XSLT_VER"; then
331 ZEBRA_MODULE(alvis,[$def], [ --enable-mod-alvis ALVIS filter (Requires libxslt)])
332 dnl ------ ANSI C Header files
334 if test "$ac_cv_header_stdc" = "no"; then
335 AC_MSG_WARN(Your system doesn't seem to support ANSI C)
337 AC_SUBST(IDZEBRA_SRC_ROOT)
338 AC_SUBST(IDZEBRA_BUILD_ROOT)
339 IDZEBRA_SRC_ROOT=`cd ${srcdir}; pwd`
340 IDZEBRA_BUILD_ROOT=`pwd`
341 dnl ------ Create Makefiles
355 include/Makefile include/idzebra/Makefile
361 test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
364 test/rusmarc/Makefile test/cddb/Makefile test/malxml/Makefile
366 test/config/Makefile test/sort2/Makefile
368 test/dmoz/Makefile test/sort/Makefile test/zsh/Makefile
369 test/marcxml/Makefile test/charmap/Makefile test/codec/Makefile
371 test/filters/Makefile
372 examples/Makefile examples/gils/Makefile examples/zthes/Makefile
373 examples/marc21/Makefile examples/marcxml/Makefile
374 examples/alvis-oai/Makefile
378 ],[sed s%echo_source=yes%echo_source=no%g < idzebra-config > util/idzebra-config && chmod +x idzebra-config util/idzebra-config])
381 "------------------------------------------------------------------------
383 ZEBRA Package: ${PACKAGE}
384 ZEBRA Version: ${VERSION}
385 Source code location: ${srcdir}
386 C Preprocessor: ${CPP}
387 C Preprocessor flags: ${CPPFLAGS}
389 C Compiler flags: ${CFLAGS}
390 Linker flags: ${LDFLAGS}
392 Host System Type: ${host}
393 Install path: ${prefix}
394 Automake: ${AUTOMAKE}
397 YAZ Version: ${YAZVERSION}
398 YAZ Include: ${YAZINC}
399 YAZ La Lib: ${YAZLALIB}
401 Bugreport: ${PACKAGE_BUGREPORT}
403 ------------------------------------------------------------------------"
405 dnl mode:shell-script
407 dnl sh-basic-offset: 4