1 dnl Zebra, Index Data ApS, 1995-2006
2 dnl $Id: configure.ac,v 1.18 2006-06-13 15:10:43 adam Exp $
5 AC_INIT([idzebra],[1.4.1],[adam@indexdata.dk])
6 AC_CONFIG_SRCDIR(configure.ac)
7 AC_CONFIG_AUX_DIR(config)
8 AM_INIT_AUTOMAKE([1.8])
9 dnl ------ Substitutions
12 AC_SUBST(READLINE_LIBS)
14 dnl ------ Checking programs
21 AC_CHECK_HEADERS(sys/resource.h sys/times.h sys/time.h sys/wait.h unistd.h)
23 AC_CHECK_LIB(crypt, crypt)
24 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
25 AC_CHECK_HEADERS(crypt.h)
29 AC_ARG_ENABLE(threads, [ --disable-threads disable threads],[enable_threads=$enableval],[enable_threads=yes])
30 if test "$enable_threads" = "yes"; then
37 YAZ_INIT($yazflag,2.1.20)
38 if test "$YAZVERSION" = "NONE"; then
39 AC_MSG_ERROR([YAZ development libraries required])
46 AC_ARG_WITH(xslt,[[ --with-xslt[=PREFIX] use libxslt in PREFIX]],xsltdir=$withval)
47 if test "$xsltdir" = "yes"; then
48 for d in /usr /usr/local; do
49 if test -x $d/bin/xslt-config; then
54 if test "$xsltdir" != "no"; then
55 AC_MSG_CHECKING(for libXSLT)
57 if test -x $xsltdir/bin/xslt-config; then
58 XSLT_VER=`$xsltdir/bin/xslt-config --version`
59 AC_MSG_RESULT($XSLT_VER)
60 have_xslt_version=`echo "$XSLT_VER" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
61 if test $have_xslt_version -lt 1001011; then
62 AC_MSG_WARN([libXSLT too old. Use 1.1.11 or later.])
65 XSLT_LIBS=`$xsltdir/bin/xslt-config --libs`
66 XSLT_CFLAGS=`$xsltdir/bin/xslt-config --cflags`
70 AC_MSG_RESULT(Not found)
73 dnl ------ Look for Tcl
74 dnl See if user has specified location of tclConfig.sh; otherwise
75 dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
80 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR tclConfig.sh in DIR], [tclconfig=$withval])
81 if test "x$tclconfig" = xNONE; then
83 AC_PREFIX_PROGRAM(tclsh)
84 tclconfig=${prefix}/lib
86 if test ! -r ${tclconfig}/tclConfig.sh; then
87 # Not found, try search for Tcl on Debian systems.
88 for d in /usr/lib/tcl*; do
89 if test -f $d/tclConfig.sh; then
95 AC_MSG_CHECKING(for Tcl)
96 if test -r ${tclconfig}/tclConfig.sh; then
97 . ${tclconfig}/tclConfig.sh
98 if test -r ${tclconfig}/../generic/tcl.h; then
99 TCL_INCLUDE=-I${tclconfig}/../generic
100 TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
101 elif test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION}; then
102 TCL_INCLUDE=-I${TCL_PREFIX}/include/tcl${TCL_VERSION}
103 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
105 TCL_INCLUDE=-I${TCL_PREFIX}/include
106 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
108 TCL_LIB=`echo $TCL_LIB|sed 's%-L/usr/lib%%g'`
109 SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
110 SHLIB_LD=$TCL_SHLIB_LD
111 SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
112 SHLIB_VERSION=$TCL_SHLIB_VERSION
113 AC_MSG_RESULT($TCL_VERSION)
114 AC_DEFINE(HAVE_TCL_H,1)
116 # The Mac OSX -framework causes problems with Libtool
117 # and dependancy libs.. so apply Tcl libs everywhere bug #461
120 LIBS="$LIBS $TCL_LIB";
125 AC_MSG_RESULT(Not found)
126 AC_DEFINE(HAVE_TCL_H,0)
130 AC_CHECK_FUNCS(mkstemp)
132 dnl ------ GNU Readline
133 READLINE_SHARED_LIBADD=""
134 AC_CHECK_LIB(ncurses, tgetent, [READLINE_SHARED_LIBADD="-lncurses"],
135 AC_CHECK_LIB(termcap, tgetent, [READLINE_SHARED_LIBADD="-ltermcap"])
138 AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline $READLINE_SHARED_LIBADD"],,$READLINE_SHARED_LIBADD)
139 AC_CHECK_LIB(history, add_history, [READLINE_LIBS="$READLINE_LIBS -lhistory"])
140 if test "$ac_cv_lib_readline_readline" = "yes"; then
141 AC_CHECK_HEADERS(readline/readline.h readline/history.h)
143 LIBS="$LIBS $READLINE_LIBS"
146 #include <readline/readline.h>
148 rl_attempted_completion_over = 0;
149 ],AC_DEFINE(HAVE_READLINE_COMPLETION_OVER))
152 #include <readline/readline.h>
154 rl_completion_matches (0, 0);
155 ],AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES))
160 AC_ARG_WITH(iconv, [ --with-iconv[=DIR] iconv library in DIR])
161 if test "$with_iconv" != "no"; then
162 AC_MSG_CHECKING(for iconv)
164 oldCPPFLAGS="${CPPFLAGS}"
165 if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
166 LIBS="$LIBS -L${with_iconv}/lib"
167 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
172 iconv_t t = iconv_open("", "");
174 AC_DEFINE(HAVE_ICONV_H)
181 iconv_t t = iconv_open("", "");
183 AC_DEFINE(HAVE_ICONV_H)
187 CPPFLAGS="$oldCPPFLAGS"
194 AC_CHECK_LIB(bz2,bzCompressInit)
195 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
196 AC_CHECK_HEADERS(bzlib.h)
198 AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
199 if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
200 AC_CHECK_HEADERS(bzlib.h)
207 AC_CHECK_LIB(dl,dlopen)
212 AC_ARG_WITH(expat, [ --with-expat[=DIR] EXPAT library in DIR],[expat=$withval])
213 if test "$expat" != "no"; then
216 if test "$expat" != "yes"; then
217 EXPAT_CFLAGS="-I$expat/include"
218 EXPAT_LIBS="-L$expat/lib"
219 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
220 LIBS="$EXPAT_LIBS $LIBS"
222 AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="$EXPAT_LIBS -lexpat"])
223 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
224 AC_CHECK_HEADERS(expat.h)
230 dnl ------- 64 bit files
231 AC_MSG_CHECKING(for LFS)
232 AC_TRY_RUN([#define _FILE_OFFSET_BITS 64
233 #include <sys/types.h>
239 int main(int argc, char **argv)
245 if (sizeof(off_t) != 8)
248 sprintf (tmp_str, "%Ld", o+o+o);
249 if (strcmp (tmp_str, "6000000000"))
251 fd = creat ("config.tmp", 0644);
254 area.l_type = F_WRLCK;
255 area.l_whence = SEEK_SET;
256 area.l_len = area.l_start = 0L;
257 if (fcntl(fd, F_SETLKW, &area))
260 unlink ("config.tmp");
263 ],bits=64,bits=32,bits=32)
264 if test "$bits" = "64"; then
265 AC_DEFINE(_FILE_OFFSET_BITS,64)
270 AC_CHECK_SIZEOF([off_t])
271 AC_CHECK_SIZEOF([long long])
272 AC_CHECK_SIZEOF([long])
274 AC_SUBST(SHARED_MODULE_LA)
276 AC_SUBST(STATIC_MODULE_OBJ)
278 AC_SUBST(STATIC_MODULE_LADD)
279 STATIC_MODULE_LADD=""
280 AC_DEFUN([ZEBRA_MODULE],[
281 AC_ARG_ENABLE(mod-$1,[$3],[myen=$enableval],[myen=$2])
282 AC_MSG_CHECKING([for module $1])
283 if test "$myen" = "yes"; then
286 if test "$enable_shared" != "yes"; then
287 if test "$myen" = "shared"; then
292 if test "$myen" = "no" -o "$myen" = "disabled"; then
293 AC_MSG_RESULT([disabled])
294 elif test "$2" = "disabled"; then
295 AC_MSG_RESULT([disabled])
296 AC_MSG_ERROR([Cannot enable mod-$1 because of missing libs (XML, etc)])
297 elif test "$myen" = "shared"; then
298 AC_MSG_RESULT([shared])
299 SHARED_MODULE_LA="${SHARED_MODULE_LA} mod-$1.la"
300 elif test "$myen" = "static"; then
301 AC_MSG_RESULT([static])
302 STATIC_MODULE_OBJ="${STATIC_MODULE_OBJ} \$(mod_${m}_la_OBJECTS)"
303 STATIC_MODULE_LADD="${STATIC_MODULE_LADD} \$(mod_${m}_la_LADD)"
304 modcpp=`echo $1|tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`
305 AC_DEFINE_UNQUOTED([IDZEBRA_STATIC_$modcpp])
307 AC_MSG_RESULT([$myen])
308 AC_MSG_ERROR([invalid --enable-mod-$1 value. Use on,off,static or shared])
312 ZEBRA_MODULE(text,static, [ --enable-mod-text Text filter])
313 ZEBRA_MODULE(grs-sgml,static,[ --enable-mod-grs-sgml Simple SGML/XML filter])
314 ZEBRA_MODULE(grs-regx,shared,[ --enable-mod-grs-regx REGX/TCL filter])
315 ZEBRA_MODULE(grs-marc,shared,[ --enable-mod-grs-marc MARC filter])
316 ZEBRA_MODULE(safari,shared, [ --enable-mod-safari Safari filter (DBC)])
317 if test "$ac_cv_header_expat_h" = "yes"; then
322 ZEBRA_MODULE(grs-xml,[$def], [ --enable-mod-grs-xml XML filter (Expat based)])
323 if test "$XSLT_VER"; then
328 ZEBRA_MODULE(alvis,[$def], [ --enable-mod-alvis ALVIS filter (Requires libxslt)])
329 dnl ------ ANSI C Header files
331 if test "$ac_cv_header_stdc" = "no"; then
332 AC_MSG_WARN(Your system doesn't seem to support ANSI C)
334 AC_SUBST(IDZEBRA_SRC_ROOT)
335 AC_SUBST(IDZEBRA_BUILD_ROOT)
336 IDZEBRA_SRC_ROOT=`cd ${srcdir}; pwd`
337 IDZEBRA_BUILD_ROOT=`pwd`
338 dnl ------ Create Makefiles
352 include/Makefile include/idzebra/Makefile
358 test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
361 test/rusmarc/Makefile test/cddb/Makefile test/malxml/Makefile
363 test/config/Makefile test/sort2/Makefile
365 test/dmoz/Makefile test/sort/Makefile test/zsh/Makefile
366 test/marcxml/Makefile test/charmap/Makefile test/codec/Makefile
368 test/filters/Makefile
369 examples/Makefile examples/gils/Makefile examples/zthes/Makefile
370 examples/marc21/Makefile examples/marcxml/Makefile
371 examples/alvis-oai/Makefile
375 ],[sed s%idzebra_echo_source=yes%idzebra_echo_source=no%g < idzebra-config > util/idzebra-config && chmod +x idzebra-config util/idzebra-config])
378 "------------------------------------------------------------------------
380 ZEBRA Package: ${PACKAGE}
381 ZEBRA Version: ${VERSION}
382 Source code location: ${srcdir}
383 C Preprocessor: ${CPP}
384 C Preprocessor flags: ${CPPFLAGS}
386 C Compiler flags: ${CFLAGS}
387 Linker flags: ${LDFLAGS}
389 Host System Type: ${host}
390 Install path: ${prefix}
391 Automake: ${AUTOMAKE}
394 YAZ Version: ${YAZVERSION}
395 YAZ Include: ${YAZINC}
396 YAZ La Lib: ${YAZLALIB}
398 Bugreport: ${PACKAGE_BUGREPORT}
400 ------------------------------------------------------------------------"
402 dnl mode:shell-script
404 dnl sh-basic-offset: 4