dnl jabberd2 configure script
dnl $Id: configure.in,v 1.1 2006/03/14 23:27:24 peralta Exp $
dnl
dnl autoconf setup
dnl
AC_PREREQ(2.57)
dnl startup
AC_INIT(jabberd, 2.0s9)
AM_INIT_AUTOMAKE
dnl copyright
AC_COPYRIGHT([Copyright (c) 2002-2004 Robert Norris
This configure script may be copied, distributed and modified under the
terms of the jabberd license; see COPYING for more details.])
dnl identify the source tree
AC_CONFIG_SRCDIR(sx/sx.h)
dnl output config header
AM_CONFIG_HEADER(config.h)
dnl
dnl build environment setup
dnl
dnl developer flags
AC_ARG_ENABLE(developer, AC_HELP_STRING([--enable-developer], [Compile with warnings and debugging symbols]),
CFLAGS="-Wall -g $CFLAGS")
dnl basic tools
AC_PROG_CC
AC_PROG_MAKE_SET
dnl need libtool for internal linking
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
dnl use libtool to compile checks
ac_link="${SHELL} ${srcdir}/libtool --mode=link $ac_link"
dnl
dnl extra paths
dnl
AC_ARG_WITH(extra_include_path, AC_HELP_STRING([--with-extra-include-path],
[use additional include paths]),
extra_include_path=$withval)
split_includes="`echo $extra_include_path | sed -e 's/:/ /g'`"
for incpath in $split_includes ; do
CPPFLAGS="-I$incpath $CPPFLAGS"
done
AC_ARG_WITH(extra_library_path, AC_HELP_STRING([--with-extra-library-path],
[use additional library paths]),
extra_library_path=$withval)
split_libs="`echo $extra_library_path | sed -e 's/:/ /g'`"
for libpath in $split_libs ; do
LDFLAGS="-L$libpath $LDFLAGS"
done
dnl
dnl header checks
dnl
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
# Two-step header checking. First check for headers which don't
# require any other headers.
AC_CHECK_HEADERS( \
arpa/inet.h \
arpa/nameser.h \
fcntl.h \
netinet/in.h \
signal.h \
sys/filio.h \
sys/ioctl.h \
sys/types.h \
sys/socket.h \
sys/stat.h \
sys/time.h \
sys/timeb.h \
sys/utsname.h \
syslog.h \
unistd.h \
windows.h \
winsock2.h)
# Now check for those headers that do, including all the required
# headers.
AC_CHECK_HEADERS(resolv.h windns.h,,,
[#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif])
dnl
dnl quirky functions
dnl
AC_CHECK_FUNC(connect, ,[AC_CHECK_LIB(socket, connect)])
AC_CHECK_LIB(ws2_32, _head_libws2_32_a)
AC_CHECK_FUNC(gethostbyname, ,[AC_CHECK_LIB(resolv, gethostbyname)])
AC_CHECK_FUNC(gethostbyname, ,[AC_CHECK_LIB(nsl, gethostbyname)])
if test "x$ac_cv_lib_nsl_gethostbyname" != "xyes" && test "x$ac_cv_func_gethostbyname" != "xyes" ; then
AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(socket, gethostbyname)])
fi
if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname" ; then
AC_MSG_CHECKING([if we can include libnsl + libsocket])
LIBS="-lnsl -lsocket $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[(void) gethostbyname]])],[my_ac_link_result=yes],[my_ac_link_result=no ])
if test "$my_ac_link_result" = "no" ; then
AC_MSG_RESULT([failure])
AC_MSG_ERROR([unable to use gethostbyname()])
else
AC_MSG_RESULT([success])
fi
fi
dnl res_query has been seen in libc, libbind and libresolv
if test "x-$ac_cv_header_resolv_h" = "x-yes" ; then
AC_CHECK_FUNCS(res_query)
if test "x-$ac_cv_func_res_query" = "x-yes" ; then
have_res_query=yes
else
AC_CHECK_LIB(resolv, res_query)
if test "x-$ac_cv_lib_resolv_res_query" = "x-yes" ; then
have_res_query=yes
else
AC_CHECK_LIB(bind, res_query)
if test "x-$ac_cv_lib_bind_res_query" = "x-yes" ; then
have_res_query=yes
else
dnl some glibcs have res_query as a macro, so work around it
AC_MSG_CHECKING([for res_query in -lresolv (alternate version)])
save_libs="$LIBS"
LIBS="-lresolv $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <resolv.h>]],
[[res_query(0,0,0,0,0)]])],
[AC_MSG_RESULT(yes)
have_res_query=yes],
[AC_MSG_RESULT(no)
LIBS="$save_libs"])
fi
fi
fi
fi
dnl windows calls it DnsQuery
if test "x-$ac_cv_header_windns_h" = "x-yes" ; then
AC_MSG_CHECKING([for DnsQuery in -ldnsapi])
save_libs="$LIBS"
LIBS="-ldnsapi $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>
#include <windns.h>]],
[[DnsQuery(0,0,0,0,0,0)]])],
[AC_MSG_RESULT(yes)
have_dnsquery=yes],
[AC_MSG_RESULT(no)
LIBS="$save_libs"])
fi
if test "x-$have_res_query" = "x-yes" ; then
AC_DEFINE(HAVE_RES_QUERY,1,[Define to 1 if you have the 'res_query' function.])
elif test "x-$have_dnsquery" = "x-yes" ; then
AC_DEFINE(HAVE_DNSQUERY,1,[Define to 1 if you have the 'DnsQuery' function.])
else
AC_MSG_ERROR([no DNS resolver interface (res_query or DnsQuery) found])
fi
dnl inet_ntop/inet_pton have been seen in -lnsl, and sometimes not at all
AC_CHECK_FUNC(inet_ntop, ,[AC_CHECK_LIB(nsl, inet_ntop)])
unset ac_cv_func_inet_ntop
AC_CHECK_FUNCS(inet_ntop inet_pton)
dnl some glibcs have broken sockaddr_storage members
if test "x-$ac_cv_type_struct_sockaddr_storage" = "x-yes" ; then
AC_MSG_CHECKING(for broken __ss_family member in struct sockaddr_storage)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(_IP6_INCLUDES,
[[do {
struct sockaddr_storage s;
s.__ss_family = 0;
} while(0)]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(ss_family, __ss_family,
[Define to '__ss_family' if 'struct sockaddr_storage' defines '__ss_family' instead of 'ss_family'.])],
AC_MSG_RESULT(no))
AC_MSG_CHECKING(for broken __ss_len member in struct sockaddr_storage)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(_IP6_INCLUDES,
[[do {
struct sockaddr_storage s;
s.__ss_len = 0;
} while(0)]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(ss_len, __ss_len,
[Define to '__ss_len' if 'struct sockaddr_storage' defines '__ss_len' instead of 'ss_len'.])],
AC_MSG_RESULT(no))
fi
dnl syslog
if test "x-$ac_cv_header_syslog_h" = "x-yes" ; then
AC_CHECK_FUNCS(syslog)
fi
if test "x-$ac_cv_header_windows_h" = "x-yes" ; then
AC_MSG_CHECKING(for ReportEvent)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>]],
[[ReportEvent(0,0,0,0,0,0,0,0,0)]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_REPORTEVENT,1,[Define to 1 if you have the 'ReportEvent' function.])],
AC_MSG_RESULT(no))
fi
dnl snprintf/vsnprintf don't exist everywhere. additionally, we require
dnl them to gracefully accept NULLs, which is non-standard
AC_CHECK_FUNCS(snprintf vsnprintf)
if test "x-$ac_cv_func_snprintf" = "x-yes" ; then
AC_MSG_CHECKING([if snprintf can handle NULL arguments])
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
#include <signal.h>
segv() { exit(1); }
main() { char b[10]; signal(SIGSEGV,segv); snprintf(b,10,"%s",NULL); exit(0); }]])],
AC_MSG_RESULT(yes),
[AC_MSG_RESULT(no)
AC_DEFINE(HAVE_BROKEN_SNPRINTF,1,[Define to 1 if 'snprintf' cannot handle NULL arguments.])])
fi
if test "x-$ac_cv_func_vsnprintf" = "x-yes" ; then
AC_MSG_CHECKING([if vsnprintf can handle NULL arguments])
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
#include <signal.h>
#include <stdarg.h>
segv() { exit(1); }
expand(char *f,...) { va_list ap; char b[10]; va_start(ap,f); vsnprintf(b,10,f,ap); va_end(ap); }
main() { char b[10]; signal(SIGSEGV,segv); expand("%s", NULL); exit(0); }]])],
AC_MSG_RESULT(yes),
[AC_MSG_RESULT(no)
AC_DEFINE(HAVE_BROKEN_VSNPRINTF,1,[Define to 1 if 'vsnprintf' cannot handle NULL arguments.])])
fi
dnl
dnl external packages
dnl
dnl find libidn >= 0.3.0
AC_ARG_ENABLE(idn, AC_HELP_STRING([--enable-idn], [enable IDN support (yes)]), want_idn=$enableval, want_idn=yes)
if test "x-$want_idn" = "x-yes" ; then
AC_CHECK_HEADERS(stringprep.h)
if test "x-$ac_cv_header_stringprep_h" = "x-yes" ; then
AC_CHECK_LIB(idn, stringprep_check_version)
fi
if test "x-$ac_cv_lib_idn_stringprep_check_version" = "x-yes" ; then
AC_MSG_CHECKING(for Libidn version >= 0.3.0)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <stringprep.h>]],
[[return !(stringprep_check_version("0.3.0"))]])],
[AC_MSG_RESULT(yes)
have_idn=yes],
AC_MSG_RESULT(no))
fi
if test "x-$have_idn" = "x-" ; then
AC_MSG_ERROR([Libidn >= 0.3.0 not found])
fi
AC_DEFINE(HAVE_IDN,1,[Define to 1 if Libidn is available.])
fi
AC_CHECK_LIB(sasl2,sasl_client_init)
dnl find openssl >= 0.9.6b
AC_ARG_ENABLE(ssl, AC_HELP_STRING([--enable-ssl], [enable SSL/TLS support (yes)]), want_ssl=$enableval, want_ssl=yes)
if test "x-$want_ssl" = "x-yes" ; then
AC_CHECK_HEADERS(openssl/crypto.h)
if test "x-$ac_cv_header_openssl_crypto_h" = "x-yes" ; then
AC_CHECK_LIB(crypto, CRYPTO_lock)
fi
if test "x-$ac_cv_lib_crypto_CRYPTO_lock" = "x-yes" ; then
AC_CHECK_HEADERS(openssl/ssl.h)
fi
if test "x-$ac_cv_header_openssl_ssl_h" = "x-yes" ; then
AC_CHECK_LIB(ssl, SSL_connect)
fi
if test "x-$ac_cv_lib_ssl_SSL_connect" = "x-yes" ; then
AC_MSG_CHECKING(for OpenSSL version >= 0.9.6b)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <openssl/opensslv.h>]],
[[return !(SSLeay() >= 0x000906020L)]])],
[AC_MSG_RESULT(yes)
have_openssl=yes],
AC_MSG_RESULT(no))
fi
if test "x-$have_openssl" = "x-" ; then
AC_MSG_ERROR([OpenSSL >= 0.9.6b not found])
fi
AC_DEFINE(HAVE_SSL,1,[Define to 1 if OpenSSL is available.])
fi
dnl
dnl optional libs
dnl
dnl mysql
AC_ARG_ENABLE(mysql, AC_HELP_STRING([--enable-mysql], [enable MySQL auth/reg/storage support (yes)]),
want_mysql=$enableval, want_mysql=yes)
if test "x-$want_mysql" = "x-yes" ; then
AC_CHECK_HEADERS(mysql.h)
if test "x-$ac_cv_header_mysql_h" != "x-yes" ; then
for incpath in /usr/include/mysql /usr/local/include/mysql; do
if test "x-$ac_cv_header_mysql_h" != "x-yes" ; then
AC_MSG_CHECKING([for mysql.h in $incpath])
save_cppflags="$CPPFLAGS"
CPPFLAGS="-I$incpath $CPPFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <mysql.h>]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_MYSQL_H,,[Define if you have mysql.h])
ac_cv_header_mysql_h=yes],
AC_MSG_RESULT(no))
if test "x-$ac_cv_header_mysql_h" != "x-yes" ; then
CPPFLAGS="$save_cppflags"
fi
fi
done
fi
if test "x-$ac_cv_header_mysql_h" = "x-yes" ; then
AC_CHECK_LIB(mysqlclient, mysql_init)
fi
if test "x-$ac_cv_lib_mysqlclient_mysql_init" != "x-yes" ; then
AC_MSG_ERROR([MySQL client libraries not found])
else
AC_DEFINE(STORAGE_MYSQL,1,[Define to 1 if you want to use MySQL for auth/reg/storage.])
fi
fi
dnl postgresql
AC_ARG_ENABLE(pgsql, AC_HELP_STRING([--enable-pgsql], [enable PostgreSQL auth/reg/storage support (no)]),
want_pgsql=$enableval, want_pgsql=no)
if test "x-$want_pgsql" = "x-yes" ; then
AC_CHECK_HEADERS(libpq-fe.h)
if test "x-$ac_cv_header_libpq_fe_h" != "x-yes" ; then
for incpath in /usr/include/postgresql /usr/local/include/postgresql; do
if test "x-$ac_cv_header_libpq_fe_h" != "x-yes" ; then
AC_MSG_CHECKING([for libpq-fe.h in $incpath])
save_cppflags="$CPPFLAGS"
CPPFLAGS="-I$incpath $CPPFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libpq-fe.h>]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBPQ_FE_H,,[Define if you have libpq_fe.h])
ac_cv_header_libpq_fe_h=yes],
AC_MSG_RESULT(no))
if test "x-$ac_cv_header_libpq_fe_h" != "x-yes" ; then
CPPFLAGS="$save_cppflags"
fi
fi
done
fi
if test "x-$ac_cv_header_libpq_fe_h" = "x-yes" ; then
AC_CHECK_LIB(pq, PQsetdbLogin)
fi
if test "x-$ac_cv_lib_pq_PQsetdbLogin" != "x-yes" ; then
AC_MSG_ERROR([PostgreSQL client libraries not found])
else
AC_DEFINE(STORAGE_PGSQL,1,[Define to 1 if you want to use PostgreSQL for auth/reg/storage.])
fi
fi
dnl SQLite 3
AC_ARG_ENABLE(sqlite, AC_HELP_STRING([--enable-sqlite], [enable SQLite 3 storage support (no)]),
want_sqlite=$enableval, want_sqlite=no)
if test "x-$want_sqlite" = "x-yes" ; then
AC_CHECK_HEADERS(sqlite3.h)
if test "x-$ac_cv_header_sqlite3_h" = "x-yes" ; then
AC_CHECK_LIB(sqlite3, sqlite3_open)
fi
if test "x-$ac_cv_lib_sqlite3_sqlite3_open" != "x-yes" ; then
AC_MSG_ERROR([SQLite 3 library not found])
else
AC_DEFINE(STORAGE_SQLITE,1,[Define to 1 if you want to use SQLite 3 for storage.])
fi
fi
dnl berkeley db
AC_ARG_ENABLE(db, AC_HELP_STRING([--enable-db], [enable Berkeley DB auth/reg/storage support (no)]),
want_db=$enableval, want_db=no)
if test "x-$want_db" = "x-yes" ; then
AC_CHECK_HEADERS(db.h)
if test "x-$ac_cv_header_db_h" = "x-yes" ; then
for lib in db-4.2 db-4.1 db-4 db4 db ; do
if test "x-$have_db_version" != "x-yes" ; then
AC_MSG_CHECKING([for db_create in -l$lib])
save_libs="$LIBS"
LIBS="-l$lib $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <db.h>]],
[[db_create(0,0,0)]])],
[AC_MSG_RESULT(yes)
AC_MSG_CHECKING(for Berkeley DB version >= 4.1.25)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <db.h>]],
[[do {
int major, minor, patch;
db_version(&major, &minor, &patch);
if(major < 4 ||
(major == 4 && minor < 1) ||
(major == 4 && minor == 1 && patch < 24))
return 1;
} while(0)]])],
[AC_MSG_RESULT(yes)
have_db_version=yes],
AC_MSG_RESULT(no))],
AC_MSG_RESULT(no))
if test "x-$have_db_version" = "x-" ; then
LIBS="$save_libs"
fi
fi
done
fi
if test "x-$have_db_version" != "x-yes" ; then
AC_MSG_ERROR([Berkeley DB >= 4.1.24 not found])
else
AC_DEFINE(STORAGE_DB,1,[Define to 1 if you want to use Berkeley DB for auth/reg/storage.])
fi
fi
dnl openldap
AC_ARG_ENABLE(ldap, AC_HELP_STRING([--enable-ldap], [enable OpenLDAP auth/reg support (no)]),
want_ldap=$enableval, want_ldap=no)
if test "x-$want_ldap" = "x-yes" ; then
AC_CHECK_HEADERS(lber.h ldap.h)
if test "x-$ac_cv_header_ldap_h" = "x-yes" -a "x-$ac_cv_header_lber_h" = "x-yes" ; then
AC_CHECK_LIB(lber, ber_alloc)
AC_CHECK_LIB(ldap, ldap_init)
fi
if test "x-$ac_cv_lib_lber_ber_alloc" = "x-yes" -a "x-$ac_cv_lib_ldap_ldap_init" = "x-yes" ; then
AC_MSG_CHECKING(for OpenLDAP version >= 2.1.0)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <lber.h>
#include <ldap.h>]],
[[do {
LDAPAPIInfo info;
info.ldapai_info_version = LDAP_API_INFO_VERSION;
ldap_get_option(0, LDAP_OPT_API_INFO, &info);
if(info.ldapai_vendor_version != LDAP_VENDOR_VERSION || LDAP_VENDOR_VERSION < 2004)
return 1;
} while(0)]])],
[AC_MSG_RESULT(yes)
have_ldap_version=yes],
AC_MSG_RESULT(no))
fi
if test "x-$want_ldap" = "x-yes" -a "x-$have_ldap_version" = "x-" ; then
AC_MSG_ERROR([OpenLDAP client libraries >= 2.1.0 not found])
else
AC_DEFINE(STORAGE_LDAP,1,[Define to 1 if you want to use OpenLDAP for auth/reg.])
fi
fi
dnl pam
AC_ARG_ENABLE(pam, AC_HELP_STRING([--enable-pam], [enable PAM auth/reg support (no)]),
want_pam=$enableval, want_pam=no)
if test "x-$want_pam" = "x-yes" ; then
AC_CHECK_HEADERS(security/pam_appl.h)
if test "x-$ac_cv_header_security_pam_appl_h" = "x-yes" ; then
AC_CHECK_LIB(pam, pam_start)
fi
if test "x-$ac_cv_lib_pam_pam_start" != "x-yes" ; then
AC_MSG_ERROR([PAM application libraries not found])
else
AC_DEFINE(STORAGE_PAM,1,[Define to 1 if you want to use PAM for auth/reg.])
fi
fi
dnl pipe (not really an external package, but does need some checks)
AC_ARG_ENABLE(pipe, AC_HELP_STRING([--enable-pipe], [enable pipe auth/reg support (no)]),
want_pipe=$enableval, want_pipe=no)
if test "x-$want_pipe" = "x-yes" ; then
AC_CHECK_HEADERS(sys/wait.h)
AC_FUNC_FORK
AC_CHECK_FUNCS(pipe wait)
if test "x-$ac_cv_header_sys_wait_h" != "x-yes" -o \
"x-$ac_cv_func_fork" != "x-yes" -o \
"x-$ac_cv_func_pipe" != "x-yes" -o \
"x-$ac_cv_func_wait" != "x-yes" ; then
AC_MSG_ERROR([Pipe auth/reg requirements (sys/wait.h, fork(), pipe(), wait()) not found])
else
AC_DEFINE(STORAGE_PIPE,1,[Define to 1 if you want to use pipes for auth/reg.])
fi
fi
dnl anon
AC_ARG_ENABLE(anon, AC_HELP_STRING([--enable-anon], [enable anonymous auth/reg support (no)]),
want_anon=$enableval, want_anon=no)
if test "x-$want_anon" = "x-yes" ; then
AC_DEFINE(STORAGE_ANON,1,[Define to 1 if you want anonymous auth.])
fi
dnl filesystem storage
AC_ARG_ENABLE(fs, AC_HELP_STRING([--enable-fs], [enable filesystem storage support (no)]),
want_fs=$enableval, want_fs=no)
if test "x-$want_fs" = "x-yes" ; then
AC_DEFINE(STORAGE_FS,1,[Define to 1 if you want to use the filesystem for storage.])
fi
dnl Oracle
AC_ARG_WITH(oracle-home,
[ --with-oracle-home=DIR the Oracle home directory, for includes and libs. ],
[ ac_oracle_home="$withval" ])
AC_ARG_ENABLE(oracle, AC_HELP_STRING([--enable-oracle], [enable Oracle auth/reg/storage support (no)]),
want_oracle=$enableval, want_oracle=no)
if test "x-$want_oracle" = "x-yes" ; then
AC_CHECK_HEADERS(oci.h)
if test "x-$ac_cv_header_oci_h" != "x-yes" ; then
if test -n $ac_oracle_home ; then
AC_MSG_CHECKING([for oci.h in $ac_oracle_home])
save_cppflags="$CPPFLAGS"
CPPFLAGS="-I$ac_oracle_home/rdbms/demo -I$ac_oracle_home/rdbms/public $CPPFLAGS"
save_libs="$LIBS"
LIBS="-L$ac_oracle_home/lib $LIBS"
save_ldflags="$LDFLAGS"
LDFLAGS="-Wl,-rpath,$ac_oracle_home/lib $LDFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <oci.h>]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_OCI_H,,[Define if you have oci.h])
ac_cv_header_oci_h=yes],
AC_MSG_RESULT(no))
if test "x-$ac_cv_header_oci_h" != "x-yes" ; then
CPPFLAGS="$save_cppflags"
LIBS="$save_libs"
LDFLAGS="$save_ldflags"
fi
fi
fi
if test "x-$ac_cv_header_oci_h" = "x-yes" ; then
AC_CHECK_LIB(clntsh, OCIInitialize)
fi
if test "x-$ac_cv_lib_clntsh_OCIInitialize" != "x-yes" ; then
AC_MSG_ERROR([Oracle client libraries not found])
else
AC_DEFINE(STORAGE_ORACLE,1,[Define to 1 if you want to use Oracle for auth/reg/storage.])
fi
fi
dnl
dnl generic system types
dnl
AC_CREATE_STDINT_H(ac-stdint.h)
dnl
dnl typedefs, structs, compiler quirks
dnl
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
dnl
dnl ipv6 stuff
dnl
AC_DEFUN([_IP6_INCLUDES],[[
#include "ac-stdint.h"
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
]])
dnl these types are missing in places
AC_CHECK_TYPES([in_port_t, sa_family_t, struct sockaddr_storage, struct sockaddr_in6, struct in6_addr],,, _IP6_INCLUDES)
dnl
dnl mio backend checks
dnl
AC_ARG_ENABLE(mio, AC_HELP_STRING([--enable-mio=BACKEND], [use BACKEND to drive MIO]),
mio_check=$enableval, mio_check='poll select')
mio_backend=''
for backend in $mio_check ; do
if test "x-$mio_backend" = "x-" ; then
case x-$backend in
x-poll)
AC_CHECK_HEADERS(poll.h)
if test "x-$ac_cv_header_poll_h" = "x-yes" ; then
AC_CHECK_FUNCS(poll,[
mio_backend='poll'
AC_DEFINE(MIO_POLL,1,[Define to 1 if you want to use 'poll' for non-blocking I/O.])])
fi
;;
x-select)
AC_CHECK_HEADERS(sys/select.h)
if test "x-$ac_cv_header_sys_select_h" = "x-yes" ; then
AC_CHECK_FUNCS(select, have_select=yes)
fi
if test "x-$have_select" != "x-yes" -a "x-$ac_cv_header_winsock2_h" = "x-yes" ; then
AC_MSG_CHECKING([for select in ws2_32])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]],
[[select(0,0,0,0,0)]])],
[AC_MSG_RESULT(yes)
have_select=yes],
AC_MSG_RESULT(no))
fi
if test "x-$have_select" = "x-yes" ; then
mio_backend='select'
AC_DEFINE(MIO_SELECT,1,[Define to 1 if you want to use 'select' for non-blocking I/O.])
fi
;;
esac
fi
done
if test "x-$mio_backend" = "x-" ; then
AC_MSG_ERROR([no MIO backend available out of: $backend])
fi
dnl functions we need
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS( \
close \
dup2 \
fcntl \
inet_aton \
ioctl \
isascii \
_findfirst \
getopt \
gettimeofday \
getpid \
_getpid \
memchr \
memmove \
memset \
mkdir \
_mkdir \
modf \
sleep \
Sleep \
strcasecmp \
stricmp \
strchr \
strdup \
strerror \
strncasecmp \
strnicmp \
strstr \
tzset \
uname \
getpagesize )
dnl windows has different names for a few basic things
if test "x-$ac_cv_func_getpid" != "x-yes" -a "x-$ac_cv_func__getpid" = "x-yes" ; then
AC_DEFINE(getpid,_getpid,[Define to a function than can provide getpid(2) functionality.])
fi
if test "x-$ac_cv_func_sleep" != "x-yes" -a "x-$ac_cv_func_Sleep" = "x-yes" ; then
AC_DEFINE(sleep,Sleep,[Define to a function than can provide sleep(2) functionality.])
fi
if test "x-$ac_cv_func_strcasecmp" != "x-yes" -a "x-$ac_cv_func_stricmp" = "x-yes" ; then
AC_DEFINE(strcasecmp,stricmp,[Define to a function than can provide strcasecmp(3) functionality.])
fi
if test "x-$ac_cv_func_strncasecmp" != "x-yes" -a "x-$ac_cv_func_strnicmp" = "x-yes" ; then
AC_DEFINE(strncasecmp,strnicmp,[Define to a function than can provide strncasecmp(3) functionality.])
fi
dnl winsock substitutions
if test "x-$ac_cv_func_close" != "x-yes" ; then
AC_MSG_CHECKING(for closesocket)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]],
[[closesocket(0)]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(close,closesocket,[Define to a function than can provide close(2) functionality.])],
AC_DEFINE(HAVE_CLOSE,1,[Define to 1 if you have the 'close' function.])
AC_MSG_RESULT(no))
fi
if test "x-$ac_cv_func_ioctl" != "x-yes" ; then
AC_MSG_CHECKING(for ioctlsocket)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>]],
[[ioctlsocket(0,0,0)]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(ioctl,ioctlsocket,[Define to a function than can provide ioctl(2) functionality.])],
AC_DEFINE(HAVE_IOCTL,1,[Define to 1 if you have the 'ioctl' function.])
AC_MSG_RESULT(no))
fi
dnl
dnl debugging
dnl
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable debug messages]),
want_debug=$enableval, want_debug=no)
if test "x-$want_debug" = "x-yes" ; then
AC_DEFINE(DEBUG,1,[Define to 1 if you want to get debug output with -D.])
AC_DEFINE(SX_DEBUG,1,[Define to 1 if you want to get SX debug output with -D.])
fi
AC_ARG_ENABLE(nad_debug, AC_HELP_STRING([--enable-nad-debug], [enable NAD pointer tracking]),
want_nad_debug=$enableval, want_nad_debug=no)
if test "x-$want_nad_debug" = "x-yes" ; then
AC_DEFINE(NAD_DEBUG,1,[Define to 1 if you want to enable NAD pointer tracking.])
fi
AC_ARG_ENABLE(pool_debug, AC_HELP_STRING([--enable-pool-debug], [enable memory pool statistics]),
want_pool_debug=$enableval, want_pool_debug=no)
if test "x-$want_pool_debug" = "x-yes" ; then
AC_DEFINE(POOL_DEBUG,1,[Define to 1 if you want to enable memory pool statistics.])
fi
dnl
dnl finishing up
dnl
dnl put our config in its own subdir
sysconfdir="$sysconfdir/jabberd"
dnl done!
AC_OUTPUT(Makefile \
etc/Makefile \
etc/templates/Makefile \
tools/Makefile \
man/Makefile \
expat/Makefile \
mio/Makefile \
subst/Makefile \
sx/Makefile \
util/Makefile \
c2s/Makefile \
resolver/Makefile \
router/Makefile \
s2s/Makefile \
sm/Makefile \
Doxyfile)