Add missing magic to GLIBC_PROVIDES.
[glibc.git] / sysdeps / mach / configure
blob33cf09bd719a9ffc18735e0129d247c553d38047
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.in 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
166 ### Sanity checks for Mach header installation
169 ac_fn_c_check_header_preproc "$LINENO" "mach/mach_types.h" "ac_cv_header_mach_mach_types_h"
170 if test "x$ac_cv_header_mach_mach_types_h" = xyes; then :
172 else
173   as_fn_error $? "cannot find Mach headers" "$LINENO" 5
177 ac_fn_c_check_header_preproc "$LINENO" "mach/mach_types.defs" "ac_cv_header_mach_mach_types_defs"
178 if test "x$ac_cv_header_mach_mach_types_defs" = xyes; then :
180 else
181   as_fn_error $? "cannot find Mach .defs files" "$LINENO" 5
188 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for task_t in mach/mach_types.h" >&5
189 $as_echo_n "checking for task_t in mach/mach_types.h... " >&6; }
190 if ${libc_cv_mach_task_t+:} false; then :
191   $as_echo_n "(cached) " >&6
192 else
193   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
194 /* end confdefs.h.  */
195 #include <mach/mach_types.h>
197 main ()
199 extern task_t foo;
200   ;
201   return 0;
203 _ACEOF
204 if ac_fn_c_try_compile "$LINENO"; then :
205   libc_cv_mach_task_t=task_t
206 else
207   libc_cv_mach_task_t=task_port_t
209 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
211 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_task_t" >&5
212 $as_echo "$libc_cv_mach_task_t" >&6; }
213 if test $libc_cv_mach_task_t != task_t; then
214   DEFINES="$DEFINES -Dtask_t=task_port_t"
216 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread_t in mach/mach_types.h" >&5
217 $as_echo_n "checking for thread_t in mach/mach_types.h... " >&6; }
218 if ${libc_cv_mach_thread_t+:} false; then :
219   $as_echo_n "(cached) " >&6
220 else
221   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
222 /* end confdefs.h.  */
223 #include <mach/mach_types.h>
225 main ()
227 extern thread_t foo;
228   ;
229   return 0;
231 _ACEOF
232 if ac_fn_c_try_compile "$LINENO"; then :
233   libc_cv_mach_thread_t=thread_t
234 else
235   libc_cv_mach_thread_t=thread_port_t
237 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
239 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_thread_t" >&5
240 $as_echo "$libc_cv_mach_thread_t" >&6; }
241 if test $libc_cv_mach_thread_t != thread_t; then
242   DEFINES="$DEFINES -Dthread_t=thread_port_t"
245 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for creation_time in task_basic_info" >&5
246 $as_echo_n "checking for creation_time in task_basic_info... " >&6; }
247 if ${libc_cv_mach_task_creation_time+:} false; then :
248   $as_echo_n "(cached) " >&6
249 else
250   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
251 /* end confdefs.h.  */
252 #include <mach/task_info.h>
254 main ()
257 extern struct task_basic_info *i;
258 long s = i->creation_time.seconds;
260   ;
261   return 0;
263 _ACEOF
264 if ac_fn_c_try_compile "$LINENO"; then :
265   libc_cv_mach_task_creation_time=yes
266 else
267   libc_cv_mach_task_creation_time=no
269 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
271 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_task_creation_time" >&5
272 $as_echo "$libc_cv_mach_task_creation_time" >&6; }
273 if test $libc_cv_mach_task_creation_time = no; then
274   as_fn_error $? "you need Mach headers supporting task_info.creation_time" "$LINENO" 5
277 mach_interface_list=
278 for ifc in mach mach4 \
279            clock clock_priv host_priv host_security ledger lock_set \
280            processor processor_set task thread_act vm_map \
281            memory_object memory_object_default default_pager \
282            i386/mach_i386 \
283            ; do
284   as_ac_Header=`$as_echo "ac_cv_header_mach/${ifc}.defs" | $as_tr_sh`
285 ac_fn_c_check_header_preproc "$LINENO" "mach/${ifc}.defs" "$as_ac_Header"
286 if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
287     mach_interface_list="$mach_interface_list $ifc"
291 done
292 if test "x$mach_interface_list" = x; then
293   as_fn_error $? "what manner of Mach is this?" "$LINENO" 5
296 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
297 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
298 if ${ac_cv_path_GREP+:} false; then :
299   $as_echo_n "(cached) " >&6
300 else
301   if test -z "$GREP"; then
302   ac_path_GREP_found=false
303   # Loop through the user's path and test for each of PROGNAME-LIST
304   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
305 for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
307   IFS=$as_save_IFS
308   test -z "$as_dir" && as_dir=.
309     for ac_prog in grep ggrep; do
310     for ac_exec_ext in '' $ac_executable_extensions; do
311       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
312       { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
313 # Check for GNU ac_path_GREP and select it if it is found.
314   # Check for GNU $ac_path_GREP
315 case `"$ac_path_GREP" --version 2>&1` in
316 *GNU*)
317   ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
319   ac_count=0
320   $as_echo_n 0123456789 >"conftest.in"
321   while :
322   do
323     cat "conftest.in" "conftest.in" >"conftest.tmp"
324     mv "conftest.tmp" "conftest.in"
325     cp "conftest.in" "conftest.nl"
326     $as_echo 'GREP' >> "conftest.nl"
327     "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
328     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
329     as_fn_arith $ac_count + 1 && ac_count=$as_val
330     if test $ac_count -gt ${ac_path_GREP_max-0}; then
331       # Best one so far, save it but keep looking for a better one
332       ac_cv_path_GREP="$ac_path_GREP"
333       ac_path_GREP_max=$ac_count
334     fi
335     # 10*(2^10) chars as input seems more than enough
336     test $ac_count -gt 10 && break
337   done
338   rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
339 esac
341       $ac_path_GREP_found && break 3
342     done
343   done
344   done
345 IFS=$as_save_IFS
346   if test -z "$ac_cv_path_GREP"; then
347     as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
348   fi
349 else
350   ac_cv_path_GREP=$GREP
354 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
355 $as_echo "$ac_cv_path_GREP" >&6; }
356  GREP="$ac_cv_path_GREP"
359 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
360 $as_echo_n "checking for egrep... " >&6; }
361 if ${ac_cv_path_EGREP+:} false; then :
362   $as_echo_n "(cached) " >&6
363 else
364   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
365    then ac_cv_path_EGREP="$GREP -E"
366    else
367      if test -z "$EGREP"; then
368   ac_path_EGREP_found=false
369   # Loop through the user's path and test for each of PROGNAME-LIST
370   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
371 for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
373   IFS=$as_save_IFS
374   test -z "$as_dir" && as_dir=.
375     for ac_prog in egrep; do
376     for ac_exec_ext in '' $ac_executable_extensions; do
377       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
378       { test -f "$ac_path_EGREP" && $as_test_x "$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   $as_echo_n 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     $as_echo '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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
422 $as_echo "$ac_cv_path_EGREP" >&6; }
423  EGREP="$ac_cv_path_EGREP"
426 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for host_page_size in mach_host.defs" >&5
427 $as_echo_n "checking for host_page_size in mach_host.defs... " >&6; }
428 if ${libc_cv_mach_host_page_size+:} false; then :
429   $as_echo_n "(cached) " >&6
430 else
431   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
432 /* end confdefs.h.  */
433 #include <mach/mach_host.defs>
435 _ACEOF
436 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
437   $EGREP "host_page_size" >/dev/null 2>&1; then :
438   libc_cv_mach_host_page_size=yes
439 else
440   libc_cv_mach_host_page_size=no
442 rm -f conftest*
445 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_host_page_size" >&5
446 $as_echo "$libc_cv_mach_host_page_size" >&6; }
447 if test $libc_cv_mach_host_page_size = yes; then
448   $as_echo "#define HAVE_HOST_PAGE_SIZE 1" >>confdefs.h
452 ac_fn_c_check_header_preproc "$LINENO" "mach/machine/ndr_def.h" "ac_cv_header_mach_machine_ndr_def_h"
453 if test "x$ac_cv_header_mach_machine_ndr_def_h" = xyes; then :
454     DEFINES="$DEFINES -DNDR_DEF_HEADER='<mach/machine/ndr_def.h>'"
455 else
456   ac_fn_c_check_header_preproc "$LINENO" "machine/ndr_def.h" "ac_cv_header_machine_ndr_def_h"
457 if test "x$ac_cv_header_machine_ndr_def_h" = xyes; then :
458     DEFINES="$DEFINES -DNDR_DEF_HEADER='<machine/ndr_def.h>'"
466 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for i386_io_perm_modify in mach_i386.defs" >&5
467 $as_echo_n "checking for i386_io_perm_modify in mach_i386.defs... " >&6; }
468 if ${libc_cv_mach_i386_ioports+:} false; then :
469   $as_echo_n "(cached) " >&6
470 else
471   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
472 /* end confdefs.h.  */
473 #include <mach/i386/mach_i386.defs>
475 _ACEOF
476 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
477   $EGREP "i386_io_perm_modify" >/dev/null 2>&1; then :
478   libc_cv_mach_i386_ioports=yes
479 else
480   libc_cv_mach_i386_ioports=no
482 rm -f conftest*
485 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_i386_ioports" >&5
486 $as_echo "$libc_cv_mach_i386_ioports" >&6; }
487 if test $libc_cv_mach_i386_ioports = yes; then
488   $as_echo "#define HAVE_I386_IO_PERM_MODIFY 1" >>confdefs.h
492 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for i386_set_gdt in mach_i386.defs" >&5
493 $as_echo_n "checking for i386_set_gdt in mach_i386.defs... " >&6; }
494 if ${libc_cv_mach_i386_gdt+:} false; then :
495   $as_echo_n "(cached) " >&6
496 else
497   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
498 /* end confdefs.h.  */
499 #include <mach/i386/mach_i386.defs>
501 _ACEOF
502 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
503   $EGREP "i386_set_gdt" >/dev/null 2>&1; then :
504   libc_cv_mach_i386_gdt=yes
505 else
506   libc_cv_mach_i386_gdt=no
508 rm -f conftest*
511 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_mach_i386_gdt" >&5
512 $as_echo "$libc_cv_mach_i386_gdt" >&6; }
513 if test $libc_cv_mach_i386_gdt = yes; then
514   $as_echo "#define HAVE_I386_SET_GDT 1" >>confdefs.h
520 # See if mig groks `retcode'.
521 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $MIG supports the retcode keyword" >&5
522 $as_echo_n "checking whether $MIG supports the retcode keyword... " >&6; }
523 if ${hurd_cv_mig_retcode+:} false; then :
524   $as_echo_n "(cached) " >&6
525 else
526   cat > conftest.defs <<\EOF
527 #include <mach/std_types.defs>
528 #include <mach/mach_types.defs>
529 subsystem foobar 1000;
530 type reply_port_t = polymorphic | MACH_MSG_TYPE_PORT_SEND_ONCE
531         ctype: mach_port_t;
532 simpleroutine foobar_reply (
533         reply_port: reply_port_t;
534         err: kern_return_t, RetCode);
536 if { ac_try='CC="${CC}" ${MIG-false} -n conftest.defs 1>&5'
537   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
538   (eval $ac_try) 2>&5
539   ac_status=$?
540   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
541   test $ac_status = 0; }; }; then
542   hurd_cv_mig_retcode=yes
543 else
544   hurd_cv_mig_retcode=no
546 rm -f conftest*
548 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hurd_cv_mig_retcode" >&5
549 $as_echo "$hurd_cv_mig_retcode" >&6; }
550 if test $hurd_cv_mig_retcode = yes; then
551   $as_echo "#define HAVE_MIG_RETCODE 1" >>confdefs.h