chiark / gitweb /
src/types.c: Do not crash when one of several addr subqueries fails
[adns] / configure.in
CommitLineData
11b35193 1# configure.in - input to autoconf
2#
ae8cc977 3# This file is part of adns, which is
26e1c3d6 4# Copyright (C) 1997-2000,2003,2006,2014 Ian Jackson
17cd4f48 5# Copyright (C) 2014 Mark Wooding
ae8cc977 6# Copyright (C) 1999-2000,2003,2006 Tony Finch
7# Copyright (C) 1991 Massachusetts Institute of Technology
8# (See the file INSTALL for full details.)
d942707d 9#
11b35193 10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
7f8bbe29 12# the Free Software Foundation; either version 3, or (at your option)
11b35193 13# any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
8c09a4c6 21# along with this program; if not, write to the Free Software Foundation.
11b35193 22
23AC_INIT(src/adns.h)
24AC_CONFIG_HEADER(src/config.h)
48337073 25
5a0be244 26dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>)
2448bf59 27define([DPKG_CACHED_TRY_COMPILE],[
5a0be244 28 AC_MSG_CHECKING($1)
29 AC_CACHE_VAL($2,[
30 AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no])
31 ])
32 if test "x$$2" = xyes; then
33 true
34 $5
35 else
36 true
37 $6
38 fi
39])
40
48337073 41AC_MSG_CHECKING(whether you requested dynamic linking)
42AC_SUBST(ENABLE_DYNAMIC)
43AC_ARG_ENABLE(dynamic,
44[ --disable-dynamic use static linking
45 --enable-dynamic[=elf] create and use ELF dynamic library (default)],
46[ case "$enableval" in
47 elf|yes)
48 ENABLE_DYNAMIC=elf
49 AC_MSG_RESULT([yes (ELF)])
50 ;;
51 no) ENABLE_DYNAMIC=no
52 AC_MSG_RESULT(no)
53 ;;
54 *) AC_MSG_ERROR(
55["invalid value $enableval for --enable-dynamic, try yes or elf"])
56 ;;
57 esac
58],[
5a0be244 59 ENABLE_DYNAMIC=elf
48337073 60 AC_MSG_RESULT([yes, by default])
61])
62
11b35193 63AC_PROG_CC
04e7fb4d 64AC_PROG_CPP
9579019a 65AC_PROG_RANLIB
a0c76eee 66AC_PROG_INSTALL
8b5269f2 67
620c146d 68AC_CHECK_FUNCS(poll)
8b5269f2 69ADNS_C_GETFUNC(socket,socket)
70ADNS_C_GETFUNC(inet_ntoa,nsl)
71
9a09fa18 72PROGS_IF_TSEARCH=adnsresfilter
73AC_SUBST(PROGS_HAVE_TSEARCH)
74AC_CHECK_FUNC(tsearch,[
75 PROGS_HAVE_TSEARCH=$PROGS_IF_TSEARCH
76],[
77 PROGS_HAVE_TSEARCH='';
78 AC_MSG_WARN([tsearch missing - not building client program(s) $PROGS_IF_TSEARCH])
79])
80
04e7fb4d 81AC_MSG_CHECKING(for INADDR_LOOPBACK)
82AC_CACHE_VAL(adns_cv_decl_inaddrloopback,[
83 AC_TRY_COMPILE([
84#include <sys/socket.h>
85#include <netinet/in.h>
86#include <arpa/inet.h>
87 ],[
88 INADDR_LOOPBACK;
89 ],
90 adns_cv_decl_inaddrloopback=yes,
91 adns_cv_decl_inaddrloopback=no)])
92if test "$adns_cv_decl_inaddrloopback" = yes; then
93 AC_MSG_RESULT(found)
94else
95 AC_MSG_RESULT([not in standard headers, urgh...])
96 AC_CHECK_HEADER(rpc/types.h,[
97 AC_DEFINE(HAVEUSE_RPCTYPES_H)
98 ],[
99 AC_MSG_ERROR([cannot find INADDR_LOOPBACK or rpc/types.h])
100 ])
101fi
102
8b5269f2 103ADNS_C_GETFUNC(inet_aton,resolv,[
104 LIBS="-lresolv $LIBS";
105 AC_MSG_WARN([inet_aton is in libresolv, urgh. Must use -lresolv.])
106])
107
5a0be244 108DPKG_CACHED_TRY_COMPILE(inlines,dpkg_cv_c_inline,,
109 [} inline int foo (int x) {],
110 AC_MSG_RESULT(yes)
111 AC_DEFINE(HAVE_INLINE),
112 AC_MSG_RESULT(no))
113
11b35193 114AC_SUBST(WARNS)
115
116if test "${GCC-no}" = yes; then
117 WARNS="-Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes -Wcast-qual -Wpointer-arith"
52888ec6 118 saved_cflags="$CFLAGS"
119 CFLAGS="$CFLAGS -Wno-pointer-sign"
120 DPKG_CACHED_TRY_COMPILE(-Wno-pointer-sign,adns_cv_c_wnoptrsign,,
121 [],
122 AC_MSG_RESULT(yes)
123 WARNS="$WARNS -Wno-pointer-sign",
124 AC_MSG_RESULT(no))
125 CFLAGS="$saved_cflags"
11b35193 126else
127 WARNS=
128fi
129
52888ec6 130ADNS_C_GCCATTRIB
131
11b35193 132AC_SUBST(SHLIBCC)
133AC_SUBST(MKSHLIB_1)
134AC_SUBST(MKSHLIB_2)
135AC_SUBST(MKSHLIB_3)
9310ea4d 136
137AC_SUBST(SHLIBFORLINK)
11b35193 138AC_SUBST(SHLIBFILE)
139AC_SUBST(SHLIBSONAME)
140
9310ea4d 141SHLIBFORLINK='libadns.so'
142SHLIBSONAME='$(SHLIBFORLINK).$(MAJOR)'
143SHLIBFILE='$(SHLIBSONAME).$(MINOR)'
11b35193 144
696e536a 145SHLIBCC='$(CC) $(CFLAGS) -fpic'
146MKSHLIB_1='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME) -o'
147MKSHLIB_2=''
148MKSHLIB_3='-lc'
149
9579019a 150AC_OUTPUT(
b99e8e9a 151 common.make settings.make Makefile
9579019a 152 src/Makefile client/Makefile dynamic/Makefile regress/Makefile
153)