]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Force use of -ffreestanding when checking for gnumach headers
authorFlavio Cruz <flaviocruz@gmail.com>
Mon, 19 Dec 2022 00:46:15 +0000 (19:46 -0500)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 19 Dec 2022 00:49:30 +0000 (01:49 +0100)
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>

sysdeps/mach/configure
sysdeps/mach/configure.ac

index 739f1028a46f46a31ef8d5287a70d6d94ef68926..36f556a66394dbc3a6db501875bfcb4c6f82a6c3 100644 (file)
@@ -133,6 +133,8 @@ if test -n "$sysheaders"; then
 fi
 
 ### Sanity checks for Mach header installation
+old_CFLAGS=$CFLAGS
+CFLAGS="$CFLAGS -ffreestanding"
 
 
 ac_fn_c_check_header_preproc "$LINENO" "mach/mach_types.h" "ac_cv_header_mach_mach_types_h"
@@ -143,6 +145,7 @@ else
 fi
 
 
+CFLAGS=$old_CFLAGS
 ac_fn_c_check_header_preproc "$LINENO" "mach/mach_types.defs" "ac_cv_header_mach_mach_types_defs"
 if test "x$ac_cv_header_mach_mach_types_defs" = xyes; then :
 
@@ -216,7 +219,9 @@ $as_echo_n "checking for creation_time in task_basic_info... " >&6; }
 if ${libc_cv_mach_task_creation_time+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  old_CFLAGS=$CFLAGS
+CFLAGS="$CFLAGS -ffreestanding"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <mach/task_info.h>
 int
@@ -242,6 +247,7 @@ $as_echo "$libc_cv_mach_task_creation_time" >&6; }
 if test $libc_cv_mach_task_creation_time = no; then
   as_fn_error $? "you need Mach headers supporting task_info.creation_time" "$LINENO" 5
 fi
+CFLAGS=$old_CFLAGS
 
 mach_interface_list=
 for ifc in mach mach4 gnumach \
index 61b00d66b109121937e64fb550b2504d0c224515..5816c3d4ad45cae32fbbb4090aaa0d2c6211e4f8 100644 (file)
@@ -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>