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