summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2023-01-09 22:16:43 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-10 22:09:04 +0100
commitd5e5dd3401ea0d0475aa830c2171be5b8a72f4fa (patch)
tree9bb1928b9d395eb498bfa5319ffffa7882452794
parent80a022e8e7738e2c616ac793f53c6b5005300101 (diff)
Update configure.ac so that we don't need glibc when running ./configure.
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. Message-Id: <Y7zYm44O0CNayuAe@jupiter.tail36e24.ts.net>
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac8
2 files changed, 10 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 7b7247c5..fb557ba6 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) \
@@ -181,7 +181,7 @@ MOSTLYCLEANFILES += gnumach-undef-bad
libgcc-routines.o: gnumach-undef gnumach-undef-bad
$(AM_V_at) if test -s gnumach-undef-bad; \
then cat gnumach-undef-bad; exit 2; else true; fi
- $(AM_V_CCLD) $(CCLD) $(LDFLAGS) -nostdlib -nostartfiles -r -static \
+ $(AM_V_CCLD) $(CCLD) $(LDFLAGS) -r -static \
-o $@ `sed 's/^/-Wl,-u,/' < $<` -x c /dev/null -lgcc
@if nm $@ | grep __init_cpu_features; \
then echo "Please install a 32bit libc without multiarch support (on Debian systems, the libc6-dev:i386 package containing /usr/lib/i386-linux-gnu/libc.a)". ; \
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