1 dnl Zebra, Index Data Aps, 1995-2004
2 dnl $Id: configure.in,v 1.99 2004-09-14 14:45:18 quinn Exp $
4 AC_INIT(include/idzebra/version.h)
5 AM_INIT_AUTOMAKE(idzebra,1.4.0)
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
24 AC_ARG_ENABLE(threads, [ --disable-threads disable threads],[enable_threads=$enableval],[enable_threads=yes])
25 if test "$enable_threads" = "yes"; then
32 dnl ------ Look for Tcl
33 dnl See if user has specified location of tclConfig.sh; otherwise
34 dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
39 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR tclConfig.sh in DIR], [tclconfig=$withval])
40 if test "x$tclconfig" = xNONE; then
42 AC_PREFIX_PROGRAM(tclsh)
43 tclconfig=${prefix}/lib
45 if test ! -r ${tclconfig}/tclConfig.sh; then
46 # Not found, try search for Tcl on Debian systems.
47 for d in /usr/lib/tcl*; do
48 if test -f $d/tclConfig.sh; then
54 AC_MSG_CHECKING(for Tcl)
55 if test -r ${tclconfig}/tclConfig.sh; then
56 . ${tclconfig}/tclConfig.sh
57 if test -r ${tclconfig}/../generic/tcl.h; then
58 TCL_INCLUDE=-I${tclconfig}/../generic
59 TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
60 elif test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION}; then
61 TCL_INCLUDE=-I${TCL_PREFIX}/include/tcl${TCL_VERSION}
62 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
64 TCL_INCLUDE=-I${TCL_PREFIX}/include
65 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
67 TCL_LIB=`echo $TCL_LIB|sed 's%-L/usr/lib%%g'`
68 SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
69 SHLIB_LD=$TCL_SHLIB_LD
70 SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
71 SHLIB_VERSION=$TCL_SHLIB_VERSION
72 AC_MSG_RESULT($TCL_VERSION)
73 AC_DEFINE(HAVE_TCL_H,1)
75 AC_MSG_RESULT(Not found)
76 AC_DEFINE(HAVE_TCL_H,0)
80 AC_CHECK_HEADERS(sys/times.h)
83 AC_CHECK_FUNCS(mkstemp)
85 dnl ------ GNU Readline
86 READLINE_SHARED_LIBADD=""
87 AC_CHECK_LIB(ncurses, tgetent, [READLINE_SHARED_LIBADD="-lncurses"],
88 AC_CHECK_LIB(termcap, tgetent, [READLINE_SHARED_LIBADD="-ltermcap"])
91 AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline $READLINE_SHARED_LIBADD"],,$READLINE_SHARED_LIBADD)
92 AC_CHECK_LIB(history, add_history, [READLINE_LIBS="$READLINE_LIBS -lhistory"])
93 if test "$ac_cv_lib_readline_readline" = "yes"; then
94 AC_CHECK_HEADERS(readline/readline.h readline/history.h)
96 LIBS="$LIBS $READLINE_LIBS"
99 #include <readline/readline.h>
103 rl_attempted_completion_over = 0;
105 ],AC_DEFINE(HAVE_READLINE_COMPLETION_OVER))
108 #include <readline/readline.h>
112 rl_completion_matches (0, 0);
114 ],AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES))
119 AC_ARG_WITH(iconv, [ --with-iconv[=DIR] iconv library in DIR])
120 if test "$with_iconv" != "no"; then
121 AC_MSG_CHECKING(for iconv)
123 oldCPPFLAGS="${CPPFLAGS}"
124 if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
125 LIBS="$LIBS -L${with_iconv}/lib"
126 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
131 static void f() {iconv_t t = iconv_open("", ""); }
133 AC_DEFINE(HAVE_ICONV_H)
140 static void f() {iconv_t t = iconv_open("", ""); }
142 AC_DEFINE(HAVE_ICONV_H)
146 CPPFLAGS="$oldCPPFLAGS"
153 AC_CHECK_LIB(bz2,bzCompressInit)
154 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
155 AC_CHECK_HEADERS(bzlib.h)
157 AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
158 if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
159 AC_CHECK_HEADERS(bzlib.h)
168 AC_ARG_WITH(expat, [ --with-expat[=DIR] EXPAT library in DIR],[expat=$withval])
169 if test "$expat" != "no"; then
172 if test "$expat" != "yes"; then
173 EXPAT_CFLAGS="-I$expat/include"
174 EXPAT_LIBS="-L$expat/lib"
175 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
176 LIBS="$EXPAT_LIBS $LIBS"
178 AC_CHECK_LIB(expat,XML_ParserCreate,[LIBS="$LIBS -lexpat"])
179 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
180 AC_CHECK_HEADERS(expat.h)
188 AM_CONDITIONAL(perl,false)
191 PERL_XS_INIT_INCLUDE=''
193 AC_ARG_WITH(perl, [ --with-perl[=FILE] perl binary location],[perl=$withval])
194 if test "$perl" != "no"; then
195 AC_MSG_CHECKING(for perl binary)
196 if test "$perl" = "yes"; then
201 if test -x "$perlbin"; then
202 AC_MSG_RESULT($perlbin)
203 AC_MSG_CHECKING(perl core directory)
204 archdir=`$perlbin -MConfig -e 'print $Config{archlib}'`;
205 perlcore="$archdir/CORE";
206 if test -d "$perlcore"; then
207 PERL_BINARY="$perlbin"
208 AC_MSG_RESULT($perlcore)
210 AC_MSG_RESULT(Failed)
213 AC_MSG_CHECKING("for ExtUtils::Embed to determine ccopts")
214 PERL_CFLAGS=`$perlbin -MExtUtils::Embed -e ccopts 2>/dev/null`
215 if test "$PERL_CFLAGS"; then
218 PERL_CFLAGS="-I$perlcore"
219 AC_MSG_RESULT(Using defaults)
222 AC_MSG_CHECKING("for ExtUtils::Embed to determine ldflags")
223 PERL_LIBS=`$perlbin -MExtUtils::Embed -e ldopts 2>/dev/null`
224 if test "$PERL_LIBS"; then
227 PERL_LIBS="-L$perlcore -lperl -lm"
228 AC_MSG_RESULT(Using defaults)
231 AC_MSG_CHECKING("for ExtUtils::Embed to create xs_init")
232 xsf="recctrl/xsinit.h"
233 `rm $xsf 2>/dev/null`;
235 `$perlbin -MExtUtils::Embed -e xsinit -- -o $xsf 2>/dev/null`
236 if test -r "$xsf"; then
238 PERL_XS_INIT="xs_init"
239 PERL_XS_INIT_INCLUDE='#include "xsinit.h"'
241 AC_MSG_RESULT(XS libraries are not going to be available)
246 CFLAGS="$PERL_CFLAGS $CFLAGS"
247 LIBS="$PERL_LIBS $LIBS"
249 AC_MSG_CHECKING(for perl library)
257 ],AM_CONDITIONAL(perl,true)
258 AC_DEFINE(HAVE_PERL,1)
262 AC_MSG_RESULT(not found)
263 AC_DEFINE(HAVE_PERL,0)
267 AC_DEFINE(HAVE_PERL,0)
268 AC_MSG_RESULT(Not found)
271 dnl ------- 64 bit files
272 AC_MSG_CHECKING(for LFS)
273 AC_TRY_RUN([#define _FILE_OFFSET_BITS 64
274 #include <sys/types.h>
280 int main(int argc, char **argv)
286 if (sizeof(off_t) != 8)
289 sprintf (tmp_str, "%Ld", o+o+o);
290 if (strcmp (tmp_str, "6000000000"))
292 fd = creat ("config.tmp", 0644);
295 area.l_type = F_WRLCK;
296 area.l_whence = SEEK_SET;
297 area.l_len = area.l_start = 0L;
298 if (fcntl(fd, F_SETLKW, &area))
301 unlink ("config.tmp");
304 ],bits=64,bits=32,bits=32)
305 if test "$bits" = "64"; then
306 AC_DEFINE(_FILE_OFFSET_BITS,64)
312 dnl ------ ANSI C Header files
314 if test "$ac_cv_header_stdc" = "no"; then
315 AC_MSG_WARN(Your system doesn't seem to support ANSI C)
317 AC_SUBST(IDZEBRA_SRC_ROOT)
318 AC_SUBST(IDZEBRA_BUILD_ROOT)
319 IDZEBRA_SRC_ROOT=`cd ${srcdir}; pwd`
320 IDZEBRA_BUILD_ROOT=`pwd`
321 dnl ------ Create Makefiles
336 include/Makefile include/idzebra/Makefile
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
353 ],[sed s%idzebra_echo_source=yes%idzebra_echo_source=no%g < idzebra-config > util/idzebra-config && chmod +x idzebra-config util/idzebra-config])
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-yazconfig=DIR to specify location."
359 test -f /etc/debian_version && echo "Debian package libyaz-dev is required."