syslog: Improve fortify with clang
[glibc.git] / sysdeps / mach / configure
blobf15160d0d80dad6a9c56d69bfb353582031f3ce0
2 # ac_fn_c_check_header_preproc LINENO HEADER VAR
3 # ----------------------------------------------
4 # Tests whether HEADER exists and can be preprocessed (in isolation), setting
5 # the cache variable VAR accordingly.
6 ac_fn_c_check_header_preproc ()
8   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
9   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
10 printf %s "checking for $2... " >&6; }
11 if eval test \${$3+y}
12 then :
13   printf %s "(cached) " >&6
14 else $as_nop
15   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
16 /* end confdefs.h.  */
17 #include <$2>
18 _ACEOF
19 if ac_fn_c_try_cpp "$LINENO"
20 then :
21   eval "$3=yes"
22 else $as_nop
23   eval "$3=no"
25 rm -f conftest.err conftest.i conftest.$ac_ext
27 eval ac_res=\$$3
28                { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
29 printf "%s\n" "$ac_res" >&6; }
30   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
32 } # ac_fn_c_check_header_preproc
33 # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
35 if test -n "$ac_tool_prefix"; then
36   # Extract the first word of "${ac_tool_prefix}mig", so it can be a program name with args.
37 set dummy ${ac_tool_prefix}mig; ac_word=$2
38 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
39 printf %s "checking for $ac_word... " >&6; }
40 if test ${ac_cv_prog_MIG+y}
41 then :
42   printf %s "(cached) " >&6
43 else $as_nop
44   if test -n "$MIG"; then
45   ac_cv_prog_MIG="$MIG" # Let the user override the test.
46 else
47 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
48 for as_dir in $PATH
50   IFS=$as_save_IFS
51   case $as_dir in #(((
52     '') as_dir=./ ;;
53     */) ;;
54     *) as_dir=$as_dir/ ;;
55   esac
56     for ac_exec_ext in '' $ac_executable_extensions; do
57   if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
58     ac_cv_prog_MIG="${ac_tool_prefix}mig"
59     printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
60     break 2
61   fi
62 done
63   done
64 IFS=$as_save_IFS
68 MIG=$ac_cv_prog_MIG
69 if test -n "$MIG"; then
70   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MIG" >&5
71 printf "%s\n" "$MIG" >&6; }
72 else
73   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
74 printf "%s\n" "no" >&6; }
79 if test -z "$ac_cv_prog_MIG"; then
80   ac_ct_MIG=$MIG
81   # Extract the first word of "mig", so it can be a program name with args.
82 set dummy mig; ac_word=$2
83 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
84 printf %s "checking for $ac_word... " >&6; }
85 if test ${ac_cv_prog_ac_ct_MIG+y}
86 then :
87   printf %s "(cached) " >&6
88 else $as_nop
89   if test -n "$ac_ct_MIG"; then
90   ac_cv_prog_ac_ct_MIG="$ac_ct_MIG" # Let the user override the test.
91 else
92 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
93 for as_dir in $PATH
95   IFS=$as_save_IFS
96   case $as_dir in #(((
97     '') as_dir=./ ;;
98     */) ;;
99     *) as_dir=$as_dir/ ;;
100   esac
101     for ac_exec_ext in '' $ac_executable_extensions; do
102   if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
103     ac_cv_prog_ac_ct_MIG="mig"
104     printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
105     break 2
106   fi
107 done
108   done
109 IFS=$as_save_IFS
113 ac_ct_MIG=$ac_cv_prog_ac_ct_MIG
114 if test -n "$ac_ct_MIG"; then
115   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MIG" >&5
116 printf "%s\n" "$ac_ct_MIG" >&6; }
117 else
118   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
119 printf "%s\n" "no" >&6; }
122   if test "x$ac_ct_MIG" = x; then
123     MIG="MISSING"
124   else
125     case $cross_compiling:$ac_tool_warned in
126 yes:)
127 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
128 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
129 ac_tool_warned=yes ;;
130 esac
131     MIG=$ac_ct_MIG
132   fi
133 else
134   MIG="$ac_cv_prog_MIG"
137 if test "x$MIG" = xMISSING; then
138   as_fn_error $? "cannot find required build tool mig" "$LINENO" 5
140 config_vars="$config_vars
141 MIG = $MIG"
143 OLD_CPPFLAGS=$CPPFLAGS
144 if test -n "$sysheaders"; then
145   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
148 ### Sanity checks for Mach header installation
149 CPPFLAGS="$CPPFLAGS -ffreestanding"
152 ac_fn_c_check_header_preproc "$LINENO" "mach/mach_types.h" "ac_cv_header_mach_mach_types_h"
153 if test "x$ac_cv_header_mach_mach_types_h" = xyes
154 then :
156 else $as_nop
157   as_fn_error $? "cannot find Mach headers" "$LINENO" 5
160 ac_fn_c_check_header_preproc "$LINENO" "mach/mach_types.defs" "ac_cv_header_mach_mach_types_defs"
161 if test "x$ac_cv_header_mach_mach_types_defs" = xyes
162 then :
164 else $as_nop
165   as_fn_error $? "cannot find Mach .defs files" "$LINENO" 5
171 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for task_t in mach/mach_types.h" >&5
172 printf %s "checking for task_t in mach/mach_types.h... " >&6; }
173 if test ${libc_cv_mach_task_t+y}
174 then :
175   printf %s "(cached) " >&6
176 else $as_nop
177   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
178 /* end confdefs.h.  */
179 #include <mach/mach_types.h>
181 main (void)
183 extern task_t foo;
184   ;
185   return 0;
187 _ACEOF
188 if ac_fn_c_try_compile "$LINENO"
189 then :
190   libc_cv_mach_task_t=task_t
191 else $as_nop
192   libc_cv_mach_task_t=task_port_t
194 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
196 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_task_t" >&5
197 printf "%s\n" "$libc_cv_mach_task_t" >&6; }
198 if test $libc_cv_mach_task_t != task_t; then
199   DEFINES="$DEFINES -Dtask_t=task_port_t"
201 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for thread_t in mach/mach_types.h" >&5
202 printf %s "checking for thread_t in mach/mach_types.h... " >&6; }
203 if test ${libc_cv_mach_thread_t+y}
204 then :
205   printf %s "(cached) " >&6
206 else $as_nop
207   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
208 /* end confdefs.h.  */
209 #include <mach/mach_types.h>
211 main (void)
213 extern thread_t foo;
214   ;
215   return 0;
217 _ACEOF
218 if ac_fn_c_try_compile "$LINENO"
219 then :
220   libc_cv_mach_thread_t=thread_t
221 else $as_nop
222   libc_cv_mach_thread_t=thread_port_t
224 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
226 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_thread_t" >&5
227 printf "%s\n" "$libc_cv_mach_thread_t" >&6; }
228 if test $libc_cv_mach_thread_t != thread_t; then
229   DEFINES="$DEFINES -Dthread_t=thread_port_t"
232 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for creation_time in task_basic_info" >&5
233 printf %s "checking for creation_time in task_basic_info... " >&6; }
234 if test ${libc_cv_mach_task_creation_time+y}
235 then :
236   printf %s "(cached) " >&6
237 else $as_nop
238   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
239 /* end confdefs.h.  */
240 #include <mach/task_info.h>
242 main (void)
245 extern struct task_basic_info *i;
246 long s = i->creation_time.seconds;
248   ;
249   return 0;
251 _ACEOF
252 if ac_fn_c_try_compile "$LINENO"
253 then :
254   libc_cv_mach_task_creation_time=yes
255 else $as_nop
256   libc_cv_mach_task_creation_time=no
258 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
260 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_task_creation_time" >&5
261 printf "%s\n" "$libc_cv_mach_task_creation_time" >&6; }
262 if test $libc_cv_mach_task_creation_time = no; then
263   as_fn_error $? "you need Mach headers supporting task_info.creation_time" "$LINENO" 5
266 mach_interface_list=
267 for ifc in mach mach4 gnumach \
268            clock clock_priv host_priv host_security ledger lock_set \
269            processor processor_set task task_notify thread_act vm_map \
270            memory_object memory_object_default i386/mach_i386 x86_64/mach_i386 \
271            ; do
272   as_ac_Header=`printf "%s\n" "ac_cv_header_mach/${ifc}.defs" | $as_tr_sh`
273 ac_fn_c_check_header_preproc "$LINENO" "mach/${ifc}.defs" "$as_ac_Header"
274 if eval test \"x\$"$as_ac_Header"\" = x"yes"
275 then :
276     mach_interface_list="$mach_interface_list $ifc"
279 done
280 if test "x$mach_interface_list" = x; then
281   as_fn_error $? "what manner of Mach is this?" "$LINENO" 5
284 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
285 printf %s "checking for grep that handles long lines and -e... " >&6; }
286 if test ${ac_cv_path_GREP+y}
287 then :
288   printf %s "(cached) " >&6
289 else $as_nop
290   if test -z "$GREP"; then
291   ac_path_GREP_found=false
292   # Loop through the user's path and test for each of PROGNAME-LIST
293   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
294 for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
296   IFS=$as_save_IFS
297   case $as_dir in #(((
298     '') as_dir=./ ;;
299     */) ;;
300     *) as_dir=$as_dir/ ;;
301   esac
302     for ac_prog in grep ggrep
303    do
304     for ac_exec_ext in '' $ac_executable_extensions; do
305       ac_path_GREP="$as_dir$ac_prog$ac_exec_ext"
306       as_fn_executable_p "$ac_path_GREP" || continue
307 # Check for GNU ac_path_GREP and select it if it is found.
308   # Check for GNU $ac_path_GREP
309 case `"$ac_path_GREP" --version 2>&1` in
310 *GNU*)
311   ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
313   ac_count=0
314   printf %s 0123456789 >"conftest.in"
315   while :
316   do
317     cat "conftest.in" "conftest.in" >"conftest.tmp"
318     mv "conftest.tmp" "conftest.in"
319     cp "conftest.in" "conftest.nl"
320     printf "%s\n" 'GREP' >> "conftest.nl"
321     "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
322     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
323     as_fn_arith $ac_count + 1 && ac_count=$as_val
324     if test $ac_count -gt ${ac_path_GREP_max-0}; then
325       # Best one so far, save it but keep looking for a better one
326       ac_cv_path_GREP="$ac_path_GREP"
327       ac_path_GREP_max=$ac_count
328     fi
329     # 10*(2^10) chars as input seems more than enough
330     test $ac_count -gt 10 && break
331   done
332   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
333 esac
335       $ac_path_GREP_found && break 3
336     done
337   done
338   done
339 IFS=$as_save_IFS
340   if test -z "$ac_cv_path_GREP"; then
341     as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
342   fi
343 else
344   ac_cv_path_GREP=$GREP
348 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
349 printf "%s\n" "$ac_cv_path_GREP" >&6; }
350  GREP="$ac_cv_path_GREP"
353 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
354 printf %s "checking for egrep... " >&6; }
355 if test ${ac_cv_path_EGREP+y}
356 then :
357   printf %s "(cached) " >&6
358 else $as_nop
359   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
360    then ac_cv_path_EGREP="$GREP -E"
361    else
362      if test -z "$EGREP"; then
363   ac_path_EGREP_found=false
364   # Loop through the user's path and test for each of PROGNAME-LIST
365   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
366 for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
368   IFS=$as_save_IFS
369   case $as_dir in #(((
370     '') as_dir=./ ;;
371     */) ;;
372     *) as_dir=$as_dir/ ;;
373   esac
374     for ac_prog in egrep
375    do
376     for ac_exec_ext in '' $ac_executable_extensions; do
377       ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext"
378       as_fn_executable_p "$ac_path_EGREP" || continue
379 # Check for GNU ac_path_EGREP and select it if it is found.
380   # Check for GNU $ac_path_EGREP
381 case `"$ac_path_EGREP" --version 2>&1` in
382 *GNU*)
383   ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
385   ac_count=0
386   printf %s 0123456789 >"conftest.in"
387   while :
388   do
389     cat "conftest.in" "conftest.in" >"conftest.tmp"
390     mv "conftest.tmp" "conftest.in"
391     cp "conftest.in" "conftest.nl"
392     printf "%s\n" 'EGREP' >> "conftest.nl"
393     "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
394     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
395     as_fn_arith $ac_count + 1 && ac_count=$as_val
396     if test $ac_count -gt ${ac_path_EGREP_max-0}; then
397       # Best one so far, save it but keep looking for a better one
398       ac_cv_path_EGREP="$ac_path_EGREP"
399       ac_path_EGREP_max=$ac_count
400     fi
401     # 10*(2^10) chars as input seems more than enough
402     test $ac_count -gt 10 && break
403   done
404   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
405 esac
407       $ac_path_EGREP_found && break 3
408     done
409   done
410   done
411 IFS=$as_save_IFS
412   if test -z "$ac_cv_path_EGREP"; then
413     as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
414   fi
415 else
416   ac_cv_path_EGREP=$EGREP
419    fi
421 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
422 printf "%s\n" "$ac_cv_path_EGREP" >&6; }
423  EGREP="$ac_cv_path_EGREP"
426 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for host_page_size in mach_host.defs" >&5
427 printf %s "checking for host_page_size in mach_host.defs... " >&6; }
428 if test ${libc_cv_mach_host_page_size+y}
429 then :
430   printf %s "(cached) " >&6
431 else $as_nop
432   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
433 /* end confdefs.h.  */
434 #include <mach/mach_host.defs>
436 _ACEOF
437 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
438   $EGREP "host_page_size" >/dev/null 2>&1
439 then :
440   libc_cv_mach_host_page_size=yes
441 else $as_nop
442   libc_cv_mach_host_page_size=no
444 rm -rf conftest*
447 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_host_page_size" >&5
448 printf "%s\n" "$libc_cv_mach_host_page_size" >&6; }
449 if test $libc_cv_mach_host_page_size = yes; then
450   printf "%s\n" "#define HAVE_HOST_PAGE_SIZE 1" >>confdefs.h
454 ac_fn_c_check_header_preproc "$LINENO" "mach/machine/ndr_def.h" "ac_cv_header_mach_machine_ndr_def_h"
455 if test "x$ac_cv_header_mach_machine_ndr_def_h" = xyes
456 then :
457     DEFINES="$DEFINES -DNDR_DEF_HEADER='<mach/machine/ndr_def.h>'"
458 else $as_nop
459   ac_fn_c_check_header_preproc "$LINENO" "machine/ndr_def.h" "ac_cv_header_machine_ndr_def_h"
460 if test "x$ac_cv_header_machine_ndr_def_h" = xyes
461 then :
462     DEFINES="$DEFINES -DNDR_DEF_HEADER='<machine/ndr_def.h>'"
468 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for i386_io_perm_modify in mach_i386.defs" >&5
469 printf %s "checking for i386_io_perm_modify in mach_i386.defs... " >&6; }
470 if test ${libc_cv_mach_i386_ioports+y}
471 then :
472   printf %s "(cached) " >&6
473 else $as_nop
474   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
475 /* end confdefs.h.  */
476 #include <mach/machine/mach_i386.defs>
478 _ACEOF
479 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
480   $EGREP "i386_io_perm_modify" >/dev/null 2>&1
481 then :
482   libc_cv_mach_i386_ioports=yes
483 else $as_nop
484   libc_cv_mach_i386_ioports=no
486 rm -rf conftest*
489 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_i386_ioports" >&5
490 printf "%s\n" "$libc_cv_mach_i386_ioports" >&6; }
491 if test $libc_cv_mach_i386_ioports = yes; then
492   printf "%s\n" "#define HAVE_I386_IO_PERM_MODIFY 1" >>confdefs.h
496 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for i386_set_gdt in mach_i386.defs" >&5
497 printf %s "checking for i386_set_gdt in mach_i386.defs... " >&6; }
498 if test ${libc_cv_mach_i386_gdt+y}
499 then :
500   printf %s "(cached) " >&6
501 else $as_nop
502   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
503 /* end confdefs.h.  */
504 #include <mach/machine/mach_i386.defs>
506 _ACEOF
507 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
508   $EGREP "i386_set_gdt" >/dev/null 2>&1
509 then :
510   libc_cv_mach_i386_gdt=yes
511 else $as_nop
512   libc_cv_mach_i386_gdt=no
514 rm -rf conftest*
517 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_i386_gdt" >&5
518 printf "%s\n" "$libc_cv_mach_i386_gdt" >&6; }
519 if test $libc_cv_mach_i386_gdt = yes; then
520   printf "%s\n" "#define HAVE_I386_SET_GDT 1" >>confdefs.h
524 CPPFLAGS=$OLD_CPPFLAGS