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)
10 AC_CONFIG_SRCDIR(tests/Makefile.in)
13 dnl Set LIBREVISION to the ever-ascending libcitadel version number.
15 dnl If the API has changed, increment LIBCURRENT.
21 LIBREVISION=m4_esyscmd_s([grep LIBCITADEL_VERSION lib/libcitadel.h | sed 's/[^0-9]*//g' ])
24 sinclude(conftools/libtool.m4)
25 sinclude(conftools/ac_c_bigendian_cross.m4)
33 dnl Checks for programs.
37 if test "$GCC" = yes ; then
39 dnl Be careful about adding the -fexceptions option; some versions of
40 dnl GCC don't support it and it causes extra warnings that are only
41 dnl distracting; avoid.
43 OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
44 CFLAGS="$OLDCFLAGS -fexceptions"
45 AC_MSG_CHECKING(whether $CC accepts -fexceptions)
48 AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS")
49 CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
52 dnl Checks for header files.
55 AC_CHECK_HEADER(sys/mman.h, [CFLAGS="$CFLAGS -D HAVE_MMAP"])
56 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
57 dnl Checks for the zlib compression library.
58 if test "x$with_zlib" != xno ; then
59 AC_CHECK_HEADERS(zlib.h,
60 [AC_CHECK_LIB(z, zlibVersion,
65 if test "x$ok_zlib" = xyes ; then
67 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
70 AC_CHECK_HEADER(CUnit/CUnit.h, [AC_DEFINE(ENABLE_TESTS, [], [whether we should compile the test-suite])])
72 AC_CHECK_HEADER(sys/sendfile.h, [AC_DEFINE(LINUX_SENDFILE, [], [whether we have the linux sendfile api])])
73 dnl TODO: we might need to check for the actual syntax....
76 AC_MSG_CHECKING([whether your system knows about splice()])
83 ssize_t sent, pipesize;
84 int fd, SplicePipe[2];
85 pipesize = splice(fd, NULL,
88 SPLICE_F_MORE | SPLICE_F_MOVE|SPLICE_F_NONBLOCK);
92 AC_DEFINE(LINUX_SPLICE, [], [whether we have the linux splice api])
101 AC_MSG_CHECKING([whether your system likes memcpy + HKEY])
110 #include <sys/select.h>
112 #include <sys/types.h>
114 #include "lib/libcitadel.h"
118 memcpy(foo, HKEY("foo"));
126 AC_DEFINE(UNDEF_MEMCPY, [], [whether we need to undefine memcpy])
132 AC_CHECK_HEADERS(iconv.h)
135 dnl Here is the check for a libc integrated iconv
137 [ --disable-iconv do not use iconv charset conversion],
138 ok_iconv=no, ok_iconv=yes)
140 AC_MSG_CHECKING(Checking to see if your system supports iconv)
144 iconv_t ic = (iconv_t)(-1) ;
145 ic = iconv_open("UTF-8", "us-ascii");
160 dnl Check for iconv in external libiconv
161 if test "$ok_iconv" = no; then
162 AC_MSG_CHECKING(Checking for an external libiconv)
163 OLD_LDFLAGS="$LDFLAGS"
164 LDFLAGS="$LDFLAGS -liconv"
168 iconv_t ic = (iconv_t)(-1) ;
169 ic = iconv_open("UTF-8", "us-ascii");
179 LDFLAGS="$OLD_LDFLAGS"
184 if test "$ok_iconv" != "no"; then
185 AC_MSG_RESULT(libcitadel will be built with character set conversion.)
186 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
188 AC_MSG_RESULT(libcitadel will be built without character set conversion.)
191 dnl disable backtrace if we don't want it.
192 AC_ARG_WITH(backtrace,
193 [ --with-backtrace enable backtrace dumps in the syslog],
194 [ if test "x$withval" != "xno" ; then
195 CFLAGS="$CFLAGS -rdynamic "
196 LDFLAGS="$LDFLAGS -rdynamic "
197 AC_CHECK_FUNCS(backtrace)
203 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
204 dnl Checks for the zlib compression library.
205 if test "x$with_zlib" != xno ; then
206 AC_CHECK_HEADERS(zlib.h,
207 [AC_CHECK_LIB(z, zlibVersion,
212 if test "x$ok_zlib" = xyes ; then
214 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
218 dnl Checks for typedefs, structures, and compiler characteristics.
223 AC_CHECK_FUNCS(memmove bcopy)
225 AC_CONFIG_FILES(Makefile libcitadel.pc tests/Makefile)
226 AC_CONFIG_HEADER(sysdep.h)
229 abs_srcdir="`cd $srcdir && pwd`"
231 if test "$abs_srcdir" != "$abs_builddir"; then
234 echo 'zlib compression: ' $ok_zlib
235 echo 'Character set conversion support:' $ok_iconv