1 dnl Zebra, Index Data Aps, 1995-2005
2 dnl $Id: configure.in,v 1.91.2.19 2006-02-23 13:29:41 adam Exp $
4 AC_INIT(include/zebraver.h)
5 AM_INIT_AUTOMAKE(idzebra,1.3.34)
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
32 YAZ_INIT($yazflag,2.0.18)
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_LIB(crypt, crypt)
86 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
87 AC_CHECK_HEADERS(crypt.h)
91 AC_CHECK_FUNCS(mkstemp)
93 dnl ------ GNU Readline
94 READLINE_SHARED_LIBADD=""
95 AC_CHECK_LIB(ncurses, tgetent, [READLINE_SHARED_LIBADD="-lncurses"],
96 AC_CHECK_LIB(termcap, tgetent, [READLINE_SHARED_LIBADD="-ltermcap"])
99 AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline $READLINE_SHARED_LIBADD"],,$READLINE_SHARED_LIBADD)
100 AC_CHECK_LIB(history, add_history, [READLINE_LIBS="$READLINE_LIBS -lhistory"])
101 if test "$ac_cv_lib_readline_readline" = "yes"; then
102 AC_CHECK_HEADERS(readline/readline.h readline/history.h)
104 LIBS="$LIBS $READLINE_LIBS"
107 #include <readline/readline.h>
111 rl_attempted_completion_over = 0;
113 ],AC_DEFINE(HAVE_READLINE_COMPLETION_OVER))
116 #include <readline/readline.h>
120 rl_completion_matches (0, 0);
122 ],AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES))
127 AC_ARG_WITH(iconv, [ --with-iconv[=DIR] iconv library in DIR])
128 if test "$with_iconv" != "no"; then
129 AC_MSG_CHECKING(for iconv)
131 oldCPPFLAGS="${CPPFLAGS}"
132 if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
133 LIBS="$LIBS -L${with_iconv}/lib"
134 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
139 static void f() {iconv_t t = iconv_open("", ""); }
141 AC_DEFINE(HAVE_ICONV_H)
148 static void f() {iconv_t t = iconv_open("", ""); }
150 AC_DEFINE(HAVE_ICONV_H)
154 CPPFLAGS="$oldCPPFLAGS"
161 AC_CHECK_LIB(bz2,bzCompressInit)
162 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
163 AC_CHECK_HEADERS(bzlib.h)
165 AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
166 if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
167 AC_CHECK_HEADERS(bzlib.h)
176 AC_ARG_WITH(expat, [ --with-expat[=DIR] EXPAT library in DIR],[expat=$withval])
177 if test "$expat" != "no"; then
180 if test "$expat" != "yes"; then
181 EXPAT_CFLAGS="-I$expat/include"
182 EXPAT_LIBS="-L$expat/lib"
183 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
184 LIBS="$EXPAT_LIBS $LIBS"
186 AC_CHECK_LIB(expat,XML_ParserCreate,[LIBS="$LIBS -lexpat"])
187 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
188 AC_CHECK_HEADERS(expat.h)
196 AM_CONDITIONAL(perl,false)
199 PERL_XS_INIT_INCLUDE=''
201 AC_ARG_WITH(perl, [ --with-perl[=FILE] perl binary location],[perl=$withval])
202 if test "$perl" != "no"; then
203 AC_MSG_CHECKING(for perl binary)
204 if test "$perl" = "yes"; then
209 if test -x "$perlbin"; then
210 AC_MSG_RESULT($perlbin)
211 AC_MSG_CHECKING(perl core directory)
212 archdir=`$perlbin -MConfig -e 'print $Config{archlib}'`;
213 perlcore="$archdir/CORE";
214 if test -d "$perlcore"; then
215 PERL_BINARY="$perlbin"
216 AC_MSG_RESULT($perlcore)
218 AC_MSG_RESULT(Failed)
221 AC_MSG_CHECKING("for ExtUtils::Embed to determine ccopts")
222 PERL_CFLAGS=`$perlbin -MExtUtils::Embed -e ccopts 2>/dev/null`
223 if test "$PERL_CFLAGS"; then
226 PERL_CFLAGS="-I$perlcore"
227 AC_MSG_RESULT(Using defaults)
230 AC_MSG_CHECKING("for ExtUtils::Embed to determine ldflags")
231 PERL_LIBS=`$perlbin -MExtUtils::Embed -e ldopts 2>/dev/null`
232 if test "$PERL_LIBS"; then
235 PERL_LIBS="-L$perlcore -lperl -lm"
236 AC_MSG_RESULT(Using defaults)
239 AC_MSG_CHECKING("for ExtUtils::Embed to create xs_init")
240 xsf="recctrl/xsinit.h"
241 `rm $xsf 2>/dev/null`;
243 `$perlbin -MExtUtils::Embed -e xsinit -- -o $xsf 2>/dev/null`
244 if test -r "$xsf"; then
246 PERL_XS_INIT="xs_init"
247 PERL_XS_INIT_INCLUDE='#include "xsinit.h"'
249 AC_MSG_RESULT(XS libraries are not going to be available)
254 CFLAGS="$PERL_CFLAGS $CFLAGS"
255 LIBS="$PERL_LIBS $LIBS"
257 AC_MSG_CHECKING(for perl library)
265 ],AM_CONDITIONAL(perl,true)
266 AC_DEFINE(HAVE_PERL,1)
270 AC_MSG_RESULT(not found)
271 AC_DEFINE(HAVE_PERL,0)
275 AC_DEFINE(HAVE_PERL,0)
276 AC_MSG_RESULT(Not found)
279 dnl ------- 64 bit files
280 AC_MSG_CHECKING(for LFS)
281 AC_TRY_RUN([#define _FILE_OFFSET_BITS 64
282 #include <sys/types.h>
288 int main(int argc, char **argv)
294 if (sizeof(off_t) != 8)
297 sprintf (tmp_str, "%Ld", o+o+o);
298 if (strcmp (tmp_str, "6000000000"))
300 fd = creat ("config.tmp", 0644);
303 area.l_type = F_WRLCK;
304 area.l_whence = SEEK_SET;
305 area.l_len = area.l_start = 0L;
306 if (fcntl(fd, F_SETLKW, &area))
309 unlink ("config.tmp");
312 ],bits=64,bits=32,bits=32)
313 if test "$bits" = "64"; then
314 AC_DEFINE(_FILE_OFFSET_BITS,64)
320 dnl ------ ANSI C Header files
322 if test "$ac_cv_header_stdc" = "no"; then
323 AC_MSG_WARN(Your system doesn't seem to support ANSI C)
325 dnl ------ Create Makefiles
349 test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
350 test/rusmarc/Makefile test/cddb/Makefile test/malxml/Makefile
351 test/config/Makefile test/sort2/Makefile
352 perl/Makefile.PL test/xelm/Makefile
353 test/dmoz/Makefile test/xpath/Makefile test/sort/Makefile test/zsh/Makefile
354 test/marcxml/Makefile test/charmap/Makefile test/codec/Makefile
355 examples/Makefile examples/gils/Makefile examples/zthes/Makefile
356 examples/mail/Makefile
359 if test -x "$perlbin"; then
360 res=`cd perl ; $perlbin Makefile.PL ; cd .. ;`;
362 if test -z "$YAZLIB"; then
363 echo "YAZ was not found. Use --with-yaz=DIR to specify location."
364 test -f /etc/debian_version && echo "Debian package libyaz-dev is required."