# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*-
# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
#############################################################################
# Copyright (c) 2002 Pelle Johansson. #
# All rights reserved. #
# #
# This file is part of the moftpd package. Use and distribution of #
# this software is governed by the terms in the file LICENCE, which #
# should have come with this package. #
#############################################################################
# $moftpd: acinclude.m4 1246 2004-12-09 12:31:54Z morth $
# Whether compiling headers or --dump-pch is supported
AC_DEFUN([AC_PRECOMPILE],
[AC_ARG_ENABLE(precompile,
AC_HELP_STRING([--disable-precompile],[Do not use precompiling]))
PRECOMPEXT=".h.gch"
PRECOMP="touch $2.h.gch"
precompiler=none
if test "$enable_precompile" != no; then
AC_CACHE_CHECK([whether ${CC} supports gch precompiled headers],
ac_cv_gch_CC,
[
ac_cv_gch_CC=no
touch conftest.h
if $CC conftest.h > /dev/null 2>&1; then
if test -f conftest.h.gch; then
ac_cv_gch_CC=yes
fi
fi
rm -rf conftest.h conftest.h.gch
])
if test "$ac_cv_gch_CC" != no; then
PRECOMP="${CC} \${CFLAGS} \${DEFS} -o $2.h.gch $1"
precompiler=GNU
else
AC_CACHE_CHECK([whether ${CC} supports pch precompiled headers],
ac_cv_pch_CC,
[ac_cv_pch_CC=no
ac_save_CC=$CC
CC="$CC --dump-pch conftest.$ac_objext"
AC_LANG_CONFTEST([])
AC_COMPILE_IFELSE([],[ac_cv_pch_CC=yes])
CC=$ac_save_CC
rm -rf conftest.$ac_objext])
if test "$ac_cv_pch_CC" != no; then
PRECOMP="${CC} ${CFLAGS} \${DEFS} -x c --dump-pch $2.pch $1"
PRECOMPEXT=".pch"
CFLAGS="${CFLAGS} --load-pch \${topobjdir}/$2.pch"
precompiler=Apple
fi
fi
fi
AC_SUBST(PRECOMP)
AC_SUBST(PRECOMPEXT)
])
AC_DEFUN([AC_NATIVE_CHARSET],
[AC_ARG_WITH(native_charset,
AC_HELP_STRING([--with-native-charset=charset],
[Use specified charset if a string is not
UTF-8. Disable to only use UTF-8. Default is iso8859-15.]),
[ac_native_charset=$withval], [ac_native_charset=iso8859-15])
if test "$ac_native_charset" = no; then
ac_native_charset=None
fi
unset ac_cv_native_charset
AC_CACHE_CHECK([what native charset to use],[ac_cv_native_charset],
[ac_cv_native_charset=$ac_native_charset])
if test "$ac_cv_native_charset" != "None"; then
AC_DEFINE(HAVE_NATIVE_CHARSET,1,[If we're to use a native charset])
native_charset=$ac_cv_native_charset
else
native_charset="none"
fi
AC_SUBST(native_charset)
])
AC_DEFUN([AC_CC_FLAG],
[AS_VAR_PUSHDEF([ac_cc_flag], [ac_cv_cc_flag_$1])
AC_CACHE_CHECK([whether ${CC} accepts $1],
ac_cc_flag,
[ac_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $1"
AC_LANG_CONFTEST([])
AC_COMPILE_IFELSE([],[AS_VAR_SET(ac_cc_flag, yes)],[
AS_VAR_SET(ac_cc_flag, no)
CFLAGS=$ac_save_CFLAGS
])
])
AS_VAR_POPDEF([ac_cc_flag])
])
AC_DEFUN([AC_CHECK_TLS],
[AC_ARG_WITH(tls,
AC_HELP_STRING([--without-tls],[Do not use TLS (formerly SSL)]))
tlshandler=no
warn_gnutls=no
if test "$with_tls" != no; then
use_tls=no
AC_ARG_WITH(gnutls,
AC_HELP_STRING([--without-gnutls],[Do not use the gnutls library.]))
ac_working_gnutls=no
if test "$with_gnutls" != no -a "$with_openssl" != yes; then
AC_CHECK_LIB([gnutls], [gnutls_global_init],
[
AC_CHECK_HEADER([gnutls/gnutls.h],
[
AC_CACHE_CHECK([gnutls version >= 1.0.23], ac_gnutls_v_ok,
[
if pkg-config gnutls --atleast-version=1.0.23 > /dev/null 2>&1; then
AS_VAR_SET(ac_gnutls_v_ok, yes)
else
AS_VAR_SET(ac_gnutls_v_ok, no)
fi
])
if test "$ac_gnutls_v_ok" != yes; then
warn_gnutls=yes
fi
ac_working_gnutls=yes
])
])
fi
if test "$ac_working_gnutls" = "yes"; then
AC_DEFINE(HAVE_GNUTLS,1,[Define if you have working gnutls])
LIBS="-lgnutls $LIBS"
tlshandler=gnutls
tls_obj=tls_gnutls.o
use_tls=yes
else
AC_ARG_WITH(openssl,
AC_HELP_STRING([--without-openssl],[Do not use the OpenSSL library.]))
ac_working_libssl=no
if test "$with_openssl" != no -a "$with_gnutls" != yes; then
AC_CHECK_LIB([crypto], [BIO_new])
AC_CHECK_LIB([ssl], [SSL_library_init],
[
# Questionable if this should be done. Environment should be
# set up correctly before calling configure.
for i in "/usr/kerberos/include"; do
if test -f $i/openssl/ssl.h; then
CFLAGS="$CFLAGS -I$i"
break
fi
done
AC_CHECK_HEADER([openssl/ssl.h],[ac_working_libssl=yes])
])
fi
if test "$ac_working_libssl" = "yes"; then
AC_DEFINE(HAVE_LIBSSL,1,[Define if you have working libssl])
LIBS="-lssl $LIBS"
tlshandler=OpenSSL
tls_obj=tls_openssl.o
use_tls=yes
fi
fi
if test "$use_tls" = "yes"; then
AC_DEFINE(USE_TLS,1,[Define if you want to use TLS])
fi
fi
AC_SUBST(tls_obj)
])
AC_DEFUN([AC_CHECK_LIBPAM],
[AC_ARG_WITH(pam,
AC_HELP_STRING([--without-pam],[Do not use PAM]))
pam_enabled=no
if test "$with_pam" != no; then
AC_CHECK_LIB([pam], [pam_start],
[
AC_CHECK_HEADER([pam/pam_appl.h],
[
ac_working_libpam=yes
AC_DEFINE([HAVE_PAM_PAM_APPL_H],1,[Define if you have <pam/pam_appl.h>])
],
[
AC_CHECK_HEADER([security/pam_appl.h],
[
ac_working_libpam=yes
AC_DEFINE([HAVE_SECURITY_PAM_APPL_H],1,[Define if you have <security/pam_appl.h>])
])
])
])
if test "$ac_working_libpam" = "yes"; then
AC_DEFINE(HAVE_LIBPAM,1,[Define if you have working libpam])
LIBS="-lpam $LIBS"
pam_enabled=yes
AC_CACHE_CHECK([whether PAM uses const],
ac_cv_pam_const,
[ac_cv_pam_const=yes
ac_save_CC=$CC
CC="$CC -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_PAM_PAM_APPL_H
#include <pam/pam_appl.h>
#endif
#ifdef HAVE_SECURITY_PAM_APPL_H
#include <security/pam_appl.h>
#endif
]],[[
void *ptr;
(void)pam_get_item (NULL, 0, &ptr);
]])], [ac_cv_pam_const=no])
CC=$ac_save_CC
])
if test "$ac_cv_pam_const" = no; then
pam_const=""
else
pam_const="const"
fi
AC_DEFINE_UNQUOTED(PAM_CONST,$pam_const,[Define to const if needed by PAM])
else
$1
fi
fi
AC_SUBST(pam_enabled)
])
AC_DEFUN([AC_CHECK_SQL],
[AC_ARG_WITH(sql,
AC_HELP_STRING([--without-sql],[Don't use SQL]))
if test "$with_sql" != no; then
use_sql=no
# Sigh why do they use a subdir?
# Is this compatible with others than bash?
save_IFS="$IFS"
IFS=':'
for i in ${LIBRARY_PATH} /usr/local/lib /usr/lib; do
if test -d $i/mysql; then
LDFLAGS="$LDFLAGS -L$i/mysql"
break
fi
done
IFS="$save_IFS"
AC_SEARCH_LIBS([compress], [z])
AC_CHECK_LIB([mysqlclient], [mysql_real_connect],
[
AC_CHECK_HEADER([mysql/mysql.h],
[
use_sql=yes
AC_DEFINE([HAVE_MYSQL],1,[Define if you have MySQL])
LIBS="-lmysqlclient $LIBS"
sqlhandlers="$sqlhandlers MySQL"
AC_CHECK_FUNCS(mysql_ssl_set)
])
])
if test "$use_sql" = "yes"; then
AC_DEFINE(USE_SQL,1,[Define if you want to use SQL])
fi
fi
if test -z "$sqlhandlers"; then
sqlhandlers=no
fi
])
AC_DEFUN([AC_CHECK_EPOLL],
[
AC_ARG_ENABLE(epoll,
AC_HELP_STRING([--disable-epoll],[Do not use epoll])
AC_HELP_STRING([--enable-epoll],[Use epoll even if check fails]))
ac_have_epoll=no
if test "$enable_epoll" = yes; then
ac_have_epoll=yes
elif test "$enable_epoll" != no; then
AC_SEARCH_LIBS([epoll_create], [epoll],
[
AC_CACHE_CHECK([whether epoll works], ac_cv_working_epoll,
[
ac_cv_working_epoll=no
AC_RUN_IFELSE(AC_LANG_PROGRAM([[
#include <sys/epoll.h>
]], [[
if (epoll_create (1) < 0)
return 1;
return 0;
]]), [ac_cv_working_epoll=yes], [], [ac_cv_working_epoll=no;echo $ECHO_N "(crosscompiling) $ECHO_C"])
])
if test "$ac_cv_working_epoll" = "yes"; then
ac_have_epoll=yes
fi
])
fi
if test "$ac_have_epoll" = "yes"; then
$1
else
$2
fi
])
syntax highlighted by Code2HTML, v. 0.9.1