11b35193 |
1 | # configure.in - input to autoconf |
2 | # |
d942707d |
3 | # This file is |
1674b672 |
4 | # Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk> |
11b35193 |
5 | # |
d942707d |
6 | # It is part of adns, which is |
3d5cde09 |
7 | # Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk> |
bef232ae |
8 | # Copyright (C) 1999-2000 Tony Finch <dot@dotat.at> |
d942707d |
9 | # |
11b35193 |
10 | # This program is free software; you can redistribute it and/or modify |
11 | # it under the terms of the GNU General Public License as published by |
12 | # the Free Software Foundation; either version 2, or (at your option) |
13 | # any later version. |
14 | # |
15 | # This program is distributed in the hope that it will be useful, |
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | # GNU General Public License for more details. |
19 | # |
20 | # You should have received a copy of the GNU General Public License |
21 | # along with this program; if not, write to the Free Software Foundation, |
22 | # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 | |
24 | AC_INIT(src/adns.h) |
25 | AC_CONFIG_HEADER(src/config.h) |
48337073 |
26 | |
5a0be244 |
27 | dnl DPKG_CACHED_TRY_COMPILE(<description>,<cachevar>,<include>,<program>,<ifyes>,<ifno>) |
28 | define(DPKG_CACHED_TRY_COMPILE,[ |
29 | AC_MSG_CHECKING($1) |
30 | AC_CACHE_VAL($2,[ |
31 | AC_TRY_COMPILE([$3],[$4],[$2=yes],[$2=no]) |
32 | ]) |
33 | if test "x$$2" = xyes; then |
34 | true |
35 | $5 |
36 | else |
37 | true |
38 | $6 |
39 | fi |
40 | ]) |
41 | |
48337073 |
42 | AC_MSG_CHECKING(whether you requested dynamic linking) |
43 | AC_SUBST(ENABLE_DYNAMIC) |
44 | AC_ARG_ENABLE(dynamic, |
45 | [ --disable-dynamic use static linking |
46 | --enable-dynamic[=elf] create and use ELF dynamic library (default)], |
47 | [ case "$enableval" in |
48 | elf|yes) |
49 | ENABLE_DYNAMIC=elf |
50 | AC_MSG_RESULT([yes (ELF)]) |
51 | ;; |
52 | no) ENABLE_DYNAMIC=no |
53 | AC_MSG_RESULT(no) |
54 | ;; |
55 | *) AC_MSG_ERROR( |
56 | ["invalid value $enableval for --enable-dynamic, try yes or elf"]) |
57 | ;; |
58 | esac |
59 | ],[ |
5a0be244 |
60 | ENABLE_DYNAMIC=elf |
48337073 |
61 | AC_MSG_RESULT([yes, by default]) |
62 | ]) |
63 | |
11b35193 |
64 | AC_PROG_CC |
04e7fb4d |
65 | AC_PROG_CPP |
9579019a |
66 | AC_PROG_RANLIB |
a0c76eee |
67 | AC_PROG_INSTALL |
8b5269f2 |
68 | |
620c146d |
69 | AC_CHECK_FUNCS(poll) |
8b5269f2 |
70 | ADNS_C_GETFUNC(socket,socket) |
71 | ADNS_C_GETFUNC(inet_ntoa,nsl) |
72 | |
9a09fa18 |
73 | PROGS_IF_TSEARCH=adnsresfilter |
74 | AC_SUBST(PROGS_HAVE_TSEARCH) |
75 | AC_CHECK_FUNC(tsearch,[ |
76 | PROGS_HAVE_TSEARCH=$PROGS_IF_TSEARCH |
77 | ],[ |
78 | PROGS_HAVE_TSEARCH=''; |
79 | AC_MSG_WARN([tsearch missing - not building client program(s) $PROGS_IF_TSEARCH]) |
80 | ]) |
81 | |
04e7fb4d |
82 | AC_MSG_CHECKING(for INADDR_LOOPBACK) |
83 | AC_CACHE_VAL(adns_cv_decl_inaddrloopback,[ |
84 | AC_TRY_COMPILE([ |
85 | #include <sys/socket.h> |
86 | #include <netinet/in.h> |
87 | #include <arpa/inet.h> |
88 | ],[ |
89 | INADDR_LOOPBACK; |
90 | ], |
91 | adns_cv_decl_inaddrloopback=yes, |
92 | adns_cv_decl_inaddrloopback=no)]) |
93 | if test "$adns_cv_decl_inaddrloopback" = yes; then |
94 | AC_MSG_RESULT(found) |
95 | else |
96 | AC_MSG_RESULT([not in standard headers, urgh...]) |
97 | AC_CHECK_HEADER(rpc/types.h,[ |
98 | AC_DEFINE(HAVEUSE_RPCTYPES_H) |
99 | ],[ |
100 | AC_MSG_ERROR([cannot find INADDR_LOOPBACK or rpc/types.h]) |
101 | ]) |
102 | fi |
103 | |
8b5269f2 |
104 | ADNS_C_GETFUNC(inet_aton,resolv,[ |
105 | LIBS="-lresolv $LIBS"; |
106 | AC_MSG_WARN([inet_aton is in libresolv, urgh. Must use -lresolv.]) |
107 | ]) |
108 | |
5a0be244 |
109 | DPKG_CACHED_TRY_COMPILE(inlines,dpkg_cv_c_inline,, |
110 | [} inline int foo (int x) {], |
111 | AC_MSG_RESULT(yes) |
112 | AC_DEFINE(HAVE_INLINE), |
113 | AC_MSG_RESULT(no)) |
114 | |
11b35193 |
115 | ADNS_C_GCCATTRIB |
5a0be244 |
116 | AC_CHECK_HEADERS(sys/select.h) |
11b35193 |
117 | |
118 | AC_SUBST(WARNS) |
119 | |
120 | if test "${GCC-no}" = yes; then |
121 | WARNS="-Wall -Wmissing-prototypes -Wwrite-strings -Wstrict-prototypes -Wcast-qual -Wpointer-arith" |
122 | else |
123 | WARNS= |
124 | fi |
125 | |
126 | AC_SUBST(SHLIBCC) |
127 | AC_SUBST(MKSHLIB_1) |
128 | AC_SUBST(MKSHLIB_2) |
129 | AC_SUBST(MKSHLIB_3) |
9310ea4d |
130 | |
131 | AC_SUBST(SHLIBFORLINK) |
11b35193 |
132 | AC_SUBST(SHLIBFILE) |
133 | AC_SUBST(SHLIBSONAME) |
134 | |
9310ea4d |
135 | SHLIBFORLINK='libadns.so' |
136 | SHLIBSONAME='$(SHLIBFORLINK).$(MAJOR)' |
137 | SHLIBFILE='$(SHLIBSONAME).$(MINOR)' |
11b35193 |
138 | |
696e536a |
139 | SHLIBCC='$(CC) $(CFLAGS) -fpic' |
140 | MKSHLIB_1='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME) -o' |
141 | MKSHLIB_2='' |
142 | MKSHLIB_3='-lc' |
143 | |
9579019a |
144 | AC_OUTPUT( |
145 | settings.make Makefile |
146 | src/Makefile client/Makefile dynamic/Makefile regress/Makefile |
147 | ) |