Fix masking of bits in serialised query
[xapian.git] / xapian-applications / omega / configure.ac
blob460625415397e01b3a2e47870ff4510e1f92dce6
1 dnl Process this file with autoconf to produce a configure script.
3 m4_define([project_version], [1.3.5])
4 AC_INIT([xapian-omega], project_version, [https://xapian.org/bugs])
5 AC_PREREQ([2.63])
6 AM_INIT_AUTOMAKE([1.11 -Wportability subdir-objects tar-ustar no-dist-gzip dist-xz])
8 AC_CONFIG_SRCDIR([omega.cc])
10 AC_CONFIG_HEADERS([config.h])
12 AC_CONFIG_MACRO_DIR([m4])
14 LT_PREREQ([2.2.6])
15 LT_INIT
17 dnl -no-undefined can cause problems on some platforms, so only pass it
18 dnl on platforms where it is required in order to link a shared library at
19 dnl all (Windows is the main one).
20 NO_UNDEFINED=
21 if test unsupported = "$allow_undefined_flag" ; then
22   NO_UNDEFINED=-no-undefined
24 AC_SUBST(NO_UNDEFINED)
26 dnl disable "maintainer only" rules by default
27 AM_MAINTAINER_MODE
29 dnl Checks for programs.
30 AC_PROG_CXX
32 AC_CANONICAL_HOST
34 # Checked: freebsd8.0 openbsd4.6 solaris2.9 solaris2.10
35 case $host_os in
36   linux* | k*bsd*-gnu | freebsd* | openbsd* | solaris*)
37     dnl Vanilla libtool sets this to "unknown" which it then handles as "yes".
38     link_all_deplibs_CXX=no
39     ;;
40 esac
42 case $host_os in
43   linux*)
44     dnl Extract search path from ldconfig which is more reliable than the way
45     dnl vanilla libtool extracts them from ld.so.conf.
46     d=`/sbin/ldconfig -N -X -v 2>&AS_MESSAGE_LOG_FD|$SED 's,^\(/.*\):\( (.*)\)\?$,\1,p;d'|tr '\n' ' '`
47     test -z "$d" || sys_lib_dlsearch_path_spec=$d
48     ;;
49 esac
51 case $host in
52   *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
53     dnl On these platforms, libtool emits a warning if -no-install is passed,
54     dnl and uses -no-fast-install instead - the least ugly way to avoid that
55     dnl warnings seems to be to duplicate the above list of platforms from
56     dnl libtool and use -no-fast-install on them directly.
57     NO_INSTALL=-no-fast-install ;;
58   *)
59     NO_INSTALL=-no-install ;;
60 esac
61 AC_SUBST([NO_INSTALL])
63 dnl Probe for any options needed to enable C++11 support.
64 AX_CXX_COMPILE_STDCXX_11
66 dnl Run tests using the C++ compiler.
67 AC_LANG_CPLUSPLUS
69 dnl Check for xapian-core.
70 XO_LIB_XAPIAN([], [],
71     [xapian-config]regexp(project_version,
72                           [^\([0-9]*\.[0-9]*[13579]\)\..*$], [-\1]))
74 dnl We want XAPIAN_CXXFLAGS to be used for configure tests.
75 save_CXXFLAGS=$CXXFLAGS
76 CXXFLAGS="$CXXFLAGS $XAPIAN_CXXFLAGS"
78 case $host_os in
79   *mingw*)
80     dnl For _ftime64() on mingw we need to tell it we're happy to require
81     dnl MSVCRT 6.10 or higher, which isn't too onerous a requirement it seems.
82     AC_DEFINE([__MSVCRT_VERSION__], [0x0601], [Define on mingw to the minimum msvcrt version to assume])
83     AC_DEFINE([MINGW_HAS_SECURE_API], [1], [Define on mingw to get _s suffixed "secure" functions declared in headers])
84     ;;
85 esac
87 AC_ARG_ENABLE(documentation,
88   [AS_HELP_STRING([--enable-documentation], [enable make rules to rebuild documentation [default=maintainer-mode]])],
89   [case ${enableval} in
90     yes|no) ;;
91     *) AC_MSG_ERROR([bad value ${enableval} for --enable-documentation]) ;;
92   esac])
93 test -z "$enable_documentation" && enable_documentation=$USE_MAINTAINER_MODE
94 AM_CONDITIONAL(DOCUMENTATION_RULES, test x"$enable_documentation" = xyes)
95 AM_CONDITIONAL(MAINTAINER_NO_DOCS, test x"$USE_MAINTAINER_MODE$enable_documentation" = xyesno)
97 vpath_build=no
98 if test "`pwd`" != "`cd $srcdir;pwd`" ; then
99   vpath_build=yes
101 AM_CONDITIONAL([VPATH_BUILD], [test yes = "$vpath_build"])
103 dnl Check for headers.
104 AC_CHECK_HEADERS([strings.h sys/select.h], [], [], [ ])
105 AC_CHECK_HEADERS([netinet/in.h arpa/inet.h sys/time.h]dnl
106                  [sys/resource.h sys/socket.h sys/sysctl.h vm/vm_param.h]dnl
107                  [sys/vmmeter.h sys/sysmp.h sys/sysinfo.h sys/pstat.h],
108                  [], [], [#include <sys/types.h>])
110 dnl Check for zlib.h.
111 AC_CHECK_HEADERS([zlib.h], [], [
112   AC_MSG_ERROR([zlib.h not found])
113   ], [ ])
115 dnl Check for zlibVersion in -lz.
116 SAVE_LIBS=$LIBS
117 LIBS=
118 dnl mingw build needs -lzlib or -lzdll.
119 AC_SEARCH_LIBS([zlibVersion], [z zlib zdll], [], [
120   AC_MSG_ERROR([zlibVersion() not found in -lz, -lzlib, or -lzdll (you  may need to install the zlib1g-dev or zlib-devel package)])
121   ])
122 ZLIB_LIBS=$LIBS
123 AC_SUBST([ZLIB_LIBS])
124 LIBS=$SAVE_LIBS
126 dnl libmagic used to detect MIME types for files we don't detect by extension.
127 AC_CHECK_HEADERS([magic.h])
128 if test $ac_cv_header_magic_h != yes ; then
129   if test -r /etc/debian_version ; then
130     pkg="libmagic-dev"
131   else
132     pkg="file-devel (or maybe libmagic-devel)"
133   fi
134   AC_MSG_ERROR([libmagic required but magic.h not found.  If you're installing from packages, you probably need to install a package called something like $pkg in order to be able to build $PACKAGE_NAME.])
137 dnl On mingw there are several dependent libraries, so AC_CHECK_LIB would
138 dnl fail - we'd have to use LT_OUTPUT and then perform the test link with
139 dnl libtool, but we've checked for magic.h, so checking the library would
140 dnl not really gain us much - we know it is -lmagic.
141 MAGIC_LIBS=-lmagic
142 AC_SUBST([MAGIC_LIBS])
144 dnl mingw (for instance) lacks ssize_t
145 AC_CHECK_TYPE(ssize_t, int)
146 AC_TYPE_MODE_T
147 AC_TYPE_PID_T
149 dnl Check for time functions.
150 AC_FUNC_STRFTIME
151 AC_CHECK_FUNCS(gettimeofday ftime gmtime_r timegm sleep)
153 dnl See if ftime() returns void (as it does on mingw).
154 if test $ac_cv_func_ftime = yes ; then
155   AC_TRY_COMPILE([#include <sys/timeb.h>],
156     [struct timeb tp; int i = ftime(&tp);],
157     ,
158     AC_DEFINE(FTIME_RETURNS_VOID, 1, [Define if ftime returns void]))
161 dnl Solaris < 10 only has putenv().
163 dnl Microsoft have marked putenv() as deprecated, so we use _putenv_s() under
164 dnl MSVC to avoid deprecation warnings.  We probe here since mingw doesn't
165 dnl currently (v3.20) provide _putenv_s(), so we can't just use it conditional
166 dnl on __WIN32__ being defined.
167 AC_CHECK_FUNCS([setenv putenv _putenv_s])
169 dnl Use for Unix permission checks.
170 AC_CHECK_FUNCS([getgrouplist])
172 dnl See if getgrouplist() takes gid_t * (e.g. Linux) or int * (e.g. OS X).
173 if test $ac_cv_func_getgrouplist = yes ; then
174   AC_TRY_COMPILE([#include <grp.h>
175 #include <unistd.h>],
176     [int g[10]; int n = 10; return getgrouplist("root", 1, g, &n) == -1;],
177     AC_DEFINE([GETGROUPLIST_TAKES_INT_P], 1, [Define if getgrouplist takes int *]))
180 dnl Check for lstat() (not available under mingw for example).
181 AC_CHECK_FUNCS(lstat)
183 dnl Add in portable replacement for mkdtemp() on platforms which lack it.
184 AC_CHECK_FUNCS(mkdtemp)
185 AM_CONDITIONAL(NEED_MKDTEMP, [test yes != "$ac_cv_func_mkdtemp"])
187 dnl Need a full link check for posix_fadvise.
188 AC_LINK_IFELSE([
189   AC_LANG_PROGRAM(
190     [[
191 #ifdef __linux__
192 # define _POSIX_C_SOURCE 200112L /* for posix_fadvise from fcntl.h */
193 #endif
194 #include <fcntl.h>
195     ]], [[
196       posix_fadvise(1, 0, 0, POSIX_FADV_NOREUSE);
197       posix_fadvise(1, 0, 0, POSIX_FADV_SEQUENTIAL);
198       posix_fadvise(1, 0, 0, POSIX_FADV_DONTNEED);
199     ]])],
200   [AC_DEFINE(HAVE_POSIX_FADVISE, 1, [Define to 1 if you have the 'posix_fadvise' function])]
203 dnl omindex uses fork(), socketpair(), and setrlimit() to impose resource
204 dnl limits on filter programs.
205 AC_CHECK_FUNCS([mmap fork setrlimit sysmp pstat_getdynamic setpgid sigaction])
207 dnl -lxnet is needed on Solaris and apparently on HP-UX too.
208 AC_SEARCH_LIBS([socketpair], [xnet],
209   [AC_DEFINE(HAVE_SOCKETPAIR, 1,
210     [Define to 1 if you have the 'socketpair' function])])
212 dnl Check that snprintf actually works as it's meant to.
214 dnl Linux 'man snprintf' warns:
215 dnl  Linux libc4.[45] does not have a snprintf, but provides a libbsd that
216 dnl  contains an snprintf equivalent to sprintf, i.e., one that ignores the
217 dnl  size argument.  Thus, the use of snprintf with early libc4 leads to
218 dnl  serious security problems.
220 dnl It also warns that glibc < 2.0.6 (and presumably other pre-C90
221 dnl implementations) return -1 when truncating so check that we get the
222 dnl ISO C90 semantics for the returned length when truncating.  If we
223 dnl have a working snprintf but with non-ISO return semantics, handle
224 dnl that case separately as it may still be useful in many cases.
226 dnl mingw has _snprintf so check for that too.
227 AC_MSG_CHECKING([for working ISO C90 conforming snprintf])
228 ac_cv_func_snprintf_noniso=no
229 for func in snprintf _snprintf ; do
230   AC_RUN_IFELSE([
231     AC_LANG_PROGRAM(
232       [[
233 #include <cstdio>
234 #include <cstring>
235 using namespace std;
236       ]],
237       dnl Return different exit status for each error so we can see which
238       dnl check failed by consulting config.log.
239       [[
240         char buffer[4] = "abc";
241         int res1 = $func(buffer, 2, "%s", "XYZ");
242         if (memcmp(buffer, "X\0c", 4) != 0) return 2;
243         int res2 = $func(buffer, 2, "%x", 0x12);
244         if (memcmp(buffer, "1\0c", 4) != 0) return 3;
245         if (res1 == -1 && res2 == -1) return 15; /* Pre-ISO semantics. */
246         if (res1 != 3) return 4;
247         if (res2 != 2) return 5;
248       ]]
249     )],
250     [ac_cv_func_snprintf=$func;break],
251     [
252     if test 15no = "$?$ac_cv_func_snprintf_noniso" ; then
253       ac_cv_func_snprintf_noniso=$func
254     fi
255     ac_cv_func_snprintf=no
256     ],
257     [ac_cv_func_snprintf=unknown;break]
258   )
259 done
260 AC_MSG_RESULT([$ac_cv_func_snprintf])
261 case $ac_cv_func_snprintf in
262   no)
263     AC_MSG_CHECKING([for working non-ISO C90 conforming snprintf])
264     AC_MSG_RESULT([$ac_cv_func_snprintf_noniso])
265     if test no != "$ac_cv_func_snprintf_noniso" ; then
266       AC_DEFINE_UNQUOTED([SNPRINTF], [$ac_cv_func_snprintf_noniso],
267         [Define to the name of a function implementing snprintf but not caring about ISO C99 return value semantics (if one exists)])
268     fi
269     ;;
270   unknown)
271     dnl be conservative when crosscompiling
272     ;;
273   *)
274     AC_DEFINE_UNQUOTED([SNPRINTF_ISO], [$ac_cv_func_snprintf],
275        [Define to the name of a function implementing snprintf with ISO C99 semantics (if one exists)])
276     AC_DEFINE_UNQUOTED([SNPRINTF], [$ac_cv_func_snprintf],
277        [Define to the name of a function implementing snprintf but not caring about ISO C99 return value semantics (if one exists)])
278     ;;
279 esac
281 AC_ARG_WITH(iconv,
282   AC_HELP_STRING([--with-iconv], [force use of iconv (error if not found)])
283   AC_HELP_STRING([--without-iconv], [don't use iconv]),
284   [with_iconv=$withval], [with_iconv=auto])
286 if test no != "$with_iconv" ; then
287   ICONV_LDFLAGS=
288   AC_SEARCH_LIBS(iconv, iconv, [], [
289     if test -f "/sw/etc/fink.conf" ; then
290       dnl For fink on OS X.
291       case $host_os in
292       darwin*)
293         ICONV_LDFLAGS=-L/sw/lib
294         SAVE_LDFLAGS=$LDFLAGS
295         LDFLAGS="$LDFLAGS $ICONV_LDFLAGS"
296         AC_CHECK_LIB(iconv, iconv, [], [
297           ICONV_LDFLAGS=
298           with_iconv=bad-$with_iconv
299         ])
300         LDFLAGS=$SAVE_LDFLAGS ;;
301       esac
302     else
303       with_iconv=bad-$with_iconv
304     fi
306     case $with_iconv in
307     bad-yes) 
308       AC_MSG_ERROR([iconv not found, but --with-iconv specified]) ;;
309     bad-*)
310       with_iconv=no ;;
311     esac
312   ])
313   AC_SUBST(ICONV_LDFLAGS)
316 if test no != "$with_iconv" ; then
317   dnl Check if iconv take "char**" or "const char**" as its input.
318   dnl Solaris 2.9 has "const char **"; GNU iconv has "char **".
319   AC_MSG_CHECKING([for type of input pointer for iconv])
320   AC_CACHE_VAL([xo_cv_iconv_input],
321     [
322       xo_cv_iconv_input=
323       for t in 'char*' 'const char *' ; do
324         dnl Use a link check as just compiling was falsely detecting a
325         dnl working iconv installation on some platforms.
326         AC_LINK_IFELSE(
327           [AC_LANG_PROGRAM(
328             [#include <iconv.h>],
329             [[
330               char buf[20];
331               $t in = const_cast<char *>("hello");
332               size_t in_len = 5;
333               char * out = buf;
334               size_t out_len = 20;
335               iconv((iconv_t)-1, &in, &in_len, &out, &out_len);
336             ]])],
337           [
338           xo_cv_iconv_input=$t
339           break
340         ])
341       done
342       if test -z "$xo_cv_iconv_input"; then
343         if test yes = "$with_iconv" ; then
344           AC_MSG_RESULT([not found])
345           AC_MSG_ERROR([Failed to work out how to call iconv but --with-iconv specified])
346         fi
347         AC_MSG_RESULT([not found - not using iconv])
348         with_iconv=no
349       fi
350     ])
351   AC_MSG_RESULT([$xo_cv_iconv_input])
352   AC_DEFINE_UNQUOTED(ICONV_INPUT_TYPE, [$xo_cv_iconv_input],
353                      [type of input pointer for iconv])
356 if test no != "$with_iconv" ; then
357   AC_DEFINE(USE_ICONV, 1, [Define if iconv() should be used for converting character sets.])
360 dnl Check processor endianness.
361 AC_C_BIGENDIAN
363 dnl Check for perl.  Needed for outlookmsg2html script.
364 dnl (And in maintainer-mode, also to make man pages from "--help" output, and
365 dnl to make the omegascript vim syntax mode.)
366 AC_PATH_PROG(PERL, perl, [])
367 test -z "$PERL" && AC_MSG_ERROR([perl is required])
369 if test x"$enable_documentation" = xyes; then
370   dnl Check for help2man. (Needed to make man pages from "--help" output).
371   AC_PATH_PROG(HELP2MAN, help2man, [])
372   test -z "$HELP2MAN" && AC_MSG_ERROR([help2man is required to build documentation])
374   dnl Check for rst2html. (Needed to make HTML from reStructuredText format)
375   dnl Also look for rst2html.py, which archlinux reportedly installs it as.
376   AC_PATH_PROGS(RST2HTML, [rst2html rst2html.py], [])
377   test -z "$RST2HTML" && AC_MSG_ERROR([rst2html is required to build documentation])
380 pcre_runtime_installed() {
381   dnl Simple check to see if the problem is likely to be that we're using a
382   dnl "packaged" pcre but only have the runtime package installed.
383   for sfx in '' 32 64 ; do
384     set /usr/lib$sfx/libpcre*.so.*
385     if test "/usr/lib$sfx/libpcre?.so.*" != "$1" ; then
386       if test -r /etc/debian_version ; then
387         pkg="libpcre3-dev"
388       else
389         pkg="pcre-devel"
390       fi
391       AS_SET_STATUS([0])
392     fi
393   done
394   AS_SET_STATUS([1])
397 AC_ARG_VAR(PCRE_CONFIG, [Location of pcre-config])
398 if test -z "$PCRE_CONFIG" ; then
399   AC_ARG_VAR(PKG_CONFIG, [Location of pkg-config])
400   AC_PATH_TOOL(PKG_CONFIG, [pkg-config])
401   if test -n "$PKG_CONFIG" ; then
402     pcre_try="$PKG_CONFIG libpcre"
403     if $pcre_try 2>/dev/null ; then
404       PCRE_CONFIG=$pcre_try
405     else
406       if pcre_runtime_installed ; then
407         AC_MSG_ERROR(['$pcre_try' failed, but the PCRE runtime library seems to be installed.  If you've installed PCRE from a package, you probably need to install an extra package called something like $pkg in order to be able to build $PACKAGE_NAME.])
408       else
409         AC_MSG_ERROR(['$pcre_try' failed.  If the PCRE library is installed, you need to add PCRE_CONFIG=/path/to/pcre-config to your configure command.])
410       fi
411     fi
412   else
413     dnl Fall back to looking for pcre-config, but that's not installed on PATH
414     dnl with the platform tuple prefixed (at least under MXE), so preferring
415     dnl 'pkg-config libpcre' works better when cross-compiling.
416     AC_PATH_TOOL(PCRE_CONFIG, [pcre-config])
417     if test -z $PCRE_CONFIG ; then
418       if pcre_runtime_installed ; then
419         AC_MSG_ERROR([Can't find pcre-config, although the PCRE runtime library seems to be installed.  If you've installed PCRE from a package, you probably need to install an extra package called something like $pkg in order to be able to build $PACKAGE_NAME.])
420       else
421         AC_MSG_ERROR([Can't find pcre-config.  If the PCRE library is installed, you need to add PCRE_CONFIG=/path/to/pcre-config to your configure command.])
422       fi
423     fi
424   fi
426 PCRE_CFLAGS=`$PCRE_CONFIG --cflags`
427 PCRE_LIBS=`$PCRE_CONFIG --libs`
428 AC_SUBST(PCRE_CFLAGS)
429 AC_SUBST(PCRE_LIBS)
431 dnl ******************************
432 dnl * Set special compiler flags *
433 dnl ******************************
435 dnl Set flags to control warnings (enable more, or disable annoying ones).
436 if test yes = "$GXX"; then
437   dnl Intel's C++ compiler and clang both lie and define __GNUC__, so check which
438   dnl we actually have, as neither is really 100% compatible.
439   case `echo __INTEL_COMPILER __clang__|$CXX -E - 2>&AS_MESSAGE_LOG_FD|grep -v '^#'` in
440     *__INTEL_COMPILER*__clang__*)
441       dnl GCC (since neither substituted):
442       dnl
443       dnl -Wundef was supported by g++ 3.0 and -fshow-column by g++ 3.1.
444       dnl
445       dnl -Wlogical-op and -Wmissing-declarations (for C++) were added in
446       dnl GCC 4.3.
447       dnl
448       dnl All the other options were supported by g++ 2.95.
449       AM_CXXFLAGS="$AM_CXXFLAGS -fshow-column -Wall -W -Wredundant-decls -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wformat-security -fno-gnu-keywords -Wundef -Woverloaded-virtual -Wstrict-null-sentinel -Wshadow -Wstrict-overflow=1 -Wlogical-op -Wmissing-declarations"
451       dnl The exact format of g++ --version seems to change with almost every
452       dnl minor release so use the preprocessor macros which should be more
453       dnl robust.
454       AC_MSG_CHECKING([for version of $CXX])
455       gxx_version=`echo __GNUC__.__GNUC_MINOR__.__GNUC_PATCHLEVEL__|$CXX -E -|sed '/^#/d;s/ //g'`
456       AC_MSG_RESULT([GCC $gxx_version])
458       case $gxx_version in
459       [[0123]].*|4.[[0123]].*)
460         AC_MSG_ERROR([Xapian requires GCC 4.4 or later])
461         ;;
462       4.[[45]].*) ;;
463       *) dnl GCC >= 4.6
464         dnl -Wdouble-promotion was added in GCC 4.6.
465         dnl
466         dnl -Winit-self was added in GCC 3.4, but for GCC < 4.7 g++ always
467         dnl warns for this case with -Wuninitialized (implied by -W).  We
468         dnl don't intend to use this idiom, so any instances are bugs we'd
469         dnl like to know about.
470         AM_CXXFLAGS="$AM_CXXFLAGS -Wdouble-promotion -Winit-self" ;;
471       esac
473       dnl FIXME:
474       dnl -Wconversion in older GCC versions is intended to help migration
475       dnl from K&R to ISO C, and isn't useful for us.  In 4.3 it was renamed
476       dnl to -Wtraditional-conversion and a new -Wconversion added which
477       dnl sounds useful but is a bit buggy currently.  So we should consider
478       dnl enabling -Wconversion once it is stabilised (GCC 4.4 or ...)
479       dnl
480       dnl -Wold-style-cast is interesting, but triggers for macros from
481       dnl system headers (e.g. FD_SET) (tested with GCC 4.4).
483       if test no != "$enable_visibility"; then
484         dnl GCC doesn't support symbol visibility on all platforms (notably
485         dnl not Mac OS X or mingw).  Currently it seems to be ELF-only.
486         AC_MSG_CHECKING([if $CXX -fvisibility=hidden works])
487         if echo 'int foo() {return 42;}'|$CXX -Werror -fvisibility=hidden -c -oconftest.o -xc++ - >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
488           AC_MSG_RESULT([yes])
489           AM_CXXFLAGS="$AM_CXXFLAGS -fvisibility=hidden"
490           dash_d_visibility=-DXAPIAN_ENABLE_VISIBILITY
491         else
492           AC_MSG_RESULT([no])
493         fi
494       fi
496       dnl Automatically add -Werror if maintainer mode is enabled.
497       if test x$USE_MAINTAINER_MODE = xyes; then
498         AM_CXXFLAGS="$AM_CXXFLAGS -Werror"
499       fi
500       ;;
501     *__clang__*)
502       dnl Intel's compiler (since __clang__ not substituted):
503       dnl
504       dnl -w1 stops the avalanche of uninteresting "remark" messages.
505       dnl -wd... disables warnings which don't have good code workarounds.
506       AM_CXXFLAGS="$AM_CXXFLAGS -Wall -w1 -wd177,1572"
508       dnl Automatically add -Werror if maintainer mode is enabled.
509       if test x$USE_MAINTAINER_MODE = xyes; then
510         AM_CXXFLAGS="$AM_CXXFLAGS -Werror"
511       fi
512       ;;
513     *__INTEL_COMPILER*)
514       dnl clang (since __INTEL_COMPILER not substituted):
515       AM_CXXFLAGS="$AM_CXXFLAGS -Wall -W -Wredundant-decls -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wformat-security -fno-gnu-keywords -Wundef -Woverloaded-virtual"
516       AM_CXXFLAGS="$AM_CXXFLAGS -Wshadow -Wstrict-overflow=1 -Winit-self -Wmissing-declarations"
518       dnl Automatically add -Werror if maintainer mode is enabled.
519       if test x$USE_MAINTAINER_MODE = xyes; then
520         AM_CXXFLAGS="$AM_CXXFLAGS -Werror"
521       fi
522       ;;
523   esac
524 else
525   dnl Not GCC, nor a compiler masquerading as GCC.
526   case /$CXX in
527   */aCC)
528     dnl +w turns on more warnings.
529     dnl +wlint turns on "lint-like" warnings.
530     dnl +W<n1>,<n2>,... suppresses warnings n1, n2, ...
531     dnl 2340 (remark) "value copied to temporary, reference to temporary
532     dnl use", in: throw Xapian::UnimplementedError("...");
533     dnl 2401 "destructor for base class ... is non-virtual" (we don't need a
534     dnl virtual destructor for intrusive_base, since we never delete
535     dnl       its subclasses by a intrusive_base *).
536     dnl 3348 "declaration hides constant ..." which seems to misfire!
537     dnl 4255 (remark) "padding size of struct "..." with ... bytes to
538     dnl alignment boundary".
539     dnl 4273 "floating-point equality and inequality comparisons may be
540     dnl inappropriate due to roundoff common in floating-point computation"
541     dnl No obvious workaround for when you really do want == or !=.
542     dnl 4285 "operator= does not have a check for the source and destination
543     dnl addresses being non-identical" - fires for AutoPtr which
544     dnl includes such a check indirectly (internaltest's autoptr1 check this).
545     dnl 20201 "Memory leak is detected" which triggers for "return new Foo;"!
546     AM_CXXFLAGS="$AM_CXXFLAGS +w +wlint +W2340,2401,3348,4255,4273,4285,20201" ;;
547   esac
550 AH_BOTTOM(
551 [/* Disable stupid MSVC "performance" warning for converting int to bool. */
552 #ifdef _MSC_VER
553 # pragma warning(disable:4800)
554 #endif
556 /* _FORTIFY_SOURCE is only supported by GCC >= 4.1 and glibc >= 2.3.4, but it
557  * shouldn't cause a problem to define it where it's not supported and some
558  * distros may have backported support, so hardcoding version checks is
559  * counter-productive.
561  * Check if _FORTIFY_SOURCE is already defined to allow the user to override
562  * our choice with "./configure CPPFLAGS=-D_FORTIFY_SOURCE=0" or "...=1".
563  */
564 #if defined __GNUC__ && !defined _FORTIFY_SOURCE
565 # define _FORTIFY_SOURCE 2
566 #endif
568 /* For GCC >= 3.0 (and Intel's C++ compiler, which also defines __GNUC__),
569  * we can use __builtin_expect to give the compiler hints about branch
570  * prediction.  See HACKING for how to use these.
571  */
572 #if defined __GNUC__
573 /* The arguments of __builtin_expect() are both long, so use !! to ensure that
574  * the first argument is always an integer expression, and always 0 or 1, but
575  * still has the same truth value for the if or while it is used in.
576  */
577 # define rare(COND) __builtin_expect(!!(COND), 0)
578 # define usual(COND) __builtin_expect(!!(COND), 1)
579 #else
580 # define rare(COND) (COND)
581 # define usual(COND) (COND)
582 #endif
585 AC_SUBST([AM_CXXFLAGS])
587 dnl Restore CXXFLAGS to those the user specified or autoconf defaulted to.
588 CXXFLAGS=$save_CXXFLAGS
590 dnl Enable large file support if possible.
591 AC_SYS_LARGEFILE
593 dnl Required for auto regeneration to work in a combined maintainer-mode tree.
594 : ${AUTOM4TE=autom4te}
595 AC_SUBST([AUTOM4TE])
597 dnl **************************
598 dnl * Build the output files *
599 dnl **************************
601 AC_CONFIG_FILES([
602  Makefile
603  docs/Makefile
604  xapian-omega.spec
605  ])
606 AC_CONFIG_FILES([makemanpage], [chmod +x makemanpage])
607 AC_CONFIG_FILES([mhtml2html], [chmod +x mhtml2html])
608 AC_CONFIG_FILES([outlookmsg2html], [chmod +x outlookmsg2html])
609 AC_CONFIG_FILES([rfc822tohtml], [chmod +x rfc822tohtml])
610 AC_OUTPUT