1 # configure.in - input to autoconf
3 # This file is part of adns, which is Copyright Ian Jackson
4 # and contributors (see the file INSTALL for full details).
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3, or (at your option)
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software Foundation.
20 AC_CONFIG_HEADER(src/config.h)
22 dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>)
23 define([DPKG_CACHED_TRY_COMPILE],[
26 AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no])
28 if test "x$$2" = xyes; then
37 AC_MSG_CHECKING(whether you requested dynamic linking)
38 AC_SUBST(ENABLE_DYNAMIC)
39 AC_ARG_ENABLE(dynamic,
40 [ --disable-dynamic use static linking
41 --enable-dynamic[=elf] create and use ELF dynamic library (default)],
42 [ case "$enableval" in
45 AC_MSG_RESULT([yes (ELF)])
51 ["invalid value $enableval for --enable-dynamic, try yes or elf"])
56 AC_MSG_RESULT([yes, by default])
65 ADNS_C_GETFUNC(socket,socket)
66 ADNS_C_GETFUNC(inet_ntoa,nsl)
68 PROGS_IF_TSEARCH=adnsresfilter
69 AC_SUBST(PROGS_HAVE_TSEARCH)
70 AC_CHECK_FUNC(tsearch,[
71 PROGS_HAVE_TSEARCH=$PROGS_IF_TSEARCH
73 PROGS_HAVE_TSEARCH='';
74 AC_MSG_WARN([tsearch missing - not building client program(s) $PROGS_IF_TSEARCH])
77 AC_MSG_CHECKING(for INADDR_LOOPBACK)
78 AC_CACHE_VAL(adns_cv_decl_inaddrloopback,[
80 #include <sys/socket.h>
81 #include <netinet/in.h>
82 #include <arpa/inet.h>
86 adns_cv_decl_inaddrloopback=yes,
87 adns_cv_decl_inaddrloopback=no)])
88 if test "$adns_cv_decl_inaddrloopback" = yes; then
91 AC_MSG_RESULT([not in standard headers, urgh...])
92 AC_CHECK_HEADER(rpc/types.h,[
93 AC_DEFINE(HAVEUSE_RPCTYPES_H)
95 AC_MSG_ERROR([cannot find INADDR_LOOPBACK or rpc/types.h])
99 ADNS_C_GETFUNC(inet_aton,resolv,[
100 LIBS="-lresolv $LIBS";
101 AC_MSG_WARN([inet_aton is in libresolv, urgh. Must use -lresolv.])
104 DPKG_CACHED_TRY_COMPILE(inlines,dpkg_cv_c_inline,,
105 [} inline int foo (int x) {],
107 AC_DEFINE(HAVE_INLINE),
112 if test "${GCC-no}" = yes; then
113 WARNS="-Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes -Wcast-qual -Wpointer-arith"
114 saved_cflags="$CFLAGS"
115 CFLAGS="$CFLAGS -Wno-pointer-sign"
116 DPKG_CACHED_TRY_COMPILE(-Wno-pointer-sign,adns_cv_c_wnoptrsign,,
119 WARNS="$WARNS -Wno-pointer-sign",
121 CFLAGS="$saved_cflags"
133 AC_SUBST(SHLIBFORLINK)
135 AC_SUBST(SHLIBSONAME)
137 SHLIBFORLINK='libadns.so'
138 SHLIBSONAME='$(SHLIBFORLINK).$(MAJOR)'
139 SHLIBFILE='$(SHLIBSONAME).$(MINOR)'
141 SHLIBCC='$(CC) $(CFLAGS) -fpic'
142 MKSHLIB_1='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME) -o'
147 common.make settings.make Makefile
148 src/Makefile client/Makefile dynamic/Makefile regress/Makefile