dinosauricon gone
[idzebra-moved-to-github.git] / configure.in
1 dnl Zebra, Index Data Aps, 1995-2002
2 dnl $Id: configure.in,v 1.54 2002-11-08 19:59:52 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.* \
51             /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh 
52    do
53      if test -f $d/html/docbook.dsl; then
54        AC_MSG_RESULT($d)
55        DSSSL_DIR=$d
56        break
57      fi
58    done
59    if test -z "$DSSSL_DIR"; then
60       AC_MSG_RESULT(Not found)
61    fi
62 ])
63 dnl
64 AC_ARG_ENABLE(threads, [  --disable-threads       disable threads],[enable_threads=$enableval],[enable_threads=yes])
65 if test "$enable_threads" = "yes"; then
66         yazflag=threads
67 else
68         yazflag=""
69 fi
70 YAZ_INIT($yazflag)
71
72 dnl ------ Look for Tcl
73 dnl See if user has specified location of tclConfig.sh; otherwise
74 dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
75 dnl disable Tcl.
76 TCL_LIB=""
77 TCL_INCLUDE=""
78 tclconfig=NONE
79 AC_ARG_WITH(tclconfig, [  --with-tclconfig=DIR    tclConfig.sh in DIR], [tclconfig=$withval])
80 if test "x$tclconfig" = xNONE; then
81         saveprefix=${prefix}
82         AC_PREFIX_PROGRAM(tclsh)
83         tclconfig=${prefix}/lib
84         prefix=${saveprefix}
85         if test ! -r ${tclconfig}/tclConfig.sh; then
86                 # Not found, try search for Tcl on Debian systems.
87                 for d in /usr/lib/tcl*; do
88                         if test -f $d/tclConfig.sh; then
89                                 tclconfig=$d
90                         fi
91                 done
92         fi
93 fi
94 AC_MSG_CHECKING(for Tcl)
95 if test -r ${tclconfig}/tclConfig.sh; then
96         . ${tclconfig}/tclConfig.sh
97         if test -r ${tclconfig}/../generic/tcl.h; then
98                 TCL_INCLUDE=-I${tclconfig}/../generic
99                 TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
100         elif test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION}; then
101                 TCL_INCLUDE=-I${TCL_PREFIX}/include/tcl${TCL_VERSION}
102                 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
103         else
104                 TCL_INCLUDE=-I${TCL_PREFIX}/include
105                 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
106         fi
107         SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
108         SHLIB_LD=$TCL_SHLIB_LD
109         SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
110         SHLIB_VERSION=$TCL_SHLIB_VERSION
111         AC_MSG_RESULT($TCL_VERSION)
112         AC_DEFINE(HAVE_TCL_H,1)
113 else
114         AC_MSG_RESULT(Not found)
115         AC_DEFINE(HAVE_TCL_H,0)
116 fi
117 dnl
118 dnl ------ times
119 AC_CHECK_HEADERS(sys/times.h)
120 dnl
121 dnl ------ mkstemp
122 AC_CHECK_FUNCS(mkstemp)
123 dnl
124 dnl ------ iconv
125 AC_ARG_WITH(iconv, [  --with-iconv[=DIR]      iconv library in DIR])
126 if test "$with_iconv" != "no"; then
127         AC_MSG_CHECKING(for iconv)
128         oldLIBS="$LIBS"
129         oldCPPFLAGS="${CPPFLAGS}"
130         if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
131                 LIBS="$LIBS -L${with_iconv}/lib"
132                 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
133         fi
134         AC_TRY_LINK([
135                 #include <iconv.h>
136         ],[
137                 static void f() {iconv_t t = iconv_open("", ""); }
138         ],[
139                 AC_DEFINE(HAVE_ICONV_H)
140                 AC_MSG_RESULT(yes)
141         ],[
142                 LIBS="$LIBS -liconv"
143                 AC_TRY_LINK([
144                         #include <iconv.h>
145                 ],[
146                         static void f() {iconv_t t = iconv_open("", ""); }
147                 ],[
148                         AC_DEFINE(HAVE_ICONV_H)
149                         AC_MSG_RESULT(yes)
150                 ],[
151                         LIBS="$oldLIBS"
152                         CPPFLAGS="$oldCPPFLAGS"
153                         AC_MSG_RESULT(no)
154                 ])
155         ])
156 fi
157 dnl
158 dnl ------- BZIP2
159 AC_CHECK_LIB(bz2,bzCompressInit)
160 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
161         AC_CHECK_HEADERS(bzlib.h)
162 else
163         AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
164         if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
165                 AC_CHECK_HEADERS(bzlib.h)
166         fi
167 fi
168 dnl
169 dnl ------ EXPAT
170 expat=yes
171 AC_ARG_WITH(expat,   [  --with-expat[=DIR]      EXPAT library in DIR],[expat=$withval])
172 if test "$expat" != "no"; then
173         xLIBS="$LIBS";
174         xCFLAGS="$CFLAGS";
175         if test "$expat" != "yes"; then
176                 EXPAT_CFLAGS="-I$expat/include"
177                 EXPAT_LIBS="-L$expat/lib"
178                 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
179                 LIBS="$EXPAT_LIBS $LIBS"
180         fi
181         AC_CHECK_LIB(expat,XML_ParserCreate,[LIBS="$LIBS -lexpat"])
182         if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
183                 AC_CHECK_HEADERS(expat.h)
184         else
185                 LIBS="$xLIBS"
186                 CFLAGS="$xCFLAGS"
187         fi
188 fi
189 dnl ------- 64 bit files
190 AC_MSG_CHECKING(for LFS)
191 AC_TRY_RUN([#define _FILE_OFFSET_BITS 64
192 #include <sys/types.h>
193 #include <unistd.h>
194 #include <string.h>
195 #include <stdio.h>
196 #include <fcntl.h>
197 #include <errno.h>
198 int main(int argc, char **argv)
199 {
200         off_t o;
201         char tmp_str[32];
202         int fd;
203         struct flock area;
204         if (sizeof(off_t) != 8) 
205                 exit (1);
206         o = 2000000000;
207         sprintf (tmp_str, "%Ld", o+o+o);
208         if (strcmp (tmp_str, "6000000000"))
209                 exit (1);
210         fd = creat ("config.tmp", 0644);
211         if (fd < 0)
212                 exit (1);
213         area.l_type = F_WRLCK;
214         area.l_whence = SEEK_SET;
215         area.l_len = area.l_start = 0L;
216         if (fcntl(fd, F_SETLKW, &area))
217                 exit (1);
218         close (fd);
219         unlink ("config.tmp");
220         exit (0);
221 }
222 ],bits=64,bits=32,bits=32)
223 if test "$bits" = "64"; then
224         AC_DEFINE(_FILE_OFFSET_BITS,64)
225         AC_MSG_RESULT(yes)
226 else
227         AC_MSG_RESULT(no)
228 fi
229 dnl
230 dnl ------ ANSI C Header files
231 AC_STDC_HEADERS
232 if test "$ac_cv_header_stdc" = "no"; then
233         AC_MSG_WARN(Your system doesn't seem to support ANSI C)
234 fi
235 dnl ------ Create Makefiles
236 AC_OUTPUT([
237   Makefile
238   util/Makefile
239   bfile/Makefile
240   dfa/Makefile
241   dict/Makefile
242   isamb/Makefile
243   isams/Makefile
244   isamc/Makefile
245   isam/Makefile
246   rset/Makefile
247   data1/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   doc/tkl.xsl
258   test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
259   test/dmoz/Makefile
260   examples/Makefile examples/gils/Makefile
261 ])