chiark / gitweb /
build system: Rename stamp-h to config.stamp
[secnet.git] / configure.in
index a548dac4fe50d33095ac33dcf025b076a16c0a09..658f9bb159c1fa98329aee311fb6e1846343c7ad 100644 (file)
@@ -1,8 +1,25 @@
 dnl Process this file with autoconf to produce a configure script.
 
+dnl This file is part of secnet.
+dnl See README for full list of copyright holders.
+dnl
+dnl secnet is free software; you can redistribute it and/or modify it
+dnl under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl 
+dnl secnet is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl General Public License for more details.
+dnl 
+dnl You should have received a copy of the GNU General Public License
+dnl version 3 along with secnet; if not, see
+dnl https://www.gnu.org/licenses/gpl.html.
+
 sinclude(ac_prog_cc_no_writeable_strings.m4)
 
-AC_INIT(secnet,0.1.16+,secnet@chiark.greenend.org.uk)
+AC_INIT(secnet,0.1.18+,secnet@chiark.greenend.org.uk)
 AC_CONFIG_SRCDIR(secnet.c)
 AC_CONFIG_HEADER(config.h)
 
@@ -11,6 +28,14 @@ AC_REVISION($Id: configure.in,v 1.4 2002/09/09 22:05:02 steve Exp $)
 
 AC_LANG_C
 
+# If fink is on the path then it is assumed we should use it.
+AC_PATH_PROG([FINK],[fink])
+if test "x$FINK" != x; then
+  finkdir=`echo $FINK|sed 's,/[[^/]]*/[[^/]]*$,,'`
+  CPPFLAGS="-I$finkdir/include ${CPPFLAGS}"
+  LDFLAGS="-L$finkdir/lib ${LDFLAGS}"
+fi
+
 AC_PROG_MAKE_SET
 AC_PROG_CC
 AC_PROG_INSTALL
@@ -19,7 +44,7 @@ AC_STDC_HEADERS
 AC_CHECK_HEADERS([stdint.h inttypes.h])
 AC_CHECK_HEADERS([net/if.h net/route.h])
 AC_CHECK_HEADERS([sys/socket.h])
-AC_CHECK_HEADERS([linux/if.h], [], [], 
+AC_CHECK_HEADERS([linux/if_tun.h], [], [], 
 [#if HAVE_SYS_SOCKET_H
 # include <sys/socket.h>
 #endif
@@ -52,20 +77,26 @@ AC_CHECK_LIB(gmp2,mpz_init_set_str)
 AC_CHECK_LIB(gmp,__gmpz_init_set_str)
 REQUIRE_HEADER([gmp.h])
 dnl Would love to barf if no gmp was found, but how to test? Requiring the header will do for now.
-AC_CHECK_LIB(fl,yywrap)
-if test "$ac_cv_lib_fl_yywrap" != yes; then
-  AC_MSG_ERROR([A compatible libfl is required])
-fi
-AC_CHECK_LIB(nsl,inet_ntoa)
+SECNET_C_GETFUNC(inet_ntoa,nsl)
 AC_CHECK_LIB(socket,socket)
-AC_CHECK_LIB(resolv,inet_aton)
+SECNET_C_GETFUNC(inet_aton,resolv)
 AC_CHECK_LIB(adns,adns_init)
 REQUIRE_HEADER([adns.h])
 
-dnl check for getopt in standard library
-AC_REPLACE_FUNCS([snprintf])
+AC_MSG_NOTICE([Checking requirements for IPv6 support...])
+enable_ipv6=true
+m4_define(NO_IPV6,[enable_ipv6=false])
+AC_CHECK_DECL(AF_INET6,        [],[NO_IPV6],[#include <netinet/in.h>])
+AC_CHECK_FUNC(adns_addr2text,  [],[NO_IPV6])
+if $enable_ipv6; then
+    AC_MSG_NOTICE([Enabling IPv6 support])
+    AC_DEFINE(CONFIG_IPV6, 1,
+              [Define to 1 to use IPv6 support in system and adns])
+else
+    AC_MSG_WARN([Disabling IPv6 support])
+fi
 
-AC_OUTPUT(Makefile,echo timestamp >stamp-h)
+AC_OUTPUT(Makefile common.make test/Makefile, echo timestamp >config.stamp)
 
 AH_TOP([
 #ifndef _CONFIG_H
@@ -124,12 +155,6 @@ typedef unsigned char uint8_t;
 #endif
 #endif
 
-#ifndef HAVE_SNPRINTF
-#include <stdio.h>
-#include <stdarg.h>
-#include "snprintf.h"
-#endif
-
 #ifdef __GNUC__
 #define NORETURN(_x) void _x __attribute__ ((noreturn))
 #define FORMAT(_a,_b,_c) __attribute__ ((format (_a,_b,_c)))