Licensing: Delete FSF street address
[adns] / configure.in
CommitLineData
11b35193 1# configure.in - input to autoconf
2#
ae8cc977 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.)
d942707d 8#
11b35193 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
7f8bbe29 11# the Free Software Foundation; either version 3, or (at your option)
11b35193 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
8c09a4c6 20# along with this program; if not, write to the Free Software Foundation.
11b35193 21
22AC_INIT(src/adns.h)
23AC_CONFIG_HEADER(src/config.h)
48337073 24
5a0be244 25dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>)
2448bf59 26define([DPKG_CACHED_TRY_COMPILE],[
5a0be244 27 AC_MSG_CHECKING($1)
28 AC_CACHE_VAL($2,[
29 AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no])
30 ])
31 if test "x$$2" = xyes; then
32 true
33 $5
34 else
35 true
36 $6
37 fi
38])
39
48337073 40AC_MSG_CHECKING(whether you requested dynamic linking)
41AC_SUBST(ENABLE_DYNAMIC)
42AC_ARG_ENABLE(dynamic,
43[ --disable-dynamic use static linking
44 --enable-dynamic[=elf] create and use ELF dynamic library (default)],
45[ case "$enableval" in
46 elf|yes)
47 ENABLE_DYNAMIC=elf
48 AC_MSG_RESULT([yes (ELF)])
49 ;;
50 no) ENABLE_DYNAMIC=no
51 AC_MSG_RESULT(no)
52 ;;
53 *) AC_MSG_ERROR(
54["invalid value $enableval for --enable-dynamic, try yes or elf"])
55 ;;
56 esac
57],[
5a0be244 58 ENABLE_DYNAMIC=elf
48337073 59 AC_MSG_RESULT([yes, by default])
60])
61
11b35193 62AC_PROG_CC
04e7fb4d 63AC_PROG_CPP
9579019a 64AC_PROG_RANLIB
a0c76eee 65AC_PROG_INSTALL
8b5269f2 66
620c146d 67AC_CHECK_FUNCS(poll)
8b5269f2 68ADNS_C_GETFUNC(socket,socket)
69ADNS_C_GETFUNC(inet_ntoa,nsl)
70
9a09fa18 71PROGS_IF_TSEARCH=adnsresfilter
72AC_SUBST(PROGS_HAVE_TSEARCH)
73AC_CHECK_FUNC(tsearch,[
74 PROGS_HAVE_TSEARCH=$PROGS_IF_TSEARCH
75],[
76 PROGS_HAVE_TSEARCH='';
77 AC_MSG_WARN([tsearch missing - not building client program(s) $PROGS_IF_TSEARCH])
78])
79
04e7fb4d 80AC_MSG_CHECKING(for INADDR_LOOPBACK)
81AC_CACHE_VAL(adns_cv_decl_inaddrloopback,[
82 AC_TRY_COMPILE([
83#include <sys/socket.h>
84#include <netinet/in.h>
85#include <arpa/inet.h>
86 ],[
87 INADDR_LOOPBACK;
88 ],
89 adns_cv_decl_inaddrloopback=yes,
90 adns_cv_decl_inaddrloopback=no)])
91if test "$adns_cv_decl_inaddrloopback" = yes; then
92 AC_MSG_RESULT(found)
93else
94 AC_MSG_RESULT([not in standard headers, urgh...])
95 AC_CHECK_HEADER(rpc/types.h,[
96 AC_DEFINE(HAVEUSE_RPCTYPES_H)
97 ],[
98 AC_MSG_ERROR([cannot find INADDR_LOOPBACK or rpc/types.h])
99 ])
100fi
101
8b5269f2 102ADNS_C_GETFUNC(inet_aton,resolv,[
103 LIBS="-lresolv $LIBS";
104 AC_MSG_WARN([inet_aton is in libresolv, urgh. Must use -lresolv.])
105])
106
5a0be244 107DPKG_CACHED_TRY_COMPILE(inlines,dpkg_cv_c_inline,,
108 [} inline int foo (int x) {],
109 AC_MSG_RESULT(yes)
110 AC_DEFINE(HAVE_INLINE),
111 AC_MSG_RESULT(no))
112
11b35193 113AC_SUBST(WARNS)
114
115if test "${GCC-no}" = yes; then
116 WARNS="-Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes -Wcast-qual -Wpointer-arith"
52888ec6 117 saved_cflags="$CFLAGS"
118 CFLAGS="$CFLAGS -Wno-pointer-sign"
119 DPKG_CACHED_TRY_COMPILE(-Wno-pointer-sign,adns_cv_c_wnoptrsign,,
120 [],
121 AC_MSG_RESULT(yes)
122 WARNS="$WARNS -Wno-pointer-sign",
123 AC_MSG_RESULT(no))
124 CFLAGS="$saved_cflags"
11b35193 125else
126 WARNS=
127fi
128
52888ec6 129ADNS_C_GCCATTRIB
130
11b35193 131AC_SUBST(SHLIBCC)
132AC_SUBST(MKSHLIB_1)
133AC_SUBST(MKSHLIB_2)
134AC_SUBST(MKSHLIB_3)
9310ea4d 135
136AC_SUBST(SHLIBFORLINK)
11b35193 137AC_SUBST(SHLIBFILE)
138AC_SUBST(SHLIBSONAME)
139
9310ea4d 140SHLIBFORLINK='libadns.so'
141SHLIBSONAME='$(SHLIBFORLINK).$(MAJOR)'
142SHLIBFILE='$(SHLIBSONAME).$(MINOR)'
11b35193 143
696e536a 144SHLIBCC='$(CC) $(CFLAGS) -fpic'
145MKSHLIB_1='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME) -o'
146MKSHLIB_2=''
147MKSHLIB_3='-lc'
148
9579019a 149AC_OUTPUT(
150 settings.make Makefile
151 src/Makefile client/Makefile dynamic/Makefile regress/Makefile
152)