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, 904, http://uncensored.citadel.org)
10 AC_CONFIG_SRCDIR(Makefile.in)
11 AC_CONFIG_AUX_DIR(conftools)
12 AC_CONFIG_SRCDIR(tests/Makefile.in)
15 dnl Set LIBREVISION to the ever-ascending libcitadel version number.
17 dnl If the API has changed, increment LIBCURRENT.
26 sinclude(conftools/libtool.m4)
27 sinclude(conftools/ac_c_bigendian_cross.m4)
35 dnl Checks for programs.
39 if test "$GCC" = yes ; then
41 dnl Be careful about adding the -fexceptions option; some versions of
42 dnl GCC don't support it and it causes extra warnings that are only
43 dnl distracting; avoid.
45 OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
46 CFLAGS="$OLDCFLAGS -fexceptions"
47 AC_MSG_CHECKING(whether $CC accepts -fexceptions)
50 AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
51 CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
54 dnl Checks for header files.
57 AC_CHECK_HEADER(sys/mman.h, [CFLAGS="$CFLAGS -D HAVE_MMAP"])
58 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
59 dnl Checks for the zlib compression library.
60 if test "x$with_zlib" != xno ; then
61 AC_CHECK_HEADERS(zlib.h,
62 [AC_CHECK_LIB(z, zlibVersion,
67 if test "x$ok_zlib" = xyes ; then
69 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
72 AC_CHECK_HEADER(CUnit/CUnit.h, [AC_DEFINE(ENABLE_TESTS, [], [whether we should compile the test-suite])])
74 AC_CHECK_HEADER(sys/sendfile.h, [AC_DEFINE(LINUX_SENDFILE, [], [whether we have the linux sendfile api])])
75 dnl TODO: we might need to check for the actual syntax....
78 AC_MSG_CHECKING([whether your system knows about splice()])
85 ssize_t sent, pipesize;
86 int fd, SplicePipe[2];
87 pipesize = splice(fd, NULL,
90 SPLICE_F_MORE | SPLICE_F_MOVE|SPLICE_F_NONBLOCK);
94 AC_DEFINE(LINUX_SPLICE, [], [whether we have the linux splice api])
103 AC_MSG_CHECKING([whether your system likes memcpy + HKEY])
112 #include <sys/select.h>
114 #include <sys/types.h>
116 #include "lib/libcitadel.h"
120 memcpy(foo, HKEY("foo"));
128 AC_DEFINE(UNDEF_MEMCPY, [], [whether we need to undefine memcpy])
134 AC_CHECK_HEADERS(iconv.h)
137 dnl Here is the check for a libc integrated iconv
139 [ --disable-iconv do not use iconv charset conversion],
140 ok_iconv=no, ok_iconv=yes)
142 AC_MSG_CHECKING(Checking to see if your system supports iconv)
146 iconv_t ic = (iconv_t)(-1) ;
147 ic = iconv_open("UTF-8", "us-ascii");
162 dnl Check for iconv in external libiconv
163 if test "$ok_iconv" = no; then
164 AC_MSG_CHECKING(Checking for an external libiconv)
165 OLD_LDFLAGS="$LDFLAGS"
166 LDFLAGS="$LDFLAGS -liconv"
170 iconv_t ic = (iconv_t)(-1) ;
171 ic = iconv_open("UTF-8", "us-ascii");
181 LDFLAGS="$OLD_LDFLAGS"
186 if test "$ok_iconv" != "no"; then
187 AC_MSG_RESULT(libcitadel will be built with character set conversion.)
188 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
190 AC_MSG_RESULT(libcitadel will be built without character set conversion.)
193 dnl disable backtrace if we don't want it.
194 AC_ARG_WITH(backtrace,
195 [ --with-backtrace enable backtrace dumps in the syslog],
196 [ if test "x$withval" != "xno" ; then
197 CFLAGS="$CFLAGS -rdynamic "
198 LDFLAGS="$LDFLAGS -rdynamic "
199 AC_CHECK_FUNCS(backtrace)
205 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
206 dnl Checks for the zlib compression library.
207 if test "x$with_zlib" != xno ; then
208 AC_CHECK_HEADERS(zlib.h,
209 [AC_CHECK_LIB(z, zlibVersion,
214 if test "x$ok_zlib" = xyes ; then
216 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
220 dnl Checks for typedefs, structures, and compiler characteristics.
225 AC_CHECK_FUNCS(memmove bcopy)
227 AC_CONFIG_FILES(Makefile libcitadel.pc tests/Makefile)
228 AC_CONFIG_HEADER(sysdep.h)
231 abs_srcdir="`cd $srcdir && pwd`"
233 if test "$abs_srcdir" != "$abs_builddir"; then
236 echo 'zlib compression: ' $ok_zlib
237 echo 'Character set conversion support:' $ok_iconv