AC_INIT([mLib], AUTO_VERSION, [mdw@distorted.org.uk], [mLib])
AC_CONFIG_SRCDIR([mLib.pc.in])
AC_CONFIG_AUX_DIR([config])
-AM_INIT_AUTOMAKE([foreign])
+AM_INIT_AUTOMAKE([foreign subdir-objects])
mdw_SILENT_RULES
AC_PROG_CC
dnl--------------------------------------------------------------------------
dnl C programming environment.
+MLIB_LIBS=
+
dnl Headers.
AC_CHECK_HEADERS([float.h])
AC_CHECK_HEADERS([stdint.h])
dnl Libraries.
+mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
AC_SEARCH_LIBS([socket], [socket])
AC_SEARCH_LIBS([gethostbyname], [nsl resolv])
+MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
dnl Functions.
AC_CHECK_FUNCS([snprintf])
dnl Types.
-AC_CHECK_TYPE([socklen_t], [int])
+AC_CHECK_TYPE([socklen_t], [],
+ [AC_DEFINE([socklen_t], [int],
+ [Define to `int' if <sys/socket.h> does not define])],
+ [AC_INCLUDES_DEFAULT
+#include <sys/socket.h>
+])
dnl Which version of struct msghdr do we have?
AC_CHECK_MEMBERS([struct msgdr.msg_control],,, [
dnl Find out whether we're cross-compiling.
AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
+dnl Set the master library list.
+AC_SUBST([MLIB_LIBS])
+
dnl--------------------------------------------------------------------------
dnl Name resolution.
[want_adns=$withval],
[want_adns=auto])
+mdw_ORIG_LIBS=$LIBS LIBS=$MLIB_LIBS
case $want_adns in
no) ;;
*) AC_SEARCH_LIBS([adns_init], [adns], [have_adns=yes], [have_adns=no]) ;;
esac
+MLIB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
case $want_adns,$have_adns in
yes,no)
AC_MSG_ERROR([ADNS library not found but explicitly requested])