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)
45 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS"])
46 CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
49 dnl Checks for header files.
51 [The preprocessor macro `STDC_HEADERS' is obsolete.
52 Except in unusual embedded environments, you can safely include all
53 ISO C90 headers unconditionally.])dnl
54 # Autoupdate added the next two lines to ensure that your configure
55 # script's behavior did not change. They are probably safe to remove.
56 AC_CHECK_INCLUDES_DEFAULT
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()])
82 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
87 ssize_t sent, pipesize;
88 int fd, SplicePipe[2];
89 pipesize = splice(fd, NULL,
92 SPLICE_F_MORE | SPLICE_F_MOVE|SPLICE_F_NONBLOCK);
95 AC_DEFINE(LINUX_SPLICE, [], [whether we have the linux splice api])
103 AC_MSG_CHECKING([whether your system likes memcpy + HKEY])
104 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
112 #include <sys/select.h>
114 #include <sys/types.h>
116 #include "lib/libcitadel.h"
119 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)
140 AC_RUN_IFELSE([AC_LANG_SOURCE([[
143 iconv_t ic = (iconv_t)(-1) ;
144 ic = iconv_open("UTF-8", "us-ascii");
157 dnl Check for iconv in external libiconv
158 if test "$ok_iconv" = no; then
159 AC_MSG_CHECKING(Checking for an external libiconv)
160 OLD_LDFLAGS="$LDFLAGS"
161 LDFLAGS="$LDFLAGS -liconv"
162 AC_RUN_IFELSE([AC_LANG_SOURCE([[
165 iconv_t ic = (iconv_t)(-1) ;
166 ic = iconv_open("UTF-8", "us-ascii");
174 LDFLAGS="$OLD_LDFLAGS"
179 if test "$ok_iconv" != "no"; then
180 AC_MSG_RESULT(libcitadel will be built with character set conversion.)
181 AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
183 AC_MSG_RESULT(libcitadel will be built without character set conversion.)
186 dnl disable backtrace if we don't want it.
187 AC_ARG_WITH(backtrace,
188 [ --with-backtrace enable backtrace dumps in the syslog],
189 [ if test "x$withval" != "xno" ; then
190 CFLAGS="$CFLAGS -rdynamic "
191 LDFLAGS="$LDFLAGS -rdynamic "
192 AC_CHECK_FUNCS(backtrace)
198 AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
199 dnl Checks for the zlib compression library.
200 if test "x$with_zlib" != xno ; then
201 AC_CHECK_HEADERS(zlib.h,
202 [AC_CHECK_LIB(z, zlibVersion,
207 if test "x$ok_zlib" = xyes ; then
209 AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
213 dnl Checks for typedefs, structures, and compiler characteristics.
218 AC_CHECK_FUNCS(memmove bcopy)
220 AC_CONFIG_FILES(Makefile libcitadel.pc)
221 AC_CONFIG_HEADERS([sysdep.h])
224 abs_srcdir="`cd $srcdir && pwd`"
226 if test "$abs_srcdir" != "$abs_builddir"; then
229 echo 'zlib compression: ' $ok_zlib
230 echo 'Character set conversion support:' $ok_iconv