1 # configure.in - input to autoconf
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.)
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)
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.
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.
24 AC_CONFIG_HEADER(src/config.h)
26 AC_DEFUN([DPKG_CACHED_TRY_COMPILE],[
29 AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no])
31 if test "x$$2" = xyes; then
40 AC_MSG_CHECKING(whether you requested dynamic linking)
41 AC_SUBST(ENABLE_DYNAMIC)
42 AC_ARG_ENABLE(dynamic,
43 [ --disable-dynamic use static linking
44 --enable-dynamic[=elf] create and use ELF dynamic library (default)],
45 [ case "$enableval" in
48 AC_MSG_RESULT([yes (ELF)])
54 ["invalid value $enableval for --enable-dynamic, try yes or elf"])
59 AC_MSG_RESULT([yes, by default])
63 AC_USE_SYSTEM_EXTENSIONS
72 * Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
74 * It is part of adns, which is
75 * Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
76 * Copyright (C) 1999-2000 Tony Finch <dot@dotat.at>
78 * This program is free software; you can redistribute it and/or modify
79 * it under the terms of the GNU General Public License as published by
80 * the Free Software Foundation; either version 2, or (at your option)
83 * This program is distributed in the hope that it will be useful,
84 * but WITHOUT ANY WARRANTY; without even the implied warranty of
85 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
86 * GNU General Public License for more details.
88 * You should have received a copy of the GNU General Public License
89 * along with this program; if not, write to the Free Software Foundation,
90 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
94 AH_TEMPLATE([HAVE_INLINE],
95 [Define if inline functions a la GCC are available.])
96 AH_TEMPLATE([HAVE_GNUC25_ATTRIB],
97 [Define if function attributes a la GCC 2.5 and higher are available.])
98 AH_TEMPLATE([HAVE_GNUC25_CONST],
99 [Define if function attributes a la GCC 2.5 and higher are available.])
100 AH_TEMPLATE([HAVE_GNUC25_NORETURN],
101 [Define if nonreturning functions a la GCC 2.5 and higher are available.])
102 AH_TEMPLATE([HAVE_GNUC25_PRINTFFORMAT],
103 [Define if printf-format argument lists a la GCC are available.])
104 AH_TEMPLATE([HAVEUSE_RPCTYPES_H],
105 [Define if we want to include rpc/types.h. Crap BSDs put INADDR_LOOPBACK there.])
108 /* Use the definitions: */
115 #include <sys/poll.h>
118 struct pollfd { int fd; short events; short revents; };
124 /* GNU C attributes. */
126 #ifdef HAVE_GNUC25_ATTRIB
127 #define FUNCATTR(x) __attribute__(x)
133 /* GNU C printf formats, or null. */
135 #ifdef HAVE_GNUC25_PRINTFFORMAT
136 #define ATTRPRINTF(si,tc) format(printf,si,tc)
138 #define ATTRPRINTF(si,tc)
142 #define PRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc)))
145 /* GNU C nonreturning functions, or null. */
147 #ifdef HAVE_GNUC25_NORETURN
148 #define ATTRNORETURN noreturn
154 #define NONRETURNING FUNCATTR((ATTRNORETURN))
157 /* Combination of both the above. */
158 #ifndef NONRETURNPRINTFFORMAT
159 #define NONRETURNPRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc),ATTRNORETURN))
162 /* GNU C constant functions, or null. */
164 #ifdef HAVE_GNUC25_CONST
165 #define ATTRCONST const
171 #define CONSTANT FUNCATTR((ATTRCONST))
174 #ifdef HAVEUSE_RPCTYPES_H
175 #include <rpc/types.h>
180 ADNS_C_GETFUNC(socket,socket)
181 ADNS_C_GETFUNC(inet_ntoa,nsl)
183 PROGS_IF_TSEARCH=adnsresfilter
184 AC_SUBST(PROGS_HAVE_TSEARCH)
185 AC_CHECK_FUNC(tsearch,[
186 PROGS_HAVE_TSEARCH=$PROGS_IF_TSEARCH
188 PROGS_HAVE_TSEARCH='';
189 AC_MSG_WARN([tsearch missing - not building client program(s) $PROGS_IF_TSEARCH])
192 AC_MSG_CHECKING(for INADDR_LOOPBACK)
193 AC_CACHE_VAL(adns_cv_decl_inaddrloopback,[
195 #include <sys/socket.h>
196 #include <netinet/in.h>
197 #include <arpa/inet.h>
201 adns_cv_decl_inaddrloopback=yes,
202 adns_cv_decl_inaddrloopback=no)])
203 if test "$adns_cv_decl_inaddrloopback" = yes; then
206 AC_MSG_RESULT([not in standard headers, urgh...])
207 AC_CHECK_HEADER(rpc/types.h,[
208 AC_DEFINE(HAVEUSE_RPCTYPES_H)
210 AC_MSG_ERROR([cannot find INADDR_LOOPBACK or rpc/types.h])
214 ADNS_C_GETFUNC(inet_aton,resolv,[
215 LIBS="-lresolv $LIBS";
216 AC_MSG_WARN([inet_aton is in libresolv, urgh. Must use -lresolv.])
219 DPKG_CACHED_TRY_COMPILE(inlines,dpkg_cv_c_inline,,
220 [} inline int foo (int x) {],
222 AC_DEFINE(HAVE_INLINE),
227 if test "${GCC-no}" = yes; then
228 WARNS="-Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes -Wcast-qual -Wpointer-arith"
229 saved_cflags="$CFLAGS"
230 CFLAGS="$CFLAGS -Wno-pointer-sign"
231 DPKG_CACHED_TRY_COMPILE(-Wno-pointer-sign,adns_cv_c_wnoptrsign,,
234 WARNS="$WARNS -Wno-pointer-sign",
236 CFLAGS="$saved_cflags"
248 AC_SUBST(SHLIBFORLINK)
250 AC_SUBST(SHLIBSONAME)
252 SHLIBFORLINK='libadns.so'
253 SHLIBSONAME='$(SHLIBFORLINK).$(MAJOR)'
254 SHLIBFILE='$(SHLIBSONAME).$(MINOR)'
256 SHLIBCC='$(CC) $(CFLAGS) -fpic'
257 MKSHLIB_1='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME) -o'
262 settings.make Makefile
263 src/Makefile client/Makefile dynamic/Makefile regress/Makefile