configure.ac revision 269257
1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3 4AC_PREREQ(2.56) 5AC_INIT(ldns, 1.6.17, libdns@nlnetlabs.nl,libdns) 6AC_CONFIG_SRCDIR([drill.c]) 7sinclude(../acx_nlnetlabs.m4) 8 9OURCPPFLAGS='' 10CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} 11OURCFLAGS='-g' 12CFLAGS=${CFLAGS:-${OURCFLAGS}} 13AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled]) 14 15AC_AIX 16# Checks for programs. 17AC_PROG_CC 18AC_PROG_MAKE_SET 19AC_CHECK_PROGS(libtool, [glibtool libtool15 libtool], [../libtool]) 20 21# add option to disable the evil rpath 22dnl Check whether to use rpath or not 23AC_ARG_ENABLE(rpath, 24 [ --disable-rpath disable hardcoded rpath (default=enabled)], 25 enable_rpath=$enableval, enable_rpath=yes) 26 27if test "x$enable_rpath" = xyes; then 28 RPATH_VAL="-Wl,-rpath=\${libdir}" 29fi 30 31 32ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"]) 33ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"]) 34 35AC_TYPE_SIZE_T 36ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"]) 37 38ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600, 39[ 40#include "confdefs.h" 41#include <stdlib.h> 42#include <ctype.h> 43#include <sys/time.h> 44#ifdef HAVE_TIME_H 45#include <time.h> 46#endif 47#include <unistd.h> 48#ifdef HAVE_GETOPT_H 49#include <getopt.h> 50#endif 51 52int test() { 53 int a; 54 char **opts = NULL; 55 struct timeval tv; 56 char *t; 57 time_t time = 0; 58 char *buf = NULL; 59 t = ctime_r(&time, buf); 60 tv.tv_usec = 10; 61 srandom(32); 62 a = getopt(2, opts, "a"); 63 a = isascii(32); 64 return a; 65} 66], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600"]) 67 68 69ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG, [#include <stdbool.h>], [CFLAGS="$CFLAGS $C99FLAG"]) 70 71AC_C_INLINE 72AC_CHECK_TYPE(int8_t, char) 73AC_CHECK_TYPE(int16_t, short) 74AC_CHECK_TYPE(int32_t, int) 75AC_CHECK_TYPE(int64_t, long long) 76AC_CHECK_TYPE(uint8_t, unsigned char) 77AC_CHECK_TYPE(uint16_t, unsigned short) 78AC_CHECK_TYPE(uint32_t, unsigned int) 79AC_CHECK_TYPE(uint64_t, unsigned long long) 80AC_CHECK_TYPE(ssize_t, int) 81 82AC_CHECK_HEADERS([sys/types.h getopt.h stdlib.h stdio.h assert.h netinet/in.h ctype.h time.h arpa/inet.h sys/time.h sys/socket.h sys/select.h],,, [AC_INCLUDES_DEFAULT]) 83AC_CHECK_HEADERS([netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/if_ether.h netinet/ip6.h],,, [ 84AC_INCLUDES_DEFAULT 85#ifdef HAVE_NETINET_IN_SYSTM_H 86#include <netinet/in_systm.h> 87#endif 88#ifdef HAVE_NETINET_IN_H 89#include <netinet/in.h> 90#endif 91#ifdef HAVE_SYS_SOCKET_H 92#include <sys/socket.h> 93#endif 94#ifdef HAVE_NET_IF_H 95#include <net/if.h> 96#endif]) 97# MinGW32 tests 98AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT]) 99 100ACX_TYPE_SOCKLEN_T 101AC_CHECK_HEADERS([sys/param.h sys/mount.h],,, 102[AC_INCLUDES_DEFAULT] 103[ 104 [ 105 #if HAVE_SYS_PARAM_H 106 # include <sys/param.h> 107 #endif 108 ] 109]) 110AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ 111#if HAVE_SYS_TYPES_H 112# include <sys/types.h> 113#endif 114#if HAVE_NETINET_IN_H 115# include <netinet/in.h> 116#endif]) 117AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ 118#if HAVE_SYS_TYPES_H 119# include <sys/types.h> 120#endif 121#if HAVE_NETINET_IN_H 122# include <netinet/in.h> 123#endif]) 124 125# check to see if libraries are needed for these functions. 126AC_SEARCH_LIBS(socket, socket) 127AC_SEARCH_LIBS([inet_pton], [nsl]) 128 129ACX_WITH_SSL_OPTIONAL 130 131ACX_CHECK_GETADDRINFO_WITH_INCLUDES 132 133LIBS_STC="$LIBS" 134AC_SUBST(LIBS_STC) 135 136# check for ldns 137AC_ARG_WITH(ldns, 138 AC_HELP_STRING([--with-ldns=PATH specify prefix of path of ldns library to use]) 139 , 140 [ 141 specialldnsdir="$withval" 142 CPPFLAGS="$CPPFLAGS -I$withval/include" 143 LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" 144 LDNSDIR="$withval" 145 LIBS="-lldns $LIBS" 146 LIBS_STC="$withval/lib/libldns.a $LIBS_STC" 147 ] 148) 149 150#AC_CHECK_HEADER(ldns/ldns.h,, [ 151# AC_MSG_ERROR([Can't find ldns headers (make copy-headers in devel source.)]) 152# ], [AC_INCLUDES_DEFAULT] 153#) 154 155AC_CHECK_FUNCS(isblank) 156 157# check for ldns development source tree 158AC_MSG_CHECKING([for ldns devel source]) 159ldns_dev_dir=.. 160if test -f $ldns_dev_dir/ldns/util.h && \ 161 grep LDNS_VERSION $ldns_dev_dir/ldns/util.h >/dev/null; then 162 ldns_version=`grep LDNS_VERSION $ldns_dev_dir/ldns/util.h | sed -e 's/^.*"\(.*\)".*$/\1/'` 163 AC_MSG_RESULT([using $ldns_dev_dir with $ldns_version]) 164 CPPFLAGS="$CPPFLAGS -I$ldns_dev_dir/include" 165 LDFLAGS="-L$ldns_dev_dir -L$ldns_dev_dir/lib $LDFLAGS" 166 LIBS="-lldns $LIBS" 167 AC_DEFINE(HAVE_LIBLDNS, 1, [If the ldns library is available.]) 168 LDNSDIR="$ldns_dev_dir" 169 LIBS_STC="$ldns_dev_dir/lib/libldns.a $LIBS_STC" 170else 171 AC_MSG_RESULT([no]) 172 AC_CHECK_LIB(ldns, ldns_rr_new, , [ 173 AC_MSG_ERROR([Can't find ldns library])dnl ' 174 ] 175 ) 176fi 177 178AC_SUBST(LDNSDIR) 179 180AC_ARG_WITH(trust-anchor, AC_HELP_STRING([--with-trust-anchor=KEYFILE], 181[Default location of the trust anchor file. [default=SYSCONFDIR/unbound/root.key]]), [ 182 LDNS_TRUST_ANCHOR_FILE="$withval" 183],[ 184 if test "x$LDNS_TRUST_ANCHOR_FILE" = "x"; then 185 if test "x$sysconfdir" = 'x${prefix}/etc' ; then 186 if test "x$prefix" = 'xNONE' ; then 187 LDNS_TRUST_ANCHOR_FILE="/etc/unbound/root.key" 188 else 189 LDNS_TRUST_ANCHOR_FILE="${prefix}/etc/unbound/root.key" 190 fi 191 else 192 LDNS_TRUST_ANCHOR_FILE="${sysconfdir}/unbound/root.key" 193 fi 194 fi 195]) 196AC_DEFINE_UNQUOTED([LDNS_TRUST_ANCHOR_FILE], ["$LDNS_TRUST_ANCHOR_FILE"], [Default trust anchor file]) 197AC_SUBST(LDNS_TRUST_ANCHOR_FILE) 198AC_MSG_NOTICE([Default trust anchor: $LDNS_TRUST_ANCHOR_FILE]) 199 200AH_BOTTOM([ 201 202#include <stdio.h> 203#include <string.h> 204#include <unistd.h> 205#include <assert.h> 206 207#if STDC_HEADERS 208#include <stdlib.h> 209#include <stddef.h> 210#endif 211 212#ifdef HAVE_STDINT_H 213#include <stdint.h> 214#endif 215 216#ifdef HAVE_SYS_SOCKET_H 217#include <sys/socket.h> 218#endif 219 220#ifdef HAVE_NETINET_IN_H 221#include <netinet/in.h> 222#endif 223 224#ifdef HAVE_ARPA_INET_H 225#include <arpa/inet.h> 226#endif 227 228#ifdef HAVE_NETINET_UDP_H 229#include <netinet/udp.h> 230#endif 231 232#ifdef HAVE_TIME_H 233#include <time.h> 234#endif 235 236#ifdef HAVE_NETINET_IN_SYSTM_H 237#include <netinet/in_systm.h> 238#endif 239 240#ifdef HAVE_NETINET_IP_H 241#include <netinet/ip.h> 242#endif 243 244#ifdef HAVE_NET_IF_H 245#include <net/if.h> 246#endif 247 248#ifdef HAVE_NETINET_IF_ETHER_H 249#include <netinet/if_ether.h> 250#endif 251 252#ifdef HAVE_WINSOCK2_H 253#define USE_WINSOCK 1 254#include <winsock2.h> 255#endif 256 257#ifdef HAVE_WS2TCPIP_H 258#include <ws2tcpip.h> 259#endif 260 261extern char *optarg; 262extern int optind, opterr; 263 264#ifndef EXIT_FAILURE 265#define EXIT_FAILURE 1 266#endif 267#ifndef EXIT_SUCCESS 268#define EXIT_SUCCESS 0 269#endif 270 271#ifdef S_SPLINT_S 272#define FD_ZERO(a) /* a */ 273#define FD_SET(a,b) /* a, b */ 274#endif 275]) 276 277AC_CONFIG_FILES([Makefile drill.1]) 278AC_CONFIG_HEADER([config.h]) 279AC_OUTPUT 280