From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1792) id 4D6563AD2D73; Mon, 19 Dec 2022 00:50:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4D6563AD2D73 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1671411011; bh=E79k3blGNqwPZVHqVT8RvonOHNNKIhV7j1W5N3rVaus=; h=From:To:Subject:Date:From; b=xcC5wXjB3vSUi0JjMCwPX8YNAjzadwKVUxRWwiKgj66Ah//tW7ow1u/dt2FS3i0r8 ZwjHiOdo+wTOtOcRgRT0QamzJ9xc1Q0IO9MJz4BZxKDESIaPxfsf6i0Ors9hJ2Y89q yPljgLsuZsgv9prrOCpCWc6VvJeXaFTb66FJrr4g= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Samuel Thibault To: glibc-cvs@sourceware.org Subject: [glibc] Force use of -ffreestanding when checking for gnumach headers X-Act-Checkin: glibc X-Git-Author: Flavio Cruz X-Git-Refname: refs/heads/master X-Git-Oldrev: 71e408e45dcacf429a94b2807f75aaadd8d37cb9 X-Git-Newrev: 8b8c768e3c701ed1993789bb46acb8a12c7a93df Message-Id: <20221219005011.4D6563AD2D73@sourceware.org> Date: Mon, 19 Dec 2022 00:50:10 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8b8c768e3c701ed1993789bb46acb8a12c7a93df commit 8b8c768e3c701ed1993789bb46acb8a12c7a93df Author: Flavio Cruz Date: Sun Dec 18 19:46:15 2022 -0500 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: Diff: --- sysdeps/mach/configure | 8 +++++++- sysdeps/mach/configure.ac | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/sysdeps/mach/configure b/sysdeps/mach/configure index 739f1028a4..36f556a663 100644 --- a/sysdeps/mach/configure +++ b/sysdeps/mach/configure @@ -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 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 \ 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 ]], [[ 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