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
7 AC_INIT([libcitadel], m4_esyscmd_s([grep LIBCITADEL_VERSION lib/libcitadel.h | sed 's/[^0-9]*//g' ]),[http://uncensored.citadel.org])
8 AC_CONFIG_SRCDIR(Makefile.in)
9 AC_CONFIG_AUX_DIR(conftools)
12 dnl Set LIBREVISION to the ever-ascending libcitadel version number.
14 dnl If the API has changed, increment LIBCURRENT.
20 LIBREVISION=m4_esyscmd_s([grep LIBCITADEL_VERSION lib/libcitadel.h | sed 's/[^0-9]*//g' ])
23 sinclude(conftools/libtool.m4)
24 sinclude(conftools/ac_c_bigendian_cross.m4)
32 dnl Checks for programs.
36 if test "$GCC" = yes ; then
38 dnl Be careful about adding the -fexceptions option; some versions of
39 dnl GCC don't support it and it causes extra warnings that are only
40 dnl distracting; avoid.
42 OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
43 CFLAGS="$OLDCFLAGS -fexceptions"
44 AC_MSG_CHECKING(whether $CC accepts -fexceptions)
47 AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
48 CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
51 dnl Checks for header files.
54 AC_CHECK_HEADER(sys/mman.h, [CFLAGS="$CFLAGS -D HAVE_MMAP"])
55 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
56 dnl Checks for the zlib compression library.
57 if test "x$with_zlib" != xno ; then
58 AC_CHECK_HEADERS(zlib.h,
59 [AC_CHECK_LIB(z, zlibVersion,
64 if test "x$ok_zlib" = xyes ; then
66 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
69 AC_CHECK_HEADER(CUnit/CUnit.h, [AC_DEFINE(ENABLE_TESTS, [], [whether we should compile the test-suite])])
71 AC_CHECK_HEADER(sys/sendfile.h, [AC_DEFINE(LINUX_SENDFILE, [], [whether we have the linux sendfile api])])
72 dnl TODO: we might need to check for the actual syntax....
75 AC_MSG_CHECKING([whether your system knows about splice()])
82 ssize_t sent, pipesize;
83 int fd, SplicePipe[2];
84 pipesize = splice(fd, NULL,
87 SPLICE_F_MORE | SPLICE_F_MOVE|SPLICE_F_NONBLOCK);
91 AC_DEFINE(LINUX_SPLICE, [], [whether we have the linux splice api])
100 AC_MSG_CHECKING([whether your system likes memcpy + HKEY])
109 #include <sys/select.h>
111 #include <sys/types.h>
113 #include "lib/libcitadel.h"
117 memcpy(foo, HKEY("foo"));
125 AC_DEFINE(UNDEF_MEMCPY, [], [whether we need to undefine memcpy])
131 AC_CHECK_HEADERS(iconv.h)
134 dnl Here is the check for a libc integrated iconv
136 [ --disable-iconv do not use iconv charset conversion],
137 ok_iconv=no, ok_iconv=yes)
139 AC_MSG_CHECKING(Checking to see if your system supports iconv)
143 iconv_t ic = (iconv_t)(-1) ;
144 ic = iconv_open("UTF-8", "us-ascii");
159 dnl Check for iconv in external libiconv
160 if test "$ok_iconv" = no; then
161 AC_MSG_CHECKING(Checking for an external libiconv)
162 OLD_LDFLAGS="$LDFLAGS"
163 LDFLAGS="$LDFLAGS -liconv"
167 iconv_t ic = (iconv_t)(-1) ;
168 ic = iconv_open("UTF-8", "us-ascii");
178 LDFLAGS="$OLD_LDFLAGS"
183 if test "$ok_iconv" != "no"; then
184 AC_MSG_RESULT(libcitadel will be built with character set conversion.)
185 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
187 AC_MSG_RESULT(libcitadel will be built without character set conversion.)
190 dnl disable backtrace if we don't want it.
191 AC_ARG_WITH(backtrace,
192 [ --with-backtrace enable backtrace dumps in the syslog],
193 [ if test "x$withval" != "xno" ; then
194 CFLAGS="$CFLAGS -rdynamic "
195 LDFLAGS="$LDFLAGS -rdynamic "
196 AC_CHECK_FUNCS(backtrace)
202 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
203 dnl Checks for the zlib compression library.
204 if test "x$with_zlib" != xno ; then
205 AC_CHECK_HEADERS(zlib.h,
206 [AC_CHECK_LIB(z, zlibVersion,
211 if test "x$ok_zlib" = xyes ; then
213 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
217 dnl Checks for typedefs, structures, and compiler characteristics.
222 AC_CHECK_FUNCS(memmove bcopy)
224 AC_CONFIG_FILES(Makefile libcitadel.pc)
225 AC_CONFIG_HEADER(sysdep.h)
228 abs_srcdir="`cd $srcdir && pwd`"
230 if test "$abs_srcdir" != "$abs_builddir"; then
233 echo 'zlib compression: ' $ok_zlib
234 echo 'Character set conversion support:' $ok_iconv