1 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
3 AC_CHECK_TOOL(MIG, mig, MISSING)
4 if test "x$MIG" = xMISSING; then
5 AC_MSG_ERROR([cannot find required build tool mig])
8 ### Sanity checks for Mach header installation
9 AC_CHECK_HEADER(mach/mach_types.h,,
10 [AC_MSG_ERROR([cannot find Mach headers])], -)
11 AC_CHECK_HEADER(mach/mach_types.defs,, [dnl
12 AC_MSG_ERROR([cannot find Mach .defs files])], -)
15 dnl mach_TYPE_CHECK(foo_t, bar_t)
17 dnl Check if foo_t is defined by <mach/mach_types.h>.
18 dnl If not, compile with -Dfoo_t=bar_t.
20 AC_DEFUN([mach_TYPE_CHECK], [dnl
21 AC_CACHE_CHECK(for $1 in mach/mach_types.h, libc_cv_mach_$1,
22 AC_TRY_COMPILE([#include <mach/mach_types.h>], [extern $1 foo;],
23 libc_cv_mach_$1=$1, libc_cv_mach_$1=$2))
24 if test [$]libc_cv_mach_$1 != $1; then
25 DEFINES="$DEFINES -D$1=$2"
29 dnl OSF Mach has renamed these typedefs for some reason.
31 mach_TYPE_CHECK(task_t, task_port_t)
32 mach_TYPE_CHECK(thread_t, thread_port_t)
35 dnl The creation_time field is a GNU Mach addition the other variants lack.
37 AC_CACHE_CHECK(for creation_time in task_basic_info,
38 libc_cv_mach_task_creation_time, [dnl
39 AC_TRY_COMPILE([#include <mach/task_info.h>], [
40 extern struct task_basic_info *i;
41 long s = i->creation_time.seconds;
42 ], libc_cv_mach_task_creation_time=yes, libc_cv_mach_task_creation_time=no)])
43 if test $libc_cv_mach_task_creation_time = no; then
44 AC_MSG_ERROR([you need Mach headers supporting task_info.creation_time])
48 dnl The Darwin variant no longer has <mach/mach.defs>
49 dnl but instead has several constituent .defs files.
50 dnl In this scenario we will presume there is a <mach/mach_interface.h>
51 dnl that contains an #include for each constituent header file,
52 dnl but we don't do a check for that here because in a bare
53 dnl environment the compile against those headers will fail.
56 for ifc in mach mach4 \
57 clock clock_priv host_priv host_security ledger lock_set \
58 processor processor_set task thread_act vm_map \
59 memory_object memory_object_default default_pager \
62 AC_CHECK_HEADER(mach/${ifc}.defs, [dnl
63 mach_interface_list="$mach_interface_list $ifc"],, -)
65 if test "x$mach_interface_list" = x; then
66 AC_MSG_ERROR([what manner of Mach is this?])
69 AC_CACHE_CHECK(for host_page_size in mach_host.defs,
70 libc_cv_mach_host_page_size, [dnl
71 AC_EGREP_HEADER(host_page_size, mach/mach_host.defs,
72 libc_cv_mach_host_page_size=yes,
73 libc_cv_mach_host_page_size=no)])
74 if test $libc_cv_mach_host_page_size = yes; then
75 AC_DEFINE([HAVE_HOST_PAGE_SIZE])
78 AC_CHECK_HEADER(mach/machine/ndr_def.h, [dnl
79 DEFINES="$DEFINES -DNDR_DEF_HEADER='<mach/machine/ndr_def.h>'"], [dnl
80 AC_CHECK_HEADER(machine/ndr_def.h, [dnl
81 DEFINES="$DEFINES -DNDR_DEF_HEADER='<machine/ndr_def.h>'"],, -)], -)
83 AC_CACHE_CHECK(for i386_io_perm_modify in mach_i386.defs,
84 libc_cv_mach_i386_ioports, [dnl
85 AC_EGREP_HEADER(i386_io_perm_modify, mach/i386/mach_i386.defs,
86 libc_cv_mach_i386_ioports=yes,
87 libc_cv_mach_i386_ioports=no)])
88 if test $libc_cv_mach_i386_ioports = yes; then
89 AC_DEFINE([HAVE_I386_IO_PERM_MODIFY])
92 AC_CACHE_CHECK(for i386_set_gdt in mach_i386.defs,
93 libc_cv_mach_i386_gdt, [dnl
94 AC_EGREP_HEADER(i386_set_gdt, mach/i386/mach_i386.defs,
95 libc_cv_mach_i386_gdt=yes,
96 libc_cv_mach_i386_gdt=no)])
97 if test $libc_cv_mach_i386_gdt = yes; then
98 AC_DEFINE([HAVE_I386_SET_GDT])
101 dnl Swiped from hurd/aclocal.m4
102 AC_DEFUN([hurd_MIG_RETCODE], [dnl
103 # See if mig groks `retcode'.
104 AC_CACHE_CHECK(whether $MIG supports the retcode keyword, hurd_cv_mig_retcode,
105 [cat > conftest.defs <<\EOF
106 #include <mach/std_types.defs>
107 #include <mach/mach_types.defs>
108 subsystem foobar 1000;
109 type reply_port_t = polymorphic | MACH_MSG_TYPE_PORT_SEND_ONCE
111 simpleroutine foobar_reply (
112 reply_port: reply_port_t;
113 err: kern_return_t, RetCode);
115 if AC_TRY_COMMAND([CC="${CC}" ${MIG-false} -n conftest.defs 1>&AS_MESSAGE_LOG_FD]); then
116 hurd_cv_mig_retcode=yes
118 hurd_cv_mig_retcode=no
121 if test $hurd_cv_mig_retcode = yes; then
122 AC_DEFINE(HAVE_MIG_RETCODE)