Fix pread consolidation on ports that require argument alignment
[glibc.git] / sysdeps / mach / configure
blob632a9c9fa47d02d0321e5188098a9553c4606e5b
3 # ac_fn_c_try_cpp LINENO
4 # ----------------------
5 # Try to preprocess conftest.$ac_ext, and return whether this succeeded.
6 ac_fn_c_try_cpp ()
8   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
9   if { { ac_try="$ac_cpp conftest.$ac_ext"
10 case "(($ac_try" in
11   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
12   *) ac_try_echo=$ac_try;;
13 esac
14 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
15 $as_echo "$ac_try_echo"; } >&5
16   (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
17   ac_status=$?
18   if test -s conftest.err; then
19     grep -v '^ *+' conftest.err >conftest.er1
20     cat conftest.er1 >&5
21     mv -f conftest.er1 conftest.err
22   fi
23   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
24   test $ac_status = 0; } > conftest.i && {
25          test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
26          test ! -s conftest.err
27        }; then :
28   ac_retval=0
29 else
30   $as_echo "$as_me: failed program was:" >&5
31 sed 's/^/| /' conftest.$ac_ext >&5
33     ac_retval=1
35   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
36   as_fn_set_status $ac_retval
38 } # ac_fn_c_try_cpp
40 # ac_fn_c_check_header_preproc LINENO HEADER VAR
41 # ----------------------------------------------
42 # Tests whether HEADER is present, setting the cache variable VAR accordingly.
43 ac_fn_c_check_header_preproc ()
45   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
46   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
47 $as_echo_n "checking for $2... " >&6; }
48 if eval \${$3+:} false; then :
49   $as_echo_n "(cached) " >&6
50 else
51   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
52 /* end confdefs.h.  */
53 #include <$2>
54 _ACEOF
55 if ac_fn_c_try_cpp "$LINENO"; then :
56   eval "$3=yes"
57 else
58   eval "$3=no"
60 rm -f conftest.err conftest.i conftest.$ac_ext
62 eval ac_res=\$$3
63                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
64 $as_echo "$ac_res" >&6; }
65   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
67 } # ac_fn_c_check_header_preproc
68 # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
70 if test -n "$ac_tool_prefix"; then
71   # Extract the first word of "${ac_tool_prefix}mig", so it can be a program name with args.
72 set dummy ${ac_tool_prefix}mig; ac_word=$2
73 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
74 $as_echo_n "checking for $ac_word... " >&6; }
75 if ${ac_cv_prog_MIG+:} false; then :
76   $as_echo_n "(cached) " >&6
77 else
78   if test -n "$MIG"; then
79   ac_cv_prog_MIG="$MIG" # Let the user override the test.
80 else
81 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
82 for as_dir in $PATH
84   IFS=$as_save_IFS
85   test -z "$as_dir" && as_dir=.
86     for ac_exec_ext in '' $ac_executable_extensions; do
87   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
88     ac_cv_prog_MIG="${ac_tool_prefix}mig"
89     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
90     break 2
91   fi
92 done
93   done
94 IFS=$as_save_IFS
98 MIG=$ac_cv_prog_MIG
99 if test -n "$MIG"; then
100   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MIG" >&5
101 $as_echo "$MIG" >&6; }
102 else
103   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
104 $as_echo "no" >&6; }
109 if test -z "$ac_cv_prog_MIG"; then
110   ac_ct_MIG=$MIG
111   # Extract the first word of "mig", so it can be a program name with args.
112 set dummy mig; ac_word=$2
113 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
114 $as_echo_n "checking for $ac_word... " >&6; }
115 if ${ac_cv_prog_ac_ct_MIG+:} false; then :
116   $as_echo_n "(cached) " >&6
117 else
118   if test -n "$ac_ct_MIG"; then
119   ac_cv_prog_ac_ct_MIG="$ac_ct_MIG" # Let the user override the test.
120 else
121 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
122 for as_dir in $PATH
124   IFS=$as_save_IFS
125   test -z "$as_dir" && as_dir=.
126     for ac_exec_ext in '' $ac_executable_extensions; do
127   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
128     ac_cv_prog_ac_ct_MIG="mig"
129     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
130     break 2
131   fi
132 done
133   done
134 IFS=$as_save_IFS
138 ac_ct_MIG=$ac_cv_prog_ac_ct_MIG
139 if test -n "$ac_ct_MIG"; then
140   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MIG" >&5
141 $as_echo "$ac_ct_MIG" >&6; }
142 else
143   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
144 $as_echo "no" >&6; }
147   if test "x$ac_ct_MIG" = x; then
148     MIG="MISSING"
149   else
150     case $cross_compiling:$ac_tool_warned in
151 yes:)
152 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
153 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
154 ac_tool_warned=yes ;;
155 esac
156     MIG=$ac_ct_MIG
157   fi
158 else
159   MIG="$ac_cv_prog_MIG"
162 if test "x$MIG" = xMISSING; then
163   as_fn_error $? "cannot find required build tool mig" "$LINENO" 5
165 config_vars="$config_vars
166 MIG = $MIG"
168 if test -n "$sysheaders"; then
169   OLD_CPPFLAGS=$CPPFLAGS
170   CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
173 ### Sanity checks for Mach header installation
176 ac_fn_c_check_header_preproc "$LINENO" "mach/mach_types.h" "ac_cv_header_mach_mach_types_h"
177 if test "x$ac_cv_header_mach_mach_types_h" = xyes; then :
179 else
180   as_fn_error $? "cannot find Mach headers" "$LINENO" 5
184 ac_fn_c_check_header_preproc "$LINENO" "mach/mach_types.defs" "ac_cv_header_mach_mach_types_defs"
185 if test "x$ac_cv_header_mach_mach_types_defs" = xyes; then :
187 else
188   as_fn_error $? "cannot find Mach .defs files" "$LINENO" 5
195 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for task_t in mach/mach_types.h" >&5
196 $as_echo_n "checking for task_t in mach/mach_types.h... " >&6; }
197 if ${libc_cv_mach_task_t+:} false; then :
198   $as_echo_n "(cached) " >&6
199 else
200   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
201 /* end confdefs.h.  */
202 #include <mach/mach_types.h>
204 main ()
206 extern task_t foo;
207   ;
208   return 0;
210 _ACEOF
211 if ac_fn_c_try_compile "$LINENO"; then :
212   libc_cv_mach_task_t=task_t
213 else
214   libc_cv_mach_task_t=task_port_t
216 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
218 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_task_t" >&5
219 $as_echo "$libc_cv_mach_task_t" >&6; }
220 if test $libc_cv_mach_task_t != task_t; then
221   DEFINES="$DEFINES -Dtask_t=task_port_t"
223 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread_t in mach/mach_types.h" >&5
224 $as_echo_n "checking for thread_t in mach/mach_types.h... " >&6; }
225 if ${libc_cv_mach_thread_t+:} false; then :
226   $as_echo_n "(cached) " >&6
227 else
228   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
229 /* end confdefs.h.  */
230 #include <mach/mach_types.h>
232 main ()
234 extern thread_t foo;
235   ;
236   return 0;
238 _ACEOF
239 if ac_fn_c_try_compile "$LINENO"; then :
240   libc_cv_mach_thread_t=thread_t
241 else
242   libc_cv_mach_thread_t=thread_port_t
244 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
246 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_thread_t" >&5
247 $as_echo "$libc_cv_mach_thread_t" >&6; }
248 if test $libc_cv_mach_thread_t != thread_t; then
249   DEFINES="$DEFINES -Dthread_t=thread_port_t"
252 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for creation_time in task_basic_info" >&5
253 $as_echo_n "checking for creation_time in task_basic_info... " >&6; }
254 if ${libc_cv_mach_task_creation_time+:} false; then :
255   $as_echo_n "(cached) " >&6
256 else
257   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
258 /* end confdefs.h.  */
259 #include <mach/task_info.h>
261 main ()
264 extern struct task_basic_info *i;
265 long s = i->creation_time.seconds;
267   ;
268   return 0;
270 _ACEOF
271 if ac_fn_c_try_compile "$LINENO"; then :
272   libc_cv_mach_task_creation_time=yes
273 else
274   libc_cv_mach_task_creation_time=no
276 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
278 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_task_creation_time" >&5
279 $as_echo "$libc_cv_mach_task_creation_time" >&6; }
280 if test $libc_cv_mach_task_creation_time = no; then
281   as_fn_error $? "you need Mach headers supporting task_info.creation_time" "$LINENO" 5
284 mach_interface_list=
285 for ifc in mach mach4 \
286            clock clock_priv host_priv host_security ledger lock_set \
287            processor processor_set task task_notify thread_act vm_map \
288            memory_object memory_object_default default_pager \
289            i386/mach_i386 \
290            ; do
291   as_ac_Header=`$as_echo "ac_cv_header_mach/${ifc}.defs" | $as_tr_sh`
292 ac_fn_c_check_header_preproc "$LINENO" "mach/${ifc}.defs" "$as_ac_Header"
293 if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
294     mach_interface_list="$mach_interface_list $ifc"
298 done
299 if test "x$mach_interface_list" = x; then
300   as_fn_error $? "what manner of Mach is this?" "$LINENO" 5
303 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
304 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
305 if ${ac_cv_path_GREP+:} false; then :
306   $as_echo_n "(cached) " >&6
307 else
308   if test -z "$GREP"; then
309   ac_path_GREP_found=false
310   # Loop through the user's path and test for each of PROGNAME-LIST
311   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
312 for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
314   IFS=$as_save_IFS
315   test -z "$as_dir" && as_dir=.
316     for ac_prog in grep ggrep; do
317     for ac_exec_ext in '' $ac_executable_extensions; do
318       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
319       as_fn_executable_p "$ac_path_GREP" || continue
320 # Check for GNU ac_path_GREP and select it if it is found.
321   # Check for GNU $ac_path_GREP
322 case `"$ac_path_GREP" --version 2>&1` in
323 *GNU*)
324   ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
326   ac_count=0
327   $as_echo_n 0123456789 >"conftest.in"
328   while :
329   do
330     cat "conftest.in" "conftest.in" >"conftest.tmp"
331     mv "conftest.tmp" "conftest.in"
332     cp "conftest.in" "conftest.nl"
333     $as_echo 'GREP' >> "conftest.nl"
334     "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
335     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
336     as_fn_arith $ac_count + 1 && ac_count=$as_val
337     if test $ac_count -gt ${ac_path_GREP_max-0}; then
338       # Best one so far, save it but keep looking for a better one
339       ac_cv_path_GREP="$ac_path_GREP"
340       ac_path_GREP_max=$ac_count
341     fi
342     # 10*(2^10) chars as input seems more than enough
343     test $ac_count -gt 10 && break
344   done
345   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
346 esac
348       $ac_path_GREP_found && break 3
349     done
350   done
351   done
352 IFS=$as_save_IFS
353   if test -z "$ac_cv_path_GREP"; then
354     as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
355   fi
356 else
357   ac_cv_path_GREP=$GREP
361 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
362 $as_echo "$ac_cv_path_GREP" >&6; }
363  GREP="$ac_cv_path_GREP"
366 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
367 $as_echo_n "checking for egrep... " >&6; }
368 if ${ac_cv_path_EGREP+:} false; then :
369   $as_echo_n "(cached) " >&6
370 else
371   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
372    then ac_cv_path_EGREP="$GREP -E"
373    else
374      if test -z "$EGREP"; then
375   ac_path_EGREP_found=false
376   # Loop through the user's path and test for each of PROGNAME-LIST
377   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
378 for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
380   IFS=$as_save_IFS
381   test -z "$as_dir" && as_dir=.
382     for ac_prog in egrep; do
383     for ac_exec_ext in '' $ac_executable_extensions; do
384       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
385       as_fn_executable_p "$ac_path_EGREP" || continue
386 # Check for GNU ac_path_EGREP and select it if it is found.
387   # Check for GNU $ac_path_EGREP
388 case `"$ac_path_EGREP" --version 2>&1` in
389 *GNU*)
390   ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
392   ac_count=0
393   $as_echo_n 0123456789 >"conftest.in"
394   while :
395   do
396     cat "conftest.in" "conftest.in" >"conftest.tmp"
397     mv "conftest.tmp" "conftest.in"
398     cp "conftest.in" "conftest.nl"
399     $as_echo 'EGREP' >> "conftest.nl"
400     "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
401     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
402     as_fn_arith $ac_count + 1 && ac_count=$as_val
403     if test $ac_count -gt ${ac_path_EGREP_max-0}; then
404       # Best one so far, save it but keep looking for a better one
405       ac_cv_path_EGREP="$ac_path_EGREP"
406       ac_path_EGREP_max=$ac_count
407     fi
408     # 10*(2^10) chars as input seems more than enough
409     test $ac_count -gt 10 && break
410   done
411   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
412 esac
414       $ac_path_EGREP_found && break 3
415     done
416   done
417   done
418 IFS=$as_save_IFS
419   if test -z "$ac_cv_path_EGREP"; then
420     as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
421   fi
422 else
423   ac_cv_path_EGREP=$EGREP
426    fi
428 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
429 $as_echo "$ac_cv_path_EGREP" >&6; }
430  EGREP="$ac_cv_path_EGREP"
433 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for host_page_size in mach_host.defs" >&5
434 $as_echo_n "checking for host_page_size in mach_host.defs... " >&6; }
435 if ${libc_cv_mach_host_page_size+:} false; then :
436   $as_echo_n "(cached) " >&6
437 else
438   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
439 /* end confdefs.h.  */
440 #include <mach/mach_host.defs>
442 _ACEOF
443 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
444   $EGREP "host_page_size" >/dev/null 2>&1; then :
445   libc_cv_mach_host_page_size=yes
446 else
447   libc_cv_mach_host_page_size=no
449 rm -f conftest*
452 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_host_page_size" >&5
453 $as_echo "$libc_cv_mach_host_page_size" >&6; }
454 if test $libc_cv_mach_host_page_size = yes; then
455   $as_echo "#define HAVE_HOST_PAGE_SIZE 1" >>confdefs.h
459 ac_fn_c_check_header_preproc "$LINENO" "mach/machine/ndr_def.h" "ac_cv_header_mach_machine_ndr_def_h"
460 if test "x$ac_cv_header_mach_machine_ndr_def_h" = xyes; then :
461     DEFINES="$DEFINES -DNDR_DEF_HEADER='<mach/machine/ndr_def.h>'"
462 else
463   ac_fn_c_check_header_preproc "$LINENO" "machine/ndr_def.h" "ac_cv_header_machine_ndr_def_h"
464 if test "x$ac_cv_header_machine_ndr_def_h" = xyes; then :
465     DEFINES="$DEFINES -DNDR_DEF_HEADER='<machine/ndr_def.h>'"
473 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for i386_io_perm_modify in mach_i386.defs" >&5
474 $as_echo_n "checking for i386_io_perm_modify in mach_i386.defs... " >&6; }
475 if ${libc_cv_mach_i386_ioports+:} false; then :
476   $as_echo_n "(cached) " >&6
477 else
478   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
479 /* end confdefs.h.  */
480 #include <mach/i386/mach_i386.defs>
482 _ACEOF
483 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
484   $EGREP "i386_io_perm_modify" >/dev/null 2>&1; then :
485   libc_cv_mach_i386_ioports=yes
486 else
487   libc_cv_mach_i386_ioports=no
489 rm -f conftest*
492 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_i386_ioports" >&5
493 $as_echo "$libc_cv_mach_i386_ioports" >&6; }
494 if test $libc_cv_mach_i386_ioports = yes; then
495   $as_echo "#define HAVE_I386_IO_PERM_MODIFY 1" >>confdefs.h
499 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for i386_set_gdt in mach_i386.defs" >&5
500 $as_echo_n "checking for i386_set_gdt in mach_i386.defs... " >&6; }
501 if ${libc_cv_mach_i386_gdt+:} false; then :
502   $as_echo_n "(cached) " >&6
503 else
504   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
505 /* end confdefs.h.  */
506 #include <mach/i386/mach_i386.defs>
508 _ACEOF
509 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
510   $EGREP "i386_set_gdt" >/dev/null 2>&1; then :
511   libc_cv_mach_i386_gdt=yes
512 else
513   libc_cv_mach_i386_gdt=no
515 rm -f conftest*
518 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_i386_gdt" >&5
519 $as_echo "$libc_cv_mach_i386_gdt" >&6; }
520 if test $libc_cv_mach_i386_gdt = yes; then
521   $as_echo "#define HAVE_I386_SET_GDT 1" >>confdefs.h
527 # See if mig groks `retcode'.
528 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $MIG supports the retcode keyword" >&5
529 $as_echo_n "checking whether $MIG supports the retcode keyword... " >&6; }
530 if ${hurd_cv_mig_retcode+:} false; then :
531   $as_echo_n "(cached) " >&6
532 else
533   cat > conftest.defs <<\EOF
534 #include <mach/std_types.defs>
535 #include <mach/mach_types.defs>
536 subsystem foobar 1000;
537 type reply_port_t = polymorphic | MACH_MSG_TYPE_PORT_SEND_ONCE
538         ctype: mach_port_t;
539 simpleroutine foobar_reply (
540         reply_port: reply_port_t;
541         err: kern_return_t, RetCode);
543 if { ac_try='CC="${CC}" ${MIG-false} -n conftest.defs 1>&5'
544   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
545   (eval $ac_try) 2>&5
546   ac_status=$?
547   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
548   test $ac_status = 0; }; }; then
549   hurd_cv_mig_retcode=yes
550 else
551   hurd_cv_mig_retcode=no
553 rm -f conftest*
555 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hurd_cv_mig_retcode" >&5
556 $as_echo "$hurd_cv_mig_retcode" >&6; }
557 if test $hurd_cv_mig_retcode = yes; then
558   $as_echo "#define HAVE_MIG_RETCODE 1" >>confdefs.h
562 if test -n "$sysheaders"; then
563   CPPFLAGS=$OLD_CPPFLAGS