Removed the async_connect_waiting and blocking states from LmConnection.
As a first step of cleaning up the network code underlying LmConnection I want to make the blocking and non-blocking calls be as similar as possible.
The socket should be able to connect in asynchronous manner even if we want to block on the open call since the mainloop iteration will handle the "block" for lm_connection_open_and_block.
AC_PREREQ(2.60)
AC_INIT([Loudmouth], [1.5.0], [http://loudmouth.lighthouseapp.com/projects/17276-libloudmouth/tickets/new], [loudmouth])
AC_COPYRIGHT([
Copyright (C) 2003-2008 Imendio AB
Copyright (C) 2007 Collabora Ltd
Copyright (C) 2007 Nokia Corporation
])
AC_CONFIG_SRCDIR(loudmouth/loudmouth.h)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_AUX_DIR(build)
AM_INIT_AUTOMAKE([1.9 dist-bzip2 no-define -Wall])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
os_win32=no
case "$host_os" in
*mingw32*)
os_win32=yes
esac
if test "$os_win32" = "yes"; then
if test "$enable_static" = "yes" -o "$enable_static" = ""; then
AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.])
enable_static=no
fi
if test "$enable_shared" = "no"; then
AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.])
fi
enable_shared=yes
CFLAGS="$CFLAGS -mms-bitfields"
LDFLAGS="$LDFLAGS -no-undefined"
fi
AC_PROG_CC
AC_ISC_POSIX
AC_HEADER_STDC
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
m4_include(build/gtkdoc.m4)
m4_include(build/dolt.m4)
LT_CURRENT=1
LT_REVISION=0
LT_AGE=1
AC_SUBST([LT_CURRENT])
AC_SUBST([LT_REVISION])
AC_SUBST([LT_AGE])
AM_PATH_GLIB_2_0
AC_CHECK_HEADERS([arpa/inet.h fcntl.h memory.h netdb.h netinet/in.h netinet/in_systm.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
AC_CHECK_HEADERS([winsock2.h arpa/nameser_compat.h])
if test "$ac_cv_header_winsock2_h" = "yes"; then
# If we have <winsock2.h>, assume we find the functions
# in -lws2_32 (ws2_32 is winsock v2, wsock32 is v1.1)
LIBS="-lws2_32 -lgdi32 $LIBS"
fi
IDT_COMPILE_WARNINGS
changequote(,)dnl
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
fi
changequote([,])dnl
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
GLIB2_REQUIRED=2.16.0
GNUTLS_REQUIRED=1.4.0
LIBTASN1_REQUIRED=0.2.6
AC_SUBST(GLIB2_REQUIRED)
AC_SUBST(GNUTLS_REQUIRED)
AC_SUBST(LIBTASN1_REQUIRED)
LM_CHECK_TIMEZONE
PKG_CHECK_MODULES(LOUDMOUTH,
glib-2.0 >= $GLIB2_REQUIRED
gobject-2.0 >= $GLIB2_REQUIRED)
PKG_CHECK_MODULES(LIBIDN, libidn, have_idn=yes, have_idn=no)
if test "x$have_idn" = "xyes"; then
AC_DEFINE(HAVE_IDN, 1, [Define if IDN support is included])
fi
dnl Gtk doc
GTK_DOC_CHECK(1.0)
dnl define a MAINT-like variable REBUILD which is set if Perl
dnl and awk are found, so autogenerated sources can be rebuilt
AC_ARG_ENABLE(rebuilds,
AS_HELP_STRING([--enable-rebuilds=@<:@no/yes/auto@:>@],
[Enable source autogeneration rules [[default=yes]]]), ,
enable_rebuilds=yes)
REBUILD=\#
if test "x$enable_rebuilds" = "xyes" && \
test -n "$PERL" && \
$PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 && \
test -n "$AWK" ; then
REBUILD=
fi
AC_SUBST(REBUILD)
dnl +--------------------------------------------------------+
dnl | Checking for libnsl and libsocket need on some systems |-
dnl +--------------------------------------------------------+
AC_CHECK_LIB(nsl,gethostbyname)
AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(resolv,res_query)
dnl +--------------------------------------------------------+
dnl | Checking for SSL support |-
dnl +--------------------------------------------------------+
AC_ARG_WITH(ssl,
AS_HELP_STRING([--with-ssl=@<:@gnutls|openssl|no@:>@],
[Which SSL implementation to use [[default=gnutls]]]),
ac_ssl=$withval,
ac_ssl=gnutls)
AC_ARG_WITH(openssl-includes,
AC_HELP_STRING([--with-openssl-includes=DIR],[OpenSSL includes]),
[ use_openssl=yes CPPFLAGS="$CPPFLAGS -I$withval" ]
)
AC_ARG_WITH(openssl-libs,
AC_HELP_STRING([--with-openssl-libs=DIR],[OpenSSL libraries]),
[ use_openssl=yes LDFLAGS="$LDFLAGS -L$withval" ]
)
enable_ssl=no
if test "x$ac_ssl" = "xgnutls"; then
dnl Look for GnuTLS
AM_PATH_LM_LIBGNUTLS($GNUTLS_REQUIRED, have_libgnutls=yes, have_libgnutls=no)
if test "x$have_libgnutls" = "xyes"; then
CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
LIBS="$LIBS $LIBGNUTLS_LIBS"
AC_DEFINE(HAVE_GNUTLS, 1, [whether to use GnuTSL support.])
enable_ssl=GnuTLS
else
AC_MSG_ERROR([GnuTLS was not found, use
--with-ssl=[[no|openssl]] to build without SSL support or
with OpenSSL])
fi
elif test "$ac_ssl" = "openssl"; then
dnl Look for OpenSSL
AC_CHECK_HEADERS([openssl/ssl.h])
OLDLIBS="$LIBS"
AC_CHECK_LIB(crypto,
BIO_f_base64,
[AC_CHECK_LIB(ssl,
SSL_new,
[SSL_LIB="-lssl -lcrypto"
AC_DEFINE(HAVE_OPENSSL,
[],
[Have OpenSSL])],
[have_openssl=no],
[-lcrypto])],
[have_openssl=no],
[])
if test "x$have_openssl" = "xno"; then
AC_MSG_ERROR([OpenSSL was not found, use --with-ssl=[[no|gnutls]] to
build without SSL support or with GnuTLS])
else
LIBS="$OLDLIBS $SSL_LIB"
enable_ssl=OpenSSL
fi
else
echo "Disabling SSL support"
fi
if test x$enable_ssl != xno; then
AC_DEFINE(HAVE_SSL, 1, [whether to use SSL support.])
else
if test x$ac_ssl != xno; then
AC_MSG_ERROR([No SSL implementation was found, if you do not want to build with SSL use --with-ssl=no])
fi
fi
AM_CONDITIONAL(USE_OPENSSL, test x$enable_ssl = xOpenSSL)
AM_CONDITIONAL(USE_GNUTLS, test x$enable_ssl = xGnuTLS)
dnl +-------------------------------------------------------------------+
dnl | Checking for libasyncns |
dnl +-------------------------------------------------------------------+
AC_ARG_WITH(asyncns, [ --with-asyncns=yes/no define whether to use libasyncns, default=no],
ac_asyncns=$withval,
ac_asyncns=no
)
enable_asyncns=no
if test x$ac_asyncns != xno; then
enable_asyncns=yes
AC_DEFINE(HAVE_ASYNCNS, 1, [Whether to use libasyncns])
else
echo "Not using asynchronous dns lookups"
fi
dnl +-------------------------------------------------------------------+
dnl | Checking for Linux TCP/IP stack |
dnl +-------------------------------------------------------------------+
AC_CHECK_DECL(TCP_KEEPCNT, [ac_use_keepalives=yes], [ac_use_keepalives=no], [
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
])
use_keepalives=no
if test x$ac_use_keepalives != xno; then
use_keepalives=yes
AC_DEFINE(USE_TCP_KEEPALIVES, 1, [Whether to use Linux TCP keepalives])
fi
dnl +-------------+
dnl | Build Flags |--------------------------------------------
dnl +-------------+
DOC_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $WARN_CFLAGS"
AC_SUBST(DOC_CFLAGS)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
dnl -----------------------------------------------------------
dnl +--------------+
dnl | Debug output |-------------------------------------------
dnl +--------------+
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug=@<:@no/yes/auto@:>@],
[Enable debugging [[default=yes]]]), ,
enable_debug=yes)
if test x$enable_debug = xno ; then
echo "Debugging disabled"
LOUDMOUTH_CFLAGS="$LOUDMOUTH_CFLAGS -DLM_NO_DEBUG"
else
echo "Debugging enabled"
fi
AC_SUBST(LOUDMOUTH_CFLAGS)
AC_SUBST(LOUDMOUTH_LIBS)
AC_OUTPUT([
Makefile
docs/Makefile
docs/reference/Makefile
loudmouth/Makefile
examples/Makefile
tests/Makefile
tests/parser-tests/Makefile
loudmouth-1.0.pc
loudmouth.spec])
dnl ==========================================================================
echo "
Loudmouth $VERSION
==================
prefix: ${prefix}
compiler: ${CC}
Have IDN support: ${have_idn}
Enable SSL: ${enable_ssl}
Asynchronous DNS: ${enable_asyncns}
Linux TCP keepalives: ${use_keepalives}
Enable Debug: ${enable_debug}
Enable Documentation ${enable_gtk_doc}
Now type 'make' to build Loudmouth
"