1 dnl Zebra, Index Data Aps, 1995-2005
2 dnl $Id: configure.in,v 1.91.2.10 2005-05-04 11:48:13 adam Exp $
4 AC_INIT(include/zebraver.h)
5 AM_INIT_AUTOMAKE(idzebra,1.3.26)
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
25 AC_ARG_ENABLE(threads, [ --disable-threads disable threads],[enable_threa
26 ds=$enableval],[enable_threads=yes])
27 if test "$enable_threads" = "yes"; then
34 dnl ------ Look for Tcl
35 dnl See if user has specified location of tclConfig.sh; otherwise
36 dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
41 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR tclConfig.sh in DIR], [tclconfig=$withval])
42 if test "x$tclconfig" = xNONE; then
44 AC_PREFIX_PROGRAM(tclsh)
45 tclconfig=${prefix}/lib
47 if test ! -r ${tclconfig}/tclConfig.sh; then
48 # Not found, try search for Tcl on Debian systems.
49 for d in /usr/lib/tcl*; do
50 if test -f $d/tclConfig.sh; then
56 AC_MSG_CHECKING(for Tcl)
57 if test -r ${tclconfig}/tclConfig.sh; then
58 . ${tclconfig}/tclConfig.sh
59 if test -r ${tclconfig}/../generic/tcl.h; then
60 TCL_INCLUDE=-I${tclconfig}/../generic
61 TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
62 elif test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION}; then
63 TCL_INCLUDE=-I${TCL_PREFIX}/include/tcl${TCL_VERSION}
64 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
66 TCL_INCLUDE=-I${TCL_PREFIX}/include
67 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
69 TCL_LIB=`echo $TCL_LIB|sed 's%-L/usr/lib%%g'`
70 SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
71 SHLIB_LD=$TCL_SHLIB_LD
72 SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
73 SHLIB_VERSION=$TCL_SHLIB_VERSION
74 AC_MSG_RESULT($TCL_VERSION)
75 AC_DEFINE(HAVE_TCL_H,1)
77 AC_MSG_RESULT(Not found)
78 AC_DEFINE(HAVE_TCL_H,0)
82 AC_CHECK_HEADERS(sys/times.h)
85 AC_CHECK_FUNCS(mkstemp)
87 dnl ------ GNU Readline
88 READLINE_SHARED_LIBADD=""
89 AC_CHECK_LIB(ncurses, tgetent, [READLINE_SHARED_LIBADD="-lncurses"],
90 AC_CHECK_LIB(termcap, tgetent, [READLINE_SHARED_LIBADD="-ltermcap"])
93 AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline $READLINE_SHARED_LIBADD"],,$READLINE_SHARED_LIBADD)
94 AC_CHECK_LIB(history, add_history, [READLINE_LIBS="$READLINE_LIBS -lhistory"])
95 if test "$ac_cv_lib_readline_readline" = "yes"; then
96 AC_CHECK_HEADERS(readline/readline.h readline/history.h)
98 LIBS="$LIBS $READLINE_LIBS"
101 #include <readline/readline.h>
105 rl_attempted_completion_over = 0;
107 ],AC_DEFINE(HAVE_READLINE_COMPLETION_OVER))
110 #include <readline/readline.h>
114 rl_completion_matches (0, 0);
116 ],AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES))
121 AC_ARG_WITH(iconv, [ --with-iconv[=DIR] iconv library in DIR])
122 if test "$with_iconv" != "no"; then
123 AC_MSG_CHECKING(for iconv)
125 oldCPPFLAGS="${CPPFLAGS}"
126 if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
127 LIBS="$LIBS -L${with_iconv}/lib"
128 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
133 static void f() {iconv_t t = iconv_open("", ""); }
135 AC_DEFINE(HAVE_ICONV_H)
142 static void f() {iconv_t t = iconv_open("", ""); }
144 AC_DEFINE(HAVE_ICONV_H)
148 CPPFLAGS="$oldCPPFLAGS"
155 AC_CHECK_LIB(bz2,bzCompressInit)
156 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
157 AC_CHECK_HEADERS(bzlib.h)
159 AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
160 if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
161 AC_CHECK_HEADERS(bzlib.h)
170 AC_ARG_WITH(expat, [ --with-expat[=DIR] EXPAT library in DIR],[expat=$withval])
171 if test "$expat" != "no"; then
174 if test "$expat" != "yes"; then
175 EXPAT_CFLAGS="-I$expat/include"
176 EXPAT_LIBS="-L$expat/lib"
177 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
178 LIBS="$EXPAT_LIBS $LIBS"
180 AC_CHECK_LIB(expat,XML_ParserCreate,[LIBS="$LIBS -lexpat"])
181 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
182 AC_CHECK_HEADERS(expat.h)
190 AM_CONDITIONAL(perl,false)
193 PERL_XS_INIT_INCLUDE=''
195 AC_ARG_WITH(perl, [ --with-perl[=FILE] perl binary location],[perl=$withval])
196 if test "$perl" != "no"; then
197 AC_MSG_CHECKING(for perl binary)
198 if test "$perl" = "yes"; then
203 if test -x "$perlbin"; then
204 AC_MSG_RESULT($perlbin)
205 AC_MSG_CHECKING(perl core directory)
206 archdir=`$perlbin -MConfig -e 'print $Config{archlib}'`;
207 perlcore="$archdir/CORE";
208 if test -d "$perlcore"; then
209 PERL_BINARY="$perlbin"
210 AC_MSG_RESULT($perlcore)
212 AC_MSG_RESULT(Failed)
215 AC_MSG_CHECKING("for ExtUtils::Embed to determine ccopts")
216 PERL_CFLAGS=`$perlbin -MExtUtils::Embed -e ccopts 2>/dev/null`
217 if test "$PERL_CFLAGS"; then
220 PERL_CFLAGS="-I$perlcore"
221 AC_MSG_RESULT(Using defaults)
224 AC_MSG_CHECKING("for ExtUtils::Embed to determine ldflags")
225 PERL_LIBS=`$perlbin -MExtUtils::Embed -e ldopts 2>/dev/null`
226 if test "$PERL_LIBS"; then
229 PERL_LIBS="-L$perlcore -lperl -lm"
230 AC_MSG_RESULT(Using defaults)
233 AC_MSG_CHECKING("for ExtUtils::Embed to create xs_init")
234 xsf="recctrl/xsinit.h"
235 `rm $xsf 2>/dev/null`;
237 `$perlbin -MExtUtils::Embed -e xsinit -- -o $xsf 2>/dev/null`
238 if test -r "$xsf"; then
240 PERL_XS_INIT="xs_init"
241 PERL_XS_INIT_INCLUDE='#include "xsinit.h"'
243 AC_MSG_RESULT(XS libraries are not going to be available)
248 CFLAGS="$PERL_CFLAGS $CFLAGS"
249 LIBS="$PERL_LIBS $LIBS"
251 AC_MSG_CHECKING(for perl library)
259 ],AM_CONDITIONAL(perl,true)
260 AC_DEFINE(HAVE_PERL,1)
264 AC_MSG_RESULT(not found)
265 AC_DEFINE(HAVE_PERL,0)
269 AC_DEFINE(HAVE_PERL,0)
270 AC_MSG_RESULT(Not found)
273 dnl ------- 64 bit files
274 AC_MSG_CHECKING(for LFS)
275 AC_TRY_RUN([#define _FILE_OFFSET_BITS 64
276 #include <sys/types.h>
282 int main(int argc, char **argv)
288 if (sizeof(off_t) != 8)
291 sprintf (tmp_str, "%Ld", o+o+o);
292 if (strcmp (tmp_str, "6000000000"))
294 fd = creat ("config.tmp", 0644);
297 area.l_type = F_WRLCK;
298 area.l_whence = SEEK_SET;
299 area.l_len = area.l_start = 0L;
300 if (fcntl(fd, F_SETLKW, &area))
303 unlink ("config.tmp");
306 ],bits=64,bits=32,bits=32)
307 if test "$bits" = "64"; then
308 AC_DEFINE(_FILE_OFFSET_BITS,64)
314 dnl ------ ANSI C Header files
316 if test "$ac_cv_header_stdc" = "no"; then
317 AC_MSG_WARN(Your system doesn't seem to support ANSI C)
319 dnl ------ Create Makefiles
343 test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
344 test/rusmarc/Makefile test/cddb/Makefile test/malxml/Makefile
345 test/config/Makefile test/sort2/Makefile
346 perl/Makefile.PL test/xelm/Makefile
347 test/dmoz/Makefile test/xpath/Makefile test/sort/Makefile test/zsh/Makefile
348 test/marcxml/Makefile test/charmap/Makefile test/codec/Makefile
349 examples/Makefile examples/gils/Makefile examples/zthes/Makefile
352 if test -x "$perlbin"; then
353 res=`cd perl ; $perlbin Makefile.PL ; cd .. ;`;
355 if test -z "$YAZLIB"; then
356 echo "YAZ was not found. Use --with-yazconfig=DIR to specify location."
357 test -f /etc/debian_version && echo "Debian package libyaz-dev is required."