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-nondecimal \
106 tst-resolv-res_init-multi \
108 tst-resolv-trailing \
110 # This test calls __res_context_send directly, which is not exported
112 tests-internal
+= tst-resolv-txnid-collision
113 tests-static
+= tst-resolv-txnid-collision
115 # Likewise for __ns_samebinaryname.
116 tests-internal
+= tst-ns_samebinaryname
117 tests-static
+= tst-ns_samebinaryname
119 # Likewise for __ns_name_length_uncompressed.
120 tests-internal
+= tst-ns_name_length_uncompressed
121 tests-static
+= tst-ns_name_length_uncompressed
123 # Likewise for struct ns_rr_cursor and its functions.
124 tests-internal
+= tst-ns_rr_cursor
125 tests-static
+= tst-ns_rr_cursor
127 # These tests need libdl.
128 ifeq (yes
,$(build-shared
))
131 tst-resolv-ai_idn-latin1 \
132 tst-resolv-ai_idn-nolibidn2 \
133 tst-resolv-canonname \
136 # Needs resolv_context.
138 tst-resolv-res_init \
139 tst-resolv-res_init-thread \
140 tst-resolv-res_ninit \
143 # Used by tst-resolv-ai_idn-nolibidn2 to disable libidn2 (by not
144 # providing any functions in libidn2.so.0).
145 modules-names
+= tst-no-libidn2
146 extra-test-objs
+= tst-no-libidn2.os
147 LDFLAGS-tst-no-libidn2.so
= -Wl
,-soname
,libidn2.so
.0
149 endif # $(build-shared)
151 # This test accesses __inet_ntop_length, an internal libc function.
152 tests-internal
+= tst-inet_pton
154 # This test accesses the __p_secstodate compat symbol.
155 ifeq ($(have-GLIBC_2.26
)$(build-shared
),yesyes
)
156 tests
+= tst-p_secstodate
159 # This test sends millions of packets and is rather slow.
160 xtests
+= tst-resolv-qtypes
162 # This test has dropped packet tests and runs for a long time.
163 xtests
+= tst-resolv-rotate
164 endif # $(have-thread-library)
166 extra-libs-others
= $(extra-libs
)
167 libresolv-routines
:= \
189 ifeq ($(have-anl-library
),yes
)
190 # Empty compatibility library for old binaries.
192 libanl-routines
+= libanl-compat
193 libanl-shared-only-routines
+= libanl-compat
196 $(libanl-routines-var
) += \
203 # $(libanl-routines-var)
205 # Pretend that libanl.so is a linker script, so that the symbolic link
207 install-lib-ldscripts
= libanl.so
208 $(inst_libdir
)/libanl.so
:
210 subdir-dirs
= nss_dns
213 # Build only an empty shared libnss_dns.
214 libnss_dns-inhibit-o
= $(filter-out .os
,$(object-suffixes
))
216 # Pretend that libnss_dns.so is a linker script, so that the symbolic link
218 install-lib-ldscripts
= libnss_dns.so
219 $(inst_libdir
)/libnss_dns.so
:
221 ifeq ($(run-built-tests
),yes
)
223 tests-special
+= $(objpfx
)mtrace-tst-leaks.out
$(objpfx
)mtrace-tst-leaks2.out \
224 $(objpfx
)mtrace-tst-resolv-res_ninit.out
228 generated
+= mtrace-tst-leaks.out tst-leaks.mtrace \
229 mtrace-tst-leaks2.out tst-leaks2.mtrace \
230 mtrace-tst-resolv-res_ninit.out tst-resolv-res_ninit.mtrace \
234 LOCALES
:= en_US.UTF-8 en_US.ISO-8859-1
235 include ..
/gen-locales.mk
237 CFLAGS-res_hconf.c
+= -fexceptions
238 CFLAGS-inet_pton.c
+= $(config-cflags-wno-ignored-attributes
)
240 # The DNS NSS modules needs the resolver.
241 $(objpfx
)libnss_dns.so
: $(objpfx
)libresolv.so
243 # The asynchronous name lookup code needs the thread library.
244 $(objpfx
)libanl.so
: $(shared-thread-library
)
246 $(objpfx
)tst-res_hconf_reorder
: $(shared-thread-library
)
247 tst-res_hconf_reorder-ENV
= RESOLV_REORDER
=on
249 $(objpfx
)tst-leaks
: $(objpfx
)libresolv.so
250 tst-leaks-ENV
= MALLOC_TRACE
=$(objpfx
)tst-leaks.mtrace \
251 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
252 $(objpfx
)mtrace-tst-leaks.out
: $(objpfx
)tst-leaks.out
253 $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-leaks.mtrace
> $@
; \
256 tst-leaks2-ENV
= MALLOC_TRACE
=$(objpfx
)tst-leaks2.mtrace \
257 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
258 $(objpfx
)mtrace-tst-leaks2.out
: $(objpfx
)tst-leaks2.out
259 { test -r
$(objpfx
)tst-leaks2.mtrace \
260 ||
( echo
"tst-leaks2.mtrace does not exist"; exit
77; ) \
261 && $(common-objpfx
)malloc
/mtrace
$(objpfx
)tst-leaks2.mtrace
; } > $@
; \
264 tst-resolv-res_ninit-ENV
= MALLOC_TRACE
=$(objpfx
)tst-resolv-res_ninit.mtrace \
265 LD_PRELOAD
=$(common-objpfx
)/malloc
/libc_malloc_debug.so
266 $(objpfx
)mtrace-tst-resolv-res_ninit.out
: $(objpfx
)tst-resolv-res_ninit.out
267 $(common-objpfx
)malloc
/mtrace \
268 $(objpfx
)tst-resolv-res_ninit.mtrace
> $@
; \
271 $(objpfx
)tst-bug18665-tcp
: $(objpfx
)libresolv.so
$(shared-thread-library
)
272 $(objpfx
)tst-bug18665
: $(objpfx
)libresolv.so
$(shared-thread-library
)
273 $(objpfx
)tst-resolv-ai_idn
: $(objpfx
)libresolv.so
$(shared-thread-library
)
274 $(objpfx
)tst-resolv-ai_idn-latin1
: \
275 $(objpfx
)libresolv.so
$(shared-thread-library
)
276 $(objpfx
)tst-resolv-ai_idn-nolibidn2
: \
277 $(objpfx
)libresolv.so
$(shared-thread-library
)
278 $(objpfx
)tst-resolv-ai_idn.out
: $(gen-locales
)
279 $(objpfx
)tst-resolv-ai_idn-latin1.out
: $(gen-locales
)
280 $(objpfx
)tst-resolv-ai_idn-nolibidn2.out
: \
281 $(gen-locales
) $(objpfx
)tst-no-libidn2.so
282 $(objpfx
)tst-resolv-aliases
: $(objpfx
)libresolv.so
$(shared-thread-library
)
283 $(objpfx
)tst-resolv-basic
: $(objpfx
)libresolv.so
$(shared-thread-library
)
284 $(objpfx
)tst-resolv-binary
: $(objpfx
)libresolv.so
$(shared-thread-library
)
285 $(objpfx
)tst-resolv-byaddr
: $(objpfx
)libresolv.so
$(shared-thread-library
)
286 $(objpfx
)tst-resolv-edns
: $(objpfx
)libresolv.so
$(shared-thread-library
)
287 $(objpfx
)tst-resolv-network
: $(objpfx
)libresolv.so
$(shared-thread-library
)
288 $(objpfx
)tst-resolv-res_init
: $(objpfx
)libresolv.so
289 $(objpfx
)tst-resolv-res_init-multi
: $(objpfx
)libresolv.so \
290 $(shared-thread-library
)
291 $(objpfx
)tst-resolv-res_init-thread
: $(objpfx
)libresolv.so \
292 $(shared-thread-library
)
293 $(objpfx
)tst-resolv-invalid-cname
: $(objpfx
)libresolv.so \
294 $(shared-thread-library
)
295 $(objpfx
)tst-resolv-noaaaa
: $(objpfx
)libresolv.so
$(shared-thread-library
)
296 $(objpfx
)tst-resolv-nondecimal
: $(objpfx
)libresolv.so
$(shared-thread-library
)
297 $(objpfx
)tst-resolv-qtypes
: $(objpfx
)libresolv.so
$(shared-thread-library
)
298 $(objpfx
)tst-resolv-rotate
: $(objpfx
)libresolv.so
$(shared-thread-library
)
299 $(objpfx
)tst-resolv-search
: $(objpfx
)libresolv.so
$(shared-thread-library
)
300 $(objpfx
)tst-resolv-trailing
: $(objpfx
)libresolv.so
$(shared-thread-library
)
301 $(objpfx
)tst-resolv-threads
: $(objpfx
)libresolv.so
$(shared-thread-library
)
302 $(objpfx
)tst-resolv-txnid-collision
: $(objpfx
)libresolv.a \
303 $(static-thread-library
)
304 $(objpfx
)tst-resolv-canonname
: $(objpfx
)libresolv.so
$(shared-thread-library
)
305 $(objpfx
)tst-resolv-trustad
: $(objpfx
)libresolv.so
$(shared-thread-library
)
307 $(objpfx
)tst-ns_name
: $(objpfx
)libresolv.so
308 $(objpfx
)tst-ns_name.out
: tst-ns_name.data
309 $(objpfx
)tst-ns_name_compress
: $(objpfx
)libresolv.so
310 $(objpfx
)tst-ns_name_pton
: $(objpfx
)libresolv.so
311 $(objpfx
)tst-res_hnok
: $(objpfx
)libresolv.so
312 $(objpfx
)tst-p_secstodate
: $(objpfx
)libresolv.so