configure.ac
changeset 140 103227122f45
parent 138 210cf8993393
child 141 f918e888a0aa
--- a/configure.ac	Tue Apr 18 13:47:21 2006 +0000
+++ b/configure.ac	Wed Apr 19 11:42:53 2006 +0000
@@ -1,4 +1,4 @@
-AC_INIT(Loudmouth, 1.0.3, loudmouth)
+AC_INIT(Loudmouth, 1.1.1, loudmouth)
 AC_PREREQ(2.59)
 AC_COPYRIGHT([Copyright (C) 2003-2006 Imendio AB])
 
@@ -8,13 +8,48 @@
 
 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
 
 AM_PATH_GLIB_2_0
 
+AC_CHECK_HEADERS([arpa/inet.h fcntl.h memory.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h]) 
+AC_CHECK_HEADERS([winsock2.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
@@ -50,7 +85,9 @@
 dnl | Check for gtk-doc. |-------------------------------
 dnl +--------------------+
 
-AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])
+AC_ARG_WITH(html-dir, 
+            AS_HELP_STRING([--with-html-dir=PATH],
+			   [path to installed docs]))
 
 if test "x$with_html_dir" = "x" ; then
   HTML_DIR='${datadir}/gtk-doc/html'
@@ -60,18 +97,28 @@
 
 AC_SUBST(HTML_DIR)
 
+AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
+
 gtk_doc_min_version=1.0
-AC_MSG_CHECKING([gtk-doc version >= $gtk_doc_min_version])
-if pkg-config --atleast-version=$gtk_doc_min_version gtk-doc; then
-  AC_MSG_RESULT(yes)
-  GTKDOC=true
-else
-  AC_MSG_RESULT(no)
-  GTKDOC=false
+if $GTKDOC ; then 
+  gtk_doc_version=`gtkdoc-mkdb --version`
+  AC_MSG_CHECKING([for gtk-doc version ($gtk_doc_version) >= $gtk_doc_min_version])
+  if perl <<EOF ; then
+    exit (("$gtk_doc_version" =~ /^[[0-9]]+\.[[0-9]]+$/) &&
+          ("$gtk_doc_version" >= "$gtk_doc_min_version") ? 0 : 1);
+EOF
+    AC_MSG_RESULT(yes)
+  else
+    AC_MSG_RESULT(no)
+    GTKDOC=false
+  fi
 fi
 
 dnl Let people disable the gtk-doc stuff.
-AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc  Use gtk-doc to build documentation [default=no]], enable_gtk_doc="$enableval", enable_gtk_doc=no)
+AC_ARG_ENABLE(gtk-doc,
+              AS_HELP_STRING([--enable-gtk-doc=@<:@no/yes/auto@:>@],
+                             [Use gtk-doc to build documentation [[default=auto]]]), ,
+              enable_gtk_doc=auto)
 
 if test x$enable_gtk_doc = xauto ; then
   if test x$GTKDOC = xtrue ; then
@@ -85,7 +132,11 @@
 
 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, [  --disable-rebuilds      disable all source autogeneration rules],,enable_rebuilds=yes)
+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" && \
@@ -106,8 +157,8 @@
 dnl | Checking for SSL support                               |-
 dnl +--------------------------------------------------------+
 AC_ARG_WITH(ssl,
-	    AS_HELP_STRING([--with-ssl@<:@=gnutls|openssl|no@:>@], 
-			   [Which SSL implementation to use, default is gnutls]),
+	    AS_HELP_STRING([--with-ssl=@<:@gnutls|openssl|no@:>@], 
+			   [Which SSL implementation to use [[default=gnutls]]]),
 	    ac_ssl=$withval,
 	    ac_ssl=gnutls)
 
@@ -122,32 +173,43 @@
 	    )
 
 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 x$ac_ssl = xopenssl; 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$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
+  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
@@ -178,9 +240,10 @@
 dnl | Debug output |-------------------------------------------
 dnl +--------------+
 
-AC_ARG_ENABLE(debug, 
-	      [  --enable-debug          Enable debug output [default=yes]],
-	      enable_debug="$enableval", enable_debug=yes, enable_debug=no)
+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"
@@ -192,8 +255,6 @@
 AC_SUBST(LOUDMOUTH_CFLAGS)
 AC_SUBST(LOUDMOUTH_LIBS)
 
-dnl Gtk doc
-GTK_DOC_CHECK(1.0)
 
 dnl +--------------------------------------+
 dnl | Check if we shoudl build C# bindings |-------------------
@@ -245,7 +306,8 @@
         Enable SSL                ${enable_ssl}
         Enable Debug:             ${enable_debug}
 	Enable Unit Tests:        ${have_check}
-
+	Enable Documentation      ${enable_gtk_doc}
+	
         Now type 'make' to build Loudmouth
 "