root/swish-e/branches/2.6/configure.in

Revision 2115, 11.0 kB (checked in by karpet, 7 months ago)

fix autodetection of LARGEFILE support

  • 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=7
10 MICRO_VERSION=0
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 setenv 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 setenv)
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 Berkeley DB check
257 dnl this macro defined in m4/ax_path_bdb.m4
258 AX_PATH_BDB([3],[
259      LIBS="$BDB_LIBS $LIBS"
260      LDFLAGS="$BDB_LDFLAGS $LDFLAGS"
261      CPPFLAGS="$CPPFLAGS $BDB_CPPFLAGS"
262  ])
263
264
265 dnl Checks for zlib library. -- from libxml2 configure.in
266 _cppflags="${CPPFLAGS}"
267 _ldflags="${LDFLAGS}"
268
269 dnl AC_ARG_WITH(zlib,AC_HELP_STRING([--with-zlib=DIR], [use zlib in DIR (YES if found)]),,withval=maybe)
270
271 AC_ARG_WITH(zlib,
272 [  --with-zlib[[=DIR]]       use libz in DIR],[
273   if test "$withval" != "no" -a "$withval" != "yes"; then
274     Z_DIR=$withval
275     CPPFLAGS="${CPPFLAGS} -I$withval/include"
276     LDFLAGS="${LDFLAGS} -L$withval/lib"
277   fi
278 ])
279 if test "$with_zlib" = "no"; then
280     echo "Disabling compression support"
281 else
282     AC_CHECK_HEADERS(zlib.h,
283         AC_CHECK_LIB(z, gzread,[
284             AC_DEFINE(HAVE_ZLIB,[],[Do we have zlib])
285             if test "x${Z_DIR}" != "x"; then
286                 Z_CFLAGS="-I${Z_DIR}/include"
287                 Z_LIBS="-L${Z_DIR}/lib -lz"
288                 [case ${host} in
289                     *-*-solaris*)
290                         Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
291                         ;;
292                 esac]
293             else
294                 Z_LIBS="-lz"
295             fi]))
296 fi
297
298 AC_SUBST(Z_CFLAGS)
299 AC_SUBST(Z_LIBS)
300
301
302 CPPFLAGS=${_cppflags}
303 LDFLAGS=${_ldflags}
304
305
306 PCRE_REQUIRED_VERSION=3.4
307 AC_ARG_WITH(pcre,AC_HELP_STRING([--with-pcre=DIR], [use pcre in DIR (YES if found)]),,withval=no)
308
309 dnl if withval not no then try to enable pcre support
310 if test "$withval" != "no"; then
311     dnl find pcre-config program
312     PCRE_CONFIG="no"
313     if test "$withval" != "yes" && test "$withval" != "maybe" ; then
314         PCRE_CONFIG_PATH="$withval/bin"
315         AC_PATH_PROG(PCRE_CONFIG, pcre-config,"no", $PCRE_CONFIG_PATH)
316     else
317         PCRE_CONFIG_PATH=$PATH
318         AC_PATH_PROG(PCRE_CONFIG, pcre-config,"no", $PCRE_CONFIG_PATH)
319     fi
320
321     dnl we won't do anything without pcre-config
322     if test "$PCRE_CONFIG" = "no"; then
323         withval="no"
324     else
325         withval=`$PCRE_CONFIG --prefix`
326     fi
327
328     dnl if withval still maybe then we have failed
329     if test "$withval" = "maybe"; then
330         withval = "no"
331     fi
332 fi
333
334 if test "$withval" != "no"; then
335     AC_SUBST(PCRE_REQUIRED_VERSION)
336     AC_MSG_CHECKING(for libpcre libraries >= $PCRE_REQUIRED_VERSION)
337
338     AC_DEFUN([VERSION_TO_NUMBER],
339     [`$1 | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])
340
341     dnl
342     dnl test version and init our variables
343     dnl
344
345     vers=VERSION_TO_NUMBER($PCRE_CONFIG --version)
346     PCRE_VERSION=`$PCRE_CONFIG --version`
347
348     if test "$vers" -ge VERSION_TO_NUMBER(echo $PCRE_REQUIRED_VERSION);then
349         PCRE_LIBS="`$PCRE_CONFIG --libs-posix`"
350         PCRE_CFLAGS="`$PCRE_CONFIG --cflags-posix`"
351         AC_MSG_RESULT(found version $PCRE_VERSION)
352     else
353         AC_MSG_ERROR(You need at least libpcre $PCRE_REQUIRED_VERSION for this version of swish)
354     fi
355
356     AC_SUBST(PCRE_CFLAGS)
357     AC_SUBST(PCRE_LIBS)
358     AC_DEFINE(HAVE_PCRE,[],[Perl REGEX library])
359 else
360     AC_MSG_RESULT([Not building with perl compatible regex - use --with-pcre to enable])
361 fi
362
363 dnl enable largefile support by default. disable with --disable-largefile
364 AC_SYS_LARGEFILE
365 AC_MSG_NOTICE([fileoffset bits = ${ac_cv_sys_file_offset_bits}])
366 if test "x${ac_cv_sys_file_offset_bits}" == "x64" ;
367 then
368        LARGEFILES_MACROS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
369 fi
370 AC_SUBST(LARGEFILES_MACROS)
371
372
373
374 CPPFLAGS=${_cppflags}
375 LDFLAGS=${_ldflags}
376
377 dnl Set a better default for libexecdir -- Thanks to David Norris!
378 libexecdiropt=$(echo $ac_option | grep 'libexecdir=')
379 if test "x$libexecdiropt" = "x"; then
380         libexecdir='${exec_prefix}/lib/${PACKAGE}'
381         AC_MSG_NOTICE([Setting libexecdir to \${exec_prefix}/lib/${PACKAGE}])
382 fi
383
384 dnl Memory Debugging options
385
386 ENABLE_DEFINE([memdebug], [MEM_DEBUG], [(developers only) checks for memory consistency on alloc/free using guards])
387 ENABLE_DEFINE([memtrace], [MEM_TRACE], [(developers only)  checks for unfreed memory, and where it is allocated] )
388 ENABLE_DEFINE([memstats], [MEM_STATISTICS], [(developers only) gives memory statistics (bytes allocated, calls, etc)])
389
390
391
392 dnl Which files to create (some .in files are handled by Makefile.am files)
393
394 AC_CONFIG_FILES(
395     Makefile
396     html/Makefile
397     pod/Makefile
398     man/Makefile
399     src/Makefile
400     src/replace/Makefile
401     src/snowball/Makefile
402     rpm/swish-e.spec
403     tests/Makefile
404     example/Makefile
405     prog-bin/Makefile
406     filters/Makefile
407     filters/SWISH/Makefile
408     conf/Makefile
409     filter-bin/Makefile
410     swish-e.pc
411     swish-config)
412 AC_OUTPUT
413
Note: See TracBrowser for help on using the browser.