Fix search for complete fields. Update version
[idzebra-moved-to-github.git] / configure.in
1 dnl Zebra, Index Data Aps, 1995-2002
2 dnl $Id: configure.in,v 1.49 2002-09-18 21:01:14 adam Exp $
3 dnl
4 AC_INIT(include/zebraver.h)
5 AM_INIT_AUTOMAKE(idzebra,1.3.3)
6 dnl ------ Substitutions
7 AC_SUBST(TCL_INCLUDE)
8 AC_SUBST(TCL_LIB)
9 dnl
10 dnl ------ Checking programs
11 AC_PROG_CC
12 AC_PROG_CPP
13 AC_PROG_INSTALL
14 AC_PROG_RANLIB
15 dnl
16 dnl ----- DOCBOOK DTD
17 AC_SUBST(DTD_DIR)
18 AC_ARG_WITH(dtd, [  --with-dtd[=DIR]        Use docbookx.dtd in DIR],
19 [
20    if test -f "$withval/docbookx.dtd"; then
21       DTD_DIR=$withval
22    fi
23 ],[
24    AC_MSG_CHECKING(for docbookx.dtd)
25    for d in /usr/share/sgml/docbook/dtd/xml/4.1.2 \
26          /usr/share/sgml/docbook/xml-dtd-4.1.2 \
27          /usr/share/sgml/docbook/xml-dtd-4.1 \
28          /usr/share/sgml/docbook/dtd/xml/4.0 \
29             /usr/lib/sgml/dtd/docbook-xml 
30    do
31      if test -f $d/docbookx.dtd; then
32        AC_MSG_RESULT($d)
33        DTD_DIR=$d
34        break
35      fi
36    done
37    if test -z "$DTD_DIR"; then
38       AC_MSG_RESULT(Not found)
39    fi
40 ])
41 AC_SUBST(DSSSL_DIR)
42 AC_ARG_WITH(dsssl,[  --with-dsssl[=DIR]      Use DSSSL in DIR/{html,print}/docbook.dsl],
43 [
44    if test -f "$withval/html/docbook.dsl"; then
45       DSSSL_DIR=$withval
46    fi
47 ],[
48    AC_MSG_CHECKING(for docbook.dsl)
49    for d in /usr/share/sgml/docbook/stylesheet/dsssl/modular \
50             /usr/share/sgml/docbook/dsssl-stylesheets-1.64 \
51             /usr/share/sgml/docbook/dsssl-stylesheets-1.59 \
52             /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh 
53    do
54      if test -f $d/html/docbook.dsl; then
55        AC_MSG_RESULT($d)
56        DSSSL_DIR=$d
57        break
58      fi
59    done
60    if test -z "$DSSSL_DIR"; then
61       AC_MSG_RESULT(Not found)
62    fi
63 ])
64 dnl
65 AC_ARG_ENABLE(threads, [  --disable-threads       disable threads],[enable_threads=$enableval],[enable_threads=yes])
66 if test "$enable_threads" = "yes"; then
67         yazflag=threads
68 else
69         yazflag=""
70 fi
71 YAZ_INIT($yazflag)
72
73 dnl ------ Look for Tcl
74 dnl See if user has specified location of tclConfig.sh; otherwise
75 dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
76 dnl disable Tcl.
77 TCL_LIB=""
78 TCL_INCLUDE=""
79 tclconfig=NONE
80 AC_ARG_WITH(tclconfig, [  --with-tclconfig=DIR    tclConfig.sh in DIR], [tclconfig=$withval])
81 if test "x$tclconfig" = xNONE; then
82         saveprefix=${prefix}
83         AC_PREFIX_PROGRAM(tclsh)
84         tclconfig=${prefix}/lib
85         prefix=${saveprefix}
86         if test ! -r ${tclconfig}/tclConfig.sh; then
87                 # Not found, try search for Tcl on Debian systems.
88                 for d in /usr/lib/tcl*; do
89                         if test -f $d/tclConfig.sh; then
90                                 tclconfig=$d
91                         fi
92                 done
93         fi
94 fi
95 AC_MSG_CHECKING(for Tcl)
96 if test -r ${tclconfig}/tclConfig.sh; then
97         . ${tclconfig}/tclConfig.sh
98         if test -r ${tclconfig}/../generic/tcl.h; then
99                 TCL_INCLUDE=-I${tclconfig}/../generic
100                 TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
101         elif test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION}; then
102                 TCL_INCLUDE=-I${TCL_PREFIX}/include/tcl${TCL_VERSION}
103                 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
104         else
105                 TCL_INCLUDE=-I${TCL_PREFIX}/include
106                 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
107         fi
108         SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
109         SHLIB_LD=$TCL_SHLIB_LD
110         SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
111         SHLIB_VERSION=$TCL_SHLIB_VERSION
112         AC_MSG_RESULT($TCL_VERSION)
113         AC_DEFINE(HAVE_TCL_H,1)
114 else
115         AC_MSG_RESULT(Not found)
116         AC_DEFINE(HAVE_TCL_H,0)
117 fi
118 dnl
119 dnl ------ times
120 AC_CHECK_HEADERS(sys/times.h)
121 dnl
122 dnl ------ mkstemp
123 AC_CHECK_FUNCS(mkstemp)
124 dnl
125 dnl ------ iconv
126 AC_ARG_WITH(iconv, [  --with-iconv[=DIR]      iconv library in DIR])
127 if test "$with_iconv" != "no"; then
128         AC_MSG_CHECKING(for iconv)
129         oldLIBS="$LIBS"
130         oldCPPFLAGS="${CPPFLAGS}"
131         if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
132                 LIBS="$LIBS -L${with_iconv}/lib"
133                 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
134         fi
135         AC_TRY_LINK([
136                 #include <iconv.h>
137         ],[
138                 static void f() {iconv_t t = iconv_open("", ""); }
139         ],[
140                 AC_DEFINE(HAVE_ICONV_H)
141                 AC_MSG_RESULT(yes)
142         ],[
143                 LIBS="$LIBS -liconv"
144                 AC_TRY_LINK([
145                         #include <iconv.h>
146                 ],[
147                         static void f() {iconv_t t = iconv_open("", ""); }
148                 ],[
149                         AC_DEFINE(HAVE_ICONV_H)
150                         AC_MSG_RESULT(yes)
151                 ],[
152                         LIBS="$oldLIBS"
153                         CPPFLAGS="$oldCPPFLAGS"
154                         AC_MSG_RESULT(no)
155                 ])
156         ])
157 fi
158 dnl
159 dnl ------- BZIP2
160 AC_CHECK_LIB(bz2,bzCompressInit)
161 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
162         AC_CHECK_HEADERS(bzlib.h)
163 else
164         AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
165         if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
166                 AC_CHECK_HEADERS(bzlib.h)
167         fi
168 fi
169 dnl
170 dnl ------ EXPAT
171 expat=yes
172 AC_ARG_WITH(expat,   [  --with-expat[=DIR]      EXPAT library in DIR],[expat=$withval])
173 if test "$expat" != "no"; then
174         xLIBS="$LIBS";
175         xCFLAGS="$CFLAGS";
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"
181         fi
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)
185         else
186                 LIBS="$xLIBS"
187                 CFLAGS="$xCFLAGS"
188         fi
189 fi
190 dnl ------- 64 bit files
191 AC_MSG_CHECKING(for LFS)
192 AC_TRY_RUN([#define _FILE_OFFSET_BITS 64
193 #include <sys/types.h>
194 #include <unistd.h>
195 #include <string.h>
196 #include <stdio.h>
197 #include <fcntl.h>
198 #include <errno.h>
199 int main(int argc, char **argv)
200 {
201         off_t o;
202         char tmp_str[32];
203         int fd;
204         struct flock area;
205         if (sizeof(off_t) != 8) 
206                 exit (1);
207         o = 2000000000;
208         sprintf (tmp_str, "%Ld", o+o+o);
209         if (strcmp (tmp_str, "6000000000"))
210                 exit (1);
211         fd = creat ("config.tmp", 0644);
212         if (fd < 0)
213                 exit (1);
214         area.l_type = F_WRLCK;
215         area.l_whence = SEEK_SET;
216         area.l_len = area.l_start = 0L;
217         if (fcntl(fd, F_SETLKW, &area))
218                 exit (1);
219         close (fd);
220         unlink ("config.tmp");
221         exit (0);
222 }
223 ],bits=64,bits=32,bits=32)
224 if test "$bits" = "64"; then
225         AC_DEFINE(_FILE_OFFSET_BITS,64)
226         AC_MSG_RESULT(yes)
227 else
228         AC_MSG_RESULT(no)
229 fi
230 dnl
231 dnl ------ ANSI C Header files
232 AC_STDC_HEADERS
233 if test "$ac_cv_header_stdc" = "no"; then
234         AC_MSG_WARN(Your system doesn't seem to support ANSI C)
235 fi
236 dnl ------ Create Makefiles
237 AC_OUTPUT([
238   Makefile
239   util/Makefile
240   bfile/Makefile
241   dfa/Makefile
242   dict/Makefile
243   isamb/Makefile
244   isams/Makefile
245   isamc/Makefile
246   isam/Makefile
247   rset/Makefile
248   recctrl/Makefile
249   index/Makefile
250   include/Makefile
251   tab/Makefile
252   doc/Makefile
253   doc/zebra.xml
254   doc/zebrahtml.dsl
255   doc/zebraprint.dsl
256   doc/zebraphp.dsl
257   test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
258   test/dmoz/Makefile
259 ])