1 dnl Zebra, Index Data Aps, 1995-2006
2 dnl $Id: configure.in,v 1.91.2.27 2006-09-19 19:16:34 adam Exp $
4 AC_INIT(include/zebraver.h)
5 AM_INIT_AUTOMAKE(idzebra,1.3.38)
7 AC_SUBST(PACKAGE_SUFFIX)
8 dnl ------ Substitutions
11 AC_SUBST(READLINE_LIBS)
12 dnl ------ Perl substitutions
14 AC_SUBST(PERL_XS_INIT)
15 AC_SUBST(PERL_XS_INIT_INCLUDE)
20 dnl ------ Checking programs
27 AC_ARG_ENABLE(threads, [ --disable-threads disable threads],[enable_threa
28 ds=$enableval],[enable_threads=yes])
29 if test "$enable_threads" = "yes"; then
34 YAZ_INIT($yazflag,2.0.18)
36 dnl ------ Look for Tcl
37 dnl See if user has specified location of tclConfig.sh; otherwise
38 dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
43 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR tclConfig.sh in DIR], [tclconfig=$withval])
44 if test "x$tclconfig" = xNONE; then
46 AC_PREFIX_PROGRAM(tclsh)
47 tclconfig=${prefix}/lib
49 if test ! -r ${tclconfig}/tclConfig.sh; then
50 # Not found, try search for Tcl on Debian systems.
51 for d in /usr/lib/tcl*; do
52 if test -f $d/tclConfig.sh; then
58 AC_MSG_CHECKING(for Tcl)
59 if test -r ${tclconfig}/tclConfig.sh; then
60 . ${tclconfig}/tclConfig.sh
61 if test -r ${tclconfig}/../generic/tcl.h; then
62 TCL_INCLUDE=-I${tclconfig}/../generic
63 TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
64 elif test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION}; then
65 TCL_INCLUDE=-I${TCL_PREFIX}/include/tcl${TCL_VERSION}
66 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
68 TCL_INCLUDE=-I${TCL_PREFIX}/include
69 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
71 TCL_LIB=`echo $TCL_LIB|sed 's%-L/usr/lib%%g'`
72 SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
73 SHLIB_LD=$TCL_SHLIB_LD
74 SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
75 SHLIB_VERSION=$TCL_SHLIB_VERSION
76 AC_MSG_RESULT($TCL_VERSION)
77 AC_DEFINE(HAVE_TCL_H,1)
79 AC_MSG_RESULT(Not found)
80 AC_DEFINE(HAVE_TCL_H,0)
84 AC_CHECK_HEADERS(sys/times.h)
87 AC_CHECK_LIB(crypt, crypt)
88 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
89 AC_CHECK_HEADERS(crypt.h)
93 AC_CHECK_FUNCS(mkstemp)
95 dnl ------ GNU Readline
96 READLINE_SHARED_LIBADD=""
97 AC_CHECK_LIB(ncurses, tgetent, [READLINE_SHARED_LIBADD="-lncurses"],
98 AC_CHECK_LIB(termcap, tgetent, [READLINE_SHARED_LIBADD="-ltermcap"])
101 AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline $READLINE_SHARED_LIBADD"],,$READLINE_SHARED_LIBADD)
102 AC_CHECK_LIB(history, add_history, [READLINE_LIBS="$READLINE_LIBS -lhistory"])
103 if test "$ac_cv_lib_readline_readline" = "yes"; then
104 AC_CHECK_HEADERS(readline/readline.h readline/history.h)
106 LIBS="$LIBS $READLINE_LIBS"
109 #include <readline/readline.h>
111 rl_attempted_completion_over = 0;
112 ],AC_DEFINE(HAVE_READLINE_COMPLETION_OVER))
115 #include <readline/readline.h>
117 rl_completion_matches (0, 0);
118 ],AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES))
123 AC_ARG_WITH(iconv, [ --with-iconv[=DIR] iconv library in DIR])
124 if test "$with_iconv" != "no"; then
125 AC_MSG_CHECKING(for iconv)
127 oldCPPFLAGS="${CPPFLAGS}"
128 if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
129 LIBS="$LIBS -L${with_iconv}/lib"
130 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
135 iconv_t t = iconv_open("", "");
137 AC_DEFINE(HAVE_ICONV_H)
144 iconv_t t = iconv_open("", "");
146 AC_DEFINE(HAVE_ICONV_H)
150 CPPFLAGS="$oldCPPFLAGS"
157 AC_CHECK_LIB(bz2,bzCompressInit)
158 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
159 AC_CHECK_HEADERS(bzlib.h)
161 AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
162 if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
163 AC_CHECK_HEADERS(bzlib.h)
172 AC_ARG_WITH(expat, [ --with-expat[=DIR] EXPAT library in DIR],[expat=$withval])
173 if test "$expat" != "no"; then
176 if test "$expat" != "yes"; then
177 EXPAT_CFLAGS="-I$expat/include"
178 EXPAT_LIBS="-L$expat/lib"
179 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
180 LIBS="$EXPAT_LIBS $LIBS"
182 AC_CHECK_LIB(expat,XML_ParserCreate,[LIBS="$LIBS -lexpat"])
183 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
184 AC_CHECK_HEADERS(expat.h)
192 AM_CONDITIONAL(perl,false)
195 PERL_XS_INIT_INCLUDE=''
197 AC_ARG_WITH(perl, [ --with-perl[=FILE] perl binary location],[perl=$withval])
198 if test "$perl" != "no"; then
199 AC_MSG_CHECKING(for perl binary)
200 if test "$perl" = "yes"; then
205 if test -x "$perlbin"; then
206 AC_MSG_RESULT($perlbin)
207 AC_MSG_CHECKING(perl core directory)
208 archdir=`$perlbin -MConfig -e 'print $Config{archlib}'`;
209 perlcore="$archdir/CORE";
210 if test -d "$perlcore"; then
211 PERL_BINARY="$perlbin"
212 AC_MSG_RESULT($perlcore)
214 AC_MSG_RESULT(Failed)
217 AC_MSG_CHECKING("for ExtUtils::Embed to determine ccopts")
218 PERL_CFLAGS=`$perlbin -MExtUtils::Embed -e ccopts 2>/dev/null`
219 if test "$PERL_CFLAGS"; then
222 PERL_CFLAGS="-I$perlcore"
223 AC_MSG_RESULT(Using defaults)
226 AC_MSG_CHECKING("for ExtUtils::Embed to determine ldflags")
227 PERL_LIBS=`$perlbin -MExtUtils::Embed -e ldopts 2>/dev/null`
228 if test "$PERL_LIBS"; then
231 PERL_LIBS="-L$perlcore -lperl -lm"
232 AC_MSG_RESULT(Using defaults)
235 AC_MSG_CHECKING("for ExtUtils::Embed to create xs_init")
236 xsf="recctrl/xsinit.h"
237 `rm $xsf 2>/dev/null`;
239 `$perlbin -MExtUtils::Embed -e xsinit -- -o $xsf 2>/dev/null`
240 if test -r "$xsf"; then
242 PERL_XS_INIT="xs_init"
243 PERL_XS_INIT_INCLUDE='#include "xsinit.h"'
245 AC_MSG_RESULT(XS libraries are not going to be available)
250 CFLAGS="$PERL_CFLAGS $CFLAGS"
251 LIBS="$PERL_LIBS $LIBS"
253 AC_MSG_CHECKING(for perl library)
261 ],AM_CONDITIONAL(perl,true)
262 AC_DEFINE(HAVE_PERL,1)
266 AC_MSG_RESULT(not found)
267 AC_DEFINE(HAVE_PERL,0)
271 AC_DEFINE(HAVE_PERL,0)
272 AC_MSG_RESULT(Not found)
275 dnl ------- 64 bit files
276 AC_MSG_CHECKING(for LFS)
277 AC_TRY_RUN([#define _FILE_OFFSET_BITS 64
278 #include <sys/types.h>
284 int main(int argc, char **argv)
290 if (sizeof(off_t) != 8)
293 if ((o+o+o) / 3 != o)
295 fd = creat ("config.tmp", 0644);
298 area.l_type = F_WRLCK;
299 area.l_whence = SEEK_SET;
300 area.l_len = area.l_start = 0L;
301 if (fcntl(fd, F_SETLKW, &area))
304 unlink ("config.tmp");
307 ],bits=64,bits=32,bits=32)
308 if test "$bits" = "64"; then
309 AC_DEFINE(_FILE_OFFSET_BITS,64)
315 dnl ------ ANSI C Header files
317 if test "$ac_cv_header_stdc" = "no"; then
318 AC_MSG_WARN(Your system doesn't seem to support ANSI C)
320 dnl ------ Create Makefiles
344 test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
345 test/rusmarc/Makefile test/cddb/Makefile test/malxml/Makefile
346 test/config/Makefile test/sort2/Makefile
347 perl/Makefile.PL test/xelm/Makefile
348 test/dmoz/Makefile test/xpath/Makefile test/sort/Makefile test/zsh/Makefile
349 test/marcxml/Makefile test/charmap/Makefile test/codec/Makefile
350 examples/Makefile examples/gils/Makefile examples/zthes/Makefile
351 examples/mail/Makefile
354 if test -x "$perlbin"; then
355 res=`cd perl ; $perlbin Makefile.PL ; cd .. ;`;
357 if test -z "$YAZLIB"; then
358 echo "YAZ was not found. Use --with-yaz=DIR to specify location."
359 test -f /etc/debian_version && echo "Debian package libyaz-dev is required."