1#
2# Copyright (C) 2013-2021 Canonical, Ltd.
3# Copyright (C) 2021 Colin Ian King
4#
5# This program is free software; you can redistribute it and/or
6# modify it under the terms of the GNU General Public License
7# as published by the Free Software Foundation; either version 2
8# of the License, or (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18#
19
20CFLAGS += -Wall -Wextra -DVERSION='"$(VERSION)"' -O2 -std=gnu99 -I.
21
22APPARMOR_PARSER=/sbin/apparmor_parser
23
24LIB_APPARMOR := -lapparmor
25KERNEL=$(shell uname -s)
26ifeq (,$(findstring $(KERNEL),Darwin DragonFly FreeBSD NetBSD OpenBSD))
27LIB_BSD := -lbsd
28endif
29LIB_Z := -lz
30LIB_CRYPT := -lcrypt
31LIB_RT := -lrt
32LIB_PTHREAD := -pthread
33LIB_AIO := -laio
34LIB_SCTP := -lsctp
35LIB_DL := -ldl
36LIB_IPSEC_MB := -lIPSec_MB
37LIB_JUDY := -lJudy
38LIB_KMOD := -lkmod
39LIB_ATOMIC := -latomic
40LIB_MATH := -lm
41
42DIR=test
43MAKE_OPTS=-f Makefile.config --no-print-directory HAVE_CONFIG=1
44
45#
46#  Load in current config; use 'make clean' to clear this
47#
48-include config
49
50CFLAGS += $(CONFIG_CFLAGS)
51LDFLAGS += $(CONFIG_LDFLAGS)
52OBJS += $(CONFIG_OBJS)
53
54#
55# Static flags, only to be used when using GCC
56#
57ifeq ($(STATIC),1)
58LDFLAGS += -static
59CFLAGS += -DBUILD_STATIC
60endif
61
62#
63#  Double empty line is intentional!
64#
65define newline
66
67
68endef
69
70using = $(info using $(2) ... $(if $(filter 1,$(1)),yes,no))
71check = $(info $(newline)Checking $(1):)
72
73#
74#  Determine the system build config
75#
76ifndef HAVE_CONFIG
77HAVE_CONFIG=1
78
79ifeq ($(shell uname -s),SunOS)
80	CONFIG_LDFLAGS += -lsocket -lnsl
81endif
82
83$(call check,libraries)
84
85ifndef $(HAVE_LIB_AIO)
86HAVE_LIB_AIO = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS=$(LIB_AIO) TEST_PROG=test-libaio have_test_prog)
87ifeq ($(HAVE_LIB_AIO),1)
88	CONFIG_CFLAGS += -DHAVE_LIB_AIO
89	CONFIG_LDFLAGS += $(LIB_AIO)
90endif
91$(call using,$(HAVE_LIB_AIO),$(LIB_AIO))
92endif
93
94ifndef $(HAVE_LIB_BSD)
95HAVE_LIB_BSD = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS=$(LIB_BSD) TEST_PROG=test-libbsd have_test_prog)
96ifeq ($(HAVE_LIB_BSD),1)
97	CONFIG_CFLAGS += -DHAVE_LIB_BSD
98	CONFIG_LDFLAGS += $(LIB_BSD)
99endif
100$(call using,$(HAVE_LIB_BSD),-lbsd)
101endif
102
103ifndef $(HAVE_LIB_CRYPT)
104HAVE_LIB_CRYPT = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS=$(LIB_CRYPT) TEST_PROG=test-libcrypt have_test_prog)
105ifeq ($(HAVE_LIB_CRYPT),1)
106	CONFIG_CFLAGS += -DHAVE_LIB_CRYPT
107	CONFIG_LDFLAGS += $(LIB_CRYPT)
108endif
109$(call using,$(HAVE_LIB_CRYPT),$(LIB_CRYPT))
110endif
111
112ifndef $(HAVE_LIB_RT)
113HAVE_LIB_RT = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS=$(LIB_RT) TEST_PROG=test-librt have_test_prog)
114ifeq ($(HAVE_LIB_RT),1)
115	CONFIG_CFLAGS += -DHAVE_LIB_RT
116	CONFIG_LDFLAGS += $(LIB_RT)
117endif
118$(call using,$(HAVE_LIB_RT),$(LIB_RT))
119endif
120
121ifndef $(HAVE_LIB_SCTP)
122HAVE_LIB_SCTP = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS=$(LIB_SCTP) TEST_PROG=test-libsctp have_test_prog)
123ifeq ($(HAVE_LIB_SCTP),1)
124	CONFIG_CFLAGS += -DHAVE_LIB_SCTP
125	CONFIG_LDFLAGS += $(LIB_SCTP)
126endif
127$(call using,$(HAVE_LIB_SCTP),$(LIB_SCTP))
128endif
129
130ifndef $(HAVE_LIB_Z)
131HAVE_LIB_Z = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS=$(LIB_Z) TEST_PROG=test-libz have_test_prog)
132ifeq ($(HAVE_LIB_Z),1)
133	CONFIG_CFLAGS += -DHAVE_LIB_Z
134	CONFIG_LDFLAGS += $(LIB_Z)
135endif
136$(call using,$(HAVE_LIB_Z),$(LIB_Z))
137endif
138
139ifndef $(HAVE_LIB_DL)
140HAVE_LIB_DL = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS=$(LIB_DL) TEST_PROG=test-libdl have_test_prog)
141ifeq ($(HAVE_LIB_DL),1)
142	CONFIG_CFLAGS += -DHAVE_LIB_DL
143	CONFIG_LDFLAGS += $(LIB_DL)
144endif
145$(call using,$(HAVE_LIB_DL),$(LIB_DL))
146endif
147
148ifndef $(HAVE_LIB_JUDY)
149HAVE_LIB_JUDY = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS=$(LIB_JUDY) TEST_PROG=test-judy have_test_prog)
150ifeq ($(HAVE_LIB_JUDY),1)
151	CONFIG_CFLAGS += -DHAVE_LIB_JUDY
152	CONFIG_LDFLAGS += $(LIB_JUDY)
153endif
154$(call using,$(HAVE_LIB_JUDY),$(LIB_JUDY))
155endif
156
157ifndef $(HAVE_LIB_PTHREAD_SPINLOCK)
158HAVE_LIB_PTHREAD_SPINLOCK = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS=$(LIB_PTHREAD) TEST_PROG=test-libpthread-spinlock have_test_prog)
159ifeq ($(HAVE_LIB_PTHREAD_SPINLOCK),1)
160	CONFIG_CFLAGS += -DHAVE_LIB_PTHREAD_SPINLOCK
161endif
162$(call using,$(HAVE_LIB_PTHREAD_SPINLOCK),$(LIB_PTHREAD) spinlock)
163endif
164
165#
166#  Always add in pthread lib last to resolve pthread linker issues
167#
168ifndef $(HAVE_LIB_PTHREAD)
169HAVE_LIB_PTHREAD = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS=$(LIB_PTHREAD) TEST_PROG=test-libpthread have_test_prog)
170ifeq ($(HAVE_LIB_PTHREAD),1)
171	CONFIG_CFLAGS += -DHAVE_LIB_PTHREAD
172	CONFIG_LDFLAGS += $(LIB_PTHREAD)
173endif
174$(call using,$(HAVE_LIB_PTHREAD),$(LIB_PTHREAD))
175endif
176
177ifndef $(HAVE_APPARMOR)
178HAVE_APPARMOR = $(shell $(MAKE) $(MAKE_OPTS) have_apparmor)
179ifeq ($(HAVE_APPARMOR),1)
180	CONFIG_OBJS += apparmor-data.o
181	CONFIG_CFLAGS += -DHAVE_APPARMOR
182	CONFIG_LDFLAGS += $(LIB_APPARMOR)
183endif
184$(call using,$(HAVE_APPARMOR),$(LIB_APPARMOR))
185endif
186
187ifndef $(HAVE_LIB_IPSEC_MB)
188HAVE_LIB_IPSEC_MB = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS=$(LIB_IPSEC_MB) TEST_PROG=test-libipsec-mb have_test_prog)
189ifeq ($(HAVE_LIB_IPSEC_MB),1)
190	CONFIG_CFLAGS += -DHAVE_LIB_IPSEC_MB
191	CONFIG_LDFLAGS += $(LIB_IPSEC_MB)
192endif
193$(call using,$(HAVE_LIB_IPSEC_MB),$(LIB_IPSEC_MB))
194endif
195
196ifndef $(HAVE_LIB_KMOD)
197HAVE_LIB_KMOD = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS=$(LIB_KMOD) TEST_PROG=test-libkmod have_test_prog)
198ifeq ($(HAVE_LIB_KMOD),1)
199	CONFIG_CFLAGS += -DHAVE_LIB_KMOD
200	CONFIG_LDFLAGS += $(LIB_KMOD)
201endif
202$(call using,$(HAVE_LIB_KMOD),$(LIB_KMOD))
203endif
204
205$(call check,header files)
206
207ifndef $(HAVE_AIO_H)
208HAVE_AIO_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=aio.h have_header_h)
209ifeq ($(HAVE_AIO_H),1)
210	CONFIG_CFLAGS += -DHAVE_AIO_H
211endif
212$(call using,$(HAVE_AIO_H),aio.h)
213endif
214
215ifndef $(HAVE_ASM_LDT_H)
216HAVE_ASM_LDT_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=asm/ldt.h have_header_h)
217ifeq ($(HAVE_ASM_LDT_H),1)
218	CONFIG_CFLAGS += -DHAVE_ASM_LDT_H
219endif
220$(call using,$(HAVE_ASM_LDT_H),asm/ldt.h)
221endif
222
223ifndef $(HAVE_ASM_MTRR_H)
224HAVE_ASM_MTRR_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=asm/mtrr.h have_header_h)
225ifeq ($(HAVE_ASM_MTRR_H),1)
226	CONFIG_CFLAGS += -DHAVE_ASM_MTRR_H
227endif
228$(call using,$(HAVE_ASM_MTRR_H),asm/mtrr.h)
229endif
230
231ifndef $(HAVE_ASM_PRCTL_H)
232HAVE_ASM_PRCTL_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=asm/prctl.h have_header_h)
233ifeq ($(HAVE_ASM_PRCTL_H),1)
234	CONFIG_CFLAGS += -DHAVE_ASM_PRCTL_H
235endif
236$(call using,$(HAVE_ASM_PRCTL_H),asm/prctl.h)
237endif
238
239#
240#  This must always come after -pthread so that static linking works
241#
242ifeq ($(shell uname -s),Haiku)
243	CONFIG_LDFLAGS += -lnetwork
244else
245	CONFIG_LDFLAGS += -lc
246endif
247
248ifndef $(HAVE_ATTR_XATTR_H)
249HAVE_ATTR_XATTR_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=attr/xattr.h have_header_h)
250ifeq ($(HAVE_ATTR_XATTR_H),1)
251	CONFIG_CFLAGS += -DHAVE_ATTR_XATTR_H
252endif
253$(call using,$(HAVE_ATTR_XATTR_H),attr/xattr.h)
254endif
255
256ifndef $(HAVE_BSD_STDLIB_H)
257HAVE_BSD_STDLIB_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=bsd/stdlib.h have_header_h)
258ifeq ($(HAVE_BSD_STDLIB_H),1)
259	CONFIG_CFLAGS += -DHAVE_BSD_STDLIB_H
260endif
261$(call using,$(HAVE_BSD_STDLIB_H),bsd/stdlib.h)
262endif
263
264ifndef $(HAVE_BSD_STRING_H)
265HAVE_BSD_STRING_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=bsd/string.h have_header_h)
266ifeq ($(HAVE_BSD_STRING_H),1)
267	CONFIG_CFLAGS += -DHAVE_BSD_STRING_H
268endif
269$(call using,$(HAVE_BSD_STRING_H),bsd/string.h)
270endif
271
272ifndef $(HAVE_BSD_SYS_TREE_H)
273HAVE_BSD_SYS_TREE_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=bsd/sys/tree.h have_header_h)
274ifeq ($(HAVE_BSD_SYS_TREE_H),1)
275	CONFIG_CFLAGS += -DHAVE_BSD_SYS_TREE_H
276endif
277$(call using,$(HAVE_BSD_SYS_TREE_H),bsd/sys/tree.h)
278endif
279
280ifndef $(HAVE_BSD_UNISTD_H)
281HAVE_BSD_UNISTD_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=bsd/unistd.h have_header_h)
282ifeq ($(HAVE_BSD_UNISTD_H),1)
283	CONFIG_CFLAGS += -DHAVE_BSD_UNISTD_H
284endif
285$(call using,$(HAVE_BSD_UNISTD_H),bsd/unistd.h)
286endif
287
288ifndef $(HAVE_BSD_WCHAR)
289HAVE_BSD_WCHAR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-bsd-wchar have_test_prog)
290ifeq ($(HAVE_BSD_WCHAR),1)
291	CONFIG_CFLAGS += -DHAVE_BSD_WCHAR
292endif
293$(call using,$(HAVE_BSD_WCHAR),bsd/wchar.h)
294endif
295
296ifndef $(HAVE_COMPLEX_H)
297HAVE_COMPLEX_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=complex.h have_header_h)
298ifeq ($(HAVE_COMPLEX_H),1)
299	CONFIG_CFLAGS += -DHAVE_COMPLEX_H
300endif
301$(call using,$(HAVE_COMPLEX_H),complex.h)
302endif
303
304ifndef $(HAVE_WCHAR)
305HAVE_WCHAR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-wchar have_test_prog)
306ifeq ($(HAVE_WCHAR),1)
307	CONFIG_CFLAGS += -DHAVE_WCHAR
308endif
309$(call using,$(HAVE_WCHAR),wchar.h)
310endif
311
312ifndef $(HAVE_CRYPT_H)
313HAVE_CRYPT_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=crypt.h have_header_h)
314ifeq ($(HAVE_CRYPT_H),1)
315	CONFIG_CFLAGS += -DHAVE_CRYPT_H
316endif
317$(call using,$(HAVE_CRYPT_H),crypt.h)
318endif
319
320ifndef $(HAVE_FEATURES_H)
321HAVE_FEATURES_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=features.h have_header_h)
322ifeq ($(HAVE_FEATURES_H),1)
323	CONFIG_CFLAGS += -DHAVE_FEATURES_H
324endif
325$(call using,$(HAVE_FEATURES_H),features.h)
326endif
327
328ifndef $(HAVE_FENV_H)
329HAVE_FENV_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=fenv.h have_header_h)
330ifeq ($(HAVE_FENV_H),1)
331	CONFIG_CFLAGS += -DHAVE_FENV_H
332endif
333$(call using,$(HAVE_FENV_H),fenv.h)
334endif
335
336ifndef $(HAVE_FLOAT_H)
337HAVE_FLOAT_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=float.h have_header_h)
338ifeq ($(HAVE_FLOAT_H),1)
339	CONFIG_CFLAGS += -DHAVE_FLOAT_H
340endif
341$(call using,$(HAVE_FLOAT_H),float.h)
342endif
343
344ifndef $(HAVE_GRP_H)
345HAVE_GRP_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=grp.h have_header_h)
346ifeq ($(HAVE_GRP_H),1)
347	CONFIG_CFLAGS += -DHAVE_GRP_H
348endif
349$(call using,$(HAVE_GRP_H),grp.h)
350endif
351
352ifndef $(HAVE_INTEL_IPSEC_MB_H)
353HAVE_INTEL_IPSEC_MB_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=intel-ipsec-mb.h have_header_h)
354ifeq ($(HAVE_INTEL_IPSEC_MB_H),1)
355	CONFIG_CFLAGS += -DHAVE_INTEL_IPSEC_MB_H
356endif
357$(call using,$(HAVE_INTEL_IPSEC_MB_H),intel_ipsec_mb.h)
358endif
359
360ifndef $(HAVE_JUDY_H)
361HAVE_JUDY_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=Judy.h have_header_h)
362ifeq ($(HAVE_JUDY_H),1)
363	CONFIG_CFLAGS += -DHAVE_JUDY_H
364endif
365$(call using,$(HAVE_JUDY_H),Judy.h)
366endif
367
368ifndef $(HAVE_KEYUTILS_H)
369HAVE_KEYUTILS_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=keyutils.h have_header_h)
370ifeq ($(HAVE_KEYUTILS_H),1)
371	CONFIG_CFLAGS += -DHAVE_KEYUTILS_H
372endif
373$(call using,$(HAVE_KEYUTILS_H),keyutils.h)
374endif
375
376ifndef $(HAVE_LIBAIO_H)
377HAVE_LIBAIO_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=libaio.h have_header_h)
378ifeq ($(HAVE_LIBAIO_H),1)
379	CONFIG_CFLAGS += -DHAVE_LIBAIO_H
380endif
381$(call using,$(HAVE_LIBAIO_H),libaio.h)
382endif
383
384ifndef $(HAVE_LIBGEN_H)
385HAVE_LIBGEN_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=libgen.h have_header_h)
386ifeq ($(HAVE_LIBGEN_H),1)
387	CONFIG_CFLAGS += -DHAVE_LIBGEN_H
388endif
389$(call using,$(HAVE_LIBGEN_H),libgen.h)
390endif
391
392ifndef $(HAVE_LIBKMOD_H)
393HAVE_LIBKMOD_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=libkmod.h have_header_h)
394ifeq ($(HAVE_LIBKMOD_H),1)
395	CONFIG_CFLAGS += -DHAVE_LIBKMOD_H
396endif
397$(call using,$(HAVE_LIBKMOD_H),libkmod.h)
398endif
399
400ifndef $(HAVE_LINK_H)
401HAVE_LINK_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=link.h have_header_h)
402ifeq ($(HAVE_LINK_H),1)
403	CONFIG_CFLAGS += -DHAVE_LINK_H
404endif
405$(call using,$(HAVE_LINK_H),link.h)
406endif
407
408ifndef $(HAVE_LINUX_ANDROID_BINDER_H)
409HAVE_LINUX_ANDROID_BINDER_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/android/binder.h have_header_h)
410ifeq ($(HAVE_LINUX_ANDROID_BINDER_H),1)
411	CONFIG_CFLAGS += -DHAVE_LINUX_ANDROID_BINDER_H
412endif
413$(call using,$(HAVE_LINUX_ANDROID_BINDER_H),linux/android/binder.h)
414endif
415
416ifndef $(HAVE_LINUX_ANDROID_BINDERFS_H)
417HAVE_LINUX_ANDROID_BINDERFS_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/android/binderfs.h have_header_h)
418ifeq ($(HAVE_LINUX_ANDROID_BINDERFS_H),1)
419	CONFIG_CFLAGS += -DHAVE_LINUX_ANDROID_BINDERFS_H
420endif
421$(call using,$(HAVE_LINUX_ANDROID_BINDERFS_H),linux/android/binderfs.h)
422endif
423
424ifndef $(HAVE_LINUX_AUDIT_H)
425HAVE_LINUX_AUDIT_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/audit.h have_header_h)
426ifeq ($(HAVE_LINUX_AUDIT_H),1)
427	CONFIG_CFLAGS += -DHAVE_LINUX_AUDIT_H
428endif
429$(call using,$(HAVE_LINUX_AUDIT_H),linux/audit.h)
430endif
431
432ifndef $(HAVE_LINUX_CDROM_H)
433HAVE_LINUX_CDROM_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/cdrom.h have_header_h)
434ifeq ($(HAVE_LINUX_CDROM_H),1)
435	CONFIG_CFLAGS += -DHAVE_LINUX_CDROM_H
436endif
437$(call using,$(HAVE_LINUX_CDROM_H),linux/cdrom.h)
438endif
439
440ifndef $(HAVE_LINUX_CN_PROC_H)
441HAVE_LINUX_CN_PROC_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/cn_proc.h have_header_h)
442ifeq ($(HAVE_LINUX_CN_PROC_H),1)
443	CONFIG_CFLAGS += -DHAVE_LINUX_CN_PROC_H
444endif
445$(call using,$(HAVE_LINUX_CN_PROC_H),linux/cn_proc.h)
446endif
447
448ifndef $(HAVE_LINUX_CONNECTOR_H)
449HAVE_LINUX_CONNECTOR_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/connector.h have_header_h)
450ifeq ($(HAVE_LINUX_CONNECTOR_H),1)
451	CONFIG_CFLAGS += -DHAVE_LINUX_CONNECTOR_H
452endif
453$(call using,$(HAVE_LINUX_CONNECTOR_H),linux/connector.h)
454endif
455
456ifndef $(HAVE_LINUX_DM_IOCTL_H)
457HAVE_LINUX_DM_IOCTL_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/dm-ioctl.h have_header_h)
458ifeq ($(HAVE_LINUX_DM_IOCTL_H),1)
459	CONFIG_CFLAGS += -DHAVE_LINUX_DM_IOCTL_H
460endif
461$(call using,$(HAVE_LINUX_DM_IOCTL_H),linux/dm-ioctl.h)
462endif
463
464ifndef $(HAVE_LINUX_FD_H)
465HAVE_LINUX_FD_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/fd.h have_header_h)
466ifeq ($(HAVE_LINUX_FD_H),1)
467	CONFIG_CFLAGS += -DHAVE_LINUX_FD_H
468endif
469$(call using,$(HAVE_LINUX_FD_H),linux/fd.h)
470endif
471
472ifndef $(HAVE_LINUX_FIEMAP_H)
473HAVE_LINUX_FIEMAP_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/fiemap.h have_header_h)
474ifeq ($(HAVE_LINUX_FIEMAP_H),1)
475	CONFIG_CFLAGS += -DHAVE_LINUX_FIEMAP_H
476endif
477$(call using,$(HAVE_LINUX_FIEMAP_H),linux/fiemap.h)
478endif
479
480ifndef $(HAVE_LINUX_FILTER_H)
481HAVE_LINUX_FILTER_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/filter.h have_header_h)
482ifeq ($(HAVE_LINUX_FILTER_H),1)
483	CONFIG_CFLAGS += -DHAVE_LINUX_FILTER_H
484$(call using,$(HAVE_LINUX_FILTER_H),linux/filter.h)
485endif
486endif
487
488ifndef $(HAVE_LINUX_FSVERITY_H)
489HAVE_LINUX_FSVERITY_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/fsverity.h have_header_h)
490ifeq ($(HAVE_LINUX_FSVERITY_H),1)
491	CONFIG_CFLAGS += -DHAVE_LINUX_FSVERITY_H
492endif
493$(call using,$(HAVE_LINUX_FSVERITY_H),linux/fsverity.h)
494endif
495
496ifndef $(HAVE_LINUX_FUTEX_H)
497HAVE_LINUX_FUTEX_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/futex.h have_header_h)
498ifeq ($(HAVE_LINUX_FUTEX_H),1)
499	CONFIG_CFLAGS += -DHAVE_LINUX_FUTEX_H
500endif
501$(call using,$(HAVE_LINUX_FUTEX_H),linux/futex.h)
502endif
503
504ifndef $(HAVE_LINUX_FS_H)
505HAVE_LINUX_FS_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/fs.h have_header_h)
506ifeq ($(HAVE_LINUX_FS_H),1)
507	CONFIG_CFLAGS += -DHAVE_LINUX_FS_H
508endif
509$(call using,$(HAVE_LINUX_FS_H),linux/fs.h)
510endif
511
512ifndef $(HAVE_LINUX_GENETLINK_H)
513HAVE_LINUX_GENETLINK_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/genetlink.h have_header_h)
514ifeq ($(HAVE_LINUX_GENETLINK_H),1)
515	CONFIG_CFLAGS += -DHAVE_LINUX_GENETLINK_H
516endif
517$(call using,$(HAVE_LINUX_GENETLINK_H),linux/genetlink.h)
518endif
519
520ifndef $(HAVE_LINUX_HDREG_H)
521HAVE_LINUX_HDREG_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/hdreg.h have_header_h)
522ifeq ($(HAVE_LINUX_HDREG_H),1)
523	CONFIG_CFLAGS += -DHAVE_LINUX_HDREG_H
524endif
525$(call using,$(HAVE_LINUX_HDREG_H),linux/hdreg.h)
526endif
527
528ifndef $(HAVE_LINUX_HPET_H)
529HAVE_LINUX_HPET_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/hpet.h have_header_h)
530ifeq ($(HAVE_LINUX_HPET_H),1)
531	CONFIG_CFLAGS += -DHAVE_LINUX_HPET_H
532endif
533$(call using,$(HAVE_LINUX_HPET_H),linux/hpet.h)
534endif
535
536ifndef $(HAVE_LINUX_IF_ALG_H)
537HAVE_LINUX_IF_ALG_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/if_alg.h have_header_h)
538ifeq ($(HAVE_LINUX_IF_ALG_H),1)
539	CONFIG_CFLAGS += -DHAVE_LINUX_IF_ALG_H
540endif
541$(call using,$(HAVE_LINUX_IF_ALG_H),linux/if_alg.h)
542endif
543
544ifndef $(HAVE_LINUX_IF_PACKET_H)
545HAVE_LINUX_IF_PACKET_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/if_packet.h have_header_h)
546ifeq ($(HAVE_LINUX_IF_PACKET_H),1)
547	CONFIG_CFLAGS += -DHAVE_LINUX_IF_PACKET_H
548endif
549$(call using,$(HAVE_LINUX_IF_PACKET_H),linux/if_packet.h)
550endif
551
552ifndef $(HAVE_LINUX_IF_TUN_H)
553HAVE_LINUX_IF_TUN_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/if_tun.h have_header_h)
554ifeq ($(HAVE_LINUX_IF_TUN_H),1)
555	CONFIG_CFLAGS += -DHAVE_LINUX_IF_TUN_H
556endif
557$(call using,$(HAVE_LINUX_IF_TUN_H),linux/if_tun.h)
558endif
559
560ifndef $(HAVE_LINUX_IO_URING_H)
561HAVE_LINUX_IO_URING_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/io_uring.h have_header_h)
562ifeq ($(HAVE_LINUX_IO_URING_H),1)
563	CONFIG_CFLAGS += -DHAVE_LINUX_IO_URING_H
564endif
565$(call using,$(HAVE_LINUX_IO_URING_H),linux/io_uring.h)
566endif
567
568ifndef $(HAVE_LINUX_KD_H)
569HAVE_LINUX_KD_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/kd.h have_header_h)
570ifeq ($(HAVE_LINUX_KD_H),1)
571	CONFIG_CFLAGS += -DHAVE_LINUX_KD_H
572endif
573$(call using,$(HAVE_LINUX_KD_H),linux/kd.h)
574endif
575
576ifndef $(HAVE_LINUX_LANDLOCK_H)
577HAVE_LINUX_LANDLOCK_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/landlock.h have_header_h)
578ifeq ($(HAVE_LINUX_LANDLOCK_H),1)
579	CONFIG_CFLAGS += -DHAVE_LINUX_LANDLOCK_H
580endif
581$(call using,$(HAVE_LINUX_LANDLOCK_H),linux/landlock.h)
582endif
583
584ifndef $(HAVE_LINUX_LOOP_H)
585HAVE_LINUX_LOOP_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/loop.h have_header_h)
586ifeq ($(HAVE_LINUX_LOOP_H),1)
587	CONFIG_CFLAGS += -DHAVE_LINUX_LOOP_H
588endif
589$(call using,$(HAVE_LINUX_LOOP_H),linux/loop.h)
590endif
591
592ifndef $(HAVE_LINUX_MEDIA_H)
593HAVE_LINUX_MEDIA_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/media.h have_header_h)
594ifeq ($(HAVE_LINUX_MEDIA_H),1)
595	CONFIG_CFLAGS += -DHAVE_LINUX_MEDIA_H
596endif
597$(call using,$(HAVE_LINUX_MEDIA_H),linux/media.h)
598endif
599
600ifndef $(HAVE_LINUX_MEMBARRIER_H)
601HAVE_LINUX_MEMBARRIER_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/membarrier.h have_header_h)
602ifeq ($(HAVE_LINUX_MEMBARRIER_H),1)
603	CONFIG_CFLAGS += -DHAVE_LINUX_MEMBARRIER_H
604endif
605$(call using,$(HAVE_LINUX_MEMBARRIER_H),linux/membarrier.h)
606endif
607
608ifndef $(HAVE_LINUX_MEMPOLICY_H)
609HAVE_LINUX_MEMPOLICY_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/mempolicy.h have_header_h)
610ifeq ($(HAVE_LINUX_MEMPOLICY_H),1)
611	CONFIG_CFLAGS += -DHAVE_LINUX_MEMPOLICY_H
612endif
613$(call using,$(HAVE_LINUX_MEMPOLICY_H),linux/mempolicy.h)
614endif
615
616ifndef $(HAVE_LINUX_NETLINK_H)
617HAVE_LINUX_NETLINK_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/netlink.h have_header_h)
618ifeq ($(HAVE_LINUX_NETLINK_H),1)
619	CONFIG_CFLAGS += -DHAVE_LINUX_NETLINK_H
620endif
621$(call using,$(HAVE_LINUX_NETLINK_H),linux/netlink.h)
622endif
623
624ifndef $(HAVE_LINUX_OPENAT2_H)
625HAVE_LINUX_OPENAT2_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/openat2.h have_header_h)
626ifeq ($(HAVE_LINUX_OPENAT2_H),1)
627	CONFIG_CFLAGS += -DHAVE_LINUX_OPENAT2_H
628endif
629$(call using,$(HAVE_LINUX_NETLINK_H),linux/openat2.h)
630endif
631
632ifndef $(HAVE_LINUX_PCI_H)
633HAVE_LINUX_PCI_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/pci.h have_header_h)
634ifeq ($(HAVE_LINUX_PCI_H),1)
635	CONFIG_CFLAGS += -DHAVE_LINUX_PCI_H
636endif
637$(call using,$(HAVE_LINUX_PCI_H),linux/pci.h)
638endif
639
640ifndef $(HAVE_LINUX_PERF_EVENT_H)
641HAVE_LINUX_PERF_EVENT_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/perf_event.h have_header_h)
642ifeq ($(HAVE_LINUX_PERF_EVENT_H),1)
643	CONFIG_CFLAGS += -DHAVE_LINUX_PERF_EVENT_H
644endif
645$(call using,$(HAVE_LINUX_PERF_EVENT_H),linux/perf_event.h)
646endif
647
648ifndef $(HAVE_LINUX_POSIX_TYPES_H)
649HAVE_LINUX_POSIX_TYPES_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/posix_types.h have_header_h)
650ifeq ($(HAVE_LINUX_POSIX_TYPES_H),1)
651	CONFIG_CFLAGS += -DHAVE_LINUX_POSIX_TYPES_H
652endif
653$(call using,$(HAVE_LINUX_POSIX_TYPES_H),linux/posix_types.h)
654endif
655
656ifndef $(HAVE_LINUX_PPDEV_H)
657HAVE_LINUX_PPDEV_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/ppdev.h have_header_h)
658ifeq ($(HAVE_LINUX_PPDEV_H),1)
659	CONFIG_CFLAGS += -DHAVE_LINUX_PPDEV_H
660endif
661$(call using,$(HAVE_LINUX_PPDEV_H),linux/ppdev.h)
662endif
663
664ifndef $(HAVE_LINUX_PTP_CLOCK_H)
665HAVE_LINUX_PTP_CLOCK_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/ptp_clock.h have_header_h)
666ifeq ($(HAVE_LINUX_PTP_CLOCK_H),1)
667	CONFIG_CFLAGS += -DHAVE_LINUX_PTP_CLOCK_H
668endif
669$(call using,$(HAVE_LINUX_PTP_CLOCK_H),linux/ptp_clock.h)
670endif
671
672ifndef $(HAVE_LINUX_RANDOM_H)
673HAVE_LINUX_RANDOM_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/random.h have_header_h)
674ifeq ($(HAVE_LINUX_RANDOM_H),1)
675	CONFIG_CFLAGS += -DHAVE_LINUX_RANDOM_H
676endif
677$(call using,$(HAVE_LINUX_RANDOM_H),linux/random.h)
678endif
679
680ifndef $(HAVE_LINUX_RSEQ_H)
681HAVE_LINUX_RSEQ_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/rseq.h have_header_h)
682ifeq ($(HAVE_LINUX_RSEQ_H),1)
683	CONFIG_CFLAGS += -DHAVE_LINUX_RSEQ_H
684endif
685$(call using,$(HAVE_LINUX_RSEQ_H),linux/rseq.h)
686endif
687
688ifndef $(HAVE_LINUX_RTC_H)
689HAVE_LINUX_RTC_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/rtc.h have_header_h)
690ifeq ($(HAVE_LINUX_RTC_H),1)
691	CONFIG_CFLAGS += -DHAVE_LINUX_RTC_H
692endif
693$(call using,$(HAVE_LINUX_RTC_H),linux/rtc.h)
694endif
695
696ifndef $(HAVE_LINUX_RTNETLINK_H)
697HAVE_LINUX_RTNETLINK_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/rtnetlink.h have_header_h)
698ifeq ($(HAVE_LINUX_RTNETLINK_H),1)
699	CONFIG_CFLAGS += -DHAVE_LINUX_RTNETLINK_H
700endif
701$(call using,$(HAVE_LINUX_RTNETLINK_H),linux/rtnetlink.h)
702endif
703
704ifndef $(HAVE_LINUX_SECCOMP_H)
705HAVE_LINUX_SECCOMP_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/seccomp.h have_header_h)
706ifeq ($(HAVE_LINUX_SECCOMP_H),1)
707	CONFIG_CFLAGS += -DHAVE_LINUX_SECCOMP_H
708endif
709$(call using,$(HAVE_LINUX_SECCOMP_H),linux/seccomp.h)
710endif
711
712ifndef $(HAVE_LINUX_SERIAL_H)
713HAVE_LINUX_SERIAL_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/serial.h have_header_h)
714ifeq ($(HAVE_LINUX_SERIAL_H),1)
715	CONFIG_CFLAGS += -DHAVE_LINUX_SERIAL_H
716endif
717$(call using,$(HAVE_LINUX_SERIAL_H),linux/serial.h)
718endif
719
720ifndef $(HAVE_LINUX_SOCK_DIAG_H)
721HAVE_LINUX_SOCK_DIAG_H = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sock-diag have_test_prog)
722ifeq ($(HAVE_LINUX_SOCK_DIAG_H),1)
723	CONFIG_CFLAGS += -DHAVE_LINUX_SOCK_DIAG_H
724endif
725$(call using,$(HAVE_LINUX_SOCK_DIAG_H),linux/sock_diag.h)
726endif
727
728ifndef $(HAVE_LINUX_SOCKET_H)
729HAVE_LINUX_SOCKET_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/socket.h have_header_h)
730ifeq ($(HAVE_LINUX_SOCKET_H),1)
731	CONFIG_CFLAGS += -DHAVE_LINUX_SOCKET_H
732endif
733$(call using,$(HAVE_LINUX_SOCKET_H),linux/socket.h)
734endif
735
736ifndef $(HAVE_LINUX_SOCKIOS_H)
737HAVE_LINUX_SOCKIOS_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/sockios.h have_header_h)
738ifeq ($(HAVE_LINUX_SOCKIOS_H),1)
739	CONFIG_CFLAGS += -DHAVE_LINUX_SOCKIOS_H
740endif
741$(call using,$(HAVE_LINUX_SOCKIOS_H),linux/sockios.h)
742endif
743
744ifndef $(HAVE_LINUX_SYSCTL_H)
745HAVE_LINUX_SYSCTL_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/sysctl.h have_header_h)
746ifeq ($(HAVE_LINUX_SYSCTL_H),1)
747	CONFIG_CFLAGS += -DHAVE_LINUX_SYSCTL_H
748endif
749$(call using,$(HAVE_LINUX_SYSCTL_H),linux/sysctl.h)
750endif
751
752ifndef $(HAVE_LINUX_TASKSTATS_H)
753HAVE_LINUX_TASKSTATS_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/taskstats.h have_header_h)
754ifeq ($(HAVE_LINUX_TASKSTATS_H),1)
755	CONFIG_CFLAGS += -DHAVE_LINUX_TASKSTATS_H
756endif
757$(call using,$(HAVE_LINUX_TASKSTATS_H),linux/taskstats.h)
758endif
759
760ifndef $(HAVE_LINUX_UDP_H)
761HAVE_LINUX_UDP_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/udp.h have_header_h)
762ifeq ($(HAVE_LINUX_UDP_H),1)
763	CONFIG_CFLAGS += -DHAVE_LINUX_UDP_H
764endif
765$(call using,$(HAVE_LINUX_UDP_H),linux/udp.h)
766endif
767
768ifndef $(HAVE_LINUX_UNIX_DIAG_H)
769HAVE_LINUX_UNIX_DIAG_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/unix_diag.h have_header_h)
770ifeq ($(HAVE_LINUX_UNIX_DIAG_H),1)
771	CONFIG_CFLAGS += -DHAVE_LINUX_UNIX_DIAG_H
772endif
773$(call using,$(HAVE_LINUX_UNIX_DIAG_H),linux/unix_diag.h)
774endif
775
776ifndef $(HAVE_LINUX_USERFAULTFD_H)
777HAVE_LINUX_USERFAULTFD_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/userfaultfd.h have_header_h)
778ifeq ($(HAVE_LINUX_USERFAULTFD_H),1)
779	CONFIG_CFLAGS += -DHAVE_LINUX_USERFAULTFD_H
780endif
781$(call using,$(HAVE_LINUX_USERFAULTFD_H),linux/userfaultfd.h)
782endif
783
784ifndef $(HAVE_LINUX_VERSION_H)
785HAVE_LINUX_VERSION_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/version.h have_header_h)
786ifeq ($(HAVE_LINUX_VERSION_H),1)
787	CONFIG_CFLAGS += -DHAVE_LINUX_VERSION_H
788endif
789$(call using,$(HAVE_LINUX_VERSION_H),linux/version.h)
790endif
791
792ifndef $(HAVE_LINUX_VIDEODEV2_H)
793HAVE_LINUX_VIDEODEV2_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/videodev2.h have_header_h)
794ifeq ($(HAVE_LINUX_VIDEODEV2_H),1)
795	CONFIG_CFLAGS += -DHAVE_LINUX_VIDEODEV2_H
796endif
797$(call using,$(HAVE_LINUX_VIDEODEV2_H),linux/videodev2.h)
798endif
799
800ifndef $(HAVE_LINUX_VT_H)
801HAVE_LINUX_VT_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/vt.h have_header_h)
802ifeq ($(HAVE_LINUX_VT_H),1)
803	CONFIG_CFLAGS += -DHAVE_LINUX_VT_H
804endif
805$(call using,$(HAVE_LINUX_VT_H),linux/vt.h)
806endif
807
808ifndef $(HAVE_LINUX_WATCHDOG_H)
809HAVE_LINUX_WATCHDOG_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=linux/watchdog.h have_header_h)
810ifeq ($(HAVE_LINUX_WATCHDOG_H),1)
811	CONFIG_CFLAGS += -DHAVE_LINUX_WATCHDOG_H
812endif
813$(call using,$(HAVE_LINUX_WATCHDOG_H),linux/watchdog.h)
814endif
815
816
817ifndef $(HAVE_LOCALE_H)
818HAVE_LOCALE_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=locale.h have_header_h)
819ifeq ($(HAVE_LOCALE_H),1)
820	CONFIG_CFLAGS += -DHAVE_LOCALE_H
821endif
822$(call using,$(HAVE_LOCALE_H),locale.h)
823endif
824
825ifndef $(HAVE_MALLOC_H)
826HAVE_MALLOC_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=malloc.h have_header_h)
827ifeq ($(HAVE_MALLOC_H),1)
828	CONFIG_CFLAGS += -DHAVE_MALLOC_H
829endif
830$(call using,$(HAVE_MALLOC_H),malloc.h)
831endif
832
833ifndef $(HAVE_MNTENT_H)
834HAVE_MNTENT_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=mntent.h have_header_h)
835ifeq ($(HAVE_MNTENT_H),1)
836	CONFIG_CFLAGS += -DHAVE_MNTENT_H
837endif
838$(call using,$(HAVE_MNTENT_H),mntent.h)
839endif
840
841ifndef $(HAVE_MQUEUE_H)
842HAVE_MQUEUE_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=mqueue.h have_header_h)
843ifeq ($(HAVE_MQUEUE_H),1)
844	CONFIG_CFLAGS += -DHAVE_MQUEUE_H
845endif
846$(call using,$(HAVE_MQUEUE_H),mqueue.h)
847endif
848
849ifndef $(HAVE_POLL_H)
850HAVE_POLL_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=poll.h have_header_h)
851ifeq ($(HAVE_POLL_H),1)
852	CONFIG_CFLAGS += -DHAVE_POLL_H
853endif
854$(call using,$(HAVE_POLL_H),poll.h)
855endif
856
857ifndef $(HAVE_SCSI_SCSI_H)
858HAVE_SCSI_SCSI_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=scsi/scsi.h have_header_h)
859ifeq ($(HAVE_SCSI_SCSI_H),1)
860	CONFIG_CFLAGS += -DHAVE_SCSI_SCSI_H
861endif
862$(call using,$(HAVE_SCSI_SCSI_H),scsi/scsi.h)
863endif
864
865ifndef $(HAVE_SCSI_SCSI_IOCTL_H)
866HAVE_SCSI_SCSI_IOCTL_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=scsi/scsi_ioctl.h have_header_h)
867ifeq ($(HAVE_SCSI_SCSI_IOCTL_H),1)
868	CONFIG_CFLAGS += -DHAVE_SCSI_SCSI_IOCTL_H
869endif
870$(call using,$(HAVE_SCSI_SCSI_IOCTL_H),scsi/scsi_ioctl.h)
871endif
872
873ifndef $(HAVE_SCSI_SG_H)
874HAVE_SCSI_SG_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=scsi/sg.h have_header_h)
875ifeq ($(HAVE_SCSI_SG_H),1)
876	CONFIG_CFLAGS += -DHAVE_SCSI_SG_H
877endif
878$(call using,$(HAVE_SCSI_SG_H),scsi/sg.h)
879endif
880
881ifndef $(HAVE_SEMAPHORE_H)
882HAVE_SEMAPHORE_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=semaphore.h have_header_h)
883ifeq ($(HAVE_SEMAPHORE_H),1)
884	CONFIG_CFLAGS += -DHAVE_SEMAPHORE_H
885endif
886$(call using,$(HAVE_SEMAPHORE_H),semaphore.h)
887endif
888
889ifndef $(HAVE_STRINGS_H)
890HAVE_STRINGS_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=strings.h have_header_h)
891ifeq ($(HAVE_STRINGS_H),1)
892	CONFIG_CFLAGS += -DHAVE_STRINGS_H
893endif
894$(call using,$(HAVE_STRINGS_H),strings.h)
895endif
896
897ifndef $(HAVE_SOUND_ASOUND_H)
898HAVE_SOUND_ASOUND_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sound/asound.h have_header_h)
899ifeq ($(HAVE_SOUND_ASOUND_H),1)
900	CONFIG_CFLAGS += -DHAVE_SOUND_ASOUND_H
901endif
902$(call using,$(HAVE_SOUND_ASOUND_H),sound/asound.h)
903endif
904
905ifndef $(HAVE_SPAWN_H)
906HAVE_SPAWN_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=spawn.h have_header_h)
907ifeq ($(HAVE_SPAWN_H),1)
908	CONFIG_CFLAGS += -DHAVE_SPAWN_H
909endif
910$(call using,$(HAVE_SPAWN_H),spawn.h)
911endif
912
913ifndef $(HAVE_SYSLOG_H)
914HAVE_SYSLOG_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=syslog.h have_header_h)
915ifeq ($(HAVE_SYSLOG_H),1)
916	CONFIG_CFLAGS += -DHAVE_SYSLOG_H
917endif
918$(call using,$(HAVE_SYSLOG_H),syslog.h)
919endif
920
921ifndef $(HAVE_SYS_APPARMOR_H)
922HAVE_SYS_APPARMOR_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/apparmor.h have_header_h)
923ifeq ($(HAVE_SYS_APPARMOR_H),1)
924	CONFIG_CFLAGS += -DHAVE_SYS_APPARMOR_H
925endif
926$(call using,$(HAVE_SYS_APPARMOR_H),sys/apparmor.h)
927endif
928
929ifndef $(HAVE_SYS_AUXV_H)
930HAVE_SYS_AUXV_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/auxv.h have_header_h)
931ifeq ($(HAVE_SYS_AUXV_H),1)
932	CONFIG_CFLAGS += -DHAVE_SYS_AUXV_H
933endif
934$(call using,$(HAVE_SYS_AUXV_H),sys/auxv.h)
935endif
936
937ifndef $(HAVE_SYS_CAPABILITY_H)
938HAVE_SYS_CAPABILITY_H = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-cap have_test_prog)
939ifeq ($(HAVE_SYS_CAPABILITY_H),1)
940	CONFIG_CFLAGS += -DHAVE_SYS_CAPABILITY_H
941endif
942$(call using,$(HAVE_SYS_CAPABILITY_H),sys/capability.h)
943endif
944
945ifndef $(HAVE_SYS_EPOLL_H)
946HAVE_SYS_EPOLL_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/epoll.h have_header_h)
947ifeq ($(HAVE_SYS_EPOLL_H),1)
948	CONFIG_CFLAGS += -DHAVE_SYS_EPOLL_H
949endif
950$(call using,$(HAVE_SYS_EPOLL_H),sys/epoll.h)
951endif
952
953ifndef $(HAVE_SYS_EVENTFD_H)
954HAVE_SYS_EVENTFD_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/eventfd.h have_header_h)
955ifeq ($(HAVE_SYS_EVENTFD_H),1)
956	CONFIG_CFLAGS += -DHAVE_SYS_EVENTFD_H
957endif
958$(call using,$(HAVE_SYS_EVENTFD_H),sys/eventfd.h)
959endif
960
961ifndef $(HAVE_SYS_FANOTIFY_H)
962HAVE_SYS_FANOTIFY_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/fanotify.h have_header_h)
963ifeq ($(HAVE_SYS_FANOTIFY_H),1)
964	CONFIG_CFLAGS += -DHAVE_SYS_FANOTIFY_H
965endif
966$(call using,$(HAVE_SYS_FANOTIFY_H),sys/fanotify.h)
967endif
968
969ifndef $(HAVE_SYS_FSUID_H)
970HAVE_SYS_FSUID_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/fsuid.h have_header_h)
971ifeq ($(HAVE_SYS_FSUID_H),1)
972	CONFIG_CFLAGS += -DHAVE_SYS_FSUID_H
973endif
974$(call using,$(HAVE_SYS_FSUID_H),sys/fsuid.h)
975endif
976
977ifndef $(HAVE_SYS_INOTIFY_H)
978HAVE_SYS_INOTIFY_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/inotify.h have_header_h)
979ifeq ($(HAVE_SYS_INOTIFY_H),1)
980	CONFIG_CFLAGS += -DHAVE_SYS_INOTIFY_H
981endif
982$(call using,$(HAVE_SYS_INOTIFY_H),sys/inotify.h)
983endif
984
985ifndef $(HAVE_SYS_IO_H)
986HAVE_SYS_IO_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/io.h have_header_h)
987ifeq ($(HAVE_SYS_IO_H),1)
988	CONFIG_CFLAGS += -DHAVE_SYS_IO_H
989endif
990$(call using,$(HAVE_SYS_IO_H),sys/io.h)
991endif
992
993ifndef $(HAVE_SYS_IPC_H)
994HAVE_SYS_IPC_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/ipc.h have_header_h)
995ifeq ($(HAVE_SYS_IPC_H),1)
996	CONFIG_CFLAGS += -DHAVE_SYS_IPC_H
997endif
998$(call using,$(HAVE_SYS_IPC_H),sys/ipc.h)
999endif
1000
1001ifndef $(HAVE_SYS_LOADAVG_H)
1002HAVE_SYS_LOADAVG_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/loadavg.h have_header_h)
1003ifeq ($(HAVE_SYS_LOADAVG_H),1)
1004	CONFIG_CFLAGS += -DHAVE_SYS_LOADAVG_H
1005endif
1006$(call using,$(HAVE_SYS_LOADAVG_H),sys/loadavg.h)
1007endif
1008
1009ifndef $(HAVE_SYS_MOUNT_H)
1010HAVE_SYS_MOUNT_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/mount.h have_header_h)
1011ifeq ($(HAVE_SYS_MOUNT_H),1)
1012	CONFIG_CFLAGS += -DHAVE_SYS_MOUNT_H
1013endif
1014$(call using,$(HAVE_SYS_MOUNT_H),sys/mount.h)
1015endif
1016
1017ifndef $(HAVE_SYS_MSG_H)
1018HAVE_SYS_MSG_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/msg.h have_header_h)
1019ifeq ($(HAVE_SYS_MSG_H),1)
1020	CONFIG_CFLAGS += -DHAVE_SYS_MSG_H
1021endif
1022$(call using,$(HAVE_SYS_MSG_H),sys/msg.h)
1023endif
1024
1025ifndef $(HAVE_SYS_PARAM_H)
1026HAVE_SYS_PARAM_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/param.h have_header_h)
1027ifeq ($(HAVE_SYS_PARAM_H),1)
1028	CONFIG_CFLAGS += -DHAVE_SYS_PARAM_H
1029endif
1030$(call using,$(HAVE_SYS_PARAM_H),sys/param.h)
1031endif
1032
1033ifndef $(HAVE_SYS_PERSONALITY_H)
1034HAVE_SYS_PERSONALITY_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/personality.h have_header_h)
1035ifeq ($(HAVE_SYS_PERSONALITY_H),1)
1036	CONFIG_CFLAGS += -DHAVE_SYS_PERSONALITY_H
1037endif
1038$(call using,$(HAVE_SYS_PERSONALITY_H),sys/personality.h)
1039endif
1040
1041ifndef $(HAVE_SYS_PLATFORM_PPC_H)
1042HAVE_SYS_PLATFORM_PPC_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/platform/ppc.h have_header_h)
1043ifeq ($(HAVE_SYS_PLATFORM_PPC_H),1)
1044	CONFIG_CFLAGS += -DHAVE_SYS_PLATFORM_PPC_H
1045$(call using,$(HAVE_SYS_PLATFORM_PPC_H),sys/platform/ppc.h)
1046endif
1047endif
1048
1049ifndef $(HAVE_SYS_PRCTL_H)
1050HAVE_SYS_PRCTL_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/prctl.h have_header_h)
1051ifeq ($(HAVE_SYS_PRCTL_H),1)
1052	CONFIG_CFLAGS += -DHAVE_SYS_PRCTL_H
1053endif
1054$(call using,$(HAVE_SYS_PRCTL_H),sys/prctl.h)
1055endif
1056
1057ifndef $(HAVE_SYS_SYSCTL_H)
1058HAVE_SYS_SYSCTL_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/sysctl.h have_header_h)
1059ifeq ($(HAVE_SYS_SYSCTL_H),1)
1060	CONFIG_CFLAGS += -DHAVE_SYS_SYSCTL_H
1061endif
1062$(call using,$(HAVE_SYS_SYSCTL_H),sys/sysctl.h)
1063endif
1064
1065ifndef $(HAVE_SYS_TREE_H)
1066HAVE_SYS_TREE_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/tree.h have_header_h)
1067ifeq ($(HAVE_SYS_TREE_H),1)
1068	CONFIG_CFLAGS += -DHAVE_SYS_TREE_H
1069endif
1070$(call using,$(HAVE_SYS_TREE_H),sys/tree.h)
1071endif
1072
1073ifndef $(HAVE_SYS_QUEUE_H)
1074HAVE_SYS_QUEUE_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/queue.h have_header_h)
1075ifeq ($(HAVE_SYS_QUEUE_H),1)
1076	CONFIG_CFLAGS += -DHAVE_SYS_QUEUE_H
1077endif
1078$(call using,$(HAVE_SYS_QUEUE_H),sys/queue.h)
1079endif
1080
1081ifndef $(HAVE_SYS_QUOTA_H)
1082HAVE_SYS_QUOTA_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/quota.h have_header_h)
1083ifeq ($(HAVE_SYS_QUOTA_H),1)
1084	CONFIG_CFLAGS += -DHAVE_SYS_QUOTA_H
1085endif
1086$(call using,$(HAVE_SYS_QUOTA_H),sys/quota.h)
1087endif
1088
1089ifndef $(HAVE_SYS_SELECT_H)
1090HAVE_SYS_SELECT_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/select.h have_header_h)
1091ifeq ($(HAVE_SYS_SELECT_H),1)
1092	CONFIG_CFLAGS += -DHAVE_SYS_SELECT_H
1093endif
1094$(call using,$(HAVE_SYS_SELECT_H),sys/select.h)
1095endif
1096
1097ifndef $(HAVE_SYS_SENDFILE_H)
1098HAVE_SYS_SENDFILE_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/sendfile.h have_header_h)
1099ifeq ($(HAVE_SYS_SENDFILE_H),1)
1100	CONFIG_CFLAGS += -DHAVE_SYS_SENDFILE_H
1101endif
1102$(call using,$(HAVE_SYS_SENDFILE_H),sys/sendfile.h)
1103endif
1104
1105ifndef $(HAVE_SYS_SHM_H)
1106HAVE_SYS_SHM_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/shm.h have_header_h)
1107ifeq ($(HAVE_SYS_SHM_H),1)
1108	CONFIG_CFLAGS += -DHAVE_SYS_SHM_H
1109endif
1110$(call using,$(HAVE_SYS_SHM_H),sys/shm.h)
1111endif
1112
1113ifndef $(HAVE_SYS_SIGNALFD_H)
1114HAVE_SYS_SIGNALFD_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/signalfd.h have_header_h)
1115ifeq ($(HAVE_SYS_SIGNALFD_H),1)
1116	CONFIG_CFLAGS += -DHAVE_SYS_SIGNALFD_H
1117endif
1118$(call using,$(HAVE_SYS_SIGNALFD_H),sys/signalfd.h)
1119endif
1120
1121ifndef $(HAVE_SYS_STATFS_H)
1122HAVE_SYS_STATFS_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/statfs.h have_header_h)
1123ifeq ($(HAVE_SYS_STATFS_H),1)
1124	CONFIG_CFLAGS += -DHAVE_SYS_STATFS_H
1125endif
1126$(call using,$(HAVE_SYS_STATFS_H),sys/statfs.h)
1127endif
1128
1129ifndef $(HAVE_SYS_STATVFS_H)
1130HAVE_SYS_STATVFS_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/statvfs.h have_header_h)
1131ifeq ($(HAVE_SYS_STATVFS_H),1)
1132	CONFIG_CFLAGS += -DHAVE_SYS_STATVFS_H
1133endif
1134$(call using,$(HAVE_SYS_STATVFS_H),sys/statvfs.h)
1135endif
1136
1137ifndef $(HAVE_SYS_SWAP_H)
1138HAVE_SYS_SWAP_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/swap.h have_header_h)
1139ifeq ($(HAVE_SYS_SWAP_H),1)
1140	CONFIG_CFLAGS += -DHAVE_SYS_SWAP_H
1141endif
1142$(call using,$(HAVE_SYS_SWAP_H),sys/swap.h)
1143endif
1144
1145ifndef $(HAVE_SYSCALL_H)
1146HAVE_SYSCALL_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/syscall.h have_header_h)
1147ifeq ($(HAVE_SYSCALL_H),1)
1148	CONFIG_CFLAGS += -DHAVE_SYSCALL_H
1149endif
1150$(call using,$(HAVE_SYSCALL_H),sys/syscall.h)
1151endif
1152
1153ifndef $(HAVE_SYS_SYSINFO_H)
1154HAVE_SYS_SYSINFO_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/sysinfo.h have_header_h)
1155ifeq ($(HAVE_SYS_SYSINFO_H),1)
1156	CONFIG_CFLAGS += -DHAVE_SYS_SYSINFO_H
1157endif
1158$(call using,$(HAVE_SYS_SYSINFO_H),sys/sysinfo.h)
1159endif
1160
1161ifndef $(HAVE_SYS_SYSMACROS_H)
1162HAVE_SYS_SYSMACROS_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/sysmacros.h have_header_h)
1163ifeq ($(HAVE_SYS_SYSMACROS_H),1)
1164	CONFIG_CFLAGS += -DHAVE_SYS_SYSMACROS_H
1165endif
1166$(call using,$(HAVE_SYS_SYSMACROS_H),sys/sysmacros.h)
1167endif
1168
1169ifndef $(HAVE_SYS_TIMERFD_H)
1170HAVE_SYS_TIMERFD_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/timerfd.h have_header_h)
1171ifeq ($(HAVE_SYS_TIMERFD_H),1)
1172	CONFIG_CFLAGS += -DHAVE_SYS_TIMERFD_H
1173endif
1174$(call using,$(HAVE_SYS_TIMERFD_H),sys/timerfd.h)
1175endif
1176
1177ifndef $(HAVE_SYS_TIMEX_H)
1178HAVE_SYS_TIMEX_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/timex.h have_header_h)
1179ifeq ($(HAVE_SYS_TIMEX_H),1)
1180	CONFIG_CFLAGS += -DHAVE_SYS_TIMEX_H
1181endif
1182$(call using,$(HAVE_SYS_TIMEX_H),sys/timex.h)
1183endif
1184
1185ifndef $(HAVE_SYS_UIO_H)
1186HAVE_SYS_UIO_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/uio.h have_header_h)
1187ifeq ($(HAVE_SYS_UIO_H),1)
1188	CONFIG_CFLAGS += -DHAVE_SYS_UIO_H
1189endif
1190$(call using,$(HAVE_SYS_UIO_H),sys/uio.h)
1191endif
1192
1193ifndef $(HAVE_SYS_UCRED_H)
1194HAVE_SYS_UCRED_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/ucred.h have_header_h)
1195ifeq ($(HAVE_SYS_UCRED_H),1)
1196	CONFIG_CFLAGS += -DHAVE_SYS_UCRED_H
1197endif
1198$(call using,$(HAVE_SYS_UCRED_H),sys/ucred.h)
1199endif
1200
1201ifndef $(HAVE_SYS_UN_H)
1202HAVE_SYS_UN_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/un.h have_header_h)
1203ifeq ($(HAVE_SYS_UN_H),1)
1204	CONFIG_CFLAGS += -DHAVE_SYS_UN_H
1205endif
1206$(call using,$(HAVE_SYS_UN_H),sys/un.h)
1207endif
1208
1209ifndef $(HAVE_SYS_UTSNAME_H)
1210HAVE_SYS_UTSNAME_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/utsname.h have_header_h)
1211ifeq ($(HAVE_SYS_UTSNAME_H),1)
1212	CONFIG_CFLAGS += -DHAVE_SYS_UTSNAME_H
1213endif
1214$(call using,$(HAVE_SYS_UTSNAME_H),sys/utsname.h)
1215endif
1216
1217ifndef $(HAVE_SYS_VFS_H)
1218HAVE_SYS_VFS_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/vfs.h have_header_h)
1219ifeq ($(HAVE_SYS_VFS_H),1)
1220	CONFIG_CFLAGS += -DHAVE_SYS_VFS_H
1221endif
1222$(call using,$(HAVE_SYS_VFS_H),sys/vfs.h)
1223endif
1224
1225ifndef $(HAVE_SYS_VMMETER_H)
1226HAVE_SYS_VMMETER_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/vmmeter.h have_header_h)
1227ifeq ($(HAVE_SYS_VMMETER_H),1)
1228	CONFIG_CFLAGS += -DHAVE_SYS_VMMETER_H
1229endif
1230$(call using,$(HAVE_SYS_VMMETER_H),sys/vmmeter.h)
1231endif
1232
1233ifndef $(HAVE_SYS_XATTR_H)
1234HAVE_SYS_XATTR_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=sys/xattr.h have_header_h)
1235ifeq ($(HAVE_SYS_XATTR_H),1)
1236	CONFIG_CFLAGS += -DHAVE_SYS_XATTR_H
1237endif
1238$(call using,$(HAVE_SYS_XATTR_H),sys/xattr.h)
1239endif
1240
1241ifndef $(HAVE_TERMIO_H)
1242HAVE_TERMIO_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=termio.h have_header_h)
1243ifeq ($(HAVE_TERMIO_H),1)
1244	CONFIG_CFLAGS += -DHAVE_TERMIO_H
1245endif
1246$(call using,$(HAVE_TERMIO_H),termio.h)
1247endif
1248
1249ifndef $(HAVE_TERMIOS_H)
1250HAVE_TERMIOS_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=termios.h have_header_h)
1251ifeq ($(HAVE_TERMIOS_H),1)
1252	CONFIG_CFLAGS += -DHAVE_TERMIOS_H
1253endif
1254$(call using,$(HAVE_TERMIOS_H),termios.h)
1255endif
1256
1257ifndef $(HAVE_NET_IF_H)
1258HAVE_NET_IF_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=net/if.h have_header_h)
1259ifeq ($(HAVE_NET_IF_H),1)
1260	CONFIG_CFLAGS += -DHAVE_NET_IF_H
1261endif
1262$(call using,$(HAVE_NET_IF_H),net/if.h)
1263endif
1264
1265ifndef $(HAVE_NETINET_IP_H)
1266HAVE_NETINET_IP_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=netinet/ip.h have_header_h)
1267ifeq ($(HAVE_NETINET_IP_H),1)
1268	CONFIG_CFLAGS += -DHAVE_NETINET_IP_H
1269endif
1270$(call using,$(HAVE_NETINET_IP_H),netinet/ip.h)
1271endif
1272
1273ifndef $(HAVE_NETINET_IP_ICMP_H)
1274HAVE_NETINET_IP_ICMP_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=netinet/ip_icmp.h have_header_h)
1275ifeq ($(HAVE_NETINET_IP_ICMP_H),1)
1276	CONFIG_CFLAGS += -DHAVE_NETINET_IP_ICMP_H
1277endif
1278$(call using,$(HAVE_NETINET_IP_ICMP_H),netinet/ip_icmp.h)
1279endif
1280
1281ifndef $(HAVE_NETINET_SCTP_H)
1282HAVE_NETINET_SCTP_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=netinet/sctp.h have_header_h)
1283ifeq ($(HAVE_NETINET_SCTP_H),1)
1284	CONFIG_CFLAGS += -DHAVE_NETINET_SCTP_H
1285endif
1286$(call using,$(HAVE_NETINET_SCTP_H),netinet/sctp.h)
1287endif
1288
1289ifndef $(HAVE_NETINET_TCP_H)
1290HAVE_NETINET_TCP_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=netinet/tcp.h have_header_h)
1291ifeq ($(HAVE_NETINET_TCP_H),1)
1292	CONFIG_CFLAGS += -DHAVE_NETINET_TCP_H
1293endif
1294$(call using,$(HAVE_NETINET_TCP_H),netinet/tcp.h)
1295endif
1296
1297ifndef $(HAVE_UCONTEXT_H)
1298HAVE_UCONTEXT_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=ucontext.h have_header_h)
1299ifeq ($(HAVE_UCONTEXT_H),1)
1300	CONFIG_CFLAGS += -DHAVE_UCONTEXT_H
1301endif
1302$(call using,$(HAVE_UCONTEXT_H),ucontext.h)
1303endif
1304
1305ifndef $(HAVE_USTAT_H)
1306HAVE_USTAT_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=ustat.h have_header_h)
1307ifeq ($(HAVE_USTAT_H),1)
1308	CONFIG_CFLAGS += -DHAVE_USTAT_H
1309endif
1310$(call using,$(HAVE_USTAT_H),ustat.h (deprecated))
1311endif
1312
1313ifndef $(HAVE_UTIME_H)
1314HAVE_UTIME_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=utime.h have_header_h)
1315ifeq ($(HAVE_UTIME_H),1)
1316	CONFIG_CFLAGS += -DHAVE_UTIME_H
1317endif
1318$(call using,$(HAVE_UTIME_H),utime.h)
1319endif
1320
1321ifndef $(HAVE_XMMINTRIN_H)
1322HAVE_XMMINTRIN_H = $(shell $(MAKE) $(MAKE_OPTS) HEADER=xmmintrin.h have_header_h)
1323ifeq ($(HAVE_XMMINTRIN_H),1)
1324	CONFIG_CFLAGS += -DHAVE_XMMINTRIN_H
1325endif
1326$(call using,$(HAVE_XMMINTRIN_H),xmmintrin.h)
1327endif
1328
1329
1330$(call check,CPU and compiler features)
1331
1332ifndef $(HAVE_ALIGNED_64)
1333HAVE_ALIGNED_64 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-aligned-64 have_test_prog)
1334ifeq ($(HAVE_ALIGNED_64),1)
1335	CONFIG_CFLAGS += -DHAVE_ALIGNED_64
1336endif
1337$(call using,$(HAVE_ALIGNED_64),64 byte alignment attribute)
1338endif
1339
1340ifndef $(HAVE_ALIGNED_128)
1341HAVE_ALIGNED_128 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-aligned-128 have_test_prog)
1342ifeq ($(HAVE_ALIGNED_128),1)
1343	CONFIG_CFLAGS += -DHAVE_ALIGNED_128
1344endif
1345$(call using,$(HAVE_ALIGNED_128),128 byte alignment attribute)
1346endif
1347
1348ifndef $(HAVE_ALIGNED_64K)
1349HAVE_ALIGNED_64K = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-aligned-64K have_test_prog)
1350ifeq ($(HAVE_ALIGNED_64K),1)
1351	CONFIG_CFLAGS += -DHAVE_ALIGNED_64K
1352endif
1353$(call using,$(HAVE_ALIGNED_64K),64K alignment attribute)
1354endif
1355
1356ifndef $(HAVE_ATTRIBUTE_FALLTHROUGH)
1357HAVE_ATTRIBUTE_FALLTHROUGH = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-attr-fallthrough have_test_prog)
1358ifeq ($(HAVE_ATTRIBUTE_FALLTHROUGH),1)
1359	CONFIG_CFLAGS += -DHAVE_ATTRIBUTE_FALLTHROUGH
1360endif
1361$(call using,$(HAVE_ATTRIBUTE_FALLTHROUGH),__attribute__((fallthrough)))
1362endif
1363
1364ifndef $(HAVE_ASM_X86_CLDEMOTE)
1365HAVE_ASM_X86_CLDEMOTE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-asm-x86-cldemote have_test_prog)
1366ifeq ($(HAVE_ASM_X86_CLDEMOTE),1)
1367	CONFIG_CFLAGS += -DHAVE_ASM_X86_CLDEMOTE
1368endif
1369$(call using,$(HAVE_ASM_X86_CLDEMOTE),cldemote instruction (x86))
1370endif
1371
1372ifndef $(HAVE_ASM_X86_CLFLUSH)
1373HAVE_ASM_X86_CLFLUSH = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-asm-x86-clflush have_test_prog)
1374ifeq ($(HAVE_ASM_X86_CLFLUSH),1)
1375	CONFIG_CFLAGS += -DHAVE_ASM_X86_CLFLUSH
1376endif
1377$(call using,$(HAVE_ASM_X86_CLFLUSH),clflush instruction (x86))
1378endif
1379
1380ifndef $(HAVE_ASM_X86_CLFLUSHOPT)
1381HAVE_ASM_X86_CLFLUSHOPT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-asm-x86-clflushopt have_test_prog)
1382ifeq ($(HAVE_ASM_X86_CLFLUSHOPT),1)
1383	CONFIG_CFLAGS += -DHAVE_ASM_X86_CLFLUSHOPT
1384endif
1385$(call using,$(HAVE_ASM_X86_CLFLUSHOPT),clflushopt instruction (x86))
1386endif
1387
1388ifndef $(HAVE_ASM_PPC64_DARN)
1389HAVE_ASM_PPC64_DARN = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-asm-ppc64-darn have_test_prog)
1390ifeq ($(HAVE_ASM_PPC64_DARN),1)
1391	CONFIG_CFLAGS += -DHAVE_ASM_PPC64_DARN
1392endif
1393$(call using,$(HAVE_ASM_PPC64_DARN),darn instruction (power9))
1394endif
1395
1396ifndef $(HAVE_ASM_RISCV_FENCE)
1397HAVE_ASM_RISCV_FENCE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-asm-riscv-fence have_test_prog)
1398ifeq ($(HAVE_ASM_RISCV_FENCE),1)
1399	CONFIG_CFLAGS += -DHAVE_ASM_RISCV_FENCE
1400endif
1401$(call using,$(HAVE_ASM_RISCV_FENCE),fence instruction (RISC-V))
1402endif
1403
1404ifndef $(HAVE_LABEL_AS_VALUE)
1405HAVE_LABEL_AS_VALUE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-label-as-value have_test_prog)
1406ifeq ($(HAVE_LABEL_AS_VALUE),1)
1407	CONFIG_CFLAGS += -DHAVE_LABEL_AS_VALUE
1408endif
1409$(call using,$(HAVE_LABEL_AS_VALUE),label as value feature)
1410endif
1411
1412ifndef $(HAVE_ASM_NOP)
1413HAVE_ASM_NOP = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-asm-nop have_test_prog)
1414ifeq ($(HAVE_ASM_NOP),1)
1415	CONFIG_CFLAGS += -DHAVE_ASM_NOP
1416endif
1417$(call using,$(HAVE_ASM_NOP),nop instruction)
1418endif
1419
1420ifndef $(HAVE_ASM_NOTHING)
1421HAVE_ASM_NOTHING = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-asm-nothing have_test_prog)
1422ifeq ($(HAVE_ASM_NOTHING),1)
1423	CONFIG_CFLAGS += -DHAVE_ASM_NOTHING
1424endif
1425$(call using,$(HAVE_ASM_NOTHING),asm(""))
1426endif
1427
1428ifndef $(HAVE_ASM_X86_PAUSE)
1429HAVE_ASM_X86_PAUSE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-asm-x86-pause have_test_prog)
1430ifeq ($(HAVE_ASM_X86_PAUSE),1)
1431	CONFIG_CFLAGS += -DHAVE_ASM_X86_PAUSE
1432endif
1433$(call using,$(HAVE_ASM_X86_PAUSE),pause instruction (x86))
1434endif
1435
1436ifndef $(HAVE_PRAGMA)
1437HAVE_PRAGMA = $(shell $(MAKE) $(MAKE_OPTS) TEST_CFLAGS=-Werror TEST_PROG=test-pragma have_test_prog)
1438ifeq ($(HAVE_PRAGMA),1)
1439	CONFIG_CFLAGS += -DHAVE_PRAGMA
1440endif
1441$(call using,$(HAVE_PRAGMA),pragma push/pop)
1442endif
1443
1444ifndef $(HAVE_PRAGMA_INSIDE)
1445HAVE_PRAGMA_INSIDE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-pragma-inside have_test_prog)
1446ifeq ($(HAVE_PRAGMA_INSIDE),1)
1447	CONFIG_CFLAGS += -DHAVE_PRAGMA_INSIDE
1448endif
1449$(call using,$(HAVE_PRAGMA_INSIDE),pragma inside functions)
1450endif
1451
1452ifndef $(HAVE_ASM_X86_RDRAND)
1453HAVE_ASM_X86_RDRAND = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-asm-x86-rdrand have_test_prog)
1454ifeq ($(HAVE_ASM_X86_RDRAND),1)
1455	CONFIG_CFLAGS += -DHAVE_ASM_X86_RDRAND
1456endif
1457$(call using,$(HAVE_ASM_X86_RDRAND),rdrand instruction (x86))
1458endif
1459
1460ifndef $(HAVE_ASM_X86_RDSEED)
1461HAVE_ASM_X86_RDSEED = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-asm-x86-rdseed have_test_prog)
1462ifeq ($(HAVE_ASM_X86_RDSEED),1)
1463	CONFIG_CFLAGS += -DHAVE_ASM_X86_RDSEED
1464endif
1465$(call using,$(HAVE_ASM_X86_RDSEED),rdseed instruction (x86))
1466endif
1467
1468ifndef $(HAVE___RESTRICT)
1469HAVE___RESTRICT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-__restrict have_test_prog)
1470ifeq ($(HAVE___RESTRICT),1)
1471	CONFIG_CFLAGS += -DHAVE___RESTRICT
1472endif
1473$(call using,$(HAVE___RESTRICT),__restrict keyword)
1474endif
1475
1476ifndef $(HAVE_ASM_ARM_YIELD)
1477HAVE_ASM_ARM_YIELD = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-asm-arm-yield have_test_prog)
1478ifeq ($(HAVE_ASM_ARM_YIELD),1)
1479	CONFIG_CFLAGS += -DHAVE_ASM_ARM_YIELD
1480endif
1481$(call using,$(HAVE_ASM_ARM_YIELD),yield instruction (ARM))
1482endif
1483
1484ifndef $(HAVE_TARGET_CLONES)
1485HAVE_TARGET_CLONES = $(shell $(MAKE) $(MAKE_OPTS) TARGET_CLONE='"default"' TEST_PROG=test-target-clones have_test_prog)
1486ifeq ($(HAVE_TARGET_CLONES),1)
1487	CONFIG_CFLAGS += -DHAVE_TARGET_CLONES
1488endif
1489$(call using,$(HAVE_TARGET_CLONES),target_clones attribute)
1490endif
1491
1492ifndef $(HAVE_TARGET_CLONES_MMX)
1493HAVE_TARGET_CLONES_MMX = $(shell $(MAKE) $(MAKE_OPTS) TARGET_CLONE='"default,mmx"' TEST_PROG=test-target-clones have_test_prog)
1494ifeq ($(HAVE_TARGET_CLONES_MMX),1)
1495	CONFIG_CFLAGS += -DHAVE_TARGET_CLONES_MMX
1496endif
1497$(call using,$(HAVE_TARGET_CLONES_MMX),target_clones mmx attribute)
1498endif
1499
1500ifndef $(HAVE_TARGET_CLONES_AVX)
1501HAVE_TARGET_CLONES_AVX = $(shell $(MAKE) $(MAKE_OPTS) TARGET_CLONE='"default,avx"' TEST_PROG=test-target-clones have_test_prog)
1502ifeq ($(HAVE_TARGET_CLONES_AVX),1)
1503	CONFIG_CFLAGS += -DHAVE_TARGET_CLONES_AVX
1504endif
1505$(call using,$(HAVE_TARGET_CLONES_AVX),target_clones avx attribute)
1506endif
1507
1508ifndef $(HAVE_TARGET_CLONES_AVX2)
1509HAVE_TARGET_CLONES_AVX2 = $(shell $(MAKE) $(MAKE_OPTS) TARGET_CLONE='"default,avx2"' TEST_PROG=test-target-clones have_test_prog)
1510ifeq ($(HAVE_TARGET_CLONES_AVX2),1)
1511	CONFIG_CFLAGS += -DHAVE_TARGET_CLONES_AVX2
1512endif
1513$(call using,$(HAVE_TARGET_CLONES_AVX2),target_clones avx2 attribute)
1514endif
1515
1516ifndef $(HAVE_TARGET_CLONES_SSE)
1517HAVE_TARGET_CLONES_SSE = $(shell $(MAKE) $(MAKE_OPTS) TARGET_CLONE='"default,sse"' TEST_PROG=test-target-clones have_test_prog)
1518ifeq ($(HAVE_TARGET_CLONES_SSE),1)
1519	CONFIG_CFLAGS += -DHAVE_TARGET_CLONES_SSE
1520endif
1521$(call using,$(HAVE_TARGET_CLONES_SSE),target_clones sse attribute)
1522endif
1523
1524ifndef $(HAVE_TARGET_CLONES_SSE2)
1525HAVE_TARGET_CLONES_SSE2 = $(shell $(MAKE) $(MAKE_OPTS) TARGET_CLONE='"default,sse2"' TEST_PROG=test-target-clones have_test_prog)
1526ifeq ($(HAVE_TARGET_CLONES_SSE2),1)
1527	CONFIG_CFLAGS += -DHAVE_TARGET_CLONES_SSE2
1528endif
1529$(call using,$(HAVE_TARGET_CLONES_SSE2),target_clones sse2 attribute)
1530endif
1531
1532ifndef $(HAVE_TARGET_CLONES_SSE3)
1533HAVE_TARGET_CLONES_SSE3 = $(shell $(MAKE) $(MAKE_OPTS) TARGET_CLONE='"default,sse3"' TEST_PROG=test-target-clones have_test_prog)
1534ifeq ($(HAVE_TARGET_CLONES_SSE3),1)
1535	CONFIG_CFLAGS += -DHAVE_TARGET_CLONES_SSE3
1536endif
1537$(call using,$(HAVE_TARGET_CLONES_SSE3),target_clones sse3 attribute)
1538endif
1539
1540ifndef $(HAVE_TARGET_CLONES_SSSE3)
1541HAVE_TARGET_CLONES_SSSE3 = $(shell $(MAKE) $(MAKE_OPTS) TARGET_CLONE='"default,ssse3"' TEST_PROG=test-target-clones have_test_prog)
1542ifeq ($(HAVE_TARGET_CLONES_SSSE3),1)
1543	CONFIG_CFLAGS += -DHAVE_TARGET_CLONES_SSSE3
1544endif
1545$(call using,$(HAVE_TARGET_CLONES_SSSE3),target_clones ssse3 attribute)
1546endif
1547
1548ifndef $(HAVE_TARGET_CLONES_SSE4_1)
1549HAVE_TARGET_CLONES_SSE4_1 = $(shell $(MAKE) $(MAKE_OPTS) TARGET_CLONE='"default,sse4.1"' TEST_PROG=test-target-clones have_test_prog)
1550ifeq ($(HAVE_TARGET_CLONES_SSE4_1),1)
1551	CONFIG_CFLAGS += -DHAVE_TARGET_CLONES_SSE4_1
1552endif
1553$(call using,$(HAVE_TARGET_CLONES_SSE4_1),target_clones sse4.1 attribute)
1554endif
1555
1556ifndef $(HAVE_TARGET_CLONES_SSE4_2)
1557HAVE_TARGET_CLONES_SSE4_2 = $(shell $(MAKE) $(MAKE_OPTS) TARGET_CLONE='"default,sse4.2"' TEST_PROG=test-target-clones have_test_prog)
1558ifeq ($(HAVE_TARGET_CLONES_SSE4_2),1)
1559	CONFIG_CFLAGS += -DHAVE_TARGET_CLONES_SSE4_2
1560endif
1561$(call using,$(HAVE_TARGET_CLONES_SSE4_2),target_clones sse4.2 attribute)
1562endif
1563
1564ifndef $(HAVE_TARGET_CLONES_SKYLAKE_AVX512)
1565HAVE_TARGET_CLONES_SKYLAKE_AVX512 = $(shell $(MAKE) $(MAKE_OPTS) TARGET_CLONE='"default,arch=skylake-avx512"' TEST_PROG=test-target-clones have_test_prog)
1566ifeq ($(HAVE_TARGET_CLONES_SKYLAKE_AVX512),1)
1567	CONFIG_CFLAGS += -DHAVE_TARGET_CLONES_SKYLAKE_AVX512
1568endif
1569$(call using,$(HAVE_TARGET_CLONES_SKYLAKE_AVX512),target_clones arch=skylake-avx512 attribute)
1570endif
1571
1572ifndef $(HAVE_TARGET_CLONES_ALDERLAKE)
1573HAVE_TARGET_CLONES_ALDERLAKE = $(shell $(MAKE) $(MAKE_OPTS) TARGET_CLONE='"default,arch=alderlake"' TEST_PROG=test-target-clones have_test_prog)
1574ifeq ($(HAVE_TARGET_CLONES_ALDERLAKE),1)
1575	CONFIG_CFLAGS += -DHAVE_TARGET_CLONES_ALDERLAKE
1576endif
1577$(call using,$(HAVE_TARGET_CLONES_ALDERLAKE),target_clones arch=alderlake attribute)
1578endif
1579
1580ifndef $(HAVE_TARGET_CLONES_POWER9)
1581HAVE_TARGET_CLONES_POWER9 = $(shell $(MAKE) $(MAKE_OPTS) TARGET_CLONE='"default,cpu=power9"' TEST_PROG=test-target-clones have_test_prog)
1582ifeq ($(HAVE_TARGET_CLONES_POWER9),1)
1583	CONFIG_CFLAGS += -DHAVE_TARGET_CLONES_POWER9
1584endif
1585$(call using,$(HAVE_TARGET_CLONES_POWER9),target_clones cpu=power9 attribute)
1586endif
1587
1588ifndef $(HAVE_VECMATH)
1589HAVE_VECMATH = $(shell $(MAKE) $(MAKE_OPTS) have_vecmath)
1590ifeq ($(HAVE_VECMATH),1)
1591	CONFIG_CFLAGS += -DHAVE_VECMATH
1592endif
1593$(call using,$(HAVE_VECMATH),vector math)
1594endif
1595
1596ifndef $(HAVE_VLA_ARG)
1597HAVE_VLA_ARG = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-vla-arg have_test_prog)
1598ifeq ($(HAVE_VLA_ARG),1)
1599	CONFIG_CFLAGS += -DHAVE_VLA_ARG
1600endif
1601$(call using,$(HAVE_VLA_ARG),variable length array function args)
1602endif
1603
1604
1605$(call check,types)
1606
1607ifndef $(HAVE_COMPLEX)
1608HAVE_COMPLEX = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-complex have_test_prog)
1609ifeq ($(HAVE_COMPLEX),1)
1610	CONFIG_CFLAGS += -DHAVE_COMPLEX
1611endif
1612$(call using,$(HAVE_COMPLEX),complex)
1613endif
1614
1615ifndef $(HAVE_DADDR_T)
1616HAVE_DADDR_T = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-daddr_t have_test_prog)
1617ifeq ($(HAVE_DADDR_T),1)
1618	CONFIG_CFLAGS += -DHAVE_DADDR_T
1619endif
1620$(call using,$(HAVE_DADDR_T),daddr_t)
1621endif
1622
1623ifndef $(HAVE_DVD_AUTHINFO)
1624HAVE_DVD_AUTHINFO = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-dvd_authinfo have_test_prog)
1625ifeq ($(HAVE_DVD_AUTHINFO),1)
1626	CONFIG_CFLAGS += -DHAVE_DVD_AUTHINFO
1627endif
1628$(call using,$(HAVE_DVD_AUTHINFO),dvd_authinfo)
1629endif
1630
1631ifndef $(HAVE_DVD_STRUCT)
1632HAVE_DVD_STRUCT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-dvd_struct have_test_prog)
1633ifeq ($(HAVE_DVD_STRUCT),1)
1634	CONFIG_CFLAGS += -DHAVE_DVD_STRUCT
1635endif
1636$(call using,$(HAVE_DVD_STRUCT),dvd_struct)
1637endif
1638
1639ifndef $(HAVE_FLOAT_DECIMAL32)
1640HAVE_FLOAT_DECIMAL32 = $(shell $(MAKE) $(MAKE_OPTS) FLOAT_TYPE=_Decimal32 have_float)
1641ifeq ($(HAVE_FLOAT_DECIMAL32),1)
1642	CONFIG_CFLAGS += -DHAVE_FLOAT_DECIMAL32
1643endif
1644$(call using,$(HAVE_FLOAT_DECIMAL32),float decimal32)
1645endif
1646
1647ifndef $(HAVE_FLOAT_DECIMAL64)
1648HAVE_FLOAT_DECIMAL64 = $(shell $(MAKE) $(MAKE_OPTS) FLOAT_TYPE=_Decimal64 have_float)
1649ifeq ($(HAVE_FLOAT_DECIMAL64),1)
1650	CONFIG_CFLAGS += -DHAVE_FLOAT_DECIMAL64
1651endif
1652$(call using,$(HAVE_FLOAT_DECIMAL64),float decimal64)
1653endif
1654
1655ifndef $(HAVE_FLOAT_DECIMAL128)
1656HAVE_FLOAT_DECIMAL128 = $(shell $(MAKE) $(MAKE_OPTS) FLOAT_TYPE=_Decimal128 have_float)
1657ifeq ($(HAVE_FLOAT_DECIMAL128),1)
1658	CONFIG_CFLAGS += -DHAVE_FLOAT_DECIMAL128
1659endif
1660$(call using,$(HAVE_FLOAT_DECIMAL128),float decimal128)
1661endif
1662
1663ifndef $(HAVE_FLOAT16)
1664HAVE_FLOAT16 = $(shell $(MAKE) $(MAKE_OPTS) FLOAT_TYPE=__fp16 have_float)
1665ifeq ($(HAVE_FLOAT16),1)
1666	CONFIG_CFLAGS += -DHAVE_FLOAT16
1667endif
1668$(call using,$(HAVE_FLOAT16),float16)
1669endif
1670
1671ifndef $(HAVE_FLOAT32)
1672HAVE_FLOAT32 = $(shell $(MAKE) $(MAKE_OPTS) FLOAT_TYPE=_Float32 have_float)
1673ifeq ($(HAVE_FLOAT32),1)
1674	CONFIG_CFLAGS += -DHAVE_FLOAT32
1675endif
1676$(call using,$(HAVE_FLOAT32),float32)
1677endif
1678
1679ifndef $(HAVE_FLOAT64)
1680HAVE_FLOAT64 = $(shell $(MAKE) $(MAKE_OPTS) FLOAT_TYPE=_Float64 have_float)
1681ifeq ($(HAVE_FLOAT64),1)
1682	CONFIG_CFLAGS += -DHAVE_FLOAT64
1683endif
1684$(call using,$(HAVE_FLOAT64),float64)
1685endif
1686
1687ifndef $(HAVE_FLOAT80)
1688HAVE_FLOAT80 = $(shell $(MAKE) $(MAKE_OPTS) FLOAT_TYPE=__float80 have_float)
1689ifeq ($(HAVE_FLOAT80),1)
1690	CONFIG_CFLAGS += -DHAVE_FLOAT80
1691endif
1692$(call using,$(HAVE_FLOAT80),float80)
1693endif
1694
1695ifndef $(HAVE_FLOAT128)
1696HAVE_FLOAT128 = $(shell $(MAKE) $(MAKE_OPTS) FLOAT_TYPE=__float128 have_float)
1697ifeq ($(HAVE_FLOAT128),1)
1698	CONFIG_CFLAGS += -DHAVE_FLOAT128
1699endif
1700$(call using,$(HAVE_FLOAT128),float128)
1701endif
1702
1703ifndef $(HAVE_INO64_T)
1704HAVE_INO64_T = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-ino64_t have_test_prog)
1705ifeq ($(HAVE_INO64_T),1)
1706	CONFIG_CFLAGS += -DHAVE_INO64_T
1707endif
1708$(call using,$(HAVE_INO64_T),ino64_t)
1709endif
1710
1711ifndef $(HAVE_INT128_T)
1712HAVE_INT128_T = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-int128_t have_test_prog)
1713ifeq ($(HAVE_INT128_T),1)
1714	CONFIG_CFLAGS += -DHAVE_INT128_T
1715endif
1716$(call using,$(HAVE_INT128_T),int128_t support)
1717endif
1718
1719ifndef $(HAVE_KERNEL_LONG_T)
1720HAVE_KERNEL_LONG_T = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-kernel_long_t have_test_prog)
1721ifeq ($(HAVE_KERNEL_LONG_T),1)
1722	CONFIG_CFLAGS += -DHAVE_KERNEL_LONG_T
1723endif
1724$(call using,$(HAVE_KERNEL_LONG_T),__kernel_long_t)
1725endif
1726
1727ifndef $(HAVE_KERNEL_ULONG_T)
1728HAVE_KERNEL_ULONG_T = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-kernel_ulong_t have_test_prog)
1729ifeq ($(HAVE_KERNEL_ULONG_T),1)
1730	CONFIG_CFLAGS += -DHAVE_KERNEL_ULONG_T
1731endif
1732$(call using,$(HAVE_KERNEL_ULONG_T),__kernel_ulong_t)
1733endif
1734
1735ifndef $(HAVE_LANDLOCK_RULE_TYPE)
1736HAVE_LANDLOCK_RULE_TYPE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-landlock_rule_type have_test_prog)
1737ifeq ($(HAVE_LANDLOCK_RULE_TYPE),1)
1738	CONFIG_CFLAGS += -DHAVE_LANDLOCK_RULE_TYPE
1739endif
1740$(call using,$(HAVE_LANDLOCK_RULE_TYPE),landlock_rule_type)
1741endif
1742
1743ifndef $(HAVE_LOFF_T)
1744HAVE_LOFF_T = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-loff_t have_test_prog)
1745ifeq ($(HAVE_LOFF_T),1)
1746	CONFIG_CFLAGS += -DHAVE_LOFF_T
1747endif
1748$(call using,$(HAVE_LOFF_T),loff_t)
1749endif
1750
1751ifndef $(HAVE_MODE_T)
1752HAVE_MODE_T = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-mode_t have_test_prog)
1753ifeq ($(HAVE_MODE_T),1)
1754	CONFIG_CFLAGS += -DHAVE_MODE_T
1755endif
1756$(call using,$(HAVE_MODE_T),mode_t)
1757endif
1758
1759ifndef $(HAVE_OFF_T)
1760HAVE_OFF_T = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-off_t have_test_prog)
1761ifeq ($(HAVE_OFF_T),1)
1762	CONFIG_CFLAGS += -DHAVE_OFF_T
1763endif
1764$(call using,$(HAVE_OFF_T),off_t)
1765endif
1766
1767ifndef $(HAVE_OFF64_T)
1768HAVE_OFF64_T = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-off64_t have_test_prog)
1769ifeq ($(HAVE_OFF64_T),1)
1770	CONFIG_CFLAGS += -DHAVE_OFF64_T
1771endif
1772$(call using,$(HAVE_OFF64_T),off64_t)
1773endif
1774
1775ifndef $(HAVE_PTHREAD_MUTEXATTR_T)
1776HAVE_PTHREAD_MUTEXATTR_T = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-pthread-mutexattr_t  have_test_prog)
1777ifeq ($(HAVE_PTHREAD_MUTEXATTR_T),1)
1778	CONFIG_CFLAGS += -DHAVE_PTHREAD_MUTEXATTR_T
1779endif
1780$(call using,$(HAVE_PTHREAD_MUTEXATTR_T),pthread_mutexattr_t)
1781endif
1782
1783ifndef $(HAVE_CDROM_BLK)
1784HAVE_CDROM_BLK = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-cdrom_blk have_test_prog)
1785ifeq ($(HAVE_CDROM_BLK),1)
1786	CONFIG_CFLAGS += -DHAVE_CDROM_BLK
1787endif
1788$(call using,$(HAVE_CDROM_BLK),struct cdrom_blk)
1789endif
1790
1791ifndef $(HAVE_CDROM_MCN)
1792HAVE_CDROM_MCN = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-cdrom_mcn have_test_prog)
1793ifeq ($(HAVE_CDROM_MCN),1)
1794	CONFIG_CFLAGS += -DHAVE_CDROM_MCN
1795endif
1796$(call using,$(HAVE_CDROM_MCN),struct cdrom_mcn)
1797endif
1798
1799ifndef $(HAVE_CDROM_MSF)
1800HAVE_CDROM_MSF = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-cdrom_msf have_test_prog)
1801ifeq ($(HAVE_CDROM_MSF),1)
1802	CONFIG_CFLAGS += -DHAVE_CDROM_MSF
1803endif
1804$(call using,$(HAVE_CDROM_MSF),struct cdrom_msf)
1805endif
1806
1807ifndef $(HAVE_CDROM_READ_AUDIO)
1808HAVE_CDROM_READ_AUDIO = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-cdrom_read_audio have_test_prog)
1809ifeq ($(HAVE_CDROM_READ_AUDIO),1)
1810	CONFIG_CFLAGS += -DHAVE_CDROM_READ_AUDIO
1811endif
1812$(call using,$(HAVE_CDROM_READ_AUDIO),struct cdrom_read_audio)
1813endif
1814
1815ifndef $(HAVE_CDROM_SUBCHNL)
1816HAVE_CDROM_SUBCHNL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-cdrom_subchnl have_test_prog)
1817ifeq ($(HAVE_CDROM_SUBCHNL),1)
1818	CONFIG_CFLAGS += -DHAVE_CDROM_SUBCHNL
1819endif
1820$(call using,$(HAVE_CDROM_SUBCHNL),struct cdrom_subchnl)
1821endif
1822
1823ifndef $(HAVE_CDROM_TI)
1824HAVE_CDROM_TI = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-cdrom_ti have_test_prog)
1825ifeq ($(HAVE_CDROM_TI),1)
1826	CONFIG_CFLAGS += -DHAVE_CDROM_TI
1827endif
1828$(call using,$(HAVE_CDROM_TI),struct cdrom_ti)
1829endif
1830
1831ifndef $(HAVE_CDROM_TOCENTRY)
1832HAVE_CDROM_TOCENTRY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-cdrom_tocentry have_test_prog)
1833ifeq ($(HAVE_CDROM_TOCENTRY),1)
1834	CONFIG_CFLAGS += -DHAVE_CDROM_TOCENTRY
1835endif
1836$(call using,$(HAVE_CDROM_TOCENTRY),struct cdrom_tocentry)
1837endif
1838
1839ifndef $(HAVE_CDROM_TOCHDR)
1840HAVE_CDROM_TOCHDR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-cdrom_tochdr have_test_prog)
1841ifeq ($(HAVE_CDROM_TOCHDR),1)
1842	CONFIG_CFLAGS += -DHAVE_CDROM_TOCHDR
1843endif
1844$(call using,$(HAVE_CDROM_TOCHDR),struct cdrom_tochdr)
1845endif
1846
1847ifndef $(HAVE_CDROM_VOLCTRL)
1848HAVE_CDROM_VOLCTRL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-cdrom_volctrl have_test_prog)
1849ifeq ($(HAVE_CDROM_VOLCTRL),1)
1850	CONFIG_CFLAGS += -DHAVE_CDROM_VOLCTRL
1851endif
1852$(call using,$(HAVE_CDROM_VOLCTRL),struct cdrom_volctrl)
1853endif
1854
1855ifndef $(HAVE_CONSOLEFONTDESC)
1856HAVE_CONSOLEFONTDESC = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-consolefontdesc have_test_prog)
1857ifeq ($(HAVE_CONSOLEFONTDESC),1)
1858	CONFIG_CFLAGS += -DHAVE_CONSOLEFONTDESC
1859endif
1860$(call using,$(HAVE_CONSOLEFONTDESC),struct consolefontdesc)
1861endif
1862
1863ifndef $(HAVE_FLOPPY_FDC_STATE)
1864HAVE_FLOPPY_FDC_STATE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-floppy_fdc_state have_test_prog)
1865ifeq ($(HAVE_FLOPPY_FDC_STATE),1)
1866	CONFIG_CFLAGS += -DHAVE_FLOPPY_FDC_STATE
1867endif
1868$(call using,$(HAVE_FLOPPY_FDC_STATE),struct floppy_fdc_state)
1869endif
1870
1871ifndef $(HAVE_FLOPPY_DRIVE_STRUCT)
1872HAVE_FLOPPY_DRIVE_STRUCT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-floppy_drive_struct have_test_prog)
1873ifeq ($(HAVE_FLOPPY_DRIVE_STRUCT),1)
1874	CONFIG_CFLAGS += -DHAVE_FLOPPY_DRIVE_STRUCT
1875endif
1876$(call using,$(HAVE_FLOPPY_DRIVE_STRUCT),struct floppy_drive_struct)
1877endif
1878
1879ifndef $(HAVE_FLOPPY_STRUCT)
1880HAVE_FLOPPY_STRUCT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-floppy_struct have_test_prog)
1881ifeq ($(HAVE_FLOPPY_STRUCT),1)
1882	CONFIG_CFLAGS += -DHAVE_FLOPPY_STRUCT
1883endif
1884$(call using,$(HAVE_FLOPPY_STRUCT),struct floppy_struct)
1885endif
1886
1887ifndef $(HAVE_DM_IOCTL)
1888HAVE_DM_IOCTL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-dm_ioctl have_test_prog)
1889ifeq ($(HAVE_DM_IOCTL),1)
1890	CONFIG_CFLAGS += -DHAVE_DM_IOCTL
1891endif
1892$(call using,$(HAVE_DM_IOCTL),struct dm_ioctl)
1893endif
1894
1895ifndef $(HAVE_FSVERITY_DIGEST)
1896HAVE_FSVERITY_DIGEST = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-fsverity_digest have_test_prog)
1897ifeq ($(HAVE_FSVERITY_DIGEST),1)
1898	CONFIG_CFLAGS += -DHAVE_FSVERITY_DIGEST
1899endif
1900$(call using,$(HAVE_FSVERITY_DIGEST),struct fsverity_digest)
1901endif
1902
1903ifndef $(HAVE_FSVERITY_ENABLE_ARG)
1904HAVE_FSVERITY_ENABLE_ARG = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-fsverity_enable_arg have_test_prog)
1905ifeq ($(HAVE_FSVERITY_ENABLE_ARG),1)
1906	CONFIG_CFLAGS += -DHAVE_FSVERITY_ENABLE_ARG
1907endif
1908$(call using,$(HAVE_FSVERITY_ENABLE_ARG),struct fsverity_enable_arg)
1909endif
1910
1911ifndef $(HAVE_IFCONF)
1912HAVE_IFCONF = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-ifconf have_test_prog)
1913ifeq ($(HAVE_IFCONF),1)
1914	CONFIG_CFLAGS += -DHAVE_IFCONF
1915endif
1916$(call using,$(HAVE_IFCONF),struct ifconf)
1917endif
1918
1919ifndef $(HAVE_ICMPHDR)
1920HAVE_ICMPHDR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-icmphdr have_test_prog)
1921ifeq ($(HAVE_ICMPHDR),1)
1922	CONFIG_CFLAGS += -DHAVE_ICMPHDR
1923endif
1924$(call using,$(HAVE_ICMPHDR),struct iphdr and icmphdr)
1925endif
1926
1927ifndef $(HAVE_KBDIACRS)
1928HAVE_KBDIACRS = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-kbdiacrs have_test_prog)
1929ifeq ($(HAVE_KBDIACRS),1)
1930	CONFIG_CFLAGS += -DHAVE_KBDIACRS
1931endif
1932$(call using struct,$(HAVE_KBDIACRS),struct kbdiacrs)
1933endif
1934
1935ifndef $(HAVE_KBENTRY)
1936HAVE_KBENTRY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-kbentry have_test_prog)
1937ifeq ($(HAVE_KBENTRY),1)
1938	CONFIG_CFLAGS += -DHAVE_KBENTRY
1939endif
1940$(call using,$(HAVE_KBENTRY),struct kbentry)
1941endif
1942
1943ifndef $(HAVE_KBKEYCODE)
1944HAVE_KBKEYCODE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-kbkeycode have_test_prog)
1945ifeq ($(HAVE_KBKEYCODE),1)
1946	CONFIG_CFLAGS += -DHAVE_KBKEYCODE
1947endif
1948$(call using,$(HAVE_KBKEYCODE),struct kbkeycode)
1949endif
1950
1951ifndef $(HAVE_KBSENTRY)
1952HAVE_KBSENTRY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-kbsentry have_test_prog)
1953ifeq ($(HAVE_KBSENTRY),1)
1954	CONFIG_CFLAGS += -DHAVE_KBSENTRY
1955endif
1956$(call using,$(HAVE_KBSENTRY),struct kbsentry)
1957endif
1958
1959ifndef $(HAVE_LANDLOCK_RULESET_ATTR)
1960HAVE_LANDLOCK_RULESET_ATTR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-landlock_ruleset_attr have_test_prog)
1961ifeq ($(HAVE_LANDLOCK_RULESET_ATTR),1)
1962	CONFIG_CFLAGS += -DHAVE_LANDLOCK_RULESET_ATTR
1963endif
1964$(call using,$(HAVE_LANDLOCK_RULESET_ATTR),struct landlock_ruleset_attr)
1965endif
1966
1967ifndef $(HAVE_MEDIA_DEVICE_INFO)
1968HAVE_MEDIA_DEVICE_INFO = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-media_device_info have_test_prog)
1969ifeq ($(HAVE_MEDIA_DEVICE_INFO),1)
1970	CONFIG_CFLAGS += -DHAVE_MEDIA_DEVICE_INFO
1971endif
1972$(call using,$(HAVE_MEDIA_DEVICE_INFO),struct media_device_info)
1973endif
1974
1975ifndef $(HAVE_MSGINFO)
1976HAVE_MSGINFO = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-msginfo have_test_prog)
1977ifeq ($(HAVE_MSGINFO),1)
1978	CONFIG_CFLAGS += -DHAVE_MSGINFO
1979endif
1980$(call using,$(HAVE_MSGINFO),struct msginfo)
1981endif
1982
1983ifndef $(HAVE_MTRR_GENTRY)
1984HAVE_MTRR_GENTRY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-mtrr_gentry have_test_prog)
1985ifeq ($(HAVE_MTRR_GENTRY),1)
1986	CONFIG_CFLAGS += -DHAVE_MTRR_GENTRY
1987endif
1988$(call using,$(HAVE_MTRR_GENTRY),struct mtrr_gentry)
1989endif
1990
1991ifndef $(HAVE_OPEN_HOW)
1992HAVE_OPEN_HOW = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-open_how have_test_prog)
1993ifeq ($(HAVE_OPEN_HOW),1)
1994	CONFIG_CFLAGS += -DHAVE_OPEN_HOW
1995endif
1996$(call using,$(HAVE_OPEN_HOW),struct open_how)
1997endif
1998
1999ifndef $(HAVE_RUSAGE_RU_MINFLT)
2000HAVE_RUSAGE_RU_MINFLT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-rusage_ru_minflt have_test_prog)
2001ifeq ($(HAVE_RUSAGE_RU_MINFLT),1)
2002	CONFIG_CFLAGS += -DHAVE_RUSAGE_RU_MINFLT
2003endif
2004$(call using,$(HAVE_RUSAGE_RU_MINFLT),struct rusage.ru_minflt)
2005endif
2006
2007ifndef $(HAVE_RUSAGE_RU_NVCSW)
2008HAVE_RUSAGE_RU_NVCSW = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-rusage_ru_nvcsw have_test_prog)
2009ifeq ($(HAVE_RUSAGE_RU_NVCSW),1)
2010	CONFIG_CFLAGS += -DHAVE_RUSAGE_RU_NVCSW
2011endif
2012$(call using,$(HAVE_RUSAGE_RU_NVCSW),struct rusage.ru_nvcsw)
2013endif
2014
2015ifndef $(HAVE_SECCOMP_NOTIF_SIZES)
2016HAVE_SECCOMP_NOTIF_SIZES = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-seccomp_notif_sizes have_test_prog)
2017ifeq ($(HAVE_SECCOMP_NOTIF_SIZES),1)
2018	CONFIG_CFLAGS += -DHAVE_SECCOMP_NOTIF_SIZES
2019endif
2020$(call using,$(HAVE_SECCOMP_NOTIF_SIZES),struct seccomp_notif_sizes)
2021endif
2022
2023ifndef $(HAVE_SERIAL_ICOUNTER)
2024HAVE_SERIAL_ICOUNTER = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-serial-icounter have_test_prog)
2025ifeq ($(HAVE_SERIAL_ICOUNTER),1)
2026	CONFIG_CFLAGS += -DHAVE_SERIAL_ICOUNTER
2027endif
2028$(call using,$(HAVE_SERIAL_ICOUNTER),struct serial_icounter_struct)
2029endif
2030
2031ifndef $(HAVE_SERIAL_STRUCT)
2032HAVE_SERIAL_STRUCT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-serial-struct have_test_prog)
2033ifeq ($(HAVE_SERIAL_STRUCT),1)
2034	CONFIG_CFLAGS += -DHAVE_SERIAL_STRUCT
2035endif
2036$(call using,$(HAVE_SERIAL_STRUCT),struct serial_struct)
2037endif
2038
2039ifndef $(HAVE_SHMID_DS)
2040HAVE_SHMID_DS = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-shmid-ds have_test_prog)
2041ifeq ($(HAVE_SHMID_DS),1)
2042	CONFIG_CFLAGS += -DHAVE_SHMID_DS
2043endif
2044$(call using,$(HAVE_SHMID_DS),struct shmid_ds)
2045endif
2046
2047ifndef $(HAVE_SHMINFO)
2048HAVE_SHMINFO = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-shminfo have_test_prog)
2049ifeq ($(HAVE_SHMINFO),1)
2050	CONFIG_CFLAGS += -DHAVE_SHMINFO
2051endif
2052$(call using,$(HAVE_SHMINFO),struct shminfo)
2053endif
2054
2055ifndef $(HAVE_SND_CTL_CARD_INFO)
2056HAVE_SND_CTL_CARD_INFO = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-snd_ctl_card_info have_test_prog)
2057ifeq ($(HAVE_SND_CTL_CARD_INFO),1)
2058	CONFIG_CFLAGS += -DHAVE_SND_CTL_CARD_INFO
2059endif
2060$(call using,$(HAVE_SND_CTL_CARD_INFO),struct snd_ctl_card_info)
2061endif
2062
2063ifndef $(HAVE_SND_CTL_TLV)
2064HAVE_SND_CTL_TLV = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-snd_ctl_tlv have_test_prog)
2065ifeq ($(HAVE_SND_CTL_TLV),1)
2066	CONFIG_CFLAGS += -DHAVE_SND_CTL_TLV
2067endif
2068$(call using,$(HAVE_SND_CTL_TLV),struct snd_ctl_tlv)
2069endif
2070
2071ifndef $(HAVE_SOCKADDR_UN)
2072HAVE_SOCKADDR_UN = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sockaddr_un have_test_prog)
2073ifeq ($(HAVE_SOCKADDR_UN),1)
2074	CONFIG_CFLAGS += -DHAVE_SOCKADDR_UN
2075endif
2076$(call using,$(HAVE_SOCKADDR_UN),struct sockaddr_un)
2077endif
2078
2079ifndef $(HAVE_TERMIOS)
2080HAVE_TERMIOS = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-termios have_test_prog)
2081ifeq ($(HAVE_TERMIOS),1)
2082	CONFIG_CFLAGS += -DHAVE_TERMIOS
2083endif
2084$(call using,$(HAVE_TERMIOS),struct termios)
2085endif
2086
2087ifndef $(HAVE_UNIMAPDESC)
2088HAVE_UNIMAPDESC = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-unimapdesc have_test_prog)
2089ifeq ($(HAVE_UNIMAPDESC),1)
2090	CONFIG_CFLAGS += -DHAVE_UNIMAPDESC
2091endif
2092$(call using,$(HAVE_UNIMAPDESC),struct unimapdesc)
2093endif
2094
2095ifndef $(HAVE_USER_DESC)
2096HAVE_USER_DESC = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-user-desc have_test_prog)
2097ifeq ($(HAVE_USER_DESC),1)
2098	CONFIG_CFLAGS += -DHAVE_USER_DESC
2099endif
2100$(call using,$(HAVE_USER_DESC),struct user_desc)
2101endif
2102
2103ifndef $(HAVE_VT_CONSIZE)
2104HAVE_VT_CONSIZE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-vt_consize have_test_prog)
2105ifeq ($(HAVE_VT_CONSIZE),1)
2106	CONFIG_CFLAGS += -DHAVE_VT_CONSIZE
2107endif
2108$(call using,$(HAVE_VT_CONSIZE),struct vt_consize)
2109endif
2110
2111ifndef $(HAVE_VT_MODE)
2112HAVE_VT_MODE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-vt_mode have_test_prog)
2113ifeq ($(HAVE_VT_MODE),1)
2114	CONFIG_CFLAGS += -DHAVE_VT_MODE
2115endif
2116$(call using,$(HAVE_VT_MODE),struct vt_mode)
2117endif
2118
2119ifndef $(HAVE_VT_SIZES)
2120HAVE_VT_SIZES = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-vt_sizes have_test_prog)
2121ifeq ($(HAVE_VT_SIZES),1)
2122	CONFIG_CFLAGS += -DHAVE_VT_SIZES
2123endif
2124$(call using,$(HAVE_VT_SIZES),struct vt_sizes)
2125endif
2126
2127ifndef $(HAVE_VT_STAT)
2128HAVE_VT_STAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-vt_stat have_test_prog)
2129ifeq ($(HAVE_VT_STAT),1)
2130	CONFIG_CFLAGS += -DHAVE_VT_STAT
2131endif
2132$(call using,$(HAVE_VT_STAT),struct vt_stat)
2133endif
2134
2135ifndef $(HAVE_V4L2_AUDIO)
2136HAVE_V4L2_AUDIO = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-v4l2_audio have_test_prog)
2137ifeq ($(HAVE_V4L2_AUDIO),1)
2138	CONFIG_CFLAGS += -DHAVE_V4L2_AUDIO
2139endif
2140$(call using,$(HAVE_V4L2_AUDIO),struct v4l2_audio)
2141endif
2142
2143ifndef $(HAVE_V4L2_AUDIOOUT)
2144HAVE_V4L2_AUDIOOUT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-v4l2_audioout have_test_prog)
2145ifeq ($(HAVE_V4L2_AUDIOOUT),1)
2146	CONFIG_CFLAGS += -DHAVE_V4L2_AUDIOOUT
2147endif
2148$(call using,$(HAVE_V4L2_AUDIOOUT),struct v4l2_audioout)
2149endif
2150
2151ifndef $(HAVE_V4L2_CAPABILITY)
2152HAVE_V4L2_CAPABILITY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-v4l2_capability have_test_prog)
2153ifeq ($(HAVE_V4L2_CAPABILITY),1)
2154	CONFIG_CFLAGS += -DHAVE_V4L2_CAPABILITY
2155endif
2156$(call using,$(HAVE_V4L2_CAPABILITY),struct v4l2_capability)
2157endif
2158
2159ifndef $(HAVE_V4L2_DV_TIMINGS)
2160HAVE_V4L2_DV_TIMINGS = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-v4l2_dv_timings have_test_prog)
2161ifeq ($(HAVE_V4L2_DV_TIMINGS),1)
2162	CONFIG_CFLAGS += -DHAVE_V4L2_DV_TIMINGS
2163endif
2164$(call using,$(HAVE_V4L2_DV_TIMINGS),struct v4l2_dv_timings)
2165endif
2166
2167ifndef $(HAVE_V4L2_ENC_IDX)
2168HAVE_V4L2_ENC_IDX = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-v4l2_enc_idx  have_test_prog)
2169ifeq ($(HAVE_V4L2_ENC_IDX),1)
2170	CONFIG_CFLAGS += -DHAVE_V4L2_ENC_IDX
2171endif
2172$(call using,$(HAVE_V4L2_ENC_IDX),struct v4l2_enc_idx)
2173endif
2174
2175ifndef $(HAVE_V4L2_FRAMEBUFFER)
2176HAVE_V4L2_FRAMEBUFFER = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-v4l2_framebuffer have_test_prog)
2177ifeq ($(HAVE_V4L2_FRAMEBUFFER),1)
2178	CONFIG_CFLAGS += -DHAVE_V4L2_FRAMEBUFFER
2179endif
2180$(call using,$(HAVE_V4L2_FRAMEBUFFER),struct v4l2_framebuffer)
2181endif
2182
2183ifndef $(HAVE_V4L2_JPEGCOMPRESSION)
2184HAVE_V4L2_JPEGCOMPRESSION = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-v4l2_jpegcompression have_test_prog)
2185ifeq ($(HAVE_V4L2_JPEGCOMPRESSION),1)
2186	CONFIG_CFLAGS += -DHAVE_V4L2_JPEGCOMPRESSION
2187endif
2188$(call using,$(HAVE_V4L2_JPEGCOMPRESSION),struct v4l2_jpegcompression)
2189endif
2190
2191ifndef $(HAVE_V4L2_STD_ID)
2192HAVE_V4L2_STD_ID = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-v4l2_std_id have_test_prog)
2193ifeq ($(HAVE_V4L2_STD_ID),1)
2194	CONFIG_CFLAGS += -DHAVE_V4L2_STD_ID
2195endif
2196$(call using,$(HAVE_V4L2_STD_ID),type v4l2_std_id)
2197endif
2198
2199ifndef $(HAVE_V2DI)
2200HAVE_V2DI = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-v2di have_test_prog)
2201ifeq ($(HAVE_V2DI),1)
2202	CONFIG_CFLAGS += -DHAVE_V2DI
2203endif
2204$(call using,$(HAVE_V2DI),__v2di)
2205endif
2206
2207ifndef $(HAVE_WINSIZE)
2208HAVE_WINSIZE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-winsize have_test_prog)
2209ifeq ($(HAVE_WINSIZE),1)
2210	CONFIG_CFLAGS += -DHAVE_WINSIZE
2211endif
2212$(call using,$(HAVE_WINSIZE),struct winsize)
2213endif
2214
2215
2216$(call check,functions and system calls)
2217
2218ifndef $(HAVE_ACCEPT4)
2219HAVE_ACCEPT4 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-accept4 have_test_prog)
2220ifeq ($(HAVE_ACCEPT4),1)
2221	CONFIG_CFLAGS += -DHAVE_ACCEPT4
2222endif
2223$(call using,$(HAVE_ACCEPT4),accept4)
2224endif
2225
2226ifndef $(HAVE_ADJTIME)
2227HAVE_ADJTIME = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-adjtime have_test_prog)
2228ifeq ($(HAVE_ADJTIME),1)
2229	CONFIG_CFLAGS += -DHAVE_ADJTIME
2230endif
2231$(call using,$(HAVE_ADJTIME),adjtime)
2232endif
2233
2234ifndef $(HAVE_ADJTIMEX)
2235HAVE_ADJTIMEX = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-adjtimex have_test_prog)
2236ifeq ($(HAVE_ADJTIMEX),1)
2237	CONFIG_CFLAGS += -DHAVE_ADJTIMEX
2238endif
2239$(call using,$(HAVE_ADJTIMEX),adjtimex)
2240endif
2241
2242ifndef $(HAVE_AFFINITY)
2243HAVE_AFFINITY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-affinity have_test_prog)
2244ifeq ($(HAVE_AFFINITY),1)
2245	CONFIG_CFLAGS += -DHAVE_AFFINITY
2246endif
2247$(call using,$(HAVE_AFFINITY),affinity scheduling CPU masks)
2248endif
2249
2250ifndef $(HAVE_AIO_CANCEL)
2251HAVE_AIO_CANCEL = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-aio-cancel have_test_prog)
2252ifeq ($(HAVE_AIO_CANCEL),1)
2253	CONFIG_CFLAGS += -DHAVE_AIO_CANCEL
2254endif
2255$(call using,$(HAVE_AIO_CANCEL),aio_cancel)
2256endif
2257
2258ifndef $(HAVE_AIO_FSYNC)
2259HAVE_AIO_FSYNC = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-aio-fsync have_test_prog)
2260ifeq ($(HAVE_AIO_FSYNC),1)
2261	CONFIG_CFLAGS += -DHAVE_AIO_FSYNC
2262endif
2263$(call using,$(HAVE_AIO_FSYNC),aio_fsync)
2264endif
2265
2266ifndef $(HAVE_AIO_READ)
2267HAVE_AIO_READ = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-aio-read have_test_prog)
2268ifeq ($(HAVE_AIO_READ),1)
2269	CONFIG_CFLAGS += -DHAVE_AIO_READ
2270endif
2271$(call using,$(HAVE_AIO_READ),aio_read)
2272endif
2273
2274ifndef $(HAVE_AIO_WRITE)
2275HAVE_AIO_WRITE = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-aio-write have_test_prog)
2276ifeq ($(HAVE_AIO_WRITE),1)
2277	CONFIG_CFLAGS += -DHAVE_AIO_WRITE
2278endif
2279$(call using,$(HAVE_AIO_WRITE),aio_write)
2280endif
2281
2282ifndef $(HAVE_ARCH_PRCTL)
2283HAVE_ARCH_PRCTL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-arch_prctl have_test_prog)
2284ifeq ($(HAVE_ARCH_PRCTL),1)
2285	CONFIG_CFLAGS += -DHAVE_ARCH_PRCTL
2286endif
2287$(call using,$(HAVE_ARCH_PRCTL),arch_prctl)
2288endif
2289
2290ifndef $(HAVE_ATOMIC_ADD_FETCH)
2291HAVE_ATOMIC_ADD_FETCH = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_add_fetch have_test_prog)
2292ifeq ($(HAVE_ATOMIC_ADD_FETCH),1)
2293	CONFIG_CFLAGS += -DHAVE_ATOMIC_ADD_FETCH
2294endif
2295$(call using,$(HAVE_ATOMIC_ADD_FETCH),__atomic_add_fetch)
2296endif
2297
2298ifndef $(HAVE_ATOMIC_AND_FETCH)
2299HAVE_ATOMIC_AND_FETCH = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_and_fetch have_test_prog)
2300ifeq ($(HAVE_ATOMIC_AND_FETCH),1)
2301	CONFIG_CFLAGS += -DHAVE_ATOMIC_AND_FETCH
2302endif
2303$(call using,$(HAVE_ATOMIC_AND_FETCH),__atomic_and_fetch)
2304endif
2305
2306ifndef $(HAVE_ATOMIC_CLEAR)
2307HAVE_ATOMIC_CLEAR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_clear have_test_prog)
2308ifeq ($(HAVE_ATOMIC_CLEAR),1)
2309	CONFIG_CFLAGS += -DHAVE_ATOMIC_CLEAR
2310endif
2311$(call using,$(HAVE_ATOMIC_CLEAR),__atomic_clear)
2312endif
2313
2314ifndef $(HAVE_ATOMIC_FETCH_ADD)
2315HAVE_ATOMIC_FETCH_ADD = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_fetch_add have_test_prog)
2316ifeq ($(HAVE_ATOMIC_FETCH_ADD),1)
2317	CONFIG_CFLAGS += -DHAVE_ATOMIC_FETCH_ADD
2318endif
2319$(call using,$(HAVE_ATOMIC_FETCH_ADD),__atomic_fetch_add)
2320endif
2321
2322ifndef $(HAVE_ATOMIC_FETCH_ADD_2)
2323HAVE_ATOMIC_FETCH_ADD_2 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_fetch_add_2 have_test_prog)
2324ifeq ($(HAVE_ATOMIC_FETCH_ADD_2),1)
2325	CONFIG_CFLAGS += -DHAVE_ATOMIC_FETCH_ADD_2
2326endif
2327$(call using,$(HAVE_ATOMIC_FETCH_ADD_2),__atomic_fetch_add_2)
2328endif
2329
2330ifndef $(HAVE_ATOMIC_FETCH_ADD_4)
2331HAVE_ATOMIC_FETCH_ADD_4 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_fetch_add_4 have_test_prog)
2332ifeq ($(HAVE_ATOMIC_FETCH_ADD_4),1)
2333	CONFIG_CFLAGS += -DHAVE_ATOMIC_FETCH_ADD_4
2334endif
2335$(call using,$(HAVE_ATOMIC_FETCH_ADD_4),__atomic_fetch_add_4)
2336endif
2337
2338ifndef $(HAVE_ATOMIC_FETCH_ADD_8)
2339HAVE_ATOMIC_FETCH_ADD_8 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_fetch_add_8 have_test_prog)
2340ifeq ($(HAVE_ATOMIC_FETCH_ADD_8),1)
2341	CONFIG_CFLAGS += -DHAVE_ATOMIC_FETCH_ADD_8
2342endif
2343$(call using,$(HAVE_ATOMIC_FETCH_ADD_8),__atomic_fetch_add_8)
2344endif
2345
2346ifndef $(HAVE_ATOMIC_FETCH_AND)
2347HAVE_ATOMIC_FETCH_AND = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_fetch_and have_test_prog)
2348ifeq ($(HAVE_ATOMIC_FETCH_AND),1)
2349	CONFIG_CFLAGS += -DHAVE_ATOMIC_FETCH_AND
2350endif
2351$(call using,$(HAVE_ATOMIC_FETCH_AND),__atomic_fetch_and)
2352endif
2353
2354ifndef $(HAVE_ATOMIC_FETCH_NAND)
2355HAVE_ATOMIC_FETCH_NAND = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_fetch_nand have_test_prog)
2356ifeq ($(HAVE_ATOMIC_FETCH_NAND),1)
2357	CONFIG_CFLAGS += -DHAVE_ATOMIC_FETCH_NAND
2358endif
2359$(call using,$(HAVE_ATOMIC_FETCH_NAND),__atomic_fetch_nand)
2360endif
2361
2362ifndef $(HAVE_ATOMIC_FETCH_OR)
2363HAVE_ATOMIC_FETCH_OR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_fetch_or have_test_prog)
2364ifeq ($(HAVE_ATOMIC_FETCH_OR),1)
2365	CONFIG_CFLAGS += -DHAVE_ATOMIC_FETCH_OR
2366endif
2367$(call using,$(HAVE_ATOMIC_FETCH_OR),__atomic_fetch_or)
2368endif
2369
2370ifndef $(HAVE_ATOMIC_FETCH_SUB)
2371HAVE_ATOMIC_FETCH_SUB = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_fetch_sub have_test_prog)
2372ifeq ($(HAVE_ATOMIC_FETCH_SUB),1)
2373	CONFIG_CFLAGS += -DHAVE_ATOMIC_FETCH_SUB
2374endif
2375$(call using,$(HAVE_ATOMIC_FETCH_SUB),__atomic_fetch_sub)
2376endif
2377
2378ifndef $(HAVE_ATOMIC_FETCH_XOR)
2379HAVE_ATOMIC_FETCH_XOR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_fetch_xor have_test_prog)
2380ifeq ($(HAVE_ATOMIC_FETCH_XOR),1)
2381	CONFIG_CFLAGS += -DHAVE_ATOMIC_FETCH_XOR
2382endif
2383$(call using,$(HAVE_ATOMIC_FETCH_XOR),__atomic_fetch_xor)
2384endif
2385
2386ifndef $(HAVE_ATOMIC_LOAD)
2387HAVE_ATOMIC_LOAD = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_load have_test_prog)
2388ifeq ($(HAVE_ATOMIC_LOAD),1)
2389	CONFIG_CFLAGS += -DHAVE_ATOMIC_LOAD
2390endif
2391$(call using,$(HAVE_ATOMIC_LOAD),__atomic_load)
2392endif
2393
2394ifndef $(HAVE_ATOMIC_LOAD_DOUBLE)
2395HAVE_ATOMIC_LOAD_DOUBLE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_load_double have_test_prog)
2396ifeq ($(HAVE_ATOMIC_LOAD_DOUBLE),1)
2397	CONFIG_CFLAGS += -DHAVE_ATOMIC_LOAD_DOUBLE
2398endif
2399$(call using,$(HAVE_ATOMIC_LOAD_DOUBLE),__atomic_load (double))
2400endif
2401
2402ifndef $(HAVE_ATOMIC_NAND_FETCH)
2403HAVE_ATOMIC_NAND_FETCH = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_nand_fetch have_test_prog)
2404ifeq ($(HAVE_ATOMIC_NAND_FETCH),1)
2405	CONFIG_CFLAGS += -DHAVE_ATOMIC_NAND_FETCH
2406endif
2407$(call using,$(HAVE_ATOMIC_NAND_FETCH),__atomic_nand_fetch)
2408endif
2409
2410ifndef $(HAVE_ATOMIC_OR_FETCH)
2411HAVE_ATOMIC_OR_FETCH = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_or_fetch have_test_prog)
2412ifeq ($(HAVE_ATOMIC_OR_FETCH),1)
2413	CONFIG_CFLAGS += -DHAVE_ATOMIC_OR_FETCH
2414endif
2415$(call using,$(HAVE_ATOMIC_OR_FETCH),__atomic_or_fetch)
2416endif
2417
2418ifndef $(HAVE_ATOMIC_STORE)
2419HAVE_ATOMIC_STORE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_store have_test_prog)
2420ifeq ($(HAVE_ATOMIC_STORE),1)
2421	CONFIG_CFLAGS += -DHAVE_ATOMIC_STORE
2422endif
2423$(call using,$(HAVE_ATOMIC_STORE),__atomic_store)
2424endif
2425
2426ifndef $(HAVE_ATOMIC_STORE_DOUBLE)
2427HAVE_ATOMIC_STORE_DOUBLE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_store_double have_test_prog)
2428ifeq ($(HAVE_ATOMIC_STORE_DOUBLE),1)
2429	CONFIG_CFLAGS += -DHAVE_ATOMIC_STORE_DOUBLE
2430endif
2431$(call using,$(HAVE_ATOMIC_STORE_DOUBLE),__atomic_store (double))
2432endif
2433
2434ifndef $(HAVE_ATOMIC_SUB_FETCH)
2435HAVE_ATOMIC_SUB_FETCH = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_sub_fetch have_test_prog)
2436ifeq ($(HAVE_ATOMIC_SUB_FETCH),1)
2437	CONFIG_CFLAGS += -DHAVE_ATOMIC_SUB_FETCH
2438endif
2439$(call using,$(HAVE_ATOMIC_SUB_FETCH),__atomic_sub_fetch)
2440endif
2441
2442ifndef $(HAVE_ATOMIC_XOR_FETCH)
2443HAVE_ATOMIC_XOR_FETCH = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-atomic_xor_fetch have_test_prog)
2444ifeq ($(HAVE_ATOMIC_XOR_FETCH),1)
2445	CONFIG_CFLAGS += -DHAVE_ATOMIC_XOR_FETCH
2446endif
2447$(call using,$(HAVE_ATOMIC_XOR_FETCH),__atomic_xor_fetch)
2448endif
2449
2450ifndef $(HAVE_ATOMIC)
2451HAVE_ATOMIC = $(shell $(MAKE) $(MAKE_OPTS) have_atomic)
2452ifeq ($(HAVE_ATOMIC),1)
2453	CONFIG_CFLAGS += -DHAVE_ATOMIC
2454	CONFIG_LDFLAGS += $(LIB_ATOMIC)
2455endif
2456$(call using,$(HAVE_ATOMIC),atomics with $(LIB_ATOMIC))
2457endif
2458
2459ifndef $(HAVE_BRK)
2460HAVE_BRK = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-brk have_test_prog)
2461ifeq ($(HAVE_BRK),1)
2462	CONFIG_CFLAGS += -DHAVE_BRK
2463endif
2464$(call using,$(HAVE_BRK),brk)
2465endif
2466
2467ifndef $(HAVE_BUILTIN___CLEAR_CACHE)
2468HAVE_BUILTIN___CLEAR_CACHE= $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-__clear_cache have_test_prog)
2469ifeq ($(HAVE_BUILTIN___CLEAR_CACHE),1)
2470	CONFIG_CFLAGS += -DHAVE_BUILTIN___CLEAR_CACHE
2471endif
2472$(call using,$(HAVE_BUILTIN___CLEAR_CACHE),__builtin___clear_cache)
2473endif
2474
2475ifndef $(HAVE_BUILTIN_CABSL)
2476MATHFUNC=__builtin_cabsl
2477export MATHFUNC
2478HAVE_BUILTIN_CABSL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_cabsl have_mathfunc)
2479ifeq ($(HAVE_BUILTIN_CABSL),1)
2480	CONFIG_CFLAGS += -DHAVE_BUILTIN_CABSL
2481endif
2482$(call using,$(HAVE_BUILTIN_CABSL),__builtin_cabsl)
2483endif
2484
2485ifndef $(HAVE_BUILTIN_CCOSL)
2486MATHFUNC=__builtin_ccosl
2487export MATHFUNC
2488HAVE_BUILTIN_CCOSL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_ccosl have_mathfunc)
2489ifeq ($(HAVE_BUILTIN_CCOSL),1)
2490	CONFIG_CFLAGS += -DHAVE_BUILTIN_CCOSL
2491endif
2492$(call using,$(HAVE_BUILTIN_CCOSL),__builtin_ccosl)
2493endif
2494
2495ifndef $(HAVE_BUILTIN_COS)
2496MATHFUNC=__builtin_cos
2497export MATHFUNC
2498HAVE_BUILTIN_COS = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_cos have_mathfunc)
2499ifeq ($(HAVE_BUILTIN_COS),1)
2500	CONFIG_CFLAGS += -DHAVE_BUILTIN_COS
2501endif
2502$(call using,$(HAVE_BUILTIN_COS),__builtin_cos)
2503endif
2504
2505ifndef $(HAVE_BUILTIN_COSF)
2506MATHFUNC=__builtin_cosf
2507export MATHFUNC
2508HAVE_BUILTIN_COSF = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_cosf have_mathfunc)
2509ifeq ($(HAVE_BUILTIN_COSF),1)
2510	CONFIG_CFLAGS += -DHAVE_BUILTIN_COSF
2511endif
2512$(call using,$(HAVE_BUILTIN_COSL),__builtin_cosf)
2513endif
2514
2515ifndef $(HAVE_BUILTIN_COSL)
2516MATHFUNC=__builtin_cosl
2517export MATHFUNC
2518HAVE_BUILTIN_COSL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_cosl have_mathfunc)
2519ifeq ($(HAVE_BUILTIN_COSL),1)
2520	CONFIG_CFLAGS += -DHAVE_BUILTIN_COSL
2521endif
2522$(call using,$(HAVE_BUILTIN_COSL),__builtin_cosl)
2523endif
2524
2525ifndef $(HAVE_BUILTIN_COSHL)
2526MATHFUNC=__builtin_coshl
2527export MATHFUNC
2528HAVE_BUILTIN_COSHL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_coshl have_mathfunc)
2529ifeq ($(HAVE_BUILTIN_COSHL),1)
2530	CONFIG_CFLAGS += -DHAVE_BUILTIN_COSHL
2531endif
2532$(call using,$(HAVE_BUILTIN_COSL),__builtin_coshl)
2533endif
2534
2535ifndef $(HAVE_BUILTIN_CPOW)
2536MATHFUNC=__builtin_cpow_
2537export MATHFUNC
2538HAVE_BUILTIN_CPOW = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_cpow have_mathfunc)
2539ifeq ($(HAVE_BUILTIN_CPOW),1)
2540	CONFIG_CFLAGS += -DHAVE_BUILTIN_CPOW
2541endif
2542$(call using,$(HAVE_BUILTIN_CPOW),__builtin_cpow)
2543endif
2544
2545ifndef $(HAVE_BUILTIN_CSINF)
2546MATHFUNC=__builtin_csinf
2547export MATHFUNC
2548HAVE_BUILTIN_CSINF = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_csinf have_mathfunc)
2549ifeq ($(HAVE_BUILTIN_CSINF),1)
2550	CONFIG_CFLAGS += -DHAVE_BUILTIN_CSINF
2551endif
2552$(call using,$(HAVE_BUILTIN_CSINF),__builtin_csinf)
2553endif
2554
2555ifndef $(HAVE_BUILTIN_CSINL)
2556MATHFUNC=__builtin_csinl
2557export MATHFUNC
2558HAVE_BUILTIN_CSINL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_csinl have_mathfunc)
2559ifeq ($(HAVE_BUILTIN_CSINL),1)
2560	CONFIG_CFLAGS += -DHAVE_BUILTIN_CSINL
2561endif
2562$(call using,$(HAVE_BUILTIN_CSINL),__builtin_csinl)
2563endif
2564
2565ifndef $(HAVE_BUILTIN_CTZ)
2566HAVE_BUILTIN_CTZ = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-ctz have_test_prog)
2567ifeq ($(HAVE_BUILTIN_CTZ),1)
2568	CONFIG_CFLAGS += -DHAVE_BUILTIN_CTZ
2569endif
2570$(call using,$(HAVE_BUILTIN_CTZ),__builtin_ctz)
2571endif
2572
2573ifndef $(HAVE_BUILTIN_CPU_IS_POWER9)
2574HAVE_BUILTIN_CPU_IS_POWER9 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-cpu-is-power9 have_test_prog)
2575ifeq ($(HAVE_BUILTIN_CPU_IS_POWER9),1)
2576	CONFIG_CFLAGS += -DHAVE_BUILTIN_CPU_IS_POWER9
2577endif
2578$(call using,$(HAVE_BUILTIN_CPU_IS_POWER9),__builtin_cpu_is("power9"))
2579endif
2580
2581ifndef $(HAVE_BUILTIN_EXP)
2582MATHFUNC=__builtin_exp
2583export MATHFUNC
2584HAVE_BUILTIN_EXP = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_exp have_mathfunc)
2585ifeq ($(HAVE_BUILTIN_EXP),1)
2586	CONFIG_CFLAGS += -DHAVE_BUILTIN_EXP
2587endif
2588$(call using,$(HAVE_BUILTIN_EXP),__builtin_exp)
2589endif
2590
2591ifndef $(HAVE_BUILTIN_EXPECT)
2592HAVE_BUILTIN_EXPECT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-expect have_test_prog)
2593ifeq ($(HAVE_BUILTIN_EXPECT),1)
2594	CONFIG_CFLAGS += -DHAVE_BUILTIN_EXPECT
2595endif
2596$(call using,$(HAVE_BUILTIN_EXPECT),__builtin_expect)
2597endif
2598
2599ifndef $(HAVE_BUILTIN_EXPL)
2600MATHFUNC=__builtin_expl
2601export MATHFUNC
2602HAVE_BUILTIN_EXPL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_expl have_mathfunc)
2603ifeq ($(HAVE_BUILTIN_EXPL),1)
2604	CONFIG_CFLAGS += -DHAVE_BUILTIN_EXPL
2605endif
2606$(call using,$(HAVE_BUILTIN_EXPL),__builtin_expl)
2607endif
2608
2609ifndef $(HAVE_BUILTIN_FABS)
2610HAVE_BUILTIN_FABS = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-fabs TEST_LIBS=$(LIB_MATH) have_test_prog)
2611ifeq ($(HAVE_BUILTIN_FABS),1)
2612	CONFIG_CFLAGS += -DHAVE_BUILTIN_FABS
2613endif
2614$(call using,$(HAVE_BUILTIN_FABS),__builtin_fabs)
2615endif
2616
2617ifndef $(HAVE_BUILTIN_FABSL)
2618HAVE_BUILTIN_FABSL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-fabsl TEST_LIBS=$(LIB_MATH) have_test_prog)
2619ifeq ($(HAVE_BUILTIN_FABSL),1)
2620	CONFIG_CFLAGS += -DHAVE_BUILTIN_FABSL
2621endif
2622$(call using,$(HAVE_BUILTIN_FABSL),__builtin_fabsl)
2623endif
2624
2625ifndef $(HAVE_BUILTIN_IA32_MOVNTDQ)
2626HAVE_BUILTIN_IA32_MOVNTDQ = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-ia32_movntdq have_test_prog)
2627ifeq ($(HAVE_BUILTIN_IA32_MOVNTDQ),1)
2628	CONFIG_CFLAGS += -DHAVE_BUILTIN_IA32_MOVNTDQ
2629endif
2630$(call using,$(HAVE_BUILTIN_IA32_MOVNTDQ),__builtin_ia32_movntdq)
2631endif
2632
2633ifndef $(HAVE_BUILTIN_IA32_MOVNTI)
2634HAVE_BUILTIN_IA32_MOVNTI = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-ia32_movnti have_test_prog)
2635ifeq ($(HAVE_BUILTIN_IA32_MOVNTI),1)
2636	CONFIG_CFLAGS += -DHAVE_BUILTIN_IA32_MOVNTI
2637endif
2638$(call using,$(HAVE_BUILTIN_IA32_MOVNTI),__builtin_ia32_movnti)
2639endif
2640
2641ifndef $(HAVE_BUILTIN_IA32_MOVNTI64)
2642HAVE_BUILTIN_IA32_MOVNTI64 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-ia32_movnti64 have_test_prog)
2643ifeq ($(HAVE_BUILTIN_IA32_MOVNTI64),1)
2644	CONFIG_CFLAGS += -DHAVE_BUILTIN_IA32_MOVNTI64
2645endif
2646$(call using,$(HAVE_BUILTIN_IA32_MOVNTI64),__builtin_ia32_movnti64)
2647endif
2648
2649ifndef $(HAVE_BUILTIN_LGAMMAL)
2650MATHFUNC=__builtin_cabsl
2651export MATHFUNC
2652HAVE_BUILTIN_LGAMMAL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_lgammal have_mathfunc)
2653ifeq ($(HAVE_BUILTIN_LGAMMAL),1)
2654	CONFIG_CFLAGS += -DHAVE_BUILTIN_LGAMMAL
2655endif
2656$(call using,$(HAVE_BUILTIN_LGAMMAL),__builtin_lgammal)
2657endif
2658
2659ifndef $(HAVE_BUILTIN_LOG)
2660MATHFUNC=__builtin_log
2661export MATHFUNC
2662HAVE_BUILTIN_LOG = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_log have_mathfunc)
2663ifeq ($(HAVE_BUILTIN_LOG),1)
2664	CONFIG_CFLAGS += -DHAVE_BUILTIN_LOG
2665endif
2666$(call using,$(HAVE_BUILTIN_LOG),__builtin_log)
2667endif
2668
2669ifndef $(HAVE_BUILTIN_LOGL)
2670MATHFUNC=__builtin_logl
2671export MATHFUNC
2672HAVE_BUILTIN_LOGL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_log have_mathfunc)
2673ifeq ($(HAVE_BUILTIN_LOGL),1)
2674	CONFIG_CFLAGS += -DHAVE_BUILTIN_LOGL
2675endif
2676$(call using,$(HAVE_BUILTIN_LOGL),__builtin_logl)
2677endif
2678
2679ifndef $(HAVE_BUILTIN_MEMCPY)
2680HAVE_BUILTIN_MEMCPY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-memcpy have_test_prog)
2681ifeq ($(HAVE_BUILTIN_MEMCPY),1)
2682	CONFIG_CFLAGS += -DHAVE_BUILTIN_MEMCPY
2683endif
2684$(call using,$(HAVE_BUILTIN_MEMCPY),__builtin_memcpy)
2685endif
2686
2687ifndef $(HAVE_BUILTIN_MEMMOVE)
2688HAVE_BUILTIN_MEMMOVE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-memmove have_test_prog)
2689ifeq ($(HAVE_BUILTIN_MEMMOVE),1)
2690	CONFIG_CFLAGS += -DHAVE_BUILTIN_MEMMOVE
2691endif
2692$(call using,$(HAVE_BUILTIN_MEMMOVE),__builtin_memmove)
2693endif
2694
2695ifndef $(HAVE_BUILTIN_NONTEMPORAL_STORE)
2696HAVE_BUILTIN_NONTEMPORAL_STORE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-nontemporal-store have_test_prog)
2697ifeq ($(HAVE_BUILTIN_NONTEMPORAL_STORE),1)
2698	CONFIG_CFLAGS += -DHAVE_BUILTIN_NONTEMPORAL_STORE
2699endif
2700$(call using,$(HAVE_BUILTIN_NONTEMPORAL_STORE),__builtin_nontemporal_store)
2701endif
2702
2703ifndef $(HAVE_BUILTIN_PARITY)
2704HAVE_BUILTIN_PARITY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-parity have_test_prog)
2705ifeq ($(HAVE_BUILTIN_PARITY),1)
2706	CONFIG_CFLAGS += -DHAVE_BUILTIN_PARITY
2707endif
2708$(call using,$(HAVE_BUILTIN_PARITY),__builtin_parity)
2709endif
2710
2711ifndef $(HAVE_BUILTIN_POW)
2712MATHFUNC=__builtin_pow_
2713export MATHFUNC
2714HAVE_BUILTIN_POW = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_pow have_mathfunc)
2715ifeq ($(HAVE_BUILTIN_POW),1)
2716	CONFIG_CFLAGS += -DHAVE_BUILTIN_POW
2717endif
2718$(call using,$(HAVE_BUILTIN_POW),__builtin_pow)
2719endif
2720
2721ifndef $(HAVE_BUILTIN_PREFETCH)
2722HAVE_BUILTIN_PREFETCH = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-prefetch have_test_prog)
2723ifeq ($(HAVE_BUILTIN_PREFETCH),1)
2724	CONFIG_CFLAGS += -DHAVE_BUILTIN_PREFETCH
2725endif
2726$(call using,$(HAVE_BUILTIN_PREFETCH),__builtin_prefetch)
2727endif
2728
2729ifndef $(HAVE_BUILTIN_RINT)
2730HAVE_BUILTIN_RINT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-rint TEST_LIBS=$(LIB_MATH) have_test_prog)
2731ifeq ($(HAVE_BUILTIN_RINT),1)
2732	CONFIG_CFLAGS += -DHAVE_BUILTIN_RINT
2733endif
2734$(call using,$(HAVE_BUILTIN_RINT),__builtin_rint)
2735endif
2736
2737ifndef $(HAVE_BUILTIN_RINTL)
2738HAVE_BUILTIN_RINTL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-rintl TEST_LIBS=$(LIB_MATH) have_test_prog)
2739ifeq ($(HAVE_BUILTIN_RINTL),1)
2740	CONFIG_CFLAGS += -DHAVE_BUILTIN_RINTL
2741endif
2742$(call using,$(HAVE_BUILTIN_RINTL),__builtin_rintl)
2743endif
2744
2745ifndef $(HAVE_BUILTIN_SFENCE)
2746HAVE_BUILTIN_SFENCE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-sfence have_test_prog)
2747ifeq ($(HAVE_BUILTIN_SFENCE),1)
2748	CONFIG_CFLAGS += -DHAVE_BUILTIN_SFENCE
2749endif
2750$(call using,$(HAVE_BUILTIN_SFENCE),__builtin_ia32_sfence)
2751endif
2752
2753ifndef $(HAVE_BUILTIN_SIN)
2754MATHFUNC=__builtin_sin
2755export MATHFUNC
2756HAVE_BUILTIN_SIN = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_sin have_mathfunc)
2757ifeq ($(HAVE_BUILTIN_SIN),1)
2758	CONFIG_CFLAGS += -DHAVE_BUILTIN_SIN
2759endif
2760$(call using,$(HAVE_BUILTIN_SIN),__builtin_sin)
2761endif
2762
2763ifndef $(HAVE_BUILTIN_SINHL)
2764MATHFUNC=__builtin_sinhl
2765export MATHFUNC
2766HAVE_BUILTIN_SINHL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_sinhl have_mathfunc)
2767ifeq ($(HAVE_BUILTIN_SINHL),1)
2768	CONFIG_CFLAGS += -DHAVE_BUILTIN_SINHL
2769endif
2770$(call using,$(HAVE_BUILTIN_SINHL),__builtin_sinhl)
2771endif
2772
2773ifndef $(HAVE_BUILTIN_SINF)
2774MATHFUNC=__builtin_sinf
2775export MATHFUNC
2776HAVE_BUILTIN_SINF = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_sinf have_mathfunc)
2777ifeq ($(HAVE_BUILTIN_SINF),1)
2778	CONFIG_CFLAGS += -DHAVE_BUILTIN_SINF
2779endif
2780$(call using,$(HAVE_BUILTIN_SINL),__builtin_sinf)
2781endif
2782
2783ifndef $(HAVE_BUILTIN_SINL)
2784MATHFUNC=__builtin_sinl
2785export MATHFUNC
2786HAVE_BUILTIN_SINL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=__builtin_sinl have_mathfunc)
2787ifeq ($(HAVE_BUILTIN_SINL),1)
2788	CONFIG_CFLAGS += -DHAVE_BUILTIN_SINL
2789endif
2790$(call using,$(HAVE_BUILTIN_SINL),__builtin_sinl)
2791endif
2792
2793ifndef $(HAVE_BUILTIN_SQRT)
2794MATHFUNC=__builtin_sqrt
2795export MATHFUNC
2796HAVE_BUILTIN_SQRT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-sqrt TEST_LIBS=$(LIB_MATH) have_test_prog)
2797ifeq ($(HAVE_BUILTIN_SQRT),1)
2798	CONFIG_CFLAGS += -DHAVE_BUILTIN_SQRT
2799endif
2800$(call using,$(HAVE_BUILTIN_SQRT),__builtin_sqrt)
2801endif
2802
2803ifndef $(HAVE_BUILTIN_SQRTL)
2804MATHFUNC=__builtin_sqrtl
2805export MATHFUNC
2806HAVE_BUILTIN_SQRTL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-sqrtl TEST_LIBS=$(LIB_MATH) have_test_prog)
2807ifeq ($(HAVE_BUILTIN_SQRTL),1)
2808	CONFIG_CFLAGS += -DHAVE_BUILTIN_SQRTL
2809endif
2810$(call using,$(HAVE_BUILTIN_SQRTL),__builtin_sqrtl)
2811endif
2812
2813ifndef $(HAVE_BUILTIN_SUPPORTS)
2814HAVE_BUILTIN_SUPPORTS = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-builtin-supports have_test_prog)
2815ifeq ($(HAVE_BUILTIN_SUPPORTS),1)
2816	CONFIG_CFLAGS += -DHAVE_BUILTIN_SUPPORTS
2817endif
2818$(call using,$(HAVE_BUILTIN_SUPPORTS),__builtin_supports)
2819endif
2820
2821ifndef $(HAVE_CABSL)
2822MATHFUNC=cabsl
2823export MATHFUNC
2824HAVE_CABSL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=cabsl have_mathfunc)
2825ifeq ($(HAVE_CABSL),1)
2826	CONFIG_CFLAGS += -DHAVE_CABSL
2827endif
2828$(call using,$(HAVE_CABSL),cabsl)
2829endif
2830
2831ifndef $(HAVE_CCOSF)
2832MATHFUNC=ccosf
2833export MATHFUNC
2834HAVE_CCOSF = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=ccosf have_mathfunc)
2835ifeq ($(HAVE_CCOSF),1)
2836	CONFIG_CFLAGS += -DHAVE_CCOSF
2837endif
2838$(call using,$(HAVE_CCOSF),ccosf)
2839endif
2840
2841ifndef $(HAVE_CCOSL)
2842MATHFUNC=ccosl
2843export MATHFUNC
2844HAVE_CCOSL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=ccosl have_mathfunc)
2845ifeq ($(HAVE_CCOSL),1)
2846	CONFIG_CFLAGS += -DHAVE_CCOSL
2847endif
2848$(call using,$(HAVE_CCOSL),ccosl)
2849endif
2850
2851ifndef $(HAVE_CHROOT)
2852HAVE_CHROOT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-chroot have_test_prog)
2853ifeq ($(HAVE_CHROOT),1)
2854	CONFIG_CFLAGS += -DHAVE_CHROOT
2855endif
2856$(call using,$(HAVE_CHROOT),chroot)
2857endif
2858
2859ifndef $(HAVE_CIMAG)
2860MATHFUNC=cimag
2861export MATHFUNC
2862HAVE_CIMAG = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=cimag have_mathfunc)
2863ifeq ($(HAVE_CIMAG),1)
2864	CONFIG_CFLAGS += -DHAVE_CIMAG
2865endif
2866$(call using,$(HAVE_CIMAG),cimag)
2867endif
2868
2869ifndef $(HAVE_CRYPT_R)
2870HAVE_CRYPT_R = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-crypt-r TEST_LIBS='$(CONFIG_LDFLAGS)' have_test_prog)
2871ifeq ($(HAVE_CRYPT_R),1)
2872	CONFIG_CFLAGS += -DHAVE_CRYPT_R
2873endif
2874$(call using,$(HAVE_CRYPT_R),crypt_r)
2875endif
2876
2877ifndef $(HAVE_CLEARENV)
2878HAVE_CLEARENV = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-clearenv have_test_prog)
2879ifeq ($(HAVE_CLEARENV),1)
2880	CONFIG_CFLAGS += -DHAVE_CLEARENV
2881endif
2882$(call using,$(HAVE_CLEARENV),clearenv)
2883endif
2884
2885ifndef $(HAVE_CLOCK_GETRES)
2886HAVE_CLOCK_GETRES = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-clock-getres have_test_prog)
2887ifeq ($(HAVE_CLOCK_GETRES),1)
2888	CONFIG_CFLAGS += -DHAVE_CLOCK_GETRES
2889endif
2890$(call using,$(HAVE_CLOCK_GETRES),clock_getres)
2891endif
2892
2893ifndef $(HAVE_CLOCK_GETTIME)
2894HAVE_CLOCK_GETTIME = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-clock-gettime have_test_prog)
2895ifeq ($(HAVE_CLOCK_GETTIME),1)
2896	CONFIG_CFLAGS += -DHAVE_CLOCK_GETTIME
2897endif
2898$(call using,$(HAVE_CLOCK_GETTIME),clock_gettime)
2899endif
2900
2901ifndef $(HAVE_CLOCK_NANOSLEEP)
2902HAVE_CLOCK_NANOSLEEP = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-clock-nanosleep have_test_prog)
2903ifeq ($(HAVE_CLOCK_NANOSLEEP),1)
2904	CONFIG_CFLAGS += -DHAVE_CLOCK_NANOSLEEP
2905endif
2906$(call using,$(HAVE_CLOCK_NANOSLEEP),clock_nanosleep)
2907endif
2908
2909ifndef $(HAVE_CLOCK_SETTIME)
2910HAVE_CLOCK_SETTIME = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-clock-settime have_test_prog)
2911ifeq ($(HAVE_CLOCK_SETTIME),1)
2912	CONFIG_CFLAGS += -DHAVE_CLOCK_SETTIME
2913endif
2914$(call using,$(HAVE_CLOCK_SETTIME),clock_settime)
2915endif
2916
2917ifndef $(HAVE_CLONE)
2918HAVE_CLONE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-clone have_test_prog)
2919ifeq ($(HAVE_CLONE),1)
2920	CONFIG_CFLAGS += -DHAVE_CLONE
2921endif
2922$(call using,$(HAVE_CLONE),clone)
2923endif
2924
2925ifndef $(HAVE_COPY_FILE_RANGE)
2926HAVE_COPY_FILE_RANGE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-copy-file-range have_test_prog)
2927ifeq ($(HAVE_COPY_FILE_RANGE),1)
2928	CONFIG_CFLAGS += -DHAVE_COPY_FILE_RANGE
2929endif
2930$(call using,$(HAVE_COPY_FILE_RANGE),copy_file_range)
2931endif
2932
2933ifndef $(HAVE_COSHL)
2934MATHFUNC=coshl
2935export MATHFUNC
2936HAVE_COSHL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=coshl have_mathfunc)
2937ifeq ($(HAVE_COSHL),1)
2938	CONFIG_CFLAGS += -DHAVE_COSHL
2939endif
2940$(call using,$(HAVE_COSHL),coshl)
2941endif
2942
2943ifndef $(HAVE_COSL)
2944MATHFUNC=cosl
2945export MATHFUNC
2946HAVE_COSL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=cosl have_mathfunc)
2947ifeq ($(HAVE_COSL),1)
2948	CONFIG_CFLAGS += -DHAVE_COSL
2949endif
2950$(call using,$(HAVE_COSL),cosl)
2951endif
2952
2953ifndef $(HAVE_CPOW)
2954MATHFUNC=cpow
2955export MATHFUNC
2956HAVE_CPOW = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=cpow have_mathfunc)
2957ifeq ($(HAVE_CPOW),1)
2958	CONFIG_CFLAGS += -DHAVE_CPOW
2959endif
2960$(call using,$(HAVE_CPOW),cpow)
2961endif
2962
2963ifndef $(HAVE_CREAL)
2964MATHFUNC=creal
2965export MATHFUNC
2966HAVE_CREAL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=creal have_mathfunc)
2967ifeq ($(HAVE_CREAL),1)
2968	CONFIG_CFLAGS += -DHAVE_CREAL
2969endif
2970$(call using,$(HAVE_CREAL),creal)
2971endif
2972
2973ifndef $(HAVE_CSINL)
2974MATHFUNC=csinl
2975export MATHFUNC
2976HAVE_CSINL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=csinl have_mathfunc)
2977ifeq ($(HAVE_CSINL),1)
2978	CONFIG_CFLAGS += -DHAVE_CSINL
2979endif
2980$(call using,$(HAVE_CSINL),csinl)
2981endif
2982
2983ifndef $(HAVE_DUP3)
2984HAVE_DUP3 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-dup3 have_test_prog)
2985ifeq ($(HAVE_DUP3),1)
2986	CONFIG_CFLAGS += -DHAVE_DUP3
2987endif
2988$(call using,$(HAVE_DUP3),dup3)
2989endif
2990
2991ifndef $(HAVE_ENDPWENT)
2992HAVE_ENDPWENT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-endpwent have_test_prog)
2993ifeq ($(HAVE_ENDPWENT),1)
2994	CONFIG_CFLAGS += -DHAVE_ENDPWENT
2995endif
2996$(call using,$(HAVE_ENDPWENT),endpwent)
2997endif
2998
2999ifndef $(HAVE_EPOLL_CREATE)
3000HAVE_EPOLL_CREATE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-epoll-create have_test_prog)
3001ifeq ($(HAVE_EPOLL_CREATE),1)
3002	CONFIG_CFLAGS += -DHAVE_EPOLL_CREATE
3003endif
3004$(call using,$(HAVE_EPOLL_CREATE),epoll_create)
3005endif
3006
3007ifndef $(HAVE_EPOLL_CREATE1)
3008HAVE_EPOLL_CREATE1 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-epoll-create1 have_test_prog)
3009ifeq ($(HAVE_EPOLL_CREATE1),1)
3010	CONFIG_CFLAGS += -DHAVE_EPOLL_CREATE1
3011endif
3012$(call using,$(HAVE_EPOLL_CREATE1),epoll_create1)
3013endif
3014
3015ifndef $(HAVE_EVENTFD)
3016HAVE_EVENTFD = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-eventfd have_test_prog)
3017ifeq ($(HAVE_EVENTFD),1)
3018	CONFIG_CFLAGS += -DHAVE_EVENTFD
3019endif
3020$(call using,$(HAVE_EVENTFD),eventfd)
3021endif
3022
3023ifndef $(HAVE_EXECVEAT)
3024HAVE_EXECVEAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-execveat have_test_prog)
3025ifeq ($(HAVE_EXECVEAT),1)
3026	CONFIG_CFLAGS += -DHAVE_EXECVEAT
3027endif
3028$(call using,$(HAVE_EXECVEAT),execveat)
3029endif
3030
3031ifndef $(HAVE_EXPL)
3032MATHFUNC=expl
3033export MATHFUNC
3034HAVE_EXPL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=expl have_mathfunc)
3035ifeq ($(HAVE_EXPL),1)
3036	CONFIG_CFLAGS += -DHAVE_EXPL
3037endif
3038$(call using,$(HAVE_EXPL),expl)
3039endif
3040
3041ifndef $(HAVE_EXECUTABLE_START)
3042HAVE_EXECUTABLE_START= $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-executable_start have_test_prog)
3043ifeq ($(HAVE_EXECUTABLE_START),1)
3044	CONFIG_CFLAGS += -DHAVE_EXECUTABLE_START
3045endif
3046$(call using,$(HAVE_EXECUTABLE_START),__executable_start)
3047endif
3048
3049ifndef $(HAVE_FACCESSAT)
3050HAVE_FACCESSAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-faccessat have_test_prog)
3051ifeq ($(HAVE_FACCESSAT),1)
3052	CONFIG_CFLAGS += -DHAVE_FACCESSAT
3053endif
3054$(call using,$(HAVE_FACCESSAT),faccessat)
3055endif
3056
3057ifndef $(HAVE_FACCESSAT2)
3058HAVE_FACCESSAT2 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-faccessat2 have_test_prog)
3059ifeq ($(HAVE_FACCESSAT2),1)
3060	CONFIG_CFLAGS += -DHAVE_FACCESSAT2
3061endif
3062$(call using,$(HAVE_FACCESSAT2),faccessat2)
3063endif
3064
3065ifndef $(HAVE_FALLOCATE)
3066HAVE_FALLOCATE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-fallocate have_test_prog)
3067ifeq ($(HAVE_FALLOCATE),1)
3068	CONFIG_CFLAGS += -DHAVE_FALLOCATE
3069endif
3070$(call using,$(HAVE_FALLOCATE),fallocate)
3071endif
3072
3073ifndef $(HAVE_FANOTIFY)
3074HAVE_FANOTIFY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-fanotify have_test_prog)
3075ifeq ($(HAVE_FANOTIFY),1)
3076	CONFIG_CFLAGS += -DHAVE_FANOTIFY
3077endif
3078$(call using,$(HAVE_FANOTIFY),fanotify)
3079endif
3080
3081ifndef $(HAVE_FCHMODAT)
3082HAVE_FCHMODAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-fchmodat have_test_prog)
3083ifeq ($(HAVE_FCHMODAT),1)
3084	CONFIG_CFLAGS += -DHAVE_FCHMODAT
3085endif
3086$(call using,$(HAVE_FCHMODAT),fchmodat)
3087endif
3088
3089ifndef $(HAVE_FCHOWNAT)
3090HAVE_FCHOWNAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-fchownat have_test_prog)
3091ifeq ($(HAVE_FCHOWNAT),1)
3092	CONFIG_CFLAGS += -DHAVE_FCHOWNAT
3093endif
3094$(call using,$(HAVE_FCHOWNAT),fchownat)
3095endif
3096
3097ifndef $(HAVE_FDATASYNC)
3098HAVE_FDATASYNC = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-fdatasync have_test_prog)
3099ifeq ($(HAVE_FDATASYNC),1)
3100	CONFIG_CFLAGS += -DHAVE_FDATASYNC
3101endif
3102$(call using,$(HAVE_FDATASYNC),fdatasync)
3103endif
3104
3105ifndef $(HAVE_FGETXATTR)
3106HAVE_FGETXATTR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-fgetxattr have_test_prog)
3107ifeq ($(HAVE_FGETXATTR),1)
3108	CONFIG_CFLAGS += -DHAVE_FGETXATTR
3109endif
3110$(call using,$(HAVE_FGETXATTR),fgetxattr)
3111endif
3112
3113ifndef $(HAVE_FLISTXATTR)
3114HAVE_FLISTXATTR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-flistxattr have_test_prog)
3115ifeq ($(HAVE_FLISTXATTR),1)
3116	CONFIG_CFLAGS += -DHAVE_FLISTXATTR
3117endif
3118$(call using,$(HAVE_FLISTXATTR),flistxattr)
3119endif
3120
3121ifndef $(HAVE_FLOCK)
3122HAVE_FLOCK = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-flock have_test_prog)
3123ifeq ($(HAVE_FLOCK),1)
3124	CONFIG_CFLAGS += -DHAVE_FLOCK
3125endif
3126$(call using,$(HAVE_FLOCK),flock)
3127endif
3128
3129ifndef $(HAVE_FREMOVEXATTR)
3130HAVE_FREMOVEXATTR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-fremovexattr have_test_prog)
3131ifeq ($(HAVE_FREMOVEXATTR),1)
3132	CONFIG_CFLAGS += -DHAVE_FREMOVEXATTR
3133endif
3134$(call using,$(HAVE_FREMOVEXATTR),fremovexattr)
3135endif
3136
3137ifndef $(HAVE_FSETXATTR)
3138HAVE_FSETXATTR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-fsetxattr have_test_prog)
3139ifeq ($(HAVE_FSETXATTR),1)
3140	CONFIG_CFLAGS += -DHAVE_FSETXATTR
3141endif
3142$(call using,$(HAVE_FSETXATTR),fsetxattr)
3143endif
3144
3145ifndef $(HAVE_FSYNC)
3146HAVE_FSYNC = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-fsync have_test_prog)
3147ifeq ($(HAVE_FSYNC),1)
3148	CONFIG_CFLAGS += -DHAVE_FSYNC
3149endif
3150$(call using,$(HAVE_FSYNC),fsync)
3151endif
3152
3153ifndef $(HAVE_FUTIMENS)
3154HAVE_FUTIMENS = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-futimens have_test_prog)
3155ifeq ($(HAVE_FUTIMENS),1)
3156	CONFIG_CFLAGS += -DHAVE_FUTIMENS
3157endif
3158$(call using,$(HAVE_FUTIMENS),futimens)
3159endif
3160
3161ifndef $(HAVE_FUTIMES)
3162HAVE_FUTIMES = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-futimes have_test_prog)
3163ifeq ($(HAVE_FUTIMES),1)
3164	CONFIG_CFLAGS += -DHAVE_FUTIMES
3165endif
3166$(call using,$(HAVE_FUTIMES),futimes)
3167endif
3168
3169ifndef $(HAVE_FUTIMESAT)
3170HAVE_FUTIMESAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-futimesat have_test_prog)
3171ifeq ($(HAVE_FUTIMESAT),1)
3172	CONFIG_CFLAGS += -DHAVE_FUTIMESAT
3173endif
3174$(call using,$(HAVE_FUTIMESAT),futimesat)
3175endif
3176
3177ifndef $(HAVE_GETAUXVAL)
3178HAVE_GETAUXVAL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getauxval have_test_prog)
3179ifeq ($(HAVE_GETAUXVAL),1)
3180	CONFIG_CFLAGS += -DHAVE_GETAUXVAL
3181endif
3182$(call using,$(HAVE_GETAUXVAL),getauxval)
3183endif
3184
3185ifndef $(HAVE_GETDOMAINNAME)
3186HAVE_GETDOMAINNAME = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getdomainname have_test_prog)
3187ifeq ($(HAVE_GETDOMAINNAME),1)
3188	CONFIG_CFLAGS += -DHAVE_GETDOMAINNAME
3189endif
3190$(call using,$(HAVE_GETDOMAINNAME),getdomainname)
3191endif
3192
3193ifndef $(HAVE_GETDTABLESIZE)
3194HAVE_GETDTABLESIZE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getdtablesize have_test_prog)
3195ifeq ($(HAVE_GETDTABLESIZE),1)
3196	CONFIG_CFLAGS += -DHAVE_GETDTABLESIZE
3197endif
3198$(call using,$(HAVE_GETDTABLESIZE),getdtablesize)
3199endif
3200
3201ifndef $(HAVE_GETHOSTNAME)
3202HAVE_GETHOSTNAME = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-gethostname have_test_prog)
3203ifeq ($(HAVE_GETHOSTNAME),1)
3204	CONFIG_CFLAGS += -DHAVE_GETHOSTNAME
3205endif
3206$(call using,$(HAVE_GETHOSTNAME),gethostname)
3207endif
3208
3209ifndef $(HAVE_GETHOSTID)
3210HAVE_GETHOSTID = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-gethostid have_test_prog)
3211ifeq ($(HAVE_GETHOSTID),1)
3212	CONFIG_CFLAGS += -DHAVE_GETHOSTID
3213endif
3214$(call using,$(HAVE_GETHOSTID),gethostid)
3215endif
3216
3217ifndef $(HAVE_GETLOADAVG)
3218HAVE_GETLOADAVG = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getloadavg have_test_prog)
3219ifeq ($(HAVE_GETLOADAVG),1)
3220	CONFIG_CFLAGS += -DHAVE_GETLOADAVG
3221endif
3222$(call using,$(HAVE_GETLOADAVG),getloadavg)
3223endif
3224
3225ifndef $(HAVE_GETMNTENT)
3226HAVE_GETMNTENT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getmntent have_test_prog)
3227ifeq ($(HAVE_GETMNTENT),1)
3228	CONFIG_CFLAGS += -DHAVE_GETMNTENT
3229endif
3230$(call using,$(HAVE_GETMNTENT),getmntent)
3231endif
3232
3233ifndef $(HAVE_GETMNTINFO)
3234HAVE_GETMNTINFO = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getmntinfo have_test_prog)
3235ifeq ($(HAVE_GETMNTINFO),1)
3236	CONFIG_CFLAGS += -DHAVE_GETMNTINFO
3237endif
3238$(call using,$(HAVE_GETMNTINFO),getmntinfo)
3239endif
3240
3241ifndef $(HAVE_GETPAGESIZE)
3242HAVE_GETPAGESIZE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getpagesize have_test_prog)
3243ifeq ($(HAVE_GETPAGESIZE),1)
3244	CONFIG_CFLAGS += -DHAVE_GETPAGESIZE
3245endif
3246$(call using,$(HAVE_GETPAGESIZE),getpagesize)
3247endif
3248
3249ifndef $(HAVE_GETPGID)
3250HAVE_GETPGID = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getpgid have_test_prog)
3251ifeq ($(HAVE_GETPGID),1)
3252	CONFIG_CFLAGS += -DHAVE_GETPGID
3253endif
3254$(call using,$(HAVE_GETPGID),getpgid)
3255endif
3256
3257ifndef $(HAVE_GETPGRP)
3258HAVE_GETPGRP = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getpgrp have_test_prog)
3259ifeq ($(HAVE_GETPGRP),1)
3260	CONFIG_CFLAGS += -DHAVE_GETPGRP
3261endif
3262$(call using,$(HAVE_GETPGRP),getpgrp)
3263endif
3264
3265ifndef $(HAVE_GETPRIORITY)
3266HAVE_GETPRIORITY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getpriority have_test_prog)
3267ifeq ($(HAVE_GETPRIORITY),1)
3268	CONFIG_CFLAGS += -DHAVE_GETPRIORITY
3269endif
3270$(call using,$(HAVE_GETPRIORITY),getpriority)
3271endif
3272
3273ifndef $(HAVE_GETPWENT)
3274HAVE_GETPWENT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getpwent have_test_prog)
3275ifeq ($(HAVE_GETPWENT),1)
3276	CONFIG_CFLAGS += -DHAVE_GETPWENT
3277endif
3278$(call using,$(HAVE_GETPWENT),getpwent)
3279endif
3280
3281ifndef $(HAVE_GETRESGID)
3282HAVE_GETRESGID = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getresgid have_test_prog)
3283ifeq ($(HAVE_GETRESGID),1)
3284	CONFIG_CFLAGS += -DHAVE_GETRESGID
3285endif
3286$(call using,$(HAVE_GETRESGID),getresgid)
3287endif
3288
3289ifndef $(HAVE_GETRESUID)
3290HAVE_GETRESUID = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getresuid have_test_prog)
3291ifeq ($(HAVE_GETRESUID),1)
3292	CONFIG_CFLAGS += -DHAVE_GETRESUID
3293endif
3294$(call using,$(HAVE_GETRESUID),getresuid)
3295endif
3296
3297ifndef $(HAVE_GETRUSAGE)
3298HAVE_GETRUSAGE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getrusage have_test_prog)
3299ifeq ($(HAVE_GETRUSAGE),1)
3300	CONFIG_CFLAGS += -DHAVE_GETRUSAGE
3301endif
3302$(call using,$(HAVE_GETRUSAGE),getrusage)
3303endif
3304
3305ifndef $(HAVE_GETSID)
3306HAVE_GETSID = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getsid have_test_prog)
3307ifeq ($(HAVE_GETSID),1)
3308	CONFIG_CFLAGS += -DHAVE_GETSID
3309endif
3310$(call using,$(HAVE_GETSID),getsid)
3311endif
3312
3313ifndef $(HAVE_GETXATTR)
3314HAVE_GETXATTR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-getxattr have_test_prog)
3315ifeq ($(HAVE_GETXATTR),1)
3316	CONFIG_CFLAGS += -DHAVE_GETXATTR
3317endif
3318$(call using,$(HAVE_GETXATTR),getxattr)
3319endif
3320
3321ifndef $(HAVE_INOTIFY)
3322HAVE_INOTIFY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-inotify have_test_prog)
3323ifeq ($(HAVE_INOTIFY),1)
3324	CONFIG_CFLAGS += -DHAVE_INOTIFY
3325endif
3326$(call using,$(HAVE_INOTIFY),inotify)
3327endif
3328
3329ifndef $(HAVE_INOTIFY1)
3330HAVE_INOTIFY1 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-inotify1 have_test_prog)
3331ifeq ($(HAVE_INOTIFY1),1)
3332	CONFIG_CFLAGS += -DHAVE_INOTIFY1
3333endif
3334$(call using,$(HAVE_INOTIFY1),inotify1)
3335endif
3336
3337ifndef $(HAVE_IOPORT)
3338HAVE_IOPORT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-ioport have_test_prog)
3339ifeq ($(HAVE_IOPORT),1)
3340	CONFIG_CFLAGS += -DHAVE_IOPORT
3341endif
3342$(call using,$(HAVE_IOPORT),ioport)
3343endif
3344
3345ifndef $(HAVE_IOPL)
3346HAVE_IOPL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-iopl have_test_prog)
3347ifeq ($(HAVE_IOPL),1)
3348	CONFIG_CFLAGS += -DHAVE_IOPL
3349endif
3350$(call using,$(HAVE_IOPL),iopl)
3351endif
3352
3353ifndef $(HAVE_LGAMMAL)
3354MATHFUNC=lgammal
3355export MATHFUNC
3356HAVE_LGAMMAL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=lgammal have_mathfunc)
3357ifeq ($(HAVE_LGAMMAL),1)
3358	CONFIG_CFLAGS += -DHAVE_LGAMMAL
3359endif
3360$(call using,$(HAVE_LGAMMAL),lgammal)
3361endif
3362
3363ifndef $(HAVE_LGETXATTR)
3364HAVE_LGETXATTR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-lgetxattr have_test_prog)
3365ifeq ($(HAVE_LGETXATTR),1)
3366	CONFIG_CFLAGS += -DHAVE_LGETXATTR
3367endif
3368$(call using,$(HAVE_LGETXATTR),lgetxattr)
3369endif
3370
3371ifndef $(HAVE_LINKAT)
3372HAVE_LINKAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-linkat have_test_prog)
3373ifeq ($(HAVE_LINKAT),1)
3374	CONFIG_CFLAGS += -DHAVE_LINKAT
3375endif
3376$(call using,$(HAVE_LINKAT),linkat)
3377endif
3378
3379ifndef $(HAVE_LISTXATTR)
3380HAVE_LISTXATTR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-listxattr have_test_prog)
3381ifeq ($(HAVE_LISTXATTR),1)
3382	CONFIG_CFLAGS += -DHAVE_LISTXATTR
3383endif
3384$(call using,$(HAVE_LISTXATTR),listxattr)
3385endif
3386
3387ifndef $(HAVE_LLISTXATTR)
3388HAVE_LLISTXATTR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-llistxattr have_test_prog)
3389ifeq ($(HAVE_LLISTXATTR),1)
3390	CONFIG_CFLAGS += -DHAVE_LLISTXATTR
3391endif
3392$(call using,$(HAVE_LLISTXATTR),llistxattr)
3393endif
3394
3395ifndef $(HAVE_LREMOVEXATTR)
3396HAVE_LREMOVEXATTR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-lremovexattr have_test_prog)
3397ifeq ($(HAVE_LREMOVEXATTR),1)
3398	CONFIG_CFLAGS += -DHAVE_LREMOVEXATTR
3399endif
3400$(call using,$(HAVE_LREMOVEXATTR),lremovexattr)
3401endif
3402
3403ifndef $(HAVE_LOCKF)
3404HAVE_LOCKF = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-lockf have_test_prog)
3405ifeq ($(HAVE_LOCKF),1)
3406	CONFIG_CFLAGS += -DHAVE_LOCKF
3407endif
3408$(call using,$(HAVE_LOCKF),lockf)
3409endif
3410
3411ifndef $(HAVE_LOGL)
3412MATHFUNC=logl
3413export MATHFUNC
3414HAVE_LOGL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=logl have_mathfunc)
3415ifeq ($(HAVE_LOGL),1)
3416	CONFIG_CFLAGS += -DHAVE_LOGL
3417endif
3418$(call using,$(HAVE_LOGL),logl)
3419endif
3420
3421ifndef $(HAVE_LOOKUP_DCOOKIE)
3422HAVE_LOOKUP_DCOOKIE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-lookup-dcookie have_test_prog)
3423ifeq ($(HAVE_LOOKUP_DCOOKIE),1)
3424	CONFIG_CFLAGS += -DHAVE_LOOKUP_DCOOKIE
3425endif
3426$(call using,$(HAVE_LOOKUP_DCOOKIE),lookup_dcookie)
3427endif
3428
3429ifndef $(HAVE_LSETXATTR)
3430HAVE_LSETXATTR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-lsetxattr have_test_prog)
3431ifeq ($(HAVE_LSETXATTR),1)
3432	CONFIG_CFLAGS += -DHAVE_LSETXATTR
3433endif
3434$(call using,$(HAVE_LSETXATTR),lsetxattr)
3435endif
3436
3437ifndef $(HAVE_MADVISE)
3438HAVE_MADVISE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-madvise have_test_prog)
3439ifeq ($(HAVE_MADVISE),1)
3440	CONFIG_CFLAGS += -DHAVE_MADVISE
3441endif
3442$(call using,$(HAVE_MADVISE),madvise)
3443endif
3444
3445ifndef $(HAVE_MALLOPT)
3446HAVE_MALLOPT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-mallopt have_test_prog)
3447ifeq ($(HAVE_MALLOPT),1)
3448	CONFIG_CFLAGS += -DHAVE_MALLOPT
3449endif
3450$(call using,$(HAVE_MALLOPT),mallopt)
3451endif
3452
3453ifndef $(HAVE_MEMFD_CREATE)
3454HAVE_MEMFD_CREATE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-memfd-create have_test_prog)
3455ifeq ($(HAVE_MEMFD_CREATE),1)
3456	CONFIG_CFLAGS += -DHAVE_MEMFD_CREATE
3457$(call using,$(HAVE_MEMFD_CREATE),memfd_create)
3458endif
3459endif
3460
3461ifndef $(HAVE_MINCORE)
3462HAVE_MINCORE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-mincore have_test_prog)
3463ifeq ($(HAVE_MINCORE),1)
3464	CONFIG_CFLAGS += -DHAVE_MINCORE
3465endif
3466$(call using,$(HAVE_MINCORE),mincore)
3467endif
3468
3469ifndef $(HAVE_MKDIRAT)
3470HAVE_MKDIRAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-mkdirat have_test_prog)
3471ifeq ($(HAVE_MKDIRAT),1)
3472	CONFIG_CFLAGS += -DHAVE_MKDIRAT
3473endif
3474$(call using,$(HAVE_MKDIRAT),mkdirat)
3475endif
3476
3477ifndef $(HAVE_MKNODAT)
3478HAVE_MKNODAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-mknodat have_test_prog)
3479ifeq ($(HAVE_MKNODAT),1)
3480	CONFIG_CFLAGS += -DHAVE_MKNODAT
3481endif
3482$(call using,$(HAVE_MKNODAT),mknodat)
3483endif
3484
3485ifndef $(HAVE_MLOCK)
3486HAVE_MLOCK = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-mlock have_test_prog)
3487ifeq ($(HAVE_MLOCK),1)
3488	CONFIG_CFLAGS += -DHAVE_MLOCK
3489endif
3490$(call using,$(HAVE_MLOCK),mlock)
3491endif
3492
3493ifndef $(HAVE_MLOCK2)
3494HAVE_MLOCK2 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-mlock2 have_test_prog)
3495ifeq ($(HAVE_MLOCK2),1)
3496	CONFIG_CFLAGS += -DHAVE_MLOCK2
3497endif
3498$(call using,$(HAVE_MLOCK2),mlock2)
3499endif
3500
3501ifndef $(HAVE_MLOCKALL)
3502HAVE_MLOCKALL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-mlockall have_test_prog)
3503ifeq ($(HAVE_MLOCKALL),1)
3504	CONFIG_CFLAGS += -DHAVE_MLOCKALL
3505endif
3506$(call using,$(HAVE_MLOCKALL),mlockall)
3507endif
3508
3509ifndef $(HAVE_MODIFY_LDT)
3510HAVE_MODIFY_LDT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-modify-ldt have_test_prog)
3511ifeq ($(HAVE_MODIFY_LDT),1)
3512	CONFIG_CFLAGS += -DHAVE_MODIFY_LDT
3513endif
3514$(call using,$(HAVE_MODIFY_LDT),modify_ldt)
3515endif
3516
3517ifndef $(HAVE_MPROTECT)
3518HAVE_MPROTECT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-mprotect have_test_prog)
3519ifeq ($(HAVE_MPROTECT),1)
3520	CONFIG_CFLAGS += -DHAVE_MPROTECT
3521endif
3522$(call using,$(HAVE_MPROTECT),mprotect)
3523endif
3524
3525ifndef $(HAVE_MQUERY)
3526HAVE_MQUERY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-mquery have_test_prog)
3527ifeq ($(HAVE_MQUERY),1)
3528	CONFIG_CFLAGS += -DHAVE_MQUERY
3529endif
3530$(call using,$(HAVE_MQUERY),mquery)
3531endif
3532
3533ifndef $(HAVE_MREMAP)
3534HAVE_MREMAP = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-mremap have_test_prog)
3535ifeq ($(HAVE_MREMAP),1)
3536	CONFIG_CFLAGS += -DHAVE_MREMAP
3537endif
3538$(call using,$(HAVE_MREMAP),mremap)
3539endif
3540
3541ifndef $(HAVE_MSYNC)
3542HAVE_MSYNC = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-msync have_test_prog)
3543ifeq ($(HAVE_MSYNC),1)
3544	CONFIG_CFLAGS += -DHAVE_MSYNC
3545endif
3546$(call using,$(HAVE_MSYNC),msync)
3547endif
3548
3549ifndef $(HAVE_MUNLOCK)
3550HAVE_MUNLOCK = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-munlock have_test_prog)
3551ifeq ($(HAVE_MUNLOCK),1)
3552	CONFIG_CFLAGS += -DHAVE_MUNLOCK
3553endif
3554$(call using,$(HAVE_MUNLOCK),munlock)
3555endif
3556
3557ifndef $(HAVE_MUNLOCKALL)
3558HAVE_MUNLOCKALL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-munlockall have_test_prog)
3559ifeq ($(HAVE_MUNLOCKALL),1)
3560	CONFIG_CFLAGS += -DHAVE_MUNLOCKALL
3561endif
3562$(call using,$(HAVE_MUNLOCKALL),munlockall)
3563endif
3564
3565
3566ifndef $(HAVE_NAME_TO_HANDLE_AT)
3567HAVE_NAME_TO_HANDLE_AT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-name-to-handle-at have_test_prog)
3568ifeq ($(HAVE_NAME_TO_HANDLE_AT),1)
3569	CONFIG_CFLAGS += -DHAVE_NAME_TO_HANDLE_AT
3570endif
3571$(call using,$(HAVE_NAME_TO_HANDLE_AT),name_to_handle_at)
3572endif
3573
3574ifndef $(HAVE_NANOSLEEP)
3575HAVE_NANOSLEEP = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-nanosleep have_test_prog)
3576ifeq ($(HAVE_NANOSLEEP),1)
3577	CONFIG_CFLAGS += -DHAVE_NANOSLEEP
3578endif
3579$(call using,$(HAVE_NANOSLEEP),nanosleep)
3580endif
3581
3582ifndef $(HAVE_NICE)
3583HAVE_NICE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-nice have_test_prog)
3584ifeq ($(HAVE_NICE),1)
3585	CONFIG_CFLAGS += -DHAVE_NICE
3586endif
3587$(call using,$(HAVE_NICE),nice)
3588endif
3589
3590ifndef $(HAVE_OPENAT)
3591HAVE_OPENAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-openat have_test_prog)
3592ifeq ($(HAVE_OPENAT),1)
3593	CONFIG_CFLAGS += -DHAVE_OPENAT
3594endif
3595$(call using,$(HAVE_OPENAT),openat)
3596endif
3597
3598ifndef $(HAVE_OPENAT2)
3599HAVE_OPENAT2 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-openat2 have_test_prog)
3600ifeq ($(HAVE_OPENAT2),1)
3601	CONFIG_CFLAGS += -DHAVE_OPENAT2
3602endif
3603$(call using,$(HAVE_OPENAT2),openat2)
3604endif
3605
3606ifndef $(HAVE_OPEN_BY_HANDLE_AT)
3607HAVE_OPEN_BY_HANDLE_AT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-open-by-handle-at have_test_prog)
3608ifeq ($(HAVE_OPEN_BY_HANDLE_AT),1)
3609	CONFIG_CFLAGS += -DHAVE_OPEN_BY_HANDLE_AT
3610endif
3611$(call using,$(HAVE_OPEN_BY_HANDLE_AT),open_by_handle_at)
3612endif
3613
3614ifndef $(HAVE_PIDFD_GETFD)
3615HAVE_PIDFD_GETFD = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-pidfd-getfd have_test_prog)
3616ifeq ($(HAVE_PIDFD_GETFD),1)
3617	CONFIG_CFLAGS += -DHAVE_PIDFD_GETFD
3618endif
3619$(call using,$(HAVE_PIDFD_GETFD),pidfd_getfd)
3620endif
3621
3622ifndef $(HAVE_PIDFD_OPEN)
3623HAVE_PIDFD_OPEN = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-pidfd-open have_test_prog)
3624ifeq ($(HAVE_PIDFD_OPEN),1)
3625	CONFIG_CFLAGS += -DHAVE_PIDFD_OPEN
3626endif
3627$(call using,$(HAVE_PIDFD_OPEN),pidfd_open)
3628endif
3629
3630ifndef $(HAVE_PIDFD_SEND_SIGNAL)
3631HAVE_PIDFD_SEND_SIGNAL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-pidfd-send-signal have_test_prog)
3632ifeq ($(HAVE_PIDFD_SEND_SIGNAL),1)
3633	CONFIG_CFLAGS += -DHAVE_PIDFD_SEND_SIGNAL
3634endif
3635$(call using,$(HAVE_PIDFD_SEND_SIGNAL),pidfd_send_signal)
3636endif
3637
3638ifndef $(HAVE_PERSONALITY)
3639HAVE_PERSONALITY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-personality have_test_prog)
3640ifeq ($(HAVE_PERSONALITY),1)
3641	CONFIG_CFLAGS += -DHAVE_PERSONALITY
3642endif
3643$(call using,$(HAVE_PERSONALITY),personality)
3644endif
3645
3646ifndef $(HAVE_PIPE2)
3647HAVE_PIPE2 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-pipe2 have_test_prog)
3648ifeq ($(HAVE_PIPE2),1)
3649	CONFIG_CFLAGS += -DHAVE_PIPE2
3650endif
3651$(call using,$(HAVE_PIPE2),pipe2)
3652endif
3653
3654ifndef $(HAVE_PKEY_ALLOC)
3655HAVE_PKEY_ALLOC = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-pkey-alloc have_test_prog)
3656ifeq ($(HAVE_PKEY_ALLOC),1)
3657	CONFIG_CFLAGS += -DHAVE_PKEY_ALLOC
3658endif
3659$(call using,$(HAVE_PKEY_ALLOC),pkey_alloc)
3660endif
3661
3662ifndef $(HAVE_PKEY_FREE)
3663HAVE_PKEY_FREE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-pkey-free have_test_prog)
3664ifeq ($(HAVE_PKEY_FREE),1)
3665	CONFIG_CFLAGS += -DHAVE_PKEY_FREE
3666endif
3667$(call using,$(HAVE_PKEY_FREE),pkey_free)
3668endif
3669
3670ifndef $(HAVE_PKEY_GET)
3671HAVE_PKEY_GET = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-pkey-get have_test_prog)
3672ifeq ($(HAVE_PKEY_GET),1)
3673	CONFIG_CFLAGS += -DHAVE_PKEY_GET
3674endif
3675$(call using,$(HAVE_PKEY_GET),pkey_get)
3676endif
3677
3678ifndef $(HAVE_PKEY_SET)
3679HAVE_PKEY_SET = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-pkey-set have_test_prog)
3680ifeq ($(HAVE_PKEY_SET),1)
3681	CONFIG_CFLAGS += -DHAVE_PKEY_SET
3682endif
3683$(call using,$(HAVE_PKEY_SET),pkey_set)
3684endif
3685
3686ifndef $(HAVE_PKEY_MPROTECT)
3687HAVE_PKEY_MPROTECT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-pkey-mprotect have_test_prog)
3688ifeq ($(HAVE_PKEY_MPROTECT),1)
3689	CONFIG_CFLAGS += -DHAVE_PKEY_MPROTECT
3690endif
3691$(call using,$(HAVE_PKEY_MPROTECT),pkey_mprotect)
3692endif
3693
3694ifndef $(HAVE_POSIX_FADVISE)
3695HAVE_POSIX_FADVISE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-posix-fadvise have_test_prog)
3696ifeq ($(HAVE_POSIX_FADVISE),1)
3697	CONFIG_CFLAGS += -DHAVE_POSIX_FADVISE
3698endif
3699$(call using,$(HAVE_POSIX_FADVISE),posix_fadvise)
3700endif
3701
3702ifndef $(HAVE_POSIX_FALLOCATE)
3703HAVE_POSIX_FALLOCATE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-posix-fallocate have_test_prog)
3704ifeq ($(HAVE_POSIX_FALLOCATE),1)
3705	CONFIG_CFLAGS += -DHAVE_POSIX_FALLOCATE
3706endif
3707$(call using,$(HAVE_POSIX_FALLOCATE),posix_fallocate)
3708endif
3709
3710ifndef $(HAVE_POSIX_MADVISE)
3711HAVE_POSIX_MADVISE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-posix-madvise have_test_prog)
3712ifeq ($(HAVE_POSIX_MADVISE),1)
3713	CONFIG_CFLAGS += -DHAVE_POSIX_MADVISE
3714endif
3715$(call using,$(HAVE_POSIX_MADVISE),posix_madvise)
3716endif
3717
3718ifndef $(HAVE_POSIX_MEMALIGN)
3719HAVE_POSIX_MEMALIGN = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-posix-memalign have_test_prog)
3720ifeq ($(HAVE_POSIX_MEMALIGN),1)
3721	CONFIG_CFLAGS += -DHAVE_POSIX_MEMALIGN
3722endif
3723$(call using,$(HAVE_POSIX_MEMALIGN),posix_memalign)
3724endif
3725
3726ifndef $(HAVE_MQ_POSIX)
3727HAVE_MQ_POSIX = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-mq-posix TEST_LIBS='$(CONFIG_LDFLAGS)' have_test_prog)
3728ifeq ($(HAVE_MQ_POSIX),1)
3729	CONFIG_CFLAGS += -DHAVE_MQ_POSIX
3730endif
3731$(call using,$(HAVE_MQ_POSIX),POSIX message queues)
3732endif
3733
3734ifndef $(HAVE_PPC_GET_TIMEBASE)
3735HAVE_PPC_GET_TIMEBASE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-ppc-get-timebase TEST_LIBS='$(CONFIG_LDFLAGS)' have_test_prog)
3736ifeq ($(HAVE_PPC_GET_TIMEBASE),1)
3737	CONFIG_CFLAGS += -DHAVE_PPC_GET_TIMEBASE
3738endif
3739$(call using,$(HAVE_PPC_GET_TIMEBASE),__ppc_get_timebase (powerpc))
3740endif
3741
3742ifndef $(HAVE_POSIX_OPENPT)
3743HAVE_POSIX_OPENPT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-posix-openpt have_test_prog)
3744ifeq ($(HAVE_POSIX_OPENPT),1)
3745	CONFIG_CFLAGS += -DHAVE_POSIX_OPENPT
3746endif
3747$(call using,$(HAVE_POSIX_OPENPT),posix_openpt)
3748endif
3749
3750ifndef $(HAVE_QUOTACTL_FD)
3751HAVE_QUOTACTL_FD = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-quotactl-fd have_test_prog)
3752ifeq ($(HAVE_QUOTACTL_FD),1)
3753	CONFIG_CFLAGS += -DHAVE_QUOTACTL_FD
3754endif
3755$(call using,$(HAVE_QUOTACTL_FD),quotactl_fd)
3756endif
3757
3758ifndef $(HAVE_SEM_POSIX)
3759HAVE_SEM_POSIX = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sem-posix TEST_LIBS='$(CONFIG_LDFLAGS)' have_test_prog)
3760ifeq ($(HAVE_SEM_POSIX),1)
3761	CONFIG_CFLAGS += -DHAVE_SEM_POSIX
3762endif
3763$(call using,$(HAVE_SEM_POSIX),POSIX semaphores)
3764endif
3765
3766ifndef $(HAVE_POSIX_SPAWN)
3767HAVE_POSIX_SPAWN = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-posix-spawn have_test_prog)
3768ifeq ($(HAVE_POSIX_SPAWN),1)
3769	CONFIG_CFLAGS += -DHAVE_POSIX_SPAWN
3770endif
3771$(call using,$(HAVE_POSIX_SPAWN),posix_spawn)
3772endif
3773
3774ifndef $(HAVE_POWL)
3775MATHFUNC=powl
3776export MATHFUNC
3777HAVE_POWL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=powl have_mathfunc)
3778ifeq ($(HAVE_POWL),1)
3779	CONFIG_CFLAGS += -DHAVE_POWL
3780endif
3781$(call using,$(HAVE_POWL),powl)
3782endif
3783
3784ifndef $(HAVE_PPOLL)
3785HAVE_PPOLL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-ppoll have_test_prog)
3786ifeq ($(HAVE_PPOLL),1)
3787	CONFIG_CFLAGS += -DHAVE_PPOLL
3788endif
3789$(call using,$(HAVE_PPOLL),ppoll)
3790endif
3791
3792ifndef $(HAVE_PRCTL)
3793HAVE_PRCTL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-prctl have_test_prog)
3794ifeq ($(HAVE_PRCTL),1)
3795	CONFIG_CFLAGS += -DHAVE_PRCTL
3796endif
3797$(call using,$(HAVE_PRCTL),prctl)
3798endif
3799
3800ifndef $(HAVE_PREADV)
3801HAVE_PREADV = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-preadv have_test_prog)
3802ifeq ($(HAVE_PREADV),1)
3803	CONFIG_CFLAGS += -DHAVE_PREADV
3804endif
3805$(call using,$(HAVE_PREADV),preadv)
3806endif
3807
3808ifndef $(HAVE_PREADV2)
3809HAVE_PREADV2 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-preadv2 have_test_prog)
3810ifeq ($(HAVE_PREADV2),1)
3811	CONFIG_CFLAGS += -DHAVE_PREADV2
3812endif
3813$(call using,$(HAVE_PREADV2),preadv2)
3814endif
3815
3816ifndef $(HAVE_PRLIMIT)
3817HAVE_PRLIMIT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-prlimit have_test_prog)
3818ifeq ($(HAVE_PRLIMIT),1)
3819	CONFIG_CFLAGS += -DHAVE_PRLIMIT
3820endif
3821$(call using,$(HAVE_PRLIMIT),prlimit)
3822endif
3823
3824ifndef $(HAVE_PROCESS_VM_READV)
3825HAVE_PROCESS_VM_READV = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-process-vm-readv have_test_prog)
3826ifeq ($(HAVE_PROCESS_VM_READV),1)
3827	CONFIG_CFLAGS += -DHAVE_PROCESS_VM_READV
3828endif
3829$(call using,$(HAVE_PROCESS_VM_READV),process_vm_readv)
3830endif
3831
3832ifndef $(HAVE_PROCESS_VM_WRITEV)
3833HAVE_PROCESS_VM_WRITEV = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-process-vm-writev have_test_prog)
3834ifeq ($(HAVE_PROCESS_VM_WRITEV),1)
3835	CONFIG_CFLAGS += -DHAVE_PROCESS_VM_WRITEV
3836endif
3837$(call using,$(HAVE_PROCESS_VM_WRITEV),process_vm_writev)
3838endif
3839
3840ifndef $(HAVE_PSELECT)
3841HAVE_PSELECT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-pselect have_test_prog)
3842ifeq ($(HAVE_PSELECT),1)
3843	CONFIG_CFLAGS += -DHAVE_PSELECT
3844endif
3845$(call using,$(HAVE_PSELECT),pselect)
3846endif
3847
3848ifndef $(HAVE_PTHREAD_ATTR_SETSTACK)
3849HAVE_PTHREAD_ATTR_SETSTACK = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-pthread-attr-setstack have_test_prog)
3850ifeq ($(HAVE_PTHREAD_ATTR_SETSTACK),1)
3851	CONFIG_CFLAGS += -DHAVE_PTHREAD_ATTR_SETSTACK
3852endif
3853$(call using,$(HAVE_PTHREAD_ATTR_SETSTACK),pthread_attr_setstack)
3854endif
3855
3856ifndef $(HAVE_PTHREAD_MUTEXATTR_DESTROY)
3857HAVE_PTHREAD_MUTEXATTR_DESTROY = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-pthread-mutexattr-destroy have_test_prog)
3858ifeq ($(HAVE_PTHREAD_MUTEXATTR_DESTROY),1)
3859	CONFIG_CFLAGS += -DHAVE_PTHREAD_MUTEXATTR_DESTROY
3860endif
3861$(call using,$(HAVE_PTHREAD_MUTEXATTR_DESTROY),pthread_mutexattr_destroy)
3862endif
3863
3864ifndef $(HAVE_PTHREAD_MUTEXATTR_INIT)
3865HAVE_PTHREAD_MUTEXATTR_INIT = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-pthread-mutexattr-init have_test_prog)
3866ifeq ($(HAVE_PTHREAD_MUTEXATTR_INIT),1)
3867	CONFIG_CFLAGS += -DHAVE_PTHREAD_MUTEXATTR_INIT
3868endif
3869$(call using,$(HAVE_PTHREAD_MUTEXATTR_INIT),pthread_mutexattr_init)
3870endif
3871
3872ifndef $(HAVE_PTHREAD_MUTEXATTR_SETPRIOCEILING)
3873HAVE_PTHREAD_MUTEXATTR_SETPRIOCEILING = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-pthread-mutexattr-setprioceiling have_test_prog)
3874ifeq ($(HAVE_PTHREAD_MUTEXATTR_SETPRIOCEILING),1)
3875	CONFIG_CFLAGS += -DHAVE_PTHREAD_MUTEXATTR_SETPRIOCEILING
3876endif
3877$(call using,$(HAVE_PTHREAD_MUTEXATTR_SETPRIOCEILING),pthread_mutexattr_setprioceiling)
3878endif
3879
3880ifndef $(HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL)
3881HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-pthread-mutexattr-setprotocol have_test_prog)
3882ifeq ($(HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL),1)
3883	CONFIG_CFLAGS += -DHAVE_PTHREAD_MUTEXATTR_SETPROTOCOL
3884endif
3885$(call using,$(HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL),pthread_mutexattr_setprotocol)
3886endif
3887
3888ifndef $(HAVE_PTHREAD_SIGQUEUE)
3889HAVE_PTHREAD_SIGQUEUE = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-pthread_sigqueue have_test_prog)
3890ifeq ($(HAVE_PTHREAD_SIGQUEUE),1)
3891	CONFIG_CFLAGS += -DHAVE_PTHREAD_SIGQUEUE
3892endif
3893$(call using,$(HAVE_PTHREAD_SIGQUEUE),pthread_sigqueue)
3894endif
3895
3896ifndef $(HAVE_PTRACE)
3897HAVE_PTRACE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-ptrace have_test_prog)
3898ifeq ($(HAVE_PTRACE),1)
3899	CONFIG_CFLAGS += -DHAVE_PTRACE
3900endif
3901$(call using,$(HAVE_PTRACE),ptrace)
3902endif
3903
3904ifndef $(HAVE_PTSNAME)
3905HAVE_PTSNAME = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-ptsname have_test_prog)
3906ifeq ($(HAVE_PTSNAME),1)
3907	CONFIG_CFLAGS += -DHAVE_PTSNAME
3908endif
3909$(call using,$(HAVE_PTSNAME),ptsname)
3910endif
3911
3912ifndef $(HAVE_PWRITEV)
3913HAVE_PWRITEV = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-pwritev have_test_prog)
3914ifeq ($(HAVE_PWRITEV),1)
3915	CONFIG_CFLAGS += -DHAVE_PWRITEV
3916endif
3917$(call using,$(HAVE_PWRITEV),pwritev)
3918endif
3919
3920ifndef $(HAVE_PWRITEV2)
3921HAVE_PWRITEV2 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-pwritev2 have_test_prog)
3922ifeq ($(HAVE_PWRITEV2),1)
3923	CONFIG_CFLAGS += -DHAVE_PWRITEV2
3924endif
3925$(call using,$(HAVE_PWRITEV2),pwritev2)
3926endif
3927
3928ifndef $(HAVE_READLINKAT)
3929HAVE_READLINKAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-readlinkat have_test_prog)
3930ifeq ($(HAVE_READLINKAT),1)
3931	CONFIG_CFLAGS += -DHAVE_READLINKAT
3932endif
3933$(call using,$(HAVE_READLINKAT),readlinkat)
3934endif
3935
3936ifndef $(HAVE_RECVMMSG)
3937HAVE_RECVMMSG = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-recvmmsg have_test_prog)
3938ifeq ($(HAVE_RECVMMSG),1)
3939	CONFIG_CFLAGS += -DHAVE_RECVMMSG
3940$(call using,$(HAVE_RECVMMSG),recvmmsg)
3941endif
3942endif
3943
3944ifndef $(HAVE_REMAP_FILE_PAGES)
3945HAVE_REMAP_FILE_PAGES = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-remap-file-pages have_test_prog)
3946ifeq ($(HAVE_REMAP_FILE_PAGES),1)
3947	CONFIG_CFLAGS += -DHAVE_REMAP_FILE_PAGES
3948endif
3949$(call using,$(HAVE_REMAP_FILE_PAGES),remap_file_pages)
3950endif
3951
3952ifndef $(HAVE_REMOVEXATTR)
3953HAVE_REMOVEXATTR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-removexattr have_test_prog)
3954ifeq ($(HAVE_REMOVEXATTR),1)
3955	CONFIG_CFLAGS += -DHAVE_REMOVEXATTR
3956endif
3957$(call using,$(HAVE_REMOVEXATTR),removexattr)
3958endif
3959
3960ifndef $(HAVE_RENAMEAT)
3961HAVE_RENAMEAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-renameat have_test_prog)
3962ifeq ($(HAVE_RENAMEAT),1)
3963	CONFIG_CFLAGS += -DHAVE_RENAMEAT
3964endif
3965$(call using,$(HAVE_RENAMEAT),renameat)
3966endif
3967
3968ifndef $(HAVE_RENAMEAT2)
3969HAVE_RENAMEAT2 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-renameat2 have_test_prog)
3970ifeq ($(HAVE_RENAMEAT2),1)
3971	CONFIG_CFLAGS += -DHAVE_RENAMEAT2
3972endif
3973$(call using,$(HAVE_RENAMEAT2),renameat2)
3974endif
3975
3976ifndef $(HAVE_RINTL)
3977MATHFUNC=rintl
3978export MATHFUNC
3979HAVE_RINTL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=rintl have_mathfunc)
3980ifeq ($(HAVE_RINTL),1)
3981	CONFIG_CFLAGS += -DHAVE_RINTL
3982endif
3983$(call using,$(HAVE_RINTL),rintl)
3984endif
3985
3986ifndef $(HAVE_SBRK)
3987HAVE_SBRK = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sbrk have_test_prog)
3988ifeq ($(HAVE_SBRK),1)
3989	CONFIG_CFLAGS += -DHAVE_SBRK
3990endif
3991$(call using,$(HAVE_SBRK),sbrk)
3992endif
3993
3994ifndef $(HAVE_SCHED_GET_PRIORITY_MAX)
3995HAVE_SCHED_GET_PRIORITY_MAX = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sched-get-priority-max have_test_prog)
3996ifeq ($(HAVE_SCHED_GET_PRIORITY_MAX),1)
3997	CONFIG_CFLAGS += -DHAVE_SCHED_GET_PRIORITY_MAX
3998endif
3999$(call using,$(HAVE_SCHED_GET_PRIORITY_MAX),sched_get_priority_max)
4000endif
4001
4002ifndef $(HAVE_SCHED_GET_PRIORITY_MIN)
4003HAVE_SCHED_GET_PRIORITY_MIN = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sched-get-priority-min have_test_prog)
4004ifeq ($(HAVE_SCHED_GET_PRIORITY_MIN),1)
4005	CONFIG_CFLAGS += -DHAVE_SCHED_GET_PRIORITY_MIN
4006endif
4007$(call using,$(HAVE_SCHED_GET_PRIORITY_MIN),sched_get_priority_min)
4008endif
4009
4010ifndef $(HAVE_SCHED_GETAFFINITY)
4011HAVE_SCHED_GETAFFINITY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sched-getaffinity have_test_prog)
4012ifeq ($(HAVE_SCHED_GETAFFINITY),1)
4013	CONFIG_CFLAGS += -DHAVE_SCHED_GETAFFINITY
4014endif
4015$(call using,$(HAVE_SCHED_GETAFFINITY),sched_getaffinity)
4016endif
4017
4018ifndef $(HAVE_SCHED_GETCPU)
4019HAVE_SCHED_GETCPU = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sched-getcpu have_test_prog)
4020ifeq ($(HAVE_SCHED_GETCPU),1)
4021	CONFIG_CFLAGS += -DHAVE_SCHED_GETCPU
4022endif
4023$(call using,$(HAVE_SCHED_GETAFFINITY),sched_getcpu)
4024endif
4025
4026ifndef $(HAVE_SCHED_RR_GET_INTERVAL)
4027HAVE_SCHED_RR_GET_INTERVAL = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sched-rr-get-interval have_test_prog)
4028ifeq ($(HAVE_SCHED_RR_GET_INTERVAL),1)
4029	CONFIG_CFLAGS += -DHAVE_SCHED_RR_GET_INTERVAL
4030endif
4031$(call using,$(HAVE_SCHED_RR_GET_INTERVAL),sched_rr_get_interval)
4032endif
4033
4034ifndef $(HAVE_SCHED_SETSCHEDULER)
4035HAVE_SCHED_SETSCHEDULER = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sched-setscheduler have_test_prog)
4036ifeq ($(HAVE_SCHED_SETSCHEDULER),1)
4037	CONFIG_CFLAGS += -DHAVE_SCHED_SETSCHEDULER
4038endif
4039$(call using,$(HAVE_SCHED_SETSCHEDULER),sched_setscheduler)
4040endif
4041
4042ifndef $(HAVE_SCHED_YIELD)
4043HAVE_SCHED_YIELD = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sched-yield have_test_prog)
4044ifeq ($(HAVE_SCHED_YIELD),1)
4045	CONFIG_CFLAGS += -DHAVE_SCHED_YIELD
4046endif
4047$(call using,$(HAVE_SCHED_YIELD),sched_yield)
4048endif
4049
4050ifndef $(HAVE_SENDMMSG)
4051HAVE_SENDMMSG = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sendmmsg have_test_prog)
4052ifeq ($(HAVE_SENDMMSG),1)
4053	CONFIG_CFLAGS += -DHAVE_SENDMMSG
4054endif
4055$(call using,$(HAVE_SENDMMSG),sendmmsg)
4056endif
4057
4058ifndef $(HAVE_SETDOMAINNAME)
4059HAVE_SETDOMAINNAME = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-setdomainname have_test_prog)
4060ifeq ($(HAVE_SETDOMAINNAME),1)
4061	CONFIG_CFLAGS += -DHAVE_SETDOMAINNAME
4062endif
4063$(call using,$(HAVE_SETDOMAINNAME),setdomainname)
4064endif
4065
4066ifndef $(HAVE_SETFSGID)
4067HAVE_SETFSGID = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-setfsgid have_test_prog)
4068ifeq ($(HAVE_SETFSGID),1)
4069	CONFIG_CFLAGS += -DHAVE_SETFSGID
4070endif
4071$(call using,$(HAVE_SETDOMAINNAME),setfsgid)
4072endif
4073
4074ifndef $(HAVE_SETFSUID)
4075HAVE_SETFSUID = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-setfsuid have_test_prog)
4076ifeq ($(HAVE_SETFSUID),1)
4077	CONFIG_CFLAGS += -DHAVE_SETFSUID
4078endif
4079$(call using,$(HAVE_SETFSUID),setfsuid)
4080endif
4081
4082ifndef $(HAVE_SETNS)
4083HAVE_SETNS = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-setns have_test_prog)
4084ifeq ($(HAVE_SETNS),1)
4085	CONFIG_CFLAGS += -DHAVE_SETNS
4086endif
4087$(call using,$(HAVE_SETNS),setns)
4088endif
4089
4090ifndef $(HAVE_SETPROCTITLE)
4091HAVE_SETPROCTITLE = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-setproctitle have_test_prog)
4092ifeq ($(HAVE_SETPROCTITLE),1)
4093	CONFIG_CFLAGS += -DHAVE_SETPROCTITLE
4094endif
4095$(call using,$(HAVE_SETPROCTITLE),setproctitle)
4096endif
4097
4098ifndef $(HAVE_SETPGID)
4099HAVE_SETPGID = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-setpgid have_test_prog)
4100ifeq ($(HAVE_SETPGID),1)
4101	CONFIG_CFLAGS += -DHAVE_SETPGID
4102endif
4103$(call using,$(HAVE_SETPGID),setpgid)
4104endif
4105
4106ifndef $(HAVE_SETPGRP)
4107HAVE_SETPGRP = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-setpgrp have_test_prog)
4108ifeq ($(HAVE_SETPGRP),1)
4109	CONFIG_CFLAGS += -DHAVE_SETPGRP
4110endif
4111$(call using,$(HAVE_SETPGRP),setpgrp)
4112endif
4113
4114ifndef $(HAVE_SETPRIORITY)
4115HAVE_SETPRIORITY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-setpriority have_test_prog)
4116ifeq ($(HAVE_SETPRIORITY),1)
4117	CONFIG_CFLAGS += -DHAVE_SETPRIORITY
4118endif
4119$(call using,$(HAVE_SETPRIORITY),setpriority)
4120endif
4121
4122ifndef $(HAVE_SETPWENT)
4123HAVE_SETPWENT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-setpwent have_test_prog)
4124ifeq ($(HAVE_SETPWENT),1)
4125	CONFIG_CFLAGS += -DHAVE_SETPWENT
4126$(call using,$(HAVE_SETPWENT),setpwent)
4127endif
4128endif
4129
4130ifndef $(HAVE_SETREGID)
4131HAVE_SETREGID = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-setregid have_test_prog)
4132ifeq ($(HAVE_SETREGID),1)
4133	CONFIG_CFLAGS += -DHAVE_SETREGID
4134endif
4135$(call using,$(HAVE_SETREGID),setregid)
4136endif
4137
4138ifndef $(HAVE_SETRESGID)
4139HAVE_SETRESGID = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-setresgid have_test_prog)
4140ifeq ($(HAVE_SETRESGID),1)
4141	CONFIG_CFLAGS += -DHAVE_SETRESGID
4142endif
4143$(call using,$(HAVE_SETRESGID),setresgid)
4144endif
4145
4146ifndef $(HAVE_SETRESUID)
4147HAVE_SETRESUID = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-setresuid have_test_prog)
4148ifeq ($(HAVE_SETRESUID),1)
4149	CONFIG_CFLAGS += -DHAVE_SETRESUID
4150endif
4151$(call using,$(HAVE_SETRESUID),setresuid)
4152endif
4153
4154ifndef $(HAVE_SETREUID)
4155HAVE_SETREUID = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-setreuid have_test_prog)
4156ifeq ($(HAVE_SETREUID),1)
4157	CONFIG_CFLAGS += -DHAVE_SETREUID
4158endif
4159$(call using,$(HAVE_SETREUID),setreuid)
4160endif
4161
4162ifndef $(HAVE_SETTIMEOFDAY)
4163HAVE_SETTIMEOFDAY = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-settimeofday have_test_prog)
4164ifeq ($(HAVE_SETTIMEOFDAY),1)
4165      CONFIG_CFLAGS += -DHAVE_SETTIMEOFDAY
4166endif
4167$(call using,$(HAVE_SETTIMEOFDAY),settimeofday)
4168endif
4169
4170ifndef $(HAVE_SETXATTR)
4171HAVE_SETXATTR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-setxattr have_test_prog)
4172ifeq ($(HAVE_SETXATTR),1)
4173	CONFIG_CFLAGS += -DHAVE_SETXATTR
4174endif
4175$(call using,$(HAVE_SETXATTR),setxattr)
4176endif
4177
4178ifndef $(HAVE_SIGALTSTACK)
4179HAVE_SIGALTSTACK = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sigaltstack have_test_prog)
4180ifeq ($(HAVE_SIGALTSTACK),1)
4181	CONFIG_CFLAGS += -DHAVE_SIGALTSTACK
4182endif
4183$(call using,$(HAVE_SIGALTSTACK),sigaltstack)
4184endif
4185
4186ifndef $(HAVE_SIGNALFD)
4187HAVE_SIGNALFD = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-signalfd have_test_prog)
4188ifeq ($(HAVE_SIGNALFD),1)
4189	CONFIG_CFLAGS += -DHAVE_SIGNALFD
4190endif
4191$(call using,$(HAVE_SIGNALFD),signalfd)
4192endif
4193
4194ifndef $(HAVE_SIGQUEUE)
4195HAVE_SIGQUEUE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sigqueue have_test_prog)
4196ifeq ($(HAVE_SIGQUEUE),1)
4197	CONFIG_CFLAGS += -DHAVE_SIGQUEUE
4198endif
4199$(call using,$(HAVE_SIGQUEUE),sigqueue)
4200endif
4201
4202ifndef $(HAVE_SIGWAITINFO)
4203HAVE_SIGWAITINFO = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sigwaitinfo have_test_prog)
4204ifeq ($(HAVE_SIGWAITINFO),1)
4205	CONFIG_CFLAGS += -DHAVE_SIGWAITINFO
4206endif
4207$(call using,$(HAVE_SIGWAITINFO),sigwaitinfo)
4208endif
4209
4210ifndef $(HAVE_SINHL)
4211MATHFUNC=sinhl
4212export MATHFUNC
4213HAVE_SINHL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=sinhl have_mathfunc)
4214ifeq ($(HAVE_SINHL),1)
4215	CONFIG_CFLAGS += -DHAVE_SINHL
4216endif
4217$(call using,$(HAVE_SINHL),sinhl)
4218endif
4219
4220ifndef $(HAVE_SINL)
4221MATHFUNC=sinl
4222export MATHFUNC
4223HAVE_SINL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=sinl have_mathfunc)
4224ifeq ($(HAVE_SINL),1)
4225	CONFIG_CFLAGS += -DHAVE_SINL
4226endif
4227$(call using,$(HAVE_SINL),sinl)
4228endif
4229
4230ifndef $(HAVE_SPLICE)
4231HAVE_SPLICE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-splice have_test_prog)
4232ifeq ($(HAVE_SPLICE),1)
4233	CONFIG_CFLAGS += -DHAVE_SPLICE
4234endif
4235$(call using,$(HAVE_SPLICE),splice)
4236endif
4237
4238ifndef $(HAVE_SQRTL)
4239MATHFUNC=sqrtl
4240export MATHFUNC
4241HAVE_SQRTL = $(shell $(MAKE) $(MAKE_OPTS) MATHFUNC=sqrtl have_mathfunc)
4242ifeq ($(HAVE_SQRTL),1)
4243	CONFIG_CFLAGS += -DHAVE_SQRTL
4244endif
4245$(call using,$(HAVE_SQRTL),sqrtl)
4246endif
4247
4248ifndef $(HAVE_STATFS)
4249HAVE_STATFS = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-statfs have_test_prog)
4250ifeq ($(HAVE_STATFS),1)
4251	CONFIG_CFLAGS += -DHAVE_STATFS
4252endif
4253$(call using,$(HAVE_STATFS),statfs)
4254endif
4255
4256ifndef $(HAVE_STIME)
4257HAVE_STIME = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-stime have_test_prog)
4258ifeq ($(HAVE_STIME),1)
4259	CONFIG_CFLAGS += -DHAVE_STIME
4260endif
4261$(call using,$(HAVE_STIME),stime (deprecated))
4262endif
4263
4264ifndef $(HAVE_BSD_STRLCAT)
4265STRFUNC=strlcat
4266export STRFUNC
4267HAVE_BSD_STRLCAT = $(shell $(MAKE) $(MAKE_OPTS) STRFUNC=strlcat have_strfunc)
4268ifeq ($(HAVE_BSD_STRLCAT),1)
4269	CONFIG_CFLAGS += -DHAVE_BSD_STRLCAT
4270endif
4271$(call using,$(HAVE_BSD_STRLCAT),strlcat)
4272endif
4273
4274ifndef $(HAVE_BSD_STRLCPY)
4275STRFUNC=strlcpy
4276export STRFUNC
4277HAVE_BSD_STRLCPY = $(shell $(MAKE) $(MAKE_OPTS) STRFUNC=strlcpy have_strfunc)
4278ifeq ($(HAVE_BSD_STRLCPY),1)
4279	CONFIG_CFLAGS += -DHAVE_BSD_STRLCPY
4280endif
4281$(call using,$(HAVE_BSD_STRLCPY),strlcpy)
4282endif
4283
4284ifndef $(HAVE_SWAPCONTEXT)
4285HAVE_SWAPCONTEXT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-swapcontext have_test_prog)
4286ifeq ($(HAVE_SWAPCONTEXT),1)
4287	CONFIG_CFLAGS += -DHAVE_SWAPCONTEXT
4288endif
4289$(call using,$(HAVE_SWAPCONTEXT),swapcontext)
4290endif
4291
4292ifndef $(HAVE_SWAP)
4293HAVE_SWAP = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-swap have_test_prog)
4294ifeq ($(HAVE_SWAP),1)
4295	CONFIG_CFLAGS += -DHAVE_SWAP
4296endif
4297$(call using,$(HAVE_SWAP),swapon and swapoff)
4298endif
4299
4300ifndef $(HAVE_SYNC_FILE_RANGE)
4301HAVE_SYNC_FILE_RANGE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sync-file-range have_test_prog)
4302ifeq ($(HAVE_SYNC_FILE_RANGE),1)
4303	CONFIG_CFLAGS += -DHAVE_SYNC_FILE_RANGE
4304endif
4305$(call using,$(HAVE_SYNC_FILE_RANGE),sync_file_range)
4306endif
4307
4308ifndef $(HAVE_SYNC_BOOL_COMPARE_AND_SWAP)
4309HAVE_SYNC_BOOL_COMPARE_AND_SWAP= $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sync-bool-compare-and-swap have_test_prog)
4310ifeq ($(HAVE_SYNC_BOOL_COMPARE_AND_SWAP),1)
4311	CONFIG_CFLAGS += -DHAVE_SYNC_BOOL_COMPARE_AND_SWAP
4312endif
4313$(call using,$(HAVE_SYNC_BOOL_COMPARE_AND_SWAP),sync_bool_compare_and_swap)
4314endif
4315
4316ifndef $(HAVE_SYNCFS)
4317HAVE_SYNCFS = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-syncfs have_test_prog)
4318ifeq ($(HAVE_SYNCFS),1)
4319	CONFIG_CFLAGS += -DHAVE_SYNCFS
4320endif
4321$(call using,$(HAVE_SYNCFS),syncfs)
4322endif
4323
4324ifndef $(HAVE_SYSINFO)
4325HAVE_SYSINFO = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sysinfo have_test_prog)
4326ifeq ($(HAVE_SYSINFO),1)
4327	CONFIG_CFLAGS += -DHAVE_SYSINFO
4328endif
4329$(call using,$(HAVE_SYSINFO),sysinfo)
4330endif
4331
4332ifndef $(HAVE_MQ_SYSV)
4333HAVE_MQ_SYSV = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-mq-sysv have_test_prog)
4334ifeq ($(HAVE_MQ_SYSV),1)
4335	CONFIG_CFLAGS += -DHAVE_MQ_SYSV
4336endif
4337$(call using,$(HAVE_MQ_SYSV),SYSV message queues)
4338endif
4339
4340ifndef $(HAVE_SEM_SYSV)
4341HAVE_SEM_SYSV = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-sem-sysv have_test_prog)
4342ifeq ($(HAVE_SEM_SYSV),1)
4343	CONFIG_CFLAGS += -DHAVE_SEM_SYSV
4344endif
4345$(call using,$(HAVE_SEM_SYSV),SYSV semaphores)
4346endif
4347
4348ifndef $(HAVE_SEMTIMEDOP)
4349HAVE_SEMTIMEDOP = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-semtimedop have_test_prog)
4350ifeq ($(HAVE_SEMTIMEDOP),1)
4351	CONFIG_CFLAGS += -DHAVE_SEMTIMEDOP
4352endif
4353$(call using,$(HAVE_SEMTIMEDOP),SYSV semtimedop)
4354endif
4355
4356ifndef $(HAVE_SHM_SYSV)
4357HAVE_SHM_SYSV = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-shm-sysv have_test_prog)
4358ifeq ($(HAVE_SHM_SYSV),1)
4359	CONFIG_CFLAGS += -DHAVE_SHM_SYSV
4360endif
4361$(call using,$(HAVE_SHM_SYSV),SYSV shared memory)
4362endif
4363
4364ifndef $(HAVE_TCDRAIN)
4365HAVE_TCDRAIN = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-tcdrain have_test_prog)
4366ifeq ($(HAVE_TCDRAIN),1)
4367	CONFIG_CFLAGS += -DHAVE_TCDRAIN
4368endif
4369$(call using,$(HAVE_TCDRAIN),tcdrain)
4370endif
4371
4372ifndef $(HAVE_TCFLOW)
4373HAVE_TCFLOW = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-tcflow have_test_prog)
4374ifeq ($(HAVE_TCFLOW),1)
4375	CONFIG_CFLAGS += -DHAVE_TCFLOW
4376endif
4377$(call using,$(HAVE_TCFLOW),tcflow)
4378endif
4379
4380ifndef $(HAVE_TCFLUSH)
4381HAVE_TCFLUSH = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-tcflush have_test_prog)
4382ifeq ($(HAVE_TCFLUSH),1)
4383	CONFIG_CFLAGS += -DHAVE_TCFLUSH
4384endif
4385$(call using,$(HAVE_TCFLUSH),tcflush)
4386endif
4387
4388ifndef $(HAVE_TCGETATTR)
4389HAVE_TCGETATTR = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-tcgetattr have_test_prog)
4390ifeq ($(HAVE_TCGETATTR),1)
4391	CONFIG_CFLAGS += -DHAVE_TCGETATTR
4392endif
4393$(call using,$(HAVE_TCGETATTR),tcgetattr)
4394endif
4395
4396ifndef $(HAVE_TEE)
4397HAVE_TEE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-tee have_test_prog)
4398ifeq ($(HAVE_TEE),1)
4399	CONFIG_CFLAGS += -DHAVE_TEE
4400endif
4401$(call using,$(HAVE_TEE),tee)
4402endif
4403
4404#
4405#  signal.h may define HAVE_TGKILL, so add _LIBC to
4406#  avoid name clash
4407#
4408ifndef $(HAVE_TGKILL_LIBC)
4409HAVE_TGKILL_LIBC = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-tgkill have_test_prog)
4410ifeq ($(HAVE_TGKILL_LIBC),1)
4411	CONFIG_CFLAGS += -DHAVE_TGKILL_LIBC
4412endif
4413$(call using,$(HAVE_TGKILL_LIBC),tgkill)
4414endif
4415
4416ifndef $(HAVE_TIMER_CREATE)
4417HAVE_TIMER_CREATE = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-timer-create have_test_prog)
4418ifeq ($(HAVE_TIMER_CREATE),1)
4419	CONFIG_CFLAGS += -DHAVE_TIMER_CREATE
4420endif
4421$(call using,$(HAVE_TIMER_CREATE),timer_create)
4422endif
4423
4424ifndef $(HAVE_TIMER_DELETE)
4425HAVE_TIMER_DELETE = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-timer-delete have_test_prog)
4426ifeq ($(HAVE_TIMER_DELETE),1)
4427	CONFIG_CFLAGS += -DHAVE_TIMER_DELETE
4428endif
4429$(call using,$(HAVE_TIMER_DELETE),timer_delete)
4430endif
4431
4432ifndef $(HAVE_TIMER_GETTIME)
4433HAVE_TIMER_GETTIME = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-timer-gettime  have_test_prog)
4434ifeq ($(HAVE_TIMER_GETTIME),1)
4435	CONFIG_CFLAGS += -DHAVE_TIMER_GETTIME
4436endif
4437$(call using,$(HAVE_TIMER_GETTIME),timer_gettime)
4438endif
4439
4440ifndef $(HAVE_TIMER_GETOVERRUN)
4441HAVE_TIMER_GETOVERRUN = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-timer-getoverrun  have_test_prog)
4442ifeq ($(HAVE_TIMER_GETOVERRUN),1)
4443	CONFIG_CFLAGS += -DHAVE_TIMER_GETOVERRUN
4444endif
4445$(call using,$(HAVE_TIMER_GETOVERRUN),timer_getoverrrun)
4446endif
4447
4448ifndef $(HAVE_TIMER_SETTIME)
4449HAVE_TIMER_SETTIME = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-timer-settime  have_test_prog)
4450ifeq ($(HAVE_TIMER_SETTIME),1)
4451	CONFIG_CFLAGS += -DHAVE_TIMER_SETTIME
4452endif
4453$(call using,$(HAVE_TIMER_SETTIME),timer_settime)
4454endif
4455
4456ifndef $(HAVE_TIMERFD_CREATE)
4457HAVE_TIMERFD_CREATE = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-timerfd-create have_test_prog)
4458ifeq ($(HAVE_TIMERFD_CREATE),1)
4459	CONFIG_CFLAGS += -DHAVE_TIMERFD_CREATE
4460endif
4461$(call using,$(HAVE_TIMERFD_CREATE),timerfd_create)
4462endif
4463
4464ifndef $(HAVE_TIMERFD_GETTIME)
4465HAVE_TIMERFD_GETTIME = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-timerfd-gettime  have_test_prog)
4466ifeq ($(HAVE_TIMERFD_GETTIME),1)
4467	CONFIG_CFLAGS += -DHAVE_TIMERFD_GETTIME
4468endif
4469$(call using,$(HAVE_TIMERFD_GETTIME),timerfd_gettime)
4470endif
4471
4472ifndef $(HAVE_TIMERFD_SETTIME)
4473HAVE_TIMERFD_SETTIME = $(shell $(MAKE) $(MAKE_OPTS) TEST_LIBS='$(CONFIG_LDFLAGS)' TEST_PROG=test-timerfd-settime  have_test_prog)
4474ifeq ($(HAVE_TIMERFD_SETTIME),1)
4475	CONFIG_CFLAGS += -DHAVE_TIMERFD_SETTIME
4476endif
4477$(call using,$(HAVE_TIMERFD_SETTIME),timerfd_settime)
4478endif
4479
4480
4481ifndef $(HAVE_TTYNAME)
4482HAVE_TTYNAME = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-ttyname have_test_prog)
4483ifeq ($(HAVE_TTYNAME),1)
4484	CONFIG_CFLAGS += -DHAVE_TTYNAME
4485endif
4486$(call using,$(HAVE_TTYNAME),ttyname)
4487endif
4488
4489ifndef $(HAVE_UMOUNT2)
4490HAVE_UMOUNT2 = $(shell $(MAKE) $(MAKE_OPTS) TEST_CFLAGS=-Werror TEST_PROG=test-umount2 have_test_prog)
4491ifeq ($(HAVE_UMOUNT2),1)
4492	CONFIG_CFLAGS += -DHAVE_UMOUNT2
4493endif
4494$(call using,$(HAVE_UMOUNT2),umount2)
4495endif
4496
4497ifndef $(HAVE_UNAME)
4498HAVE_UNAME = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-uname have_test_prog)
4499ifeq ($(HAVE_UNAME),1)
4500	CONFIG_CFLAGS += -DHAVE_UNAME
4501endif
4502$(call using,$(HAVE_UNAME),uname)
4503endif
4504
4505ifndef $(HAVE_UNLINKAT)
4506HAVE_UNLINKAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-unlinkat have_test_prog)
4507ifeq ($(HAVE_UNLINKAT),1)
4508	CONFIG_CFLAGS += -DHAVE_UNLINKAT
4509endif
4510$(call using,$(HAVE_UNLINKAT),unlinkat)
4511endif
4512
4513ifndef $(HAVE_UNSHARE)
4514HAVE_UNSHARE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-unshare have_test_prog)
4515ifeq ($(HAVE_UNSHARE),1)
4516	CONFIG_CFLAGS += -DHAVE_UNSHARE
4517endif
4518$(call using,$(HAVE_UNSHARE),unshare)
4519endif
4520
4521ifndef $(HAVE_USTAT)
4522HAVE_USTAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_CFLAGS=-Werror TEST_PROG=test-ustat have_test_prog)
4523ifeq ($(HAVE_USTAT),1)
4524	CONFIG_CFLAGS += -DHAVE_USTAT
4525endif
4526$(call using,$(HAVE_USTAT),ustat (deprecated))
4527endif
4528
4529ifndef $(HAVE_UTIMENSAT)
4530HAVE_UTIMENSAT = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-utimensat have_test_prog)
4531ifeq ($(HAVE_UTIMENSAT),1)
4532	CONFIG_CFLAGS += -DHAVE_UTIMENSAT
4533endif
4534$(call using,$(HAVE_UTIMENSAT),utimensat)
4535endif
4536
4537ifndef $(HAVE_VHANGUP)
4538HAVE_VHANGUP = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-vhangup have_test_prog)
4539ifeq ($(HAVE_VHANGUP),1)
4540	CONFIG_CFLAGS += -DHAVE_VHANGUP
4541endif
4542$(call using,$(HAVE_VHANGUP),vhangup)
4543endif
4544
4545ifndef $(HAVE_VMSPLICE)
4546HAVE_VMSPLICE = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-vmsplice have_test_prog)
4547ifeq ($(HAVE_VMSPLICE),1)
4548	CONFIG_CFLAGS += -DHAVE_VMSPLICE
4549endif
4550$(call using,$(HAVE_VMSPLICE),vmsplice)
4551endif
4552
4553ifndef $(HAVE_WAITID)
4554HAVE_WAITID = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-waitid have_test_prog)
4555ifeq ($(HAVE_WAITID),1)
4556	CONFIG_CFLAGS += -DHAVE_WAITID
4557endif
4558$(call using,$(HAVE_WAITID),waitid)
4559endif
4560
4561ifndef $(HAVE_WAIT3)
4562HAVE_WAIT3 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-wait3 have_test_prog)
4563ifeq ($(HAVE_WAIT3),1)
4564	CONFIG_CFLAGS += -DHAVE_WAIT3
4565endif
4566$(call using,$(HAVE_WAIT3),wait3)
4567endif
4568
4569ifndef $(HAVE_WAIT4)
4570HAVE_WAIT4 = $(shell $(MAKE) $(MAKE_OPTS) TEST_PROG=test-wait4 have_test_prog)
4571ifeq ($(HAVE_WAIT4),1)
4572	CONFIG_CFLAGS += -DHAVE_WAIT4
4573endif
4574$(call using,$(HAVE_WAIT4),wait4)
4575endif
4576
4577ifndef $(HAVE_WCSCASECMP)
4578WCSFUNC=wcscasecmp
4579export WCSFUNC
4580HAVE_WCSCASECMP = $(shell $(MAKE) $(MAKE_OPTS) WCSFUNC=wcscasecmp have_wcsfunc)
4581ifeq ($(HAVE_WCSCASECMP),1)
4582	CONFIG_CFLAGS += -DHAVE_WCSCASECMP
4583endif
4584$(call using,$(HAVE_WCSCASECMP),wcscasecmp)
4585endif
4586
4587ifndef $(HAVE_WCSCAT)
4588WCSFUNC=wcscat
4589export WCSFUNC
4590HAVE_WCSCAT = $(shell $(MAKE) $(MAKE_OPTS) WCSFUNC=wcscat have_wcsfunc)
4591ifeq ($(HAVE_WCSCAT),1)
4592	CONFIG_CFLAGS += -DHAVE_WCSCAT
4593endif
4594$(call using,$(HAVE_WCSCAT),wcscat)
4595endif
4596
4597ifndef $(HAVE_WCSCHR)
4598WCSFUNC=wcschr
4599export WCSFUNC
4600HAVE_WCSCHR = $(shell $(MAKE) $(MAKE_OPTS) WCSFUNC=wcschr have_wcsfunc)
4601ifeq ($(HAVE_WCSCHR),1)
4602	CONFIG_CFLAGS += -DHAVE_WCSCHR
4603endif
4604$(call using,$(HAVE_WCSCHR),wcschr)
4605endif
4606
4607ifndef $(HAVE_WCSCMP)
4608WCSFUNC=wcscmp
4609export WCSFUNC
4610HAVE_WCSCMP = $(shell $(MAKE) $(MAKE_OPTS) WCSFUNC=wcscmp have_wcsfunc)
4611ifeq ($(HAVE_WCSCMP),1)
4612	CONFIG_CFLAGS += -DHAVE_WCSCMP
4613endif
4614$(call using,$(HAVE_WCSCMP),wcscmp)
4615endif
4616
4617ifndef $(HAVE_WCSCOLL)
4618WCSFUNC=wcscoll
4619export WCSFUNC
4620HAVE_WCSCOLL = $(shell $(MAKE) $(MAKE_OPTS) WCSFUNC=wcscoll have_wcsfunc)
4621ifeq ($(HAVE_WCSCOLL),1)
4622	CONFIG_CFLAGS += -DHAVE_WCSCOLL
4623endif
4624$(call using,$(HAVE_WCSCOLL),wcscoll)
4625endif
4626
4627ifndef $(HAVE_WCSCPY)
4628WCSFUNC=wcscpy
4629export WCSFUNC
4630HAVE_WCSCPY = $(shell $(MAKE) $(MAKE_OPTS) WCSFUNC=wcscpy have_wcsfunc)
4631ifeq ($(HAVE_WCSCPY),1)
4632	CONFIG_CFLAGS += -DHAVE_WCSCPY
4633endif
4634$(call using,$(HAVE_WCSCPY),wcscpy)
4635endif
4636
4637ifndef $(HAVE_WCSLCAT)
4638WCSFUNC=wcslcat
4639export WCSFUNC
4640HAVE_WCSLCAT = $(shell $(MAKE) $(MAKE_OPTS) WCSFUNC=wcslcat have_wcsfunc)
4641ifeq ($(HAVE_WCSLCAT),1)
4642	CONFIG_CFLAGS += -DHAVE_WCSLCAT
4643endif
4644$(call using,$(HAVE_WCSLCAT),wcslcat)
4645endif
4646
4647ifndef $(HAVE_WCSLCPY)
4648WCSFUNC=wcslcpy
4649export WCSFUNC
4650HAVE_WCSLCPY = $(shell $(MAKE) $(MAKE_OPTS) WCSFUNC=wcslcpy have_wcsfunc)
4651ifeq ($(HAVE_WCSLCPY),1)
4652	CONFIG_CFLAGS += -DHAVE_WCSLCPY
4653endif
4654$(call using,$(HAVE_WCSLCPY),wcslcpy)
4655endif
4656
4657ifndef $(HAVE_WCSLEN)
4658WCSFUNC=wcslen
4659export WCSFUNC
4660HAVE_WCSLEN = $(shell $(MAKE) $(MAKE_OPTS) WCSFUNC=wcslen have_wcsfunc)
4661ifeq ($(HAVE_WCSLEN),1)
4662	CONFIG_CFLAGS += -DHAVE_WCSLEN
4663endif
4664$(call using,$(HAVE_WCSLEN),wcslen)
4665endif
4666
4667ifndef $(HAVE_WCSNCASECMP)
4668WCSFUNC=wcsncasecmp
4669export WCSFUNC
4670HAVE_WCSNCASECMP = $(shell $(MAKE) $(MAKE_OPTS) WCSFUNC=wcsncasecmp have_wcsfunc)
4671ifeq ($(HAVE_WCSNCASECMP),1)
4672	CONFIG_CFLAGS += -DHAVE_WCSNCASECMP
4673endif
4674$(call using,$(HAVE_WCSNCASECMP),wcsncasecmp)
4675endif
4676
4677ifndef $(HAVE_WCSNCAT)
4678WCSFUNC=wcsncat
4679export WCSFUNC
4680HAVE_WCSNCAT = $(shell $(MAKE) $(MAKE_OPTS) WCSFUNC=wcsncat have_wcsfunc)
4681ifeq ($(HAVE_WCSNCAT),1)
4682	CONFIG_CFLAGS += -DHAVE_WCSNCAT
4683endif
4684$(call using,$(HAVE_WCSNCAT),wcsncat)
4685endif
4686
4687ifndef $(HAVE_WCSNCMP)
4688WCSFUNC=wcsncmp
4689export WCSFUNC
4690HAVE_WCSNCMP = $(shell $(MAKE) $(MAKE_OPTS) WCSFUNC=wcsncmp have_wcsfunc)
4691ifeq ($(HAVE_WCSNCMP),1)
4692	CONFIG_CFLAGS += -DHAVE_WCSNCMP
4693endif
4694$(call using,$(HAVE_WCSNCMP),wcsncmp)
4695endif
4696
4697ifndef $(HAVE_WCSRCHR)
4698WCSFUNC=wcsrchr
4699export WCSFUNC
4700HAVE_WCSRCHR = $(shell $(MAKE) $(MAKE_OPTS) WCSFUNC=wcsrchr have_wcsfunc)
4701ifeq ($(HAVE_WCSRCHR),1)
4702	CONFIG_CFLAGS += -DHAVE_WCSRCHR
4703endif
4704$(call using,$(HAVE_WCSRCHR),wcsrchr)
4705endif
4706
4707ifndef $(HAVE_WCSXFRM)
4708WCSFUNC=wcsxfrm
4709export WCSFUNC
4710HAVE_WCSXFRM = $(shell $(MAKE) $(MAKE_OPTS) WCSFUNC=wcsxfrm have_wcsfunc)
4711ifeq ($(HAVE_WCSXFRM),1)
4712	CONFIG_CFLAGS += -DHAVE_WCSXFRM
4713endif
4714$(call using,$(HAVE_WCSXFRM),wcsxfrm)
4715endif
4716
4717ifneq ($(VERBOSE),)
4718$(info $(newline)CONFIG_LDFLAGS: $(CONFIG_LDFLAGS))
4719$(info CONFIG_CFLAGS: $(CONFIG_CFLAGS)$(newline))
4720endif
4721
4722endif
4723
4724
4725.SUFFIXES: .c .o
4726
4727#
4728#  save configuration
4729#
4730.PHONY: save_config
4731save_config:
4732	@echo $(CONFIG_CFLAGS) | tr ' ' '\n' | grep "\-D" | sed s'/CONFIG_CFLAGS=//' | sed s'/-D/#define /' | sort > config.h
4733	@echo CONFIG_LDFLAGS=$(CONFIG_LDFLAGS) >> config
4734	@echo CONFIG_OBJS=$(CONFIG_OBJS) >> config
4735
4736#
4737#  check if we can build against AppArmor
4738#
4739.PHONY: have_apparmor
4740have_apparmor: $(DIR)/test-apparmor.c
4741	@$(CC) $(CFLAGS) $(CPPFLAGS) $(DIR)/test-apparmor.c $(LIB_APPARMOR) -o $(DIR)/test-apparmor 2> /dev/null || true
4742	@$(APPARMOR_PARSER) -Q usr.bin.pulseaudio.eg -o apparmor-data.bin 2> /dev/null; \
4743	if [ $$? -ne 0 ]; then \
4744		echo 0 ;\
4745	else \
4746		if [ -f $(DIR)/test-apparmor ]; then \
4747			if [ -x "$(APPARMOR_PARSER)" ]; then \
4748				if [ -f apparmor-data.bin ]; then \
4749					echo 1 ;\
4750				else \
4751					echo 0 ;\
4752				fi \
4753			else \
4754				echo 0 ;\
4755			fi \
4756		else \
4757			echo 0 ;\
4758		fi \
4759	fi
4760	@rm -f $(DIR)/test-apparmor apparmor-data.bin
4761
4762#
4763#  check if compiler supports a specific floating point decimal format
4764#
4765.PHONY: have_float
4766have_float:
4767	@$(CC) $(CFLAGS) $(CPPFLAGS) -DFLOAT=$(FLOAT_TYPE) -o $(DIR)/test-float $(DIR)/test-float.c -lm 2> /dev/null || true
4768	@if [ -f $(DIR)/test-float ]; then \
4769		echo 1 ;\
4770	else \
4771		echo 0 ;\
4772	fi
4773	@rm -f $(DIR)/test-float
4774
4775#
4776#  check if we have a specific header
4777#
4778.PHONY: have_header_h
4779have_header_h:
4780	@echo "#include <sys/types.h>" > $(DIR)/test-header.c
4781	@echo "#include <$(HEADER)>" >> $(DIR)/test-header.c
4782	@$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $(DIR)/test-header.o $(DIR)/test-header.c 2> /dev/null || true
4783	@if [ -f $(DIR)/test-header.o ]; then \
4784		echo 1 ;\
4785	else \
4786		echo 0 ;\
4787	fi
4788	@rm -f $(DIR)/test-header.o $(DIR)/test-header.c
4789
4790#
4791#  check if we can build using a specific test program
4792#
4793.PHONY: have_test_prog
4794have_test_prog: $(DIR)/$(TEST_PROG).c
4795	@$(CC) $(CFLAGS) $(CPPFLAGS) -Itest $(TEST_CFLAGS) -DTARGET_CLONE='$(TARGET_CLONE)' $(DIR)/$(TEST_PROG).c $(TEST_LIBS) -o $(DIR)/$(TEST_PROG) $(LDFLAGS) 2> /dev/null || true
4796	@if [ -f $(DIR)/$(TEST_PROG) ]; then \
4797		echo 1 ;\
4798	else \
4799		echo 0 ;\
4800	fi
4801		@rm -rf $(DIR)/$(TEST_PROG)
4802
4803#
4804#  check if we can build vecmath related code
4805#
4806.PHONY: have_vecmath
4807have_vecmath: stress-vecmath.c
4808	@$(CC) $(CFLAGS) $(CPPFLAGS) -Itest -DHAVE_VECMATH -c -o stress-vecmath-test.o stress-vecmath.c 2> /dev/null || true
4809	@if [ -f stress-vecmath-test.o ]; then \
4810		echo 1 ;\
4811	else \
4812		echo 0 ;\
4813	fi
4814	@rm -rf stress-vecmath-test.o
4815
4816#
4817#  check if we have specific math functions
4818#
4819.PHONY: have_mathfunc
4820have_mathfunc: $(DIR)/test-mathfunc.c
4821	@$(CC) $(CFLAGS) $(CPPFLAGS) -DMATHFUNC=$(MATHFUNC) $(DIR)/test-mathfunc.c -o $(DIR)/test-mathfunc -lm 2> /dev/null || true
4822	@if [ -f $(DIR)/test-mathfunc ]; then \
4823		echo 1 ;\
4824	else \
4825		echo 0 ;\
4826	fi
4827	@rm -rf $(DIR)/test-mathfunc
4828
4829#
4830#  check if we have specific string str* functions
4831#
4832.PHONY: have_strfunc
4833have_strfunc: $(DIR)/test-strfunc.c
4834	@$(CC) $(CFLAGS) $(CPPFLAGS) -DSTRFUNC=$(STRFUNC) $(DIR)/test-strfunc.c -o $(DIR)/test-strfunc $(LIB_BSD) 2> /dev/null || true
4835	@if [ -f $(DIR)/test-strfunc ]; then \
4836		echo 1 ;\
4837	else \
4838		echo 0 ;\
4839	fi
4840	@rm -rf $(DIR)/test-strfunc
4841
4842#
4843#  check if we have specific wide string wcs* functions
4844#
4845.PHONY: have_wcsfunc
4846have_wcsfunc: $(DIR)/test-wcsfunc.c
4847	@$(CC) $(CFLAGS) $(CPPFLAGS) -DWCSFUNC=$(WCSFUNC) $(DIR)/test-wcsfunc.c -o $(DIR)/test-wcsfunc $(LIB_BSD) 2> /dev/null || true
4848	@if [ -f $(DIR)/test-wcsfunc ]; then \
4849		echo 1 ;\
4850	else \
4851		echo 0 ;\
4852	fi
4853	@rm -rf $(DIR)/test-wcsfunc
4854
4855#
4856#  check if we can build atomic related code
4857#
4858.PHONY: have_atomic
4859have_atomic: test/test-atomic_clear.c
4860	@$(CC) $(CFLAGS) $(CPPFLAGS) test/test-atomic_clear.c $(LIB_ATOMIC) -o stress-atomic_clear 2> /dev/null || true
4861	@if [ -f stress-atomic_clear ]; then \
4862		(./stress-atomic_clear > /dev/null 2>&1) && echo 1 || echo 0 ; \
4863	else \
4864		echo 0 ; \
4865	fi
4866	@rm -rf stress-atomic_clear
4867