1 # Copyright (C) 1994-2023 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
91 tst-inet_addr-binary \
93 tst-ns_name_compress \
95 tst-res_hconf_reorder \
102 tst-resolv-invalid-cname \
105 tst-resolv-noaaaa-vc \
106 tst-resolv-nondecimal \
107 tst-resolv-res_init-multi \
109 tst-resolv-trailing \
111 # This test calls __res_context_send directly, which is not exported
113 tests-internal
+= tst-resolv-txnid-collision
114 tests-static
+= tst-resolv-txnid-collision
116 # Likewise for __ns_samebinaryname.
117 tests-internal
+= tst-ns_samebinaryname
118 tests-static
+= tst-ns_samebinaryname
120 # Likewise for __ns_name_length_uncompressed.
121 tests-internal
+= tst-ns_name_length_uncompressed
122 tests-static
+= tst-ns_name_length_uncompressed
124 # Likewise for struct ns_rr_cursor and its functions.
125 tests-internal
+= tst-ns_rr_cursor
126 tests-static
+= tst-ns_rr_cursor
128 # These tests need libdl.
129 ifeq (yes
,$(build-shared
))
132 tst-resolv-ai_idn-latin1 \
133 tst-resolv-ai_idn-nolibidn2 \
134 tst-resolv-canonname \
137 # Needs resolv_context.
139 tst-resolv-res_init \
140 tst-resolv-res_init-thread \
141 tst-resolv-res_ninit \
144 # Used by tst-resolv-ai_idn-nolibidn2 to disable libidn2 (by not
145 # providing any functions in libidn2.so.0).
146 modules-names
+= tst-no-libidn2
147 extra-test-objs
+= tst-no-libidn2.os
148 LDFLAGS-tst-no-libidn2.so
= -Wl
,-soname
,libidn2.so
.0
150 endif # $(build-shared)
152 # This test accesses __inet_ntop_length, an internal libc function.
153 tests-internal
+= tst-inet_pton
155 # This test accesses the __p_secstodate compat symbol.
156 ifeq ($(have-GLIBC_2.26
)$(build-shared
),yesyes
)
157 tests
+= tst-p_secstodate
160 # This test sends millions of packets and is rather slow.
161 xtests
+= tst-resolv-qtypes
163 # This test has dropped packet tests and runs for a long time.
164 xtests
+= tst-resolv-rotate
165 endif # $(have-thread-library)
167 extra-libs-others
= $(extra-libs
)
168 libresolv-routines
:= \
190 ifeq ($(have-anl-library
),yes
)
191 # Empty compatibility library for old binaries.
193 libanl-routines
+= libanl-compat
194 libanl-shared-only-routines
+= libanl-compat
197 $(libanl-routines-var
) += \
204 # $(libanl-routines-var)
206 # Pretend that libanl.so is a linker script, so that the symbolic link
208 install-lib-ldscripts
= libanl.so
209 $(inst_libdir
)/libanl.so
:
211 subdir-dirs
= nss_dns
214 # Build only an empty shared libnss_dns.
215 libnss_dns-inhibit-o
= $(filter-out .os
,$(object-suffixes
))
217 # Pretend that libnss_dns.so is a linker script, so that the symbolic link
219 install-lib-ldscripts
= libnss_dns.so
220 $(inst_libdir
)/libnss_dns.so
:
222 ifeq ($(run-built-tests
),yes
)
224 tests-special
+= $(objpfx
)mtrace-tst-leaks.out
$(objpfx
)mtrace-tst-leaks2.out \
225 $(objpfx
)mtrace-tst-resolv-res_ninit.out
229 generated
+= mtrace-tst-leaks.out tst-leaks.mtrace \
230 mtrace-tst-leaks2.out tst-leaks2.mtrace \
231 mtrace-tst-resolv-res_ninit.out tst-resolv-res_ninit.mtrace \
235 LOCALES
:= en_US.UTF-8 en_US.ISO-8859-1
236 include ..
/gen-locales.mk
238 CFLAGS-res_hconf.c
+= -fexceptions
239 CFLAGS-inet_pton.c
+= $(config-cflags-wno-ignored-attributes
)
241 # The DNS NSS modules needs the resolver.
242 $(objpfx
)libnss_dns.so
: $(objpfx
)libresolv.so
244 # The asynchronous name lookup code needs the thread library.
245 $(objpfx
)libanl.so
: $(shared-thread-library
)
247 $(objpfx
)tst-res_hconf_reorder
: $(shared-thread-library
)
248 tst-res_hconf_reorder-ENV
= RESOLV_REORDER
=on
250 $(objpfx
)tst-leaks
: $(objpfx
)libresolv.so
251 tst-leaks-ENV
= MALLOC_TRACE
=$(objpfx
)tst-leaks.mtrace \
252 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
253 $(objpfx
)mtrace-tst-leaks.out
: $(objpfx
)tst-leaks.out
254 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-leaks.mtrace
> $@
; \
257 tst-leaks2-ENV
= MALLOC_TRACE
=$(objpfx
)tst-leaks2.mtrace \
258 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
259 $(objpfx
)mtrace-tst-leaks2.out
: $(objpfx
)tst-leaks2.out
260 { test -r
$(objpfx
)tst-leaks2.mtrace \
261 ||
( echo
"tst-leaks2.mtrace does not exist"; exit
77; ) \
262 && $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-leaks2.mtrace
; } > $@
; \
265 tst-resolv-res_ninit-ENV
= MALLOC_TRACE
=$(objpfx
)tst-resolv-res_ninit.mtrace \
266 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
267 $(objpfx
)mtrace-tst-resolv-res_ninit.out
: $(objpfx
)tst-resolv-res_ninit.out
268 $(common-objpfx
)malloc
/mtrace \
269 $(objpfx
)tst-resolv-res_ninit.mtrace
> $@
; \
272 $(objpfx
)tst-bug18665-tcp
: $(objpfx
)libresolv.so
$(shared-thread-library
)
273 $(objpfx
)tst-bug18665
: $(objpfx
)libresolv.so
$(shared-thread-library
)
274 $(objpfx
)tst-resolv-ai_idn
: $(objpfx
)libresolv.so
$(shared-thread-library
)
275 $(objpfx
)tst-resolv-ai_idn-latin1
: \
276 $(objpfx
)libresolv.so
$(shared-thread-library
)
277 $(objpfx
)tst-resolv-ai_idn-nolibidn2
: \
278 $(objpfx
)libresolv.so
$(shared-thread-library
)
279 $(objpfx
)tst-resolv-ai_idn.out
: $(gen-locales
)
280 $(objpfx
)tst-resolv-ai_idn-latin1.out
: $(gen-locales
)
281 $(objpfx
)tst-resolv-ai_idn-nolibidn2.out
: \
282 $(gen-locales
) $(objpfx
)tst-no-libidn2.so
283 $(objpfx
)tst-resolv-aliases
: $(objpfx
)libresolv.so
$(shared-thread-library
)
284 $(objpfx
)tst-resolv-basic
: $(objpfx
)libresolv.so
$(shared-thread-library
)
285 $(objpfx
)tst-resolv-binary
: $(objpfx
)libresolv.so
$(shared-thread-library
)
286 $(objpfx
)tst-resolv-byaddr
: $(objpfx
)libresolv.so
$(shared-thread-library
)
287 $(objpfx
)tst-resolv-edns
: $(objpfx
)libresolv.so
$(shared-thread-library
)
288 $(objpfx
)tst-resolv-network
: $(objpfx
)libresolv.so
$(shared-thread-library
)
289 $(objpfx
)tst-resolv-res_init
: $(objpfx
)libresolv.so
290 $(objpfx
)tst-resolv-res_init-multi
: $(objpfx
)libresolv.so \
291 $(shared-thread-library
)
292 $(objpfx
)tst-resolv-res_init-thread
: $(objpfx
)libresolv.so \
293 $(shared-thread-library
)
294 $(objpfx
)tst-resolv-invalid-cname
: $(objpfx
)libresolv.so \
295 $(shared-thread-library
)
296 $(objpfx
)tst-resolv-noaaaa
: $(objpfx
)libresolv.so
$(shared-thread-library
)
297 $(objpfx
)tst-resolv-noaaaa-vc
: $(objpfx
)libresolv.so
$(shared-thread-library
)
298 $(objpfx
)tst-resolv-nondecimal
: $(objpfx
)libresolv.so
$(shared-thread-library
)
299 $(objpfx
)tst-resolv-qtypes
: $(objpfx
)libresolv.so
$(shared-thread-library
)
300 $(objpfx
)tst-resolv-rotate
: $(objpfx
)libresolv.so
$(shared-thread-library
)
301 $(objpfx
)tst-resolv-search
: $(objpfx
)libresolv.so
$(shared-thread-library
)
302 $(objpfx
)tst-resolv-trailing
: $(objpfx
)libresolv.so
$(shared-thread-library
)
303 $(objpfx
)tst-resolv-threads
: $(objpfx
)libresolv.so
$(shared-thread-library
)
304 $(objpfx
)tst-resolv-txnid-collision
: $(objpfx
)libresolv.a \
305 $(static-thread-library
)
306 $(objpfx
)tst-resolv-canonname
: $(objpfx
)libresolv.so
$(shared-thread-library
)
307 $(objpfx
)tst-resolv-trustad
: $(objpfx
)libresolv.so
$(shared-thread-library
)
309 $(objpfx
)tst-ns_name
: $(objpfx
)libresolv.so
310 $(objpfx
)tst-ns_name.out
: tst-ns_name.data
311 $(objpfx
)tst-ns_name_compress
: $(objpfx
)libresolv.so
312 $(objpfx
)tst-ns_name_pton
: $(objpfx
)libresolv.so
313 $(objpfx
)tst-res_hnok
: $(objpfx
)libresolv.so
314 $(objpfx
)tst-p_secstodate
: $(objpfx
)libresolv.so