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])
70 * Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
72 * It is part of adns, which is
73 * Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
74 * Copyright (C) 1999-2000 Tony Finch <dot@dotat.at>
76 * This program is free software; you can redistribute it and/or modify
77 * it under the terms of the GNU General Public License as published by
78 * the Free Software Foundation; either version 2, or (at your option)
81 * This program is distributed in the hope that it will be useful,
82 * but WITHOUT ANY WARRANTY; without even the implied warranty of
83 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
84 * GNU General Public License for more details.
86 * You should have received a copy of the GNU General Public License
87 * along with this program; if not, write to the Free Software Foundation,
88 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
92 AH_TEMPLATE([HAVE_INLINE],
93 [Define if inline functions a la GCC are available.])
94 AH_TEMPLATE([HAVE_GNUC25_ATTRIB],
95 [Define if function attributes a la GCC 2.5 and higher are available.])
96 AH_TEMPLATE([HAVE_GNUC25_CONST],
97 [Define if function attributes a la GCC 2.5 and higher are available.])
98 AH_TEMPLATE([HAVE_GNUC25_NORETURN],
99 [Define if nonreturning functions a la GCC 2.5 and higher are available.])
100 AH_TEMPLATE([HAVE_GNUC25_PRINTFFORMAT],
101 [Define if printf-format argument lists a la GCC are available.])
102 AH_TEMPLATE([HAVEUSE_RPCTYPES_H],
103 [Define if we want to include rpc/types.h. Crap BSDs put INADDR_LOOPBACK there.])
106 /* Use the definitions: */
113 #include <sys/poll.h>
116 struct pollfd { int fd; short events; short revents; };
122 /* GNU C attributes. */
124 #ifdef HAVE_GNUC25_ATTRIB
125 #define FUNCATTR(x) __attribute__(x)
131 /* GNU C printf formats, or null. */
133 #ifdef HAVE_GNUC25_PRINTFFORMAT
134 #define ATTRPRINTF(si,tc) format(printf,si,tc)
136 #define ATTRPRINTF(si,tc)
140 #define PRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc)))
143 /* GNU C nonreturning functions, or null. */
145 #ifdef HAVE_GNUC25_NORETURN
146 #define ATTRNORETURN noreturn
152 #define NONRETURNING FUNCATTR((ATTRNORETURN))
155 /* Combination of both the above. */
156 #ifndef NONRETURNPRINTFFORMAT
157 #define NONRETURNPRINTFFORMAT(si,tc) FUNCATTR((ATTRPRINTF(si,tc),ATTRNORETURN))
160 /* GNU C constant functions, or null. */
162 #ifdef HAVE_GNUC25_CONST
163 #define ATTRCONST const
169 #define CONSTANT FUNCATTR((ATTRCONST))
172 #ifdef HAVEUSE_RPCTYPES_H
173 #include <rpc/types.h>
178 ADNS_C_GETFUNC(socket,socket)
179 ADNS_C_GETFUNC(inet_ntoa,nsl)
181 PROGS_IF_TSEARCH=adnsresfilter
182 AC_SUBST(PROGS_HAVE_TSEARCH)
183 AC_CHECK_FUNC(tsearch,[
184 PROGS_HAVE_TSEARCH=$PROGS_IF_TSEARCH
186 PROGS_HAVE_TSEARCH='';
187 AC_MSG_WARN([tsearch missing - not building client program(s) $PROGS_IF_TSEARCH])
190 AC_MSG_CHECKING(for INADDR_LOOPBACK)
191 AC_CACHE_VAL(adns_cv_decl_inaddrloopback,[
193 #include <sys/socket.h>
194 #include <netinet/in.h>
195 #include <arpa/inet.h>
199 adns_cv_decl_inaddrloopback=yes,
200 adns_cv_decl_inaddrloopback=no)])
201 if test "$adns_cv_decl_inaddrloopback" = yes; then
204 AC_MSG_RESULT([not in standard headers, urgh...])
205 AC_CHECK_HEADER(rpc/types.h,[
206 AC_DEFINE(HAVEUSE_RPCTYPES_H)
208 AC_MSG_ERROR([cannot find INADDR_LOOPBACK or rpc/types.h])
212 ADNS_C_GETFUNC(inet_aton,resolv,[
213 LIBS="-lresolv $LIBS";
214 AC_MSG_WARN([inet_aton is in libresolv, urgh. Must use -lresolv.])
217 DPKG_CACHED_TRY_COMPILE(inlines,dpkg_cv_c_inline,,
218 [} inline int foo (int x) {],
220 AC_DEFINE(HAVE_INLINE),
225 if test "${GCC-no}" = yes; then
226 WARNS="-Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes -Wcast-qual -Wpointer-arith"
227 saved_cflags="$CFLAGS"
228 CFLAGS="$CFLAGS -Wno-pointer-sign"
229 DPKG_CACHED_TRY_COMPILE(-Wno-pointer-sign,adns_cv_c_wnoptrsign,,
232 WARNS="$WARNS -Wno-pointer-sign",
234 CFLAGS="$saved_cflags"
246 AC_SUBST(SHLIBFORLINK)
248 AC_SUBST(SHLIBSONAME)
250 SHLIBFORLINK='libadns.so'
251 SHLIBSONAME='$(SHLIBFORLINK).$(MAJOR)'
252 SHLIBFILE='$(SHLIBSONAME).$(MINOR)'
254 SHLIBCC='$(CC) $(CFLAGS) -fpic'
255 MKSHLIB_1='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME) -o'
260 settings.make Makefile
261 src/Makefile client/Makefile dynamic/Makefile regress/Makefile