chiark / gitweb /
Build: Overhaul build system.
[mLib] / configure.ac
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..52db7c7
--- /dev/null
@@ -0,0 +1,106 @@
+dnl -*-autoconf-*-
+dnl
+dnl Configuration script for mLib
+dnl
+dnl (c) 2008 Straylight/Edgeware
+dnl
+
+dnl ----- Licensing notice --------------------------------------------------
+dnl
+dnl This file is part of the mLib utilities library.
+dnl
+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 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 Library General Public License for more details.
+dnl
+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([mLib], AUTO_VERSION, [mdw@distorted.org.uk])
+AC_CONFIG_SRCDIR([mLib.pc.in])
+AC_CONFIG_AUX_DIR([config])
+AM_INIT_AUTOMAKE([foreign])
+
+AC_PROG_CC
+AM_PROG_CC_C_O
+AM_PROG_LIBTOOL
+AX_CFLAGS_WARN_ALL
+mdw_LIBTOOL_VERSION_INFO
+
+mdw_MANEXT
+
+AC_DEFINE_UNQUOTED([SRCDIR], ["$(cd $srcdir && pwd)"],
+                  [absolute pathname for the source directory.])
+
+dnl--------------------------------------------------------------------------
+dnl C programming environment.
+
+dnl Headers.
+AC_CHECK_HEADERS([float.h])
+
+dnl Libraries.
+AC_SEARCH_LIBS([socket], [socket])
+AC_SEARCH_LIBS([gethostbyname], [nsl resolv])
+
+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--------------------------------------------------------------------------
+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])
+
+case $want_adns in
+  no) ;;
+  *) AC_SEARCH_LIBS([adns_init], [adns], [have_adns=yes], [have_adns=no]) ;;
+esac
+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 Output.
+
+AC_CONFIG_HEADER([config/config.h])
+
+AC_CONFIG_FILES(
+  [Makefile]
+  [man/Makefile])
+AC_OUTPUT
+
+dnl ----- That's all, folks -------------------------------------------------