1 dnl configuration script for libcitadel
2 dnl Process this file with autoconf to produce a configure script.
5 dnl Ensure that libcitadel is configured with autoconf 2.52 or newer
8 AC_INIT(libcitadel, 3.8.13, http://uncensored.citadel.org)
10 AC_CONFIG_SRCDIR(Makefile.in)
11 AC_CONFIG_AUX_DIR(conftools)
12 AC_CONFIG_SRCDIR(tests/Makefile.in)
13 m4_include([m4/local.m4])
16 dnl Increment LIBREVISION if source code has changed at all
18 dnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0
20 dnl If the API changes compatibly (i.e. simply adding a new function
21 dnl without changing or removing earlier interfaces), then increment LIBAGE.
23 dnl If the API changes incompatibly set LIBAGE back to 0
30 sinclude(conftools/libtool.m4)
31 sinclude(conftools/ac_c_bigendian_cross.m4)
39 dnl Checks for programs.
43 if test "$GCC" = yes ; then
45 dnl Be careful about adding the -fexceptions option; some versions of
46 dnl GCC don't support it and it causes extra warnings that are only
47 dnl distracting; avoid.
49 OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
50 CFLAGS="$OLDCFLAGS -fexceptions"
51 AC_MSG_CHECKING(whether $CC accepts -fexceptions)
54 AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
55 CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
58 dnl Checks for header files.
61 AC_CHECK_HEADER(sys/mman.h, [CFLAGS="$CFLAGS -D HAVE_MMAP"])
62 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
63 dnl Checks for the zlib compression library.
64 if test "x$with_zlib" != xno ; then
65 AC_CHECK_HEADERS(zlib.h,
66 [AC_CHECK_LIB(z, zlibVersion,
71 if test "x$ok_zlib" = xyes ; then
73 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
76 AC_CHECK_HEADER(CUnit/CUnit.h, [AC_DEFINE(ENABLE_TESTS, [], [whether we should compile the test-suite])])
78 AC_CHECK_HEADER(sys/sendfile.h, [AC_DEFINE(LINUX_SENDFILE, [], [whether we have the linux sendfile api])])
79 dnl TODO: we might need to check for the actual syntax....
82 AC_MSG_CHECKING([whether your system knows about splice()])
89 ssize_t sent, pipesize;
90 int fd, SplicePipe[2];
91 pipesize = splice(fd, NULL,
94 SPLICE_F_MORE | SPLICE_F_MOVE|SPLICE_F_NONBLOCK);
98 AC_DEFINE(LINUX_SPLICE, [], [whether we have the linux splice api])
107 AC_MSG_CHECKING([whether your system likes memcpy + HKEY])
116 #include <sys/select.h>
118 #include <sys/types.h>
120 #include "lib/libcitadel.h"
124 memcpy(foo, HKEY("foo"));
132 AC_DEFINE(UNDEF_MEMCPY, [], [whether we need to undefine memcpy])
138 AC_CHECK_HEADERS(iconv.h)
141 dnl Here is the check for a libc integrated iconv
143 [ --disable-iconv do not use iconv charset conversion],
144 ok_iconv=no, ok_iconv=yes)
146 AC_MSG_CHECKING(Checking to see if your system supports iconv)
150 iconv_t ic = (iconv_t)(-1) ;
151 ic = iconv_open("UTF-8", "us-ascii");
166 dnl Check for iconv in external libiconv
167 if test "$ok_iconv" = no; then
168 AC_MSG_CHECKING(Checking for an external libiconv)
169 OLD_LDFLAGS="$LDFLAGS"
170 LDFLAGS="$LDFLAGS -liconv"
174 iconv_t ic = (iconv_t)(-1) ;
175 ic = iconv_open("UTF-8", "us-ascii");
185 LDFLAGS="$OLD_LDFLAGS"
190 if test "$ok_iconv" != "no"; then
191 AC_MSG_RESULT(libcitadel will be built with character set conversion.)
192 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
194 AC_MSG_RESULT(libcitadel will be built without character set conversion.)
197 dnl disable backtrace if we don't want it.
198 AC_ARG_WITH(backtrace,
199 [ --with-backtrace enable backtrace dumps in the syslog],
200 [ if test "x$withval" != "xno" ; then
201 CFLAGS="$CFLAGS -rdynamic "
202 LDFLAGS="$LDFLAGS -rdynamic "
203 AC_CHECK_FUNCS(backtrace)
209 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
210 dnl Checks for the zlib compression library.
211 if test "x$with_zlib" != xno ; then
212 AC_CHECK_HEADERS(zlib.h,
213 [AC_CHECK_LIB(z, zlibVersion,
218 if test "x$ok_zlib" = xyes ; then
220 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
224 dnl Checks for typedefs, structures, and compiler characteristics.
229 AC_CHECK_FUNCS(memmove bcopy)
231 AC_CONFIG_FILES(Makefile libcitadel.pc tests/Makefile)
232 AC_CONFIG_HEADER(sysdep.h)
235 abs_srcdir="`cd $srcdir && pwd`"
237 if test "$abs_srcdir" != "$abs_builddir"; then
240 echo 'zlib compression: ' $ok_zlib
241 echo 'Character set conversion support:' $ok_iconv