chiark / gitweb /
@@ -3,6 +3,8 @@
[adns] / configure.in
CommitLineData
b6953d1b 1# configure.in - input to autoconf
2#
39f45e7e 3# This file is part of adns, which is
4# Copyright (C) 1997-2000,2003,2006 Ian Jackson
5# Copyright (C) 1999-2000,2003,2006 Tony Finch
6# Copyright (C) 1991 Massachusetts Institute of Technology
7# (See the file INSTALL for full details.)
a79ac5ba 8#
b6953d1b 9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation; either version 2, or (at your option)
12# any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program; if not, write to the Free Software Foundation,
21# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23AC_INIT(src/adns.h)
24AC_CONFIG_HEADER(src/config.h)
acfd75c4 25
cc0f95d0 26dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>)
1a392929 27define([DPKG_CACHED_TRY_COMPILE],[
cc0f95d0 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
acfd75c4 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],[
cc0f95d0 59 ENABLE_DYNAMIC=elf
acfd75c4 60 AC_MSG_RESULT([yes, by default])
61])
62
b6953d1b 63AC_PROG_CC
a3f177e4 64AC_PROG_CPP
72cdc702 65AC_PROG_RANLIB
08bff712 66AC_PROG_INSTALL
b6b44132 67
74c94831 68AC_CHECK_FUNCS(poll)
b6b44132 69ADNS_C_GETFUNC(socket,socket)
70ADNS_C_GETFUNC(inet_ntoa,nsl)
71
87ad5851 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
a3f177e4 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
b6b44132 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
cc0f95d0 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
b6953d1b 114AC_SUBST(WARNS)
115
116if test "${GCC-no}" = yes; then
117 WARNS="-Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes -Wcast-qual -Wpointer-arith"
cefe030c 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"
b6953d1b 126else
127 WARNS=
128fi
129
cefe030c 130ADNS_C_GCCATTRIB
131
b6953d1b 132AC_SUBST(SHLIBCC)
133AC_SUBST(MKSHLIB_1)
134AC_SUBST(MKSHLIB_2)
135AC_SUBST(MKSHLIB_3)
11c3ea54 136
137AC_SUBST(SHLIBFORLINK)
b6953d1b 138AC_SUBST(SHLIBFILE)
139AC_SUBST(SHLIBSONAME)
140
11c3ea54 141SHLIBFORLINK='libadns.so'
142SHLIBSONAME='$(SHLIBFORLINK).$(MAJOR)'
143SHLIBFILE='$(SHLIBSONAME).$(MINOR)'
b6953d1b 144
9e949dce 145SHLIBCC='$(CC) $(CFLAGS) -fpic'
146MKSHLIB_1='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME) -o'
147MKSHLIB_2=''
148MKSHLIB_3='-lc'
149
72cdc702 150AC_OUTPUT(
151 settings.make Makefile
152 src/Makefile client/Makefile dynamic/Makefile regress/Makefile
153)