[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Update configure.ac so that we don't need glibc when running
From: |
Flavio Cruz |
Subject: |
Re: [PATCH] Update configure.ac so that we don't need glibc when running ./configure. |
Date: |
Mon, 9 Jan 2023 22:16:43 -0500 |
For x86_64-pc-gnu we still do not have a working glibc so ./configure will fail
under a freestanding environment. We force ./configure to avoid running
compiled C programs as a test which it is not needed when compiling a kernel.
---
On Mon, Jan 09, 2023 at 07:52:21PM +0100, Samuel Thibault wrote:
Flavio Cruz, le dim. 08 janv. 2023 21:49:40 -0500, a ecrit:
For x86_64-pc-gnu we still do not have a working glibc so ./configure will fail
under a freestanding environment. We force ./configure to avoid running
compiled C programs as a test which it is not needed when compiling a kernel.
---
configure.ac | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/configure.ac b/configure.ac
index 3aaa935c..06a243a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,6 +21,9 @@ AC_INIT([AC_PACKAGE_NAME], [AC_PACKAGE_VERSION],
[AC_PACKAGE_BUGREPORT],
[AC_PACKAGE_TARNAME])
AC_CONFIG_SRCDIR([kern/ipc_kobject.c])
+# We don't need glibc to compile gnumach.
+: ${CFLAGS="-ffreestanding -nostdlib"}
AIUI we can then drop these from Makefile.am?
(better not duplicate flags, that most often leads to cargo cult).
Yes, here's the revised patch.
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE(
@@ -79,7 +82,12 @@ AC_SUBST([systype])
#
AC_PROG_AWK
+# Temporarily force cross compiling mode to make sure the configure script
+# does not try to run compiled binaries.
+save_cross_compiling=$cross_compiling
+cross_compiling=yes
AM_PROG_AS
+cross_compiling=$save_cross_compiling
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
--
2.39.0
Makefile.am | 2 +-
configure.ac | 8 ++++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 7b7247c5..1bcf7941 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -43,7 +43,7 @@ AM_LDFLAGS =
GCC_INSTALL = $(shell LANG=C gcc -print-search-dirs | sed -n -e 's/install: \(.*\)/\1/p')
AM_CPPFLAGS += \
- -ffreestanding -nostdinc -imacros config.h -I $(GCC_INSTALL)/include
+ -imacros config.h -I $(GCC_INSTALL)/include
AM_CPPFLAGS += \
-I$(systype) \
diff --git a/configure.ac b/configure.ac
index 3aaa935c..8f10b5d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,6 +21,9 @@ AC_INIT([AC_PACKAGE_NAME], [AC_PACKAGE_VERSION],
[AC_PACKAGE_BUGREPORT],
[AC_PACKAGE_TARNAME])
AC_CONFIG_SRCDIR([kern/ipc_kobject.c])
+# We don't need glibc to compile gnumach.
+CFLAGS="$CFLAGS -ffreestanding -nostdlib"
+
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE(
@@ -79,7 +82,12 @@ AC_SUBST([systype])
#
AC_PROG_AWK
+# Temporarily force cross compiling mode to make sure the configure script
+# does not try to run compiled binaries.
+save_cross_compiling=$cross_compiling
+cross_compiling=yes
AM_PROG_AS
+cross_compiling=$save_cross_compiling
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
--
2.39.0