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, 2.8.12, 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 Increment LIBREVISION if source code has changed at all
17 dnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0
19 dnl If the API changes compatibly (i.e. simply adding a new function
20 dnl without changing or removing earlier interfaces), then increment LIBAGE.
22 dnl If the API changes incompatibly set LIBAGE back to 0
29 sinclude(conftools/libtool.m4)
30 sinclude(conftools/ac_c_bigendian_cross.m4)
38 dnl Checks for programs.
42 if test "$GCC" = yes ; then
44 dnl Be careful about adding the -fexceptions option; some versions of
45 dnl GCC don't support it and it causes extra warnings that are only
46 dnl distracting; avoid.
48 OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
49 CFLAGS="$OLDCFLAGS -fexceptions"
50 AC_MSG_CHECKING(whether $CC accepts -fexceptions)
53 AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
54 CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
57 dnl Checks for header files.
60 AC_CHECK_HEADER(sys/mman.h, [CFLAGS="$CFLAGS -D HAVE_MMAP"])
61 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
62 dnl Checks for the zlib compression library.
63 if test "x$with_zlib" != xno ; then
64 AC_CHECK_HEADERS(zlib.h,
65 [AC_CHECK_LIB(z, zlibVersion,
70 if test "x$ok_zlib" = xyes ; then
72 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
75 AC_CHECK_HEADER(CUnit/CUnit.h, [AC_DEFINE(ENABLE_TESTS, [], [whether we should compile the test-suite])])
77 AC_CHECK_HEADER(sys/sendfile.h, [AC_DEFINE(LINUX_SENDFILE, [], [whether we have the linux sendfile api])])
78 dnl TODO: we might need to check for the actual syntax....
81 AC_MSG_CHECKING([whether your system knows about splice()])
88 ssize_t sent, pipesize;
89 int fd, SplicePipe[2];
90 pipesize = splice(fd, NULL,
93 SPLICE_F_MORE | SPLICE_F_MOVE|SPLICE_F_NONBLOCK);
97 AC_DEFINE(LINUX_SPLICE, [], [whether we have the linux splice api])
107 AC_CHECK_HEADERS(iconv.h)
110 dnl Here is the check for a libc integrated iconv
112 [ --disable-iconv do not use iconv charset conversion],
113 ok_iconv=no, ok_iconv=yes)
115 AC_MSG_CHECKING(Checking to see if your system supports iconv)
119 iconv_t ic = (iconv_t)(-1) ;
120 ic = iconv_open("UTF-8", "us-ascii");
135 dnl Check for iconv in external libiconv
136 if test "$ok_iconv" = no; then
137 AC_MSG_CHECKING(Checking for an external libiconv)
138 OLD_LDFLAGS="$LDFLAGS"
139 LDFLAGS="$LDFLAGS -liconv"
143 iconv_t ic = (iconv_t)(-1) ;
144 ic = iconv_open("UTF-8", "us-ascii");
154 LDFLAGS="$OLD_LDFLAGS"
159 if test "$ok_iconv" != "no"; then
160 AC_MSG_RESULT(libcitadel will be built with character set conversion.)
161 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
163 AC_MSG_RESULT(libcitadel will be built without character set conversion.)
166 dnl disable backtrace if we don't want it.
167 AC_ARG_WITH(backtrace,
168 [ --with-backtrace enable backtrace dumps in the syslog],
169 [ if test "x$withval" != "xno" ; then
170 CFLAGS="$CFLAGS -rdynamic "
171 LDFLAGS="$LDFLAGS -rdynamic "
172 AC_CHECK_FUNCS(backtrace)
178 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
179 dnl Checks for the zlib compression library.
180 if test "x$with_zlib" != xno ; then
181 AC_CHECK_HEADERS(zlib.h,
182 [AC_CHECK_LIB(z, zlibVersion,
187 if test "x$ok_zlib" = xyes ; then
189 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
193 dnl Checks for typedefs, structures, and compiler characteristics.
198 AC_CHECK_FUNCS(memmove bcopy)
200 AC_CONFIG_FILES(Makefile libcitadel.pc tests/Makefile)
201 AC_CONFIG_HEADER(sysdep.h)
204 abs_srcdir="`cd $srcdir && pwd`"
206 if test "$abs_srcdir" != "$abs_builddir"; then
209 echo 'zlib compression: ' $ok_zlib
210 echo 'Character set conversion support:' $ok_iconv