1 # Copyright (C) 1994-2022 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <https://www.gnu.org/licenses/>.
19 # Sub-makefile for resolv portion of the library.
25 headers
:= resolv.h bits
/types
/res_state.h \
26 netdb.h bits
/netdb.h \
27 arpa
/nameser.h arpa
/nameser_compat.h \
43 ns_name_length_uncompressed \
60 res_context_hostalias \
76 tests
= tst-aton tst-leaks tst-inet_ntop
77 tests-container
= tst-leaks2
79 tests-internal
+= tst-inet_aton_exact
82 generate
:= mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace
84 extra-libs
:= libresolv libnss_dns
85 ifeq ($(have-thread-library
),yes
)
86 routines
+= gai_sigqueue
92 tst-ns_name_compress \
94 tst-res_hconf_reorder \
101 tst-resolv-invalid-cname \
104 tst-resolv-nondecimal \
105 tst-resolv-res_init-multi \
107 tst-resolv-trailing \
109 # This test calls __res_context_send directly, which is not exported
111 tests-internal
+= tst-resolv-txnid-collision
112 tests-static
+= tst-resolv-txnid-collision
114 # Likewise for __ns_samebinaryname.
115 tests-internal
+= tst-ns_samebinaryname
116 tests-static
+= tst-ns_samebinaryname
118 # Likewise for __ns_name_length_uncompressed.
119 tests-internal
+= tst-ns_name_length_uncompressed
120 tests-static
+= tst-ns_name_length_uncompressed
122 # Likewise for struct ns_rr_cursor and its functions.
123 tests-internal
+= tst-ns_rr_cursor
124 tests-static
+= tst-ns_rr_cursor
126 # These tests need libdl.
127 ifeq (yes
,$(build-shared
))
130 tst-resolv-ai_idn-latin1 \
131 tst-resolv-ai_idn-nolibidn2 \
132 tst-resolv-canonname \
135 # Needs resolv_context.
137 tst-resolv-res_init \
138 tst-resolv-res_init-thread \
139 tst-resolv-res_ninit \
142 # Used by tst-resolv-ai_idn-nolibidn2 to disable libidn2 (by not
143 # providing any functions in libidn2.so.0).
144 modules-names
+= tst-no-libidn2
145 extra-test-objs
+= tst-no-libidn2.os
146 LDFLAGS-tst-no-libidn2.so
= -Wl
,-soname
,libidn2.so
.0
148 endif # $(build-shared)
150 # This test accesses __inet_ntop_length, an internal libc function.
151 tests-internal
+= tst-inet_pton
153 # This test accesses the __p_secstodate compat symbol.
154 ifeq ($(have-GLIBC_2.26
)$(build-shared
),yesyes
)
155 tests
+= tst-p_secstodate
158 # This test sends millions of packets and is rather slow.
159 xtests
+= tst-resolv-qtypes
161 # This test has dropped packet tests and runs for a long time.
162 xtests
+= tst-resolv-rotate
163 endif # $(have-thread-library)
165 extra-libs-others
= $(extra-libs
)
166 libresolv-routines
:= \
188 ifeq ($(have-GLIBC_2.34
)$(have-thread-library
),yesyes
)
189 # Empty compatibility library for old binaries.
191 libanl-routines
+= libanl-compat
192 libanl-shared-only-routines
+= libanl-compat
195 $(libanl-routines-var
) += \
202 # $(libanl-routines-var)
204 # Pretend that libanl.so is a linker script, so that the symbolic link
206 install-lib-ldscripts
= libanl.so
207 $(inst_libdir
)/libanl.so
:
209 subdir-dirs
= nss_dns
212 # Build only an empty shared libnss_dns.
213 libnss_dns-inhibit-o
= $(filter-out .os
,$(object-suffixes
))
215 # Pretend that libnss_dns.so is a linker script, so that the symbolic link
217 install-lib-ldscripts
= libnss_dns.so
218 $(inst_libdir
)/libnss_dns.so
:
220 ifeq ($(run-built-tests
),yes
)
222 tests-special
+= $(objpfx
)mtrace-tst-leaks.out
$(objpfx
)mtrace-tst-leaks2.out \
223 $(objpfx
)mtrace-tst-resolv-res_ninit.out
227 generated
+= mtrace-tst-leaks.out tst-leaks.mtrace \
228 mtrace-tst-leaks2.out tst-leaks2.mtrace \
229 mtrace-tst-resolv-res_ninit.out tst-resolv-res_ninit.mtrace \
233 LOCALES
:= en_US.UTF-8 en_US.ISO-8859-1
234 include ..
/gen-locales.mk
236 CFLAGS-res_hconf.c
+= -fexceptions
238 # The DNS NSS modules needs the resolver.
239 $(objpfx
)libnss_dns.so
: $(objpfx
)libresolv.so
241 # The asynchronous name lookup code needs the thread library.
242 $(objpfx
)libanl.so
: $(shared-thread-library
)
244 $(objpfx
)tst-res_hconf_reorder
: $(shared-thread-library
)
245 tst-res_hconf_reorder-ENV
= RESOLV_REORDER
=on
247 $(objpfx
)tst-leaks
: $(objpfx
)libresolv.so
248 tst-leaks-ENV
= MALLOC_TRACE
=$(objpfx
)tst-leaks.mtrace \
249 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
250 $(objpfx
)mtrace-tst-leaks.out
: $(objpfx
)tst-leaks.out
251 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-leaks.mtrace
> $@
; \
254 tst-leaks2-ENV
= MALLOC_TRACE
=$(objpfx
)tst-leaks2.mtrace \
255 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
256 $(objpfx
)mtrace-tst-leaks2.out
: $(objpfx
)tst-leaks2.out
257 { test -r
$(objpfx
)tst-leaks2.mtrace \
258 ||
( echo
"tst-leaks2.mtrace does not exist"; exit
77; ) \
259 && $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-leaks2.mtrace
; } > $@
; \
262 tst-resolv-res_ninit-ENV
= MALLOC_TRACE
=$(objpfx
)tst-resolv-res_ninit.mtrace \
263 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
264 $(objpfx
)mtrace-tst-resolv-res_ninit.out
: $(objpfx
)tst-resolv-res_ninit.out
265 $(common-objpfx
)malloc
/mtrace \
266 $(objpfx
)tst-resolv-res_ninit.mtrace
> $@
; \
269 $(objpfx
)tst-bug18665-tcp
: $(objpfx
)libresolv.so
$(shared-thread-library
)
270 $(objpfx
)tst-bug18665
: $(objpfx
)libresolv.so
$(shared-thread-library
)
271 $(objpfx
)tst-resolv-ai_idn
: $(objpfx
)libresolv.so
$(shared-thread-library
)
272 $(objpfx
)tst-resolv-ai_idn-latin1
: \
273 $(objpfx
)libresolv.so
$(shared-thread-library
)
274 $(objpfx
)tst-resolv-ai_idn-nolibidn2
: \
275 $(objpfx
)libresolv.so
$(shared-thread-library
)
276 $(objpfx
)tst-resolv-ai_idn.out
: $(gen-locales
)
277 $(objpfx
)tst-resolv-ai_idn-latin1.out
: $(gen-locales
)
278 $(objpfx
)tst-resolv-ai_idn-nolibidn2.out
: \
279 $(gen-locales
) $(objpfx
)tst-no-libidn2.so
280 $(objpfx
)tst-resolv-aliases
: $(objpfx
)libresolv.so
$(shared-thread-library
)
281 $(objpfx
)tst-resolv-basic
: $(objpfx
)libresolv.so
$(shared-thread-library
)
282 $(objpfx
)tst-resolv-binary
: $(objpfx
)libresolv.so
$(shared-thread-library
)
283 $(objpfx
)tst-resolv-byaddr
: $(objpfx
)libresolv.so
$(shared-thread-library
)
284 $(objpfx
)tst-resolv-edns
: $(objpfx
)libresolv.so
$(shared-thread-library
)
285 $(objpfx
)tst-resolv-network
: $(objpfx
)libresolv.so
$(shared-thread-library
)
286 $(objpfx
)tst-resolv-res_init
: $(objpfx
)libresolv.so
287 $(objpfx
)tst-resolv-res_init-multi
: $(objpfx
)libresolv.so \
288 $(shared-thread-library
)
289 $(objpfx
)tst-resolv-res_init-thread
: $(objpfx
)libresolv.so \
290 $(shared-thread-library
)
291 $(objpfx
)tst-resolv-invalid-cname
: $(objpfx
)libresolv.so \
292 $(shared-thread-library
)
293 $(objpfx
)tst-resolv-noaaaa
: $(objpfx
)libresolv.so
$(shared-thread-library
)
294 $(objpfx
)tst-resolv-nondecimal
: $(objpfx
)libresolv.so
$(shared-thread-library
)
295 $(objpfx
)tst-resolv-qtypes
: $(objpfx
)libresolv.so
$(shared-thread-library
)
296 $(objpfx
)tst-resolv-rotate
: $(objpfx
)libresolv.so
$(shared-thread-library
)
297 $(objpfx
)tst-resolv-search
: $(objpfx
)libresolv.so
$(shared-thread-library
)
298 $(objpfx
)tst-resolv-trailing
: $(objpfx
)libresolv.so
$(shared-thread-library
)
299 $(objpfx
)tst-resolv-threads
: $(objpfx
)libresolv.so
$(shared-thread-library
)
300 $(objpfx
)tst-resolv-txnid-collision
: $(objpfx
)libresolv.a \
301 $(static-thread-library
)
302 $(objpfx
)tst-resolv-canonname
: $(objpfx
)libresolv.so
$(shared-thread-library
)
303 $(objpfx
)tst-resolv-trustad
: $(objpfx
)libresolv.so
$(shared-thread-library
)
305 $(objpfx
)tst-ns_name
: $(objpfx
)libresolv.so
306 $(objpfx
)tst-ns_name.out
: tst-ns_name.data
307 $(objpfx
)tst-ns_name_compress
: $(objpfx
)libresolv.so
308 $(objpfx
)tst-ns_name_pton
: $(objpfx
)libresolv.so
309 $(objpfx
)tst-res_hnok
: $(objpfx
)libresolv.so
310 $(objpfx
)tst-p_secstodate
: $(objpfx
)libresolv.so