-dnl configuration script for libcitadel
-dnl Process this file with autoconf to produce a configure script.
-dnl
-
-dnl Ensure that libcitadel is configured with autoconf 2.52 or newer
-AC_PREREQ([2.71])
-AC_INIT([libcitadel],[m4_esyscmd_s(grep LIBCITADEL_VERSION lib/libcitadel.h | sed 's/[^0-9]*//g' )],[http://uncensored.citadel.org])
-AC_CONFIG_SRCDIR(Makefile.in)
-AC_CONFIG_AUX_DIR(conftools)
-
-dnl
-dnl Set LIBREVISION to the ever-ascending libcitadel version number.
-dnl
-dnl If the API has changed, increment LIBCURRENT.
-dnl
-dnl Set LIBAGE to 0.
-dnl
-
-LIBCURRENT=4
-LIBREVISION=m4_esyscmd_s([grep LIBCITADEL_VERSION lib/libcitadel.h | sed 's/[^0-9]*//g' ])
-LIBAGE=0
-
-sinclude(conftools/libtool.m4)
-sinclude(conftools/ac_c_bigendian_cross.m4)
-
-AC_PROG_LIBTOOL
-
-AC_SUBST(LIBCURRENT)
-AC_SUBST(LIBREVISION)
-AC_SUBST(LIBAGE)
-
-dnl Checks for programs.
-AC_PROG_CC
-AC_PROG_INSTALL
-
-if test "$GCC" = yes ; then
- dnl
- dnl Be careful about adding the -fexceptions option; some versions of
- dnl GCC don't support it and it causes extra warnings that are only
- dnl distracting; avoid.
- dnl
- OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes"
- CFLAGS="$OLDCFLAGS -fexceptions"
- AC_MSG_CHECKING(whether $CC accepts -fexceptions)
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS"])
- CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'`
-fi
-
-dnl Checks for header files.
-m4_warn([obsolete],
-[The preprocessor macro `STDC_HEADERS' is obsolete.
- Except in unusual embedded environments, you can safely include all
- ISO C90 headers unconditionally.])dnl
-# Autoupdate added the next two lines to ensure that your configure
-# script's behavior did not change. They are probably safe to remove.
-AC_CHECK_INCLUDES_DEFAULT
-AC_PROG_EGREP
-
-
-AC_CHECK_HEADER(sys/mman.h, [CFLAGS="$CFLAGS -D HAVE_MMAP"])
-AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
-dnl Checks for the zlib compression library.
-if test "x$with_zlib" != xno ; then
- AC_CHECK_HEADERS(zlib.h,
- [AC_CHECK_LIB(z, zlibVersion,
- [ok_zlib=yes],,
- )])
-fi
-
-if test "x$ok_zlib" = xyes ; then
- LIBS="-lz $LIBS"
- AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
-fi
-
-AC_CHECK_HEADER(CUnit/CUnit.h, [AC_DEFINE(ENABLE_TESTS, [], [whether we should compile the test-suite])])
-
-AC_CHECK_HEADER(sys/sendfile.h, [AC_DEFINE(LINUX_SENDFILE, [], [whether we have the linux sendfile api])])
-dnl TODO: we might need to check for the actual syntax....
-
-
-AC_MSG_CHECKING([whether your system knows about splice()])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#define _GNU_SOURCE
-#include <unistd.h>
-#include <fcntl.h>
-]], [[
- ssize_t sent, pipesize;
- int fd, SplicePipe[2];
- pipesize = splice(fd, NULL,
- SplicePipe[1], NULL,
- 1,
- SPLICE_F_MORE | SPLICE_F_MOVE|SPLICE_F_NONBLOCK);
-]])],[
- ok_splice=yes
- AC_DEFINE(LINUX_SPLICE, [], [whether we have the linux splice api])
- AC_MSG_RESULT([yes])
- ],[
- ok_splice=no
- AC_MSG_RESULT([no])
-
-])
-
-AC_MSG_CHECKING([whether your system likes memcpy + HKEY])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#define _GNU_SOURCE
-#include <ctype.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <sys/select.h>
-#include <fcntl.h>
-#include <sys/types.h>
-
-#include "lib/libcitadel.h"
-]], [[
- char foo[22];
- memcpy(foo, HKEY("foo"));
-
-]])],[
-
- AC_MSG_RESULT([yes])
- ],[
- AC_DEFINE(UNDEF_MEMCPY, [], [whether we need to undefine memcpy])
- AC_MSG_RESULT([no])
-
-])
-
-
-AC_CHECK_HEADERS(iconv.h)
-
-
-dnl Here is the check for a libc integrated iconv
-AC_ARG_ENABLE(iconv,
- [ --disable-iconv do not use iconv charset conversion],
- ok_iconv=no, ok_iconv=yes)
-
-AC_MSG_CHECKING(Checking to see if your system supports iconv)
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
- #include <iconv.h>
- main() {
- iconv_t ic = (iconv_t)(-1) ;
- ic = iconv_open("UTF-8", "us-ascii");
- iconv_close(ic);
- exit(0);
- }
- ]])],[
- ok_iconv=yes
- AC_MSG_RESULT([yes])
- ],[
- ok_iconv=no
- AC_MSG_RESULT([no])
-
-],[])
-
-dnl Check for iconv in external libiconv
-if test "$ok_iconv" = no; then
- AC_MSG_CHECKING(Checking for an external libiconv)
- OLD_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -liconv"
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
- #include <iconv.h>
- main() {
- iconv_t ic = (iconv_t)(-1) ;
- ic = iconv_open("UTF-8", "us-ascii");
- iconv_close(ic);
- }
- ]])],[
- ok_iconv=yes
- AC_MSG_RESULT([yes])
- ],[
- ok_iconv=no
- LDFLAGS="$OLD_LDFLAGS"
- AC_MSG_RESULT([no])
-
- ],[])
-fi
-if test "$ok_iconv" != "no"; then
- AC_MSG_RESULT(libcitadel will be built with character set conversion.)
- AC_DEFINE(HAVE_ICONV,[],[whether we have iconv for charset conversion])
-else
- AC_MSG_RESULT(libcitadel will be built without character set conversion.)
-fi
-
-dnl disable backtrace if we don't want it.
-AC_ARG_WITH(backtrace,
- [ --with-backtrace enable backtrace dumps in the syslog],
- [ if test "x$withval" != "xno" ; then
- CFLAGS="$CFLAGS -rdynamic "
- LDFLAGS="$LDFLAGS -rdynamic "
- AC_CHECK_FUNCS(backtrace)
- fi
- ]
-)
-
-
-AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
-dnl Checks for the zlib compression library.
-if test "x$with_zlib" != xno ; then
- AC_CHECK_HEADERS(zlib.h,
- [AC_CHECK_LIB(z, zlibVersion,
- [ok_zlib=yes],,
- )])
-fi
-
-if test "x$ok_zlib" = xyes ; then
- LIBS="-lz $LIBS"
- AC_DEFINE(HAVE_ZLIB,[],[whether we have zlib])
-fi
-
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-
-AC_SUBST(LIBS)
-AC_C_CONST
-AC_TYPE_SIZE_T
-AC_CHECK_FUNCS(memmove bcopy)
-
-AC_CONFIG_FILES(Makefile libcitadel.pc)
-AC_CONFIG_HEADERS([sysdep.h])
-AC_OUTPUT
-
-abs_srcdir="`cd $srcdir && pwd`"
-abs_builddir="`pwd`"
-if test "$abs_srcdir" != "$abs_builddir"; then
- make mkdir-init
-fi
-echo 'zlib compression: ' $ok_zlib
-echo 'Character set conversion support:' $ok_iconv