Blame sysdeps/mach/configure.ac

Packit 6c4009
GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
Packit 6c4009
Packit 6c4009
AC_CHECK_TOOL(MIG, mig, MISSING)
Packit 6c4009
if test "x$MIG" = xMISSING; then
Packit 6c4009
  AC_MSG_ERROR([cannot find required build tool mig])
Packit 6c4009
fi
Packit 6c4009
LIBC_CONFIG_VAR([MIG], [$MIG])
Packit 6c4009
Packit 6c4009
if test -n "$sysheaders"; then
Packit 6c4009
  OLD_CPPFLAGS=$CPPFLAGS
Packit 6c4009
  CPPFLAGS="$CPPFLAGS $SYSINCLUDES"
Packit 6c4009
fi
Packit 6c4009
Packit 6c4009
### Sanity checks for Mach header installation
Packit 6c4009
AC_CHECK_HEADER(mach/mach_types.h,,
Packit 6c4009
                [AC_MSG_ERROR([cannot find Mach headers])], -)
Packit 6c4009
AC_CHECK_HEADER(mach/mach_types.defs,, [dnl
Packit 6c4009
AC_MSG_ERROR([cannot find Mach .defs files])], -)
Packit 6c4009
Packit 6c4009
dnl
Packit 6c4009
dnl mach_TYPE_CHECK(foo_t, bar_t)
Packit 6c4009
dnl
Packit 6c4009
dnl Check if foo_t is defined by <mach/mach_types.h>.
Packit 6c4009
dnl If not, compile with -Dfoo_t=bar_t.
Packit 6c4009
dnl
Packit 6c4009
AC_DEFUN([mach_TYPE_CHECK], [dnl
Packit 6c4009
AC_CACHE_CHECK(for $1 in mach/mach_types.h, libc_cv_mach_$1,
Packit 6c4009
AC_TRY_COMPILE([#include <mach/mach_types.h>], [extern $1 foo;],
Packit 6c4009
libc_cv_mach_$1=$1, libc_cv_mach_$1=$2))
Packit 6c4009
if test [$]libc_cv_mach_$1 != $1; then
Packit 6c4009
  DEFINES="$DEFINES -D$1=$2"
Packit 6c4009
fi])
Packit 6c4009
Packit 6c4009
dnl
Packit 6c4009
dnl OSF Mach has renamed these typedefs for some reason.
Packit 6c4009
dnl
Packit 6c4009
mach_TYPE_CHECK(task_t, task_port_t)
Packit 6c4009
mach_TYPE_CHECK(thread_t, thread_port_t)
Packit 6c4009
Packit 6c4009
dnl
Packit 6c4009
dnl The creation_time field is a GNU Mach addition the other variants lack.
Packit 6c4009
dnl
Packit 6c4009
AC_CACHE_CHECK(for creation_time in task_basic_info,
Packit 6c4009
	       libc_cv_mach_task_creation_time, [dnl
Packit 6c4009
AC_TRY_COMPILE([#include <mach/task_info.h>], [
Packit 6c4009
extern struct task_basic_info *i;
Packit 6c4009
long s = i->creation_time.seconds;
Packit 6c4009
], libc_cv_mach_task_creation_time=yes, libc_cv_mach_task_creation_time=no)])
Packit 6c4009
if test $libc_cv_mach_task_creation_time = no; then
Packit 6c4009
  AC_MSG_ERROR([you need Mach headers supporting task_info.creation_time])
Packit 6c4009
fi
Packit 6c4009
Packit 6c4009
dnl
Packit 6c4009
dnl The Darwin variant no longer has <mach/mach.defs>
Packit 6c4009
dnl but instead has several constituent .defs files.
Packit 6c4009
dnl In this scenario we will presume there is a <mach/mach_interface.h>
Packit 6c4009
dnl that contains an #include for each constituent header file,
Packit 6c4009
dnl but we don't do a check for that here because in a bare
Packit 6c4009
dnl environment the compile against those headers will fail.
Packit 6c4009
dnl
Packit 6c4009
mach_interface_list=
Packit 6c4009
for ifc in mach mach4 gnumach \
Packit 6c4009
	   clock clock_priv host_priv host_security ledger lock_set \
Packit 6c4009
	   processor processor_set task task_notify thread_act vm_map \
Packit 6c4009
	   memory_object memory_object_default default_pager \
Packit 6c4009
	   i386/mach_i386 \
Packit 6c4009
	   ; do
Packit 6c4009
  AC_CHECK_HEADER(mach/${ifc}.defs, [dnl
Packit 6c4009
  mach_interface_list="$mach_interface_list $ifc"],, -)
Packit 6c4009
done
Packit 6c4009
if test "x$mach_interface_list" = x; then
Packit 6c4009
  AC_MSG_ERROR([what manner of Mach is this?])
Packit 6c4009
fi
Packit 6c4009
Packit 6c4009
AC_CACHE_CHECK(for host_page_size in mach_host.defs,
Packit 6c4009
	       libc_cv_mach_host_page_size, [dnl
Packit 6c4009
AC_EGREP_HEADER(host_page_size, mach/mach_host.defs,
Packit 6c4009
		libc_cv_mach_host_page_size=yes,
Packit 6c4009
		libc_cv_mach_host_page_size=no)])
Packit 6c4009
if test $libc_cv_mach_host_page_size = yes; then
Packit 6c4009
  AC_DEFINE([HAVE_HOST_PAGE_SIZE])
Packit 6c4009
fi
Packit 6c4009
Packit 6c4009
AC_CHECK_HEADER(mach/machine/ndr_def.h, [dnl
Packit 6c4009
  DEFINES="$DEFINES -DNDR_DEF_HEADER='<mach/machine/ndr_def.h>'"], [dnl
Packit 6c4009
AC_CHECK_HEADER(machine/ndr_def.h, [dnl
Packit 6c4009
  DEFINES="$DEFINES -DNDR_DEF_HEADER='<machine/ndr_def.h>'"],, -)], -)
Packit 6c4009
Packit 6c4009
AC_CACHE_CHECK(for i386_io_perm_modify in mach_i386.defs,
Packit 6c4009
	       libc_cv_mach_i386_ioports, [dnl
Packit 6c4009
AC_EGREP_HEADER(i386_io_perm_modify, mach/i386/mach_i386.defs,
Packit 6c4009
		libc_cv_mach_i386_ioports=yes,
Packit 6c4009
		libc_cv_mach_i386_ioports=no)])
Packit 6c4009
if test $libc_cv_mach_i386_ioports = yes; then
Packit 6c4009
  AC_DEFINE([HAVE_I386_IO_PERM_MODIFY])
Packit 6c4009
fi
Packit 6c4009
Packit 6c4009
AC_CACHE_CHECK(for i386_set_gdt in mach_i386.defs,
Packit 6c4009
	       libc_cv_mach_i386_gdt, [dnl
Packit 6c4009
AC_EGREP_HEADER(i386_set_gdt, mach/i386/mach_i386.defs,
Packit 6c4009
		libc_cv_mach_i386_gdt=yes,
Packit 6c4009
		libc_cv_mach_i386_gdt=no)])
Packit 6c4009
if test $libc_cv_mach_i386_gdt = yes; then
Packit 6c4009
  AC_DEFINE([HAVE_I386_SET_GDT])
Packit 6c4009
fi
Packit 6c4009
Packit 6c4009
dnl Swiped from hurd/aclocal.m4
Packit 6c4009
AC_DEFUN([hurd_MIG_RETCODE], [dnl
Packit 6c4009
# See if mig groks `retcode'.
Packit 6c4009
AC_CACHE_CHECK(whether $MIG supports the retcode keyword, hurd_cv_mig_retcode,
Packit 6c4009
[cat > conftest.defs <<\EOF
Packit 6c4009
#include <mach/std_types.defs>
Packit 6c4009
#include <mach/mach_types.defs>
Packit 6c4009
subsystem foobar 1000;
Packit 6c4009
type reply_port_t = polymorphic | MACH_MSG_TYPE_PORT_SEND_ONCE
Packit 6c4009
	ctype: mach_port_t;
Packit 6c4009
simpleroutine foobar_reply (
Packit 6c4009
	reply_port: reply_port_t;
Packit 6c4009
	err: kern_return_t, RetCode);
Packit 6c4009
EOF
Packit 6c4009
if AC_TRY_COMMAND([CC="${CC}" ${MIG-false} -n conftest.defs 1>&AS_MESSAGE_LOG_FD]); then
Packit 6c4009
  hurd_cv_mig_retcode=yes
Packit 6c4009
else
Packit 6c4009
  hurd_cv_mig_retcode=no
Packit 6c4009
fi
Packit 6c4009
rm -f conftest*])
Packit 6c4009
if test $hurd_cv_mig_retcode = yes; then
Packit 6c4009
  AC_DEFINE(HAVE_MIG_RETCODE)
Packit 6c4009
fi])
Packit 6c4009
Packit 6c4009
hurd_MIG_RETCODE
Packit 6c4009
Packit 6c4009
if test -n "$sysheaders"; then
Packit 6c4009
  CPPFLAGS=$OLD_CPPFLAGS
Packit 6c4009
fi