about summary refs log tree commit diff
path: root/sysdeps/mach/configure.ac
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2022-12-18 19:46:15 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-12-19 01:49:30 +0100
commit8b8c768e3c701ed1993789bb46acb8a12c7a93df (patch)
tree3b97ed037df898e99ec59a0e3ac482c9aa53cdb7 /sysdeps/mach/configure.ac
parent71e408e45dcacf429a94b2807f75aaadd8d37cb9 (diff)
downloadglibc-8b8c768e3c701ed1993789bb46acb8a12c7a93df.tar.gz
glibc-8b8c768e3c701ed1993789bb46acb8a12c7a93df.tar.xz
glibc-8b8c768e3c701ed1993789bb46acb8a12c7a93df.zip
Force use of -ffreestanding when checking for gnumach headers
Without this ./configure assumes that we are in a fully hosted
environment, which might not be the case. After this patch, we can rely on
the freestanding header files provided by GCC such as stdint.h.
Message-Id: <Y5+0V9osFc/zXMq0@mars>
Diffstat (limited to 'sysdeps/mach/configure.ac')
-rw-r--r--sysdeps/mach/configure.ac6
1 files changed, 6 insertions, 0 deletions
diff --git a/sysdeps/mach/configure.ac b/sysdeps/mach/configure.ac
index 61b00d66b1..5816c3d4ad 100644
--- a/sysdeps/mach/configure.ac
+++ b/sysdeps/mach/configure.ac
@@ -12,8 +12,11 @@ if test -n "$sysheaders"; then
 fi
 
 ### Sanity checks for Mach header installation
+old_CFLAGS=$CFLAGS
+CFLAGS="$CFLAGS -ffreestanding"
 AC_CHECK_HEADER(mach/mach_types.h,,
                 [AC_MSG_ERROR([cannot find Mach headers])], -)
+CFLAGS=$old_CFLAGS
 AC_CHECK_HEADER(mach/mach_types.defs,, [dnl
 AC_MSG_ERROR([cannot find Mach .defs files])], -)
 
@@ -42,6 +45,8 @@ dnl The creation_time field is a GNU Mach addition the other variants lack.
 dnl
 AC_CACHE_CHECK(for creation_time in task_basic_info,
 	       libc_cv_mach_task_creation_time, [dnl
+old_CFLAGS=$CFLAGS
+CFLAGS="$CFLAGS -ffreestanding"
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <mach/task_info.h>]], [[
 extern struct task_basic_info *i;
 long s = i->creation_time.seconds;
@@ -49,6 +54,7 @@ long s = i->creation_time.seconds;
 if test $libc_cv_mach_task_creation_time = no; then
   AC_MSG_ERROR([you need Mach headers supporting task_info.creation_time])
 fi
+CFLAGS=$old_CFLAGS
 
 dnl
 dnl The Darwin variant no longer has <mach/mach.defs>