1 dnl Zebra, Index Data Aps, 1995-2004
2 dnl $Id: configure.in,v 1.90 2004-03-29 15:48:14 adam Exp $
4 AC_INIT(include/zebraver.h)
5 AM_INIT_AUTOMAKE(idzebra,1.3.16)
6 dnl ------ Substitutions
9 AC_SUBST(READLINE_LIBS)
10 dnl ------ Perl substitutions
12 AC_SUBST(PERL_XS_INIT)
13 AC_SUBST(PERL_XS_INIT_INCLUDE)
18 dnl ------ Checking programs
26 AC_ARG_WITH(dtd, [ --with-dtd[=DIR] Use docbookx.dtd in DIR],
28 if test -f "$withval/docbookx.dtd"; then
32 AC_MSG_CHECKING(for docbookx.dtd)
33 for d in /usr/share/sgml/docbook/dtd/xml/4.1.2 \
34 /usr/share/sgml/docbook/xml-dtd-4.1.2* \
35 /usr/share/sgml/docbook/xml-dtd-4.1 \
36 /usr/share/sgml/docbook/dtd/xml/4.0 \
37 /usr/lib/sgml/dtd/docbook-xml
39 if test -f $d/docbookx.dtd; then
45 if test -z "$DTD_DIR"; then
46 AC_MSG_RESULT(Not found)
50 AC_ARG_WITH(dsssl,[ --with-dsssl[=DIR] Use DSSSL in DIR/{html,print}/docbook.dsl],
52 if test -f "$withval/html/docbook.dsl"; then
56 AC_MSG_CHECKING(for docbook.dsl)
57 for d in /usr/share/sgml/docbook/stylesheet/dsssl/modular \
58 /usr/share/sgml/docbook/dsssl-stylesheets-1.* \
59 /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh
61 if test -f $d/html/docbook.dsl; then
67 if test -z "$DSSSL_DIR"; then
68 AC_MSG_RESULT(Not found)
72 AC_ARG_ENABLE(threads, [ --disable-threads disable threads],[enable_threads=$enableval],[enable_threads=yes])
73 if test "$enable_threads" = "yes"; then
79 dnl ------ Look for Tcl
80 dnl See if user has specified location of tclConfig.sh; otherwise
81 dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
86 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR tclConfig.sh in DIR], [tclconfig=$withval])
87 if test "x$tclconfig" = xNONE; then
89 AC_PREFIX_PROGRAM(tclsh)
90 tclconfig=${prefix}/lib
92 if test ! -r ${tclconfig}/tclConfig.sh; then
93 # Not found, try search for Tcl on Debian systems.
94 for d in /usr/lib/tcl*; do
95 if test -f $d/tclConfig.sh; then
101 AC_MSG_CHECKING(for Tcl)
102 if test -r ${tclconfig}/tclConfig.sh; then
103 . ${tclconfig}/tclConfig.sh
104 if test -r ${tclconfig}/../generic/tcl.h; then
105 TCL_INCLUDE=-I${tclconfig}/../generic
106 TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
107 elif test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION}; then
108 TCL_INCLUDE=-I${TCL_PREFIX}/include/tcl${TCL_VERSION}
109 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
111 TCL_INCLUDE=-I${TCL_PREFIX}/include
112 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
114 TCL_LIB=`echo $TCL_LIB|sed 's%-L/usr/lib%%g'`
115 SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
116 SHLIB_LD=$TCL_SHLIB_LD
117 SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
118 SHLIB_VERSION=$TCL_SHLIB_VERSION
119 AC_MSG_RESULT($TCL_VERSION)
120 AC_DEFINE(HAVE_TCL_H,1)
122 AC_MSG_RESULT(Not found)
123 AC_DEFINE(HAVE_TCL_H,0)
127 AC_CHECK_HEADERS(sys/times.h)
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>
150 rl_attempted_completion_over = 0;
152 ],AC_DEFINE(HAVE_READLINE_COMPLETION_OVER))
155 #include <readline/readline.h>
159 rl_completion_matches (0, 0);
161 ],AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES))
166 AC_ARG_WITH(iconv, [ --with-iconv[=DIR] iconv library in DIR])
167 if test "$with_iconv" != "no"; then
168 AC_MSG_CHECKING(for iconv)
170 oldCPPFLAGS="${CPPFLAGS}"
171 if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
172 LIBS="$LIBS -L${with_iconv}/lib"
173 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
178 static void f() {iconv_t t = iconv_open("", ""); }
180 AC_DEFINE(HAVE_ICONV_H)
187 static void f() {iconv_t t = iconv_open("", ""); }
189 AC_DEFINE(HAVE_ICONV_H)
193 CPPFLAGS="$oldCPPFLAGS"
200 AC_CHECK_LIB(bz2,bzCompressInit)
201 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
202 AC_CHECK_HEADERS(bzlib.h)
204 AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
205 if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
206 AC_CHECK_HEADERS(bzlib.h)
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,[LIBS="$LIBS -lexpat"])
226 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
227 AC_CHECK_HEADERS(expat.h)
235 AM_CONDITIONAL(perl,false)
238 PERL_XS_INIT_INCLUDE=''
240 AC_ARG_WITH(perl, [ --with-perl[=FILE] perl binary location],[perl=$withval])
241 if test "$perl" != "no"; then
242 AC_MSG_CHECKING(for perl binary)
243 if test "$perl" = "yes"; then
248 if test -x "$perlbin"; then
249 AC_MSG_RESULT($perlbin)
250 AC_MSG_CHECKING(perl core directory)
251 archdir=`$perlbin -MConfig -e 'print $Config{archlib}'`;
252 perlcore="$archdir/CORE";
253 if test -d "$perlcore"; then
254 PERL_BINARY="$perlbin"
255 AC_MSG_RESULT($perlcore)
257 AC_MSG_RESULT(Failed)
260 AC_MSG_CHECKING("for ExtUtils::Embed to determine ccopts")
261 PERL_CFLAGS=`$perlbin -MExtUtils::Embed -e ccopts 2>/dev/null`
262 if test "$PERL_CFLAGS"; then
265 PERL_CFLAGS="-I$perlcore"
266 AC_MSG_RESULT(Using defaults)
269 AC_MSG_CHECKING("for ExtUtils::Embed to determine ldflags")
270 PERL_LIBS=`$perlbin -MExtUtils::Embed -e ldopts 2>/dev/null`
271 if test "$PERL_LIBS"; then
274 PERL_LIBS="-L$perlcore -lperl -lm"
275 AC_MSG_RESULT(Using defaults)
278 AC_MSG_CHECKING("for ExtUtils::Embed to create xs_init")
279 xsf="recctrl/xsinit.h"
280 `rm $xsf 2>/dev/null`;
282 `$perlbin -MExtUtils::Embed -e xsinit -- -o $xsf 2>/dev/null`
283 if test -r "$xsf"; then
285 PERL_XS_INIT="xs_init"
286 PERL_XS_INIT_INCLUDE='#include "xsinit.h"'
288 AC_MSG_RESULT(XS libraries are not going to be available)
293 CFLAGS="$PERL_CFLAGS $CFLAGS"
294 LIBS="$PERL_LIBS $LIBS"
296 AC_MSG_CHECKING(for perl library)
304 ],AM_CONDITIONAL(perl,true)
305 AC_DEFINE(HAVE_PERL,1)
309 AC_MSG_RESULT(not found)
310 AC_DEFINE(HAVE_PERL,0)
314 AC_DEFINE(HAVE_PERL,0)
315 AC_MSG_RESULT(Not found)
318 dnl ------- 64 bit files
319 AC_MSG_CHECKING(for LFS)
320 AC_TRY_RUN([#define _FILE_OFFSET_BITS 64
321 #include <sys/types.h>
327 int main(int argc, char **argv)
333 if (sizeof(off_t) != 8)
336 sprintf (tmp_str, "%Ld", o+o+o);
337 if (strcmp (tmp_str, "6000000000"))
339 fd = creat ("config.tmp", 0644);
342 area.l_type = F_WRLCK;
343 area.l_whence = SEEK_SET;
344 area.l_len = area.l_start = 0L;
345 if (fcntl(fd, F_SETLKW, &area))
348 unlink ("config.tmp");
351 ],bits=64,bits=32,bits=32)
352 if test "$bits" = "64"; then
353 AC_DEFINE(_FILE_OFFSET_BITS,64)
359 dnl ------ ANSI C Header files
361 if test "$ac_cv_header_stdc" = "no"; then
362 AC_MSG_WARN(Your system doesn't seem to support ANSI C)
364 dnl ------ Create Makefiles
388 test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
389 test/rusmarc/Makefile test/cddb/Makefile test/malxml/Makefile
391 perl/Makefile.PL test/xelm/Makefile
392 test/dmoz/Makefile test/xpath/Makefile test/sort/Makefile test/zsh/Makefile
393 test/marcxml/Makefile test/charmap/Makefile
394 examples/Makefile examples/gils/Makefile examples/zthes/Makefile
397 if test -x "$perlbin"; then
398 res=`cd perl ; $perlbin Makefile.PL ; cd .. ;`;
400 if test -z "$YAZLIB"; then
401 echo "YAZ was not found. Use --with-yazconfig=DIR to specify location."
402 test -f /etc/debian_version && echo "Debian package libyaz-dev is required."