1 dnl Zebra, Index Data ApS, 1995-2006
2 dnl $Id: configure.ac,v 1.1 2006-03-28 17:03:55 adam Exp $
5 AC_INIT([idzebra],[1.4.0],[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/times.h sys/time.h unistd.h sys/resource.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.9)
43 AC_ARG_WITH(xslt,[[ --with-xslt[=PREFIX] use libxslt in PREFIX]],xsltdir=$withval)
44 if test "$xsltdir" = "yes"; then
45 for d in /usr /usr/local; do
46 if test -x $d/bin/xslt-config; then
51 if test "$xsltdir" != "no"; then
52 AC_MSG_CHECKING(for libXSLT)
54 if test -x $xsltdir/bin/xslt-config; then
55 XSLT_VER=`$xsltdir/bin/xslt-config --version`
56 AC_MSG_RESULT($XSLT_VER)
57 have_xslt_version=`echo "$XSLT_VER" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
58 if test $have_xslt_version -lt 1001011; then
59 AC_MSG_WARN([libXSLT too old. Use 1.1.11 or later.])
62 XSLT_LIBS=`$xsltdir/bin/xslt-config --libs`
63 XSLT_CFLAGS=`$xsltdir/bin/xslt-config --cflags`
67 AC_MSG_RESULT(Not found)
70 dnl ------ Look for Tcl
71 dnl See if user has specified location of tclConfig.sh; otherwise
72 dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
77 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR tclConfig.sh in DIR], [tclconfig=$withval])
78 if test "x$tclconfig" = xNONE; then
80 AC_PREFIX_PROGRAM(tclsh)
81 tclconfig=${prefix}/lib
83 if test ! -r ${tclconfig}/tclConfig.sh; then
84 # Not found, try search for Tcl on Debian systems.
85 for d in /usr/lib/tcl*; do
86 if test -f $d/tclConfig.sh; then
92 AC_MSG_CHECKING(for Tcl)
93 if test -r ${tclconfig}/tclConfig.sh; then
94 . ${tclconfig}/tclConfig.sh
95 if test -r ${tclconfig}/../generic/tcl.h; then
96 TCL_INCLUDE=-I${tclconfig}/../generic
97 TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
98 elif test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION}; then
99 TCL_INCLUDE=-I${TCL_PREFIX}/include/tcl${TCL_VERSION}
100 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
102 TCL_INCLUDE=-I${TCL_PREFIX}/include
103 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
105 TCL_LIB=`echo $TCL_LIB|sed 's%-L/usr/lib%%g'`
106 SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
107 SHLIB_LD=$TCL_SHLIB_LD
108 SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
109 SHLIB_VERSION=$TCL_SHLIB_VERSION
110 AC_MSG_RESULT($TCL_VERSION)
111 AC_DEFINE(HAVE_TCL_H,1)
113 # The Mac OSX -framework causes problems with Libtool
114 # and dependancy libs.. so apply Tcl libs everywhere
118 LIBS="$LIBS $TCL_LIB";
123 AC_MSG_RESULT(Not found)
124 AC_DEFINE(HAVE_TCL_H,0)
128 AC_CHECK_FUNCS(mkstemp)
130 dnl ------ GNU Readline
131 READLINE_SHARED_LIBADD=""
132 AC_CHECK_LIB(ncurses, tgetent, [READLINE_SHARED_LIBADD="-lncurses"],
133 AC_CHECK_LIB(termcap, tgetent, [READLINE_SHARED_LIBADD="-ltermcap"])
136 AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline $READLINE_SHARED_LIBADD"],,$READLINE_SHARED_LIBADD)
137 AC_CHECK_LIB(history, add_history, [READLINE_LIBS="$READLINE_LIBS -lhistory"])
138 if test "$ac_cv_lib_readline_readline" = "yes"; then
139 AC_CHECK_HEADERS(readline/readline.h readline/history.h)
141 LIBS="$LIBS $READLINE_LIBS"
144 #include <readline/readline.h>
146 rl_attempted_completion_over = 0;
147 ],AC_DEFINE(HAVE_READLINE_COMPLETION_OVER))
150 #include <readline/readline.h>
152 rl_completion_matches (0, 0);
153 ],AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES))
158 AC_ARG_WITH(iconv, [ --with-iconv[=DIR] iconv library in DIR])
159 if test "$with_iconv" != "no"; then
160 AC_MSG_CHECKING(for iconv)
162 oldCPPFLAGS="${CPPFLAGS}"
163 if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
164 LIBS="$LIBS -L${with_iconv}/lib"
165 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
170 iconv_t t = iconv_open("", "");
172 AC_DEFINE(HAVE_ICONV_H)
179 iconv_t t = iconv_open("", "");
181 AC_DEFINE(HAVE_ICONV_H)
185 CPPFLAGS="$oldCPPFLAGS"
192 AC_CHECK_LIB(bz2,bzCompressInit)
193 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
194 AC_CHECK_HEADERS(bzlib.h)
196 AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
197 if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
198 AC_CHECK_HEADERS(bzlib.h)
205 AC_CHECK_LIB(dl,dlopen)
210 AC_ARG_WITH(expat, [ --with-expat[=DIR] EXPAT library in DIR],[expat=$withval])
211 if test "$expat" != "no"; then
214 if test "$expat" != "yes"; then
215 EXPAT_CFLAGS="-I$expat/include"
216 EXPAT_LIBS="-L$expat/lib"
217 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
218 LIBS="$EXPAT_LIBS $LIBS"
220 AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="$EXPAT_LIBS -lexpat"])
221 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
222 AC_CHECK_HEADERS(expat.h)
228 dnl ------- 64 bit files
229 AC_MSG_CHECKING(for LFS)
230 AC_TRY_RUN([#define _FILE_OFFSET_BITS 64
231 #include <sys/types.h>
237 int main(int argc, char **argv)
243 if (sizeof(off_t) != 8)
246 sprintf (tmp_str, "%Ld", o+o+o);
247 if (strcmp (tmp_str, "6000000000"))
249 fd = creat ("config.tmp", 0644);
252 area.l_type = F_WRLCK;
253 area.l_whence = SEEK_SET;
254 area.l_len = area.l_start = 0L;
255 if (fcntl(fd, F_SETLKW, &area))
258 unlink ("config.tmp");
261 ],bits=64,bits=32,bits=32)
262 if test "$bits" = "64"; then
263 AC_DEFINE(_FILE_OFFSET_BITS,64)
269 AC_SUBST(SHARED_MODULE_LA)
271 AC_SUBST(STATIC_MODULE_OBJ)
273 AC_SUBST(STATIC_MODULE_LADD)
274 STATIC_MODULE_LADD=""
275 AC_DEFUN([ZEBRA_MODULE],[
276 AC_ARG_ENABLE(mod-$1,[$3],[myen=$enableval],[myen=$2])
277 AC_MSG_CHECKING([for module $1])
278 if test "$myen" = "yes"; then
281 if test "$enable_shared" != "yes"; then
282 if test "$myen" = "shared"; then
287 if test "$myen" = "shared"; then
288 AC_MSG_RESULT([shared])
289 SHARED_MODULE_LA="${SHARED_MODULE_LA} mod-$1.la"
290 elif test "$myen" = "static" -o "$myen" = "yes"; then
291 AC_MSG_RESULT([static])
292 STATIC_MODULE_OBJ="${STATIC_MODULE_OBJ} \$(mod_${m}_la_OBJECTS)"
293 STATIC_MODULE_LADD="${STATIC_MODULE_LADD} \$(mod_${m}_la_LADD)"
294 modcpp=`echo $1|tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`
295 AC_DEFINE_UNQUOTED([IDZEBRA_STATIC_$modcpp])
296 elif test "$myen" = "no"; then
297 AC_MSG_RESULT([disabled])
299 AC_MSG_RESULT([$myen])
300 AC_MSG_ERROR([invalid --enable-mod-$1 value. Use on,off,static or shared])
304 ZEBRA_MODULE(text,static, [ --enable-mod-text Text filter])
305 ZEBRA_MODULE(grs-sgml,static,[ --enable-mod-grs-sgml Simple SGML/XML filter])
306 ZEBRA_MODULE(grs-regx,shared,[ --enable-mod-grs-regx REGX/TCL filter])
307 ZEBRA_MODULE(grs-marc,shared,[ --enable-mod-grs-marc MARC filter])
308 ZEBRA_MODULE(grs-csv,shared, [ --enable-mod-grs-csv CSV filter])
309 ZEBRA_MODULE(grs-danbib,shared,[ --enable-mod-grs-danbib DanBib filter (DBC)])
310 ZEBRA_MODULE(safari,shared, [ --enable-mod-safari Safari filter (DBC)])
311 if test "$ac_cv_header_expat_h" = "yes"; then
316 ZEBRA_MODULE(grs-xml,[$def], [ --enable-mod-grs-xml XML filter (Expat based)])
317 if test "$XSLT_VER"; then
322 ZEBRA_MODULE(xslt,[$def], [ --enable-mod-xslt XSLT filter])
323 ZEBRA_MODULE(alvis,[$def], [ --enable-mod-alvis ALVIS filter])
324 dnl ------ ANSI C Header files
326 if test "$ac_cv_header_stdc" = "no"; then
327 AC_MSG_WARN(Your system doesn't seem to support ANSI C)
329 AC_SUBST(IDZEBRA_SRC_ROOT)
330 AC_SUBST(IDZEBRA_BUILD_ROOT)
331 IDZEBRA_SRC_ROOT=`cd ${srcdir}; pwd`
332 IDZEBRA_BUILD_ROOT=`pwd`
333 dnl ------ Create Makefiles
347 include/Makefile include/idzebra/Makefile
355 test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
358 test/rusmarc/Makefile test/cddb/Makefile test/malxml/Makefile
360 test/config/Makefile test/sort2/Makefile
362 test/dmoz/Makefile test/sort/Makefile test/zsh/Makefile
363 test/marcxml/Makefile test/charmap/Makefile test/codec/Makefile
365 test/filters/Makefile
366 examples/Makefile examples/gils/Makefile examples/zthes/Makefile
367 examples/marc21/Makefile examples/alvis-oai/Makefile
371 ],[sed s%idzebra_echo_source=yes%idzebra_echo_source=no%g < idzebra-config > util/idzebra-config && chmod +x idzebra-config util/idzebra-config])
372 if test -z "$YAZLIB"; then
373 echo "YAZ was not found. Use --with-yaz=DIR to specify location."
374 test -f /etc/debian_version && echo "Debian package libyaz-dev is required."