1 dnl Zebra, Index Data Aps, 1995-2004
2 dnl $Id: configure.in,v 1.91.2.4 2004-09-16 18:36:50 adam Exp $
4 AC_INIT(include/zebraver.h)
5 AM_INIT_AUTOMAKE(idzebra,1.3.18)
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 dnl ------ Look for Tcl
27 dnl See if user has specified location of tclConfig.sh; otherwise
28 dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
33 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR tclConfig.sh in DIR], [tclconfig=$withval])
34 if test "x$tclconfig" = xNONE; then
36 AC_PREFIX_PROGRAM(tclsh)
37 tclconfig=${prefix}/lib
39 if test ! -r ${tclconfig}/tclConfig.sh; then
40 # Not found, try search for Tcl on Debian systems.
41 for d in /usr/lib/tcl*; do
42 if test -f $d/tclConfig.sh; then
48 AC_MSG_CHECKING(for Tcl)
49 if test -r ${tclconfig}/tclConfig.sh; then
50 . ${tclconfig}/tclConfig.sh
51 if test -r ${tclconfig}/../generic/tcl.h; then
52 TCL_INCLUDE=-I${tclconfig}/../generic
53 TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
54 elif test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION}; then
55 TCL_INCLUDE=-I${TCL_PREFIX}/include/tcl${TCL_VERSION}
56 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
58 TCL_INCLUDE=-I${TCL_PREFIX}/include
59 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
61 TCL_LIB=`echo $TCL_LIB|sed 's%-L/usr/lib%%g'`
62 SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
63 SHLIB_LD=$TCL_SHLIB_LD
64 SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
65 SHLIB_VERSION=$TCL_SHLIB_VERSION
66 AC_MSG_RESULT($TCL_VERSION)
67 AC_DEFINE(HAVE_TCL_H,1)
69 AC_MSG_RESULT(Not found)
70 AC_DEFINE(HAVE_TCL_H,0)
74 AC_CHECK_HEADERS(sys/times.h)
77 AC_CHECK_FUNCS(mkstemp)
79 dnl ------ GNU Readline
80 READLINE_SHARED_LIBADD=""
81 AC_CHECK_LIB(ncurses, tgetent, [READLINE_SHARED_LIBADD="-lncurses"],
82 AC_CHECK_LIB(termcap, tgetent, [READLINE_SHARED_LIBADD="-ltermcap"])
85 AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline $READLINE_SHARED_LIBADD"],,$READLINE_SHARED_LIBADD)
86 AC_CHECK_LIB(history, add_history, [READLINE_LIBS="$READLINE_LIBS -lhistory"])
87 if test "$ac_cv_lib_readline_readline" = "yes"; then
88 AC_CHECK_HEADERS(readline/readline.h readline/history.h)
90 LIBS="$LIBS $READLINE_LIBS"
93 #include <readline/readline.h>
97 rl_attempted_completion_over = 0;
99 ],AC_DEFINE(HAVE_READLINE_COMPLETION_OVER))
102 #include <readline/readline.h>
106 rl_completion_matches (0, 0);
108 ],AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES))
113 AC_ARG_WITH(iconv, [ --with-iconv[=DIR] iconv library in DIR])
114 if test "$with_iconv" != "no"; then
115 AC_MSG_CHECKING(for iconv)
117 oldCPPFLAGS="${CPPFLAGS}"
118 if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
119 LIBS="$LIBS -L${with_iconv}/lib"
120 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
125 static void f() {iconv_t t = iconv_open("", ""); }
127 AC_DEFINE(HAVE_ICONV_H)
134 static void f() {iconv_t t = iconv_open("", ""); }
136 AC_DEFINE(HAVE_ICONV_H)
140 CPPFLAGS="$oldCPPFLAGS"
147 AC_CHECK_LIB(bz2,bzCompressInit)
148 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
149 AC_CHECK_HEADERS(bzlib.h)
151 AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
152 if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
153 AC_CHECK_HEADERS(bzlib.h)
162 AC_ARG_WITH(expat, [ --with-expat[=DIR] EXPAT library in DIR],[expat=$withval])
163 if test "$expat" != "no"; then
166 if test "$expat" != "yes"; then
167 EXPAT_CFLAGS="-I$expat/include"
168 EXPAT_LIBS="-L$expat/lib"
169 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
170 LIBS="$EXPAT_LIBS $LIBS"
172 AC_CHECK_LIB(expat,XML_ParserCreate,[LIBS="$LIBS -lexpat"])
173 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
174 AC_CHECK_HEADERS(expat.h)
182 AM_CONDITIONAL(perl,false)
185 PERL_XS_INIT_INCLUDE=''
187 AC_ARG_WITH(perl, [ --with-perl[=FILE] perl binary location],[perl=$withval])
188 if test "$perl" != "no"; then
189 AC_MSG_CHECKING(for perl binary)
190 if test "$perl" = "yes"; then
195 if test -x "$perlbin"; then
196 AC_MSG_RESULT($perlbin)
197 AC_MSG_CHECKING(perl core directory)
198 archdir=`$perlbin -MConfig -e 'print $Config{archlib}'`;
199 perlcore="$archdir/CORE";
200 if test -d "$perlcore"; then
201 PERL_BINARY="$perlbin"
202 AC_MSG_RESULT($perlcore)
204 AC_MSG_RESULT(Failed)
207 AC_MSG_CHECKING("for ExtUtils::Embed to determine ccopts")
208 PERL_CFLAGS=`$perlbin -MExtUtils::Embed -e ccopts 2>/dev/null`
209 if test "$PERL_CFLAGS"; then
212 PERL_CFLAGS="-I$perlcore"
213 AC_MSG_RESULT(Using defaults)
216 AC_MSG_CHECKING("for ExtUtils::Embed to determine ldflags")
217 PERL_LIBS=`$perlbin -MExtUtils::Embed -e ldopts 2>/dev/null`
218 if test "$PERL_LIBS"; then
221 PERL_LIBS="-L$perlcore -lperl -lm"
222 AC_MSG_RESULT(Using defaults)
225 AC_MSG_CHECKING("for ExtUtils::Embed to create xs_init")
226 xsf="recctrl/xsinit.h"
227 `rm $xsf 2>/dev/null`;
229 `$perlbin -MExtUtils::Embed -e xsinit -- -o $xsf 2>/dev/null`
230 if test -r "$xsf"; then
232 PERL_XS_INIT="xs_init"
233 PERL_XS_INIT_INCLUDE='#include "xsinit.h"'
235 AC_MSG_RESULT(XS libraries are not going to be available)
240 CFLAGS="$PERL_CFLAGS $CFLAGS"
241 LIBS="$PERL_LIBS $LIBS"
243 AC_MSG_CHECKING(for perl library)
251 ],AM_CONDITIONAL(perl,true)
252 AC_DEFINE(HAVE_PERL,1)
256 AC_MSG_RESULT(not found)
257 AC_DEFINE(HAVE_PERL,0)
261 AC_DEFINE(HAVE_PERL,0)
262 AC_MSG_RESULT(Not found)
265 dnl ------- 64 bit files
266 AC_MSG_CHECKING(for LFS)
267 AC_TRY_RUN([#define _FILE_OFFSET_BITS 64
268 #include <sys/types.h>
274 int main(int argc, char **argv)
280 if (sizeof(off_t) != 8)
283 sprintf (tmp_str, "%Ld", o+o+o);
284 if (strcmp (tmp_str, "6000000000"))
286 fd = creat ("config.tmp", 0644);
289 area.l_type = F_WRLCK;
290 area.l_whence = SEEK_SET;
291 area.l_len = area.l_start = 0L;
292 if (fcntl(fd, F_SETLKW, &area))
295 unlink ("config.tmp");
298 ],bits=64,bits=32,bits=32)
299 if test "$bits" = "64"; then
300 AC_DEFINE(_FILE_OFFSET_BITS,64)
306 dnl ------ ANSI C Header files
308 if test "$ac_cv_header_stdc" = "no"; then
309 AC_MSG_WARN(Your system doesn't seem to support ANSI C)
311 dnl ------ Create Makefiles
335 test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
336 test/rusmarc/Makefile test/cddb/Makefile test/malxml/Makefile
337 test/config/Makefile test/sort2/Makefile
338 perl/Makefile.PL test/xelm/Makefile
339 test/dmoz/Makefile test/xpath/Makefile test/sort/Makefile test/zsh/Makefile
340 test/marcxml/Makefile test/charmap/Makefile test/codec/Makefile
341 examples/Makefile examples/gils/Makefile examples/zthes/Makefile
344 if test -x "$perlbin"; then
345 res=`cd perl ; $perlbin Makefile.PL ; cd .. ;`;
347 if test -z "$YAZLIB"; then
348 echo "YAZ was not found. Use --with-yazconfig=DIR to specify location."
349 test -f /etc/debian_version && echo "Debian package libyaz-dev is required."