root/swish-e/trunk/configure.in

Revision 2416, 11.7 kB (checked in by karpet, 2 months ago)

bump version to distinguish pre-2.4.7

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 AC_PREREQ(2.50)/
2 AC_INIT(src/swish.c)
3 AC_CONFIG_AUX_DIR(config)
4
5 PACKAGE=swish-e
6
7 dnl version number
8 MAJOR_VERSION=2
9 MINOR_VERSION=5
10 MICRO_VERSION=8
11 INTERFACE_AGE=0
12 BINARY_AGE=0
13 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
14
15
16 dnl NOT USED
17 dnl provide a way to ignore docs
18 dnl AC_ARG_ENABLE(docs,
19 dnl              AC_HELP_STRING([--disable-docs], [when building from CVS without doc build tools]),
20 dnl             docs=no,
21 dnl             docs=yes)
22 dnl AM_CONDITIONAL(BUILDDOCS, test x$docs = xyes)
23
24
25
26 dnl provide a way to build html docs from website
27 dnl and check if html docs are available for install
28
29 SWISH_WEB=""
30 AM_CONDITIONAL(BUILDDOCS, false )
31 AM_CONDITIONAL(INSTALLDOCS, false )
32 AC_ARG_WITH(website,AC_HELP_STRING([--with-website=DIR],[use swish-e.org website src in DIR (YES if found)]),,withval=no)
33
34 if test "x$withval" != "xno"; then
35     dnl find build program
36     SWISH_WEB="$withval/bin/build"
37
38     dnl Not sure how portable -x is (according to the autobook)
39     if test ! -f "$SWISH_WEB"; then
40         AC_MSG_ERROR([Failed to find program to build swish-e html docs "$SWISH_WEB"])
41     fi
42 else
43     AC_PATH_PROG([SWISH_WEB],[build-swish-docs])
44 fi
45
46 if test -n "$SWISH_WEB"; then
47
48     SWISH_WEB_CHK=`$SWISH_WEB -check`
49
50     if test "x$SWISH_WEB_CHK" = xa-ok; then
51         AC_MSG_RESULT([Building html docs with $SWISH_WEB])
52         AC_SUBST(SWISH_WEB)
53         AM_CONDITIONAL(BUILDDOCS, true )
54         AM_CONDITIONAL(INSTALLDOCS, true )
55
56     else
57         AC_MSG_ERROR([problem running '$SWISH_WEB -check'. Returned '$SWISH_WEB_CHECK'])
58     fi
59
60 else
61     if test -f "$srcdir/html/readme.html"; then
62         AM_CONDITIONAL(INSTALLDOCS, true)
63     else
64         AC_MSG_WARN([** Not installing HTML docs.  "$srcdir/html/README.html" not found **])
65     fi
66 fi
67
68
69
70
71
72
73 AC_ARG_ENABLE(daystamp,
74              AC_HELP_STRING([--enable-daystamp], [Adds today's date to version]),
75              daystamp=yes,)
76
77 if test x$daystamp = xyes; then
78         TODAY=`/bin/date +%Y-%m-%d`
79         VERSION="$VERSION-$TODAY"
80 fi
81
82
83
84 dnl Header file for -D defines and sets @DEFS@ to -DHAVE_CONFIG_H
85 AM_CONFIG_HEADER(src/acconfig.h)
86
87 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
88
89 dnl Enable DLL builds for Win32.  This must come before AC_PROG_LIBTOOL.
90 AC_PROG_CC
91 AM_PROG_CC_STDC
92 AC_C_CONST
93 AC_LIBTOOL_WIN32_DLL
94 AC_PROG_LIBTOOL
95 AM_PROG_LIBTOOL
96
97
98
99 dnl prevent automake from generating rules to auto-rebuild tools
100 dnl see http://sources.redhat.com/automake/automake.html#maintainer-mode
101 dnl developers: either run configure with --enable-maintainer-mode
102 dnl or simply rerun ./bootstrap && ./configure when needed
103
104 AM_MAINTAINER_MODE
105
106
107
108 dnl Check for gettimeofday()
109 AC_CHECK_FUNC(BSDgettimeofday,
110               [AC_DEFINE(HAVE_BSDGETTIMEOFDAY,[],[Get time of day])],
111               [AC_CHECK_FUNC(gettimeofday, ,
112                              [AC_DEFINE(NO_GETTOD,[],[Get time of day])])])
113
114
115
116
117 dnl check for #! (shebang)
118 AC_SYS_INTERPRETER
119
120 dnl Set the @SET_MAKE@ variable=make if $(MAKE) not set
121 AC_PROG_MAKE_SET
122
123 dnl Check for Perl - need full path for scripts
124 AC_PATH_PROG([PERL], [perl], [no])
125 if test "$PERL" = "false"; then
126     AC_MSG_WARN([perl was not found - needed for script shebang lines])
127 fi
128
129
130 dnl Check pod2man for creating man pages
131 AC_CHECK_PROG([POD2MAN], [pod2man], [pod2man], [false])
132 if test "$POD2MAN" = "false"; then
133     dnl disable building of man pages?
134     AC_MSG_WARN([pod2man was not found - needed for building man pages])
135 fi
136
137 dnl Check for install - used for installing distribution
138 AC_PROG_INSTALL
139
140 dnl -- from src/configure.in --
141
142 dnl Check for a C compiler
143 AC_PROG_CC
144
145 dnl Check for vsnprintf in libsnprintf.so
146 AC_CHECK_LIB(snprintf, vsnprintf)
147
148 dnl Checks for header files.
149 dnl looks for dirent.h and sets HAVE_DIRENT_H -- do we use?
150 AC_HEADER_DIRENT
151
152 AC_HEADER_STAT
153 AC_HEADER_STDC
154
155 dnl Check for some headers
156 AC_CHECK_HEADERS(unistd.h stdlib.h string.h sys/timeb.h windows.h)
157 AC_CHECK_HEADERS(sys/resource.h sys/param.h)
158
159 AC_HEADER_SYS_WAIT
160
161 dnl Checks for typedefs, structures, and compiler characteristics.
162 AC_C_CONST
163 AC_TYPE_PID_T
164 AC_TYPE_SIZE_T
165 AC_STRUCT_TM
166
167 dnl Checks for library functions.
168 AC_FUNC_ALLOCA
169 AC_FUNC_STRFTIME
170 AC_FUNC_VPRINTF
171 AC_FUNC_FORK
172 AC_CHECK_FUNCS(waitpid kill)
173 AC_CHECK_FUNCS(re_comp regcomp strdup strstr lstat access)
174 AC_CHECK_FUNCS(strchr memcpy)
175 AC_CHECK_FUNCS(clock times getrusage)
176 AC_CHECK_LIB(m,log)
177
178 dnl Allow use strcoll() instead of strncmp()/strncasecmp() to enable locale dependent collating
179 AC_FUNC_STRCOLL
180
181 AC_FUNC_GETGROUPS
182
183 AC_TYPE_GETGROUPS
184
185 AC_REPLACE_FUNCS(vsnprintf mkstemp)
186
187 dnl Optional building with libxml2
188
189 dnl Probably should be 2.4.5 + patches
190 LIBXML_REQUIRED_VERSION=2.4.3
191
192 AC_ARG_WITH(libxml2,AC_HELP_STRING([--with-libxml2=DIR],[use libxml2 in DIR (YES if found)]),,withval=maybe)
193
194 dnl if the user explicity asked for no libxml2
195 if test "$withval" != "no"; then
196     dnl find xml2-config program
197     XML2_CONFIG="no"
198     if test "$withval" != "yes" && test "$withval" != "maybe" ; then
199         XML2_CONFIG_PATH="$withval/bin"
200         AC_PATH_PROG(XML2_CONFIG, xml2-config,"no", $XML2_CONFIG_PATH)
201     else
202         XML2_CONFIG_PATH=$PATH
203         AC_PATH_PROG(XML2_CONFIG, xml2-config,"no", $XML2_CONFIG_PATH)
204     fi
205
206     dnl we can't do anything without xml2-config
207     if test "$XML2_CONFIG" = "no"; then
208         withval="no"
209     else
210         withval=`$XML2_CONFIG --prefix`
211     fi
212
213     dnl if withval still maybe then we have failed
214     if test "$withval" = "maybe"; then
215         withval = "no"
216     fi
217 fi
218
219 if test "$withval" = "no"; then
220     AC_MSG_RESULT([Not building with libxml2 - use --with-libxml2 to enable])
221 else
222
223     AC_SUBST(LIBXML_REQUIRED_VERSION)
224     AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION)
225
226     AC_DEFUN([VERSION_TO_NUMBER],
227     [`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
228
229     dnl
230     dnl test version and init our variables
231     dnl
232
233     vers=VERSION_TO_NUMBER($XML2_CONFIG --version)
234     XML2_VERSION=`$XML2_CONFIG --version`
235
236     if test "$vers" -ge VERSION_TO_NUMBER(echo $LIBXML_REQUIRED_VERSION);then
237         LIBXML2_LIB="`$XML2_CONFIG --libs`"
238         LIBXML2_CFLAGS="`$XML2_CONFIG --cflags`"
239         AC_MSG_RESULT(found version $XML2_VERSION)
240     else
241         AC_MSG_ERROR(You need at least libxml2 $LIBXML_REQUIRED_VERSION for this version of swish)
242     fi
243
244
245     AC_DEFINE(HAVE_LIBXML2,[],[Libxml2 support included])
246
247     dnl LIBXML2_OBJS="libswishindex_la-parser.lo"
248     LIBXML2_OBJS="parser.lo"
249     AC_SUBST(LIBXML2_OBJS)
250     AC_SUBST(LIBXML2_LIB)
251     AC_SUBST(LIBXML2_CFLAGS)
252 fi
253
254
255
256 dnl Provide an option for enabling btree/incremental indexing for development
257 AC_ARG_ENABLE(incremental,
258              AC_HELP_STRING([--enable-incremental], [** developer use only **]),btree=yes,)
259
260 AC_ARG_ENABLE(psortarray,
261              AC_HELP_STRING([--enable-psortarray], [** and use ARRAY persort arrays (if incremental) ]),psortarray=yes,)
262
263 if test x$btree = xyes; then
264     AC_MSG_WARN([** Buidling with developer only incremental indexing code **])
265     BTREE_OBJS="btree.lo array.lo worddata.lo fhash.lo"
266     AC_SUBST(BTREE_OBJS)
267     AC_DEFINE(USE_BTREE,[],[Experimental BTREE support])
268
269     if test "x$psortarray" = xyes; then
270         AC_MSG_WARN([** And using ARRAY presorted tables **])
271         AC_DEFINE(USE_PRESORT_ARRAY,[],[Experimental BTREE PRESORT ARRAYS])
272     fi
273 fi
274
275
276 dnl Checks for zlib library. -- from libxml2 configure.in
277 _cppflags="${CPPFLAGS}"
278 _ldflags="${LDFLAGS}"
279
280 dnl AC_ARG_WITH(zlib,AC_HELP_STRING([--with-zlib=DIR], [use zlib in DIR (YES if found)]),,withval=maybe)
281
282 AC_ARG_WITH(zlib,
283 [  --with-zlib[[=DIR]]       use libz in DIR],[
284   if test "$withval" != "no" -a "$withval" != "yes"; then
285     Z_DIR=$withval
286     CPPFLAGS="${CPPFLAGS} -I$withval/include"
287     LDFLAGS="${LDFLAGS} -L$withval/lib"
288   fi
289 ])
290 if test "$with_zlib" = "no"; then
291     echo "Disabling compression support"
292 else
293     AC_CHECK_HEADERS(zlib.h,
294         AC_CHECK_LIB(z, gzread,[
295             AC_DEFINE(HAVE_ZLIB,[],[Do we have zlib])
296             if test "x${Z_DIR}" != "x"; then
297                 Z_CFLAGS="-I${Z_DIR}/include"
298                 Z_LIBS="-L${Z_DIR}/lib -lz"
299                 [case ${host} in
300                     *-*-solaris*)
301                         Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
302                         ;;
303                 esac]
304             else
305                 Z_LIBS="-lz"
306             fi]))
307 fi
308
309 dnl mingw build requires this for win32
310 if test "x${target}" == "xi586-mingw32msvc"; then
311      Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lzdll"
312 fi
313
314 echo "Z_LIBS = $Z_LIBS"
315
316
317 AC_SUBST(Z_CFLAGS)
318 AC_SUBST(Z_LIBS)
319
320
321 CPPFLAGS=${_cppflags}
322 LDFLAGS=${_ldflags}
323
324
325 PCRE_REQUIRED_VERSION=3.4
326 AC_ARG_WITH(pcre,AC_HELP_STRING([--with-pcre=DIR], [use pcre in DIR (YES if found)]),,withval=no)
327
328 dnl if withval not no then try to enable pcre support
329 if test "$withval" != "no"; then
330     dnl find pcre-config program
331     PCRE_CONFIG="no"
332     if test "$withval" != "yes" && test "$withval" != "maybe" ; then
333         PCRE_CONFIG_PATH="$withval/bin"
334         AC_PATH_PROG(PCRE_CONFIG, pcre-config,"no", $PCRE_CONFIG_PATH)
335     else
336         PCRE_CONFIG_PATH=$PATH
337         AC_PATH_PROG(PCRE_CONFIG, pcre-config,"no", $PCRE_CONFIG_PATH)
338     fi
339
340     dnl we won't do anything without pcre-config
341     if test "$PCRE_CONFIG" = "no"; then
342         withval="no"
343     else
344         withval=`$PCRE_CONFIG --prefix`
345     fi
346
347     dnl if withval still maybe then we have failed
348     if test "$withval" = "maybe"; then
349         withval = "no"
350     fi
351 fi
352
353 if test "$withval" != "no"; then
354     AC_SUBST(PCRE_REQUIRED_VERSION)
355     AC_MSG_CHECKING(for libpcre libraries >= $PCRE_REQUIRED_VERSION)
356
357     AC_DEFUN([VERSION_TO_NUMBER],
358     [`$1 | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
359
360     dnl
361     dnl test version and init our variables
362     dnl
363
364     vers=VERSION_TO_NUMBER($PCRE_CONFIG --version)
365     PCRE_VERSION=`$PCRE_CONFIG --version`
366
367     if test "$vers" -ge VERSION_TO_NUMBER(echo $PCRE_REQUIRED_VERSION);then
368         PCRE_LIBS="`$PCRE_CONFIG --libs-posix`"
369         PCRE_CFLAGS="`$PCRE_CONFIG --cflags-posix`"
370         AC_MSG_RESULT(found version $PCRE_VERSION)
371     else
372         AC_MSG_ERROR(You need at least libpcre $PCRE_REQUIRED_VERSION for this version of swish)
373     fi
374
375     AC_SUBST(PCRE_CFLAGS)
376     AC_SUBST(PCRE_LIBS)
377     AC_DEFINE(HAVE_PCRE,[],[Perl REGEX library])
378 else
379     AC_MSG_RESULT([Not building with perl compatible regex - use --with-pcre to enable])
380 fi
381
382 dnl enable largefile support by default. disable with --disable-largefile
383 AC_SYS_LARGEFILE
384 AC_MSG_NOTICE([fileoffset bits = ${ac_cv_sys_file_offset_bits}])
385 if test "x${ac_cv_sys_file_offset_bits}" == "x64" ;
386 then
387         LARGEFILES_MACROS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
388 fi
389 AC_SUBST(LARGEFILES_MACROS)
390
391 CPPFLAGS=${_cppflags}
392 LDFLAGS=${_ldflags}
393
394 dnl Set a better default for libexecdir -- Thanks to David Norris!
395 libexecdiropt=$(echo $ac_option | grep 'libexecdir=')
396 if test "x$libexecdiropt" = "x"; then
397         libexecdir='${exec_prefix}/lib/${PACKAGE}'
398         AC_MSG_NOTICE([Setting libexecdir to \${exec_prefix}/lib/${PACKAGE}])
399 fi
400
401 dnl Memory Debugging options
402
403 ENABLE_DEFINE([memdebug], [MEM_DEBUG], [(developers only) checks for memory consistency on alloc/free using guards])
404 ENABLE_DEFINE([memtrace], [MEM_TRACE], [(developers only)  checks for unfreed memory, and where it is allocated] )
405 ENABLE_DEFINE([memstats], [MEM_STATISTICS], [(developers only) gives memory statistics (bytes allocated, calls, etc)])
406
407
408
409 dnl Which files to create (some .in files are handled by Makefile.am files)
410
411 AC_CONFIG_FILES(
412     Makefile
413     html/Makefile
414     pod/Makefile
415     man/Makefile
416     src/Makefile
417     src/expat/Makefile
418     src/replace/Makefile
419     src/snowball/Makefile
420     rpm/swish-e.spec
421     tests/Makefile
422     example/Makefile
423     prog-bin/Makefile
424     filters/Makefile
425     filters/SWISH/Makefile
426     conf/Makefile
427     filter-bin/Makefile
428     swish-e.pc
429     swish-config)
430 AC_OUTPUT
431
Note: See TracBrowser for help on using the browser.