@@@ m4
[mLib] / configure.ac
index 919d367..cd3d3c1 100644 (file)
 dnl -*-autoconf-*-
 dnl
-dnl Configuring the Common Files Distribution
+dnl Configuration script for mLib
 dnl
-dnl (c) 1997 Mark Wooding
+dnl (c) 2008 Straylight/Edgeware
 dnl
 
 dnl----- Licensing notice ---------------------------------------------------
 dnl
-dnl This file is part of the Common Files Distribution (`common')
+dnl This file is part of the mLib utilities library.
 dnl
-dnl `Common' is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
+dnl mLib is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU Library General Public License as
+dnl published by the Free Software Foundation; either version 2 of the
+dnl License, or (at your option) any later version.
 dnl
-dnl `Common' is distributed in the hope that it will be useful,
+dnl mLib is distributed in the hope that it will be useful,
 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
+dnl GNU Library General Public License for more details.
 dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with `common'; if not, write to the Free Software Foundation,
-dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+dnl You should have received a copy of the GNU Library General Public
+dnl License along with mLib; if not, write to the Free
+dnl Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+dnl MA 02111-1307, USA.
 
 dnl--------------------------------------------------------------------------
 dnl Initialization.
 
 mdw_AUTO_VERSION
-AC_INIT([Common Files Distribution], AUTO_VERSION,
-       [mdw@distorted.org.uk], [cfd])
-AC_CONFIG_SRCDIR([mdw-setup])
+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])
+AC_CONFIG_MACRO_DIRS([m4])
+AM_INIT_AUTOMAKE([foreign subdir-objects])
 mdw_SILENT_RULES
 
-AC_PROG_LN_S
+AC_PROG_CC
+AM_PROG_CC_C_O
+AM_PROG_LIBTOOL
+AX_CFLAGS_WARN_ALL
+mdw_LIBTOOL_VERSION_INFO
+
+AC_CHECK_PROGS([AUTOM4TE], [autom4te])
+
+mdw_MANEXT([mLib])
+
+AC_DEFINE_UNQUOTED([SRCDIR], ["$(cd $srcdir && pwd)"],
+                  [absolute pathname for the source directory.])
 
 dnl--------------------------------------------------------------------------
-dnl Finding installation directories.
-
-AC_ARG_WITH(
-  [aclocaldir],
-  AS_HELP_STRING([--with-aclocaldir=DIR],
-                [store autoconf snippets in DIR]),
-  [aclocaldir=$withval],
-  [AC_CACHE_CHECK([where to stash Autoconf macros], [mdw_cv_aclocaldir], [
-     mdw_cv_aclocaldir=$(aclocal --print-ac-dir)
-     if test $? -ne 0; then AC_MSG_ERROR([aclocal not installed]); fi
-   ])
-   aclocaldir=$mdw_cv_aclocaldir])
-AC_SUBST([aclocaldir])
+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], [],
+  [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],,, [
+#include <sys/types.h>
+#include <sys/socket.h>
+])
+
+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.
+
+AC_ARG_WITH([adns],
+  AS_HELP_STRING([--with-adns],
+                [use ADNS library for background 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])
+    ;;
+  yes,yes | auto,yes)
+    use_adns=yes
+    AC_DEFINE([HAVE_ADNS], [1],
+             [define if you have (and want to use) the ADNS library.])
+    ;;
+  no,* | auto,no)
+    use_adns=no
+    mdw_DEFINE_PATHS([
+      AC_DEFINE_UNQUOTED([BRES_SERVER],
+                        ["mdw_PATH($libexecdir)/$PACKAGE/mdw_PROG(bres)"],
+                        [pathname to the standalone `bres' binary.'])
+    ])
+    ;;
+esac
+AM_CONDITIONAL([WITH_ADNS], [test "$use_adns" = yes])
+
+dnl--------------------------------------------------------------------------
+dnl Python (used for testing).
+
+AM_PATH_PYTHON([2.4],, [:])
 
 dnl--------------------------------------------------------------------------
 dnl Output.
 
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_HEADER([config/config.h])
+AC_CONFIG_TESTDIR([t])
+
+AC_CONFIG_FILES(
+  [Makefile]
+  [buf/Makefile]
+  [codec/Makefile]
+  [hash/Makefile]
+  [mem/Makefile]
+  [sel/Makefile]
+  [struct/Makefile]
+  [sys/Makefile]
+  [test/Makefile]
+  [trace/Makefile]
+  [ui/Makefile]
+  [utils/Makefile]
+  [t/Makefile t/atlocal])
 AC_OUTPUT
 
-dnl----- That's all, folks --------------------------------------------------
+dnl------ That's all, folks -------------------------------------------------