build: Make eltorito-efi build manually toggleable
diff --git a/GNUmakefile.in b/GNUmakefile.in
index 334f7c66..fcb7d6ef 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -16,6 +16,8 @@ NASMESCAPE = $(subst ','"'$(COMMA) \"'\"$(COMMA) '"',$(1))
override PATH := $(BUILDDIR)/toolchain/bin:/usr/local/bin:$(PATH)
export PATH
+override BUILD_ELTORITO_EFI := @build_eltorito_efi@
+
WERROR ?= @werror@
export WERROR
@@ -140,6 +142,7 @@ limine-bios: common-bios decompressor
.PHONY: limine-eltorito-efi
limine-eltorito-efi:
+ifeq ($(BUILD_ELTORITO_EFI), yes)
mkdir -p '$(call SHESCAPE,$(BINDIR))'
dd if=/dev/zero of='$(call SHESCAPE,$(BINDIR))/limine-eltorito-efi.bin' bs=512 count=2880 2>/dev/null
( mformat -i '$(call SHESCAPE,$(BINDIR))/limine-eltorito-efi.bin' -f 1440 :: && \
@@ -150,6 +153,7 @@ limine-eltorito-efi:
( ( [ -f '$(call SHESCAPE,$(BUILDDIR))/common-uefi32/BOOTIA32.EFI' ] && \
mcopy -D o -i '$(call SHESCAPE,$(BINDIR))/limine-eltorito-efi.bin' '$(call SHESCAPE,$(BUILDDIR))/common-uefi32/BOOTIA32.EFI' ::/EFI/BOOT ) || true ) \
) || rm -f '$(call SHESCAPE,$(BINDIR))/limine-eltorito-efi.bin'
+endif
.PHONY: limine-uefi
limine-uefi: limine-uefi32 limine-uefi64
diff --git a/configure.ac b/configure.ac
index 1d1315d6..4a4b521a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,9 +41,20 @@ if ! test "x$GZIP_FOUND" = "xyes"; then
AC_MSG_ERROR([gzip not found, please install gzip before configuring])
fi
+BUILD_ELTORITO_EFI="yes"
+
+AC_ARG_ENABLE([eltorito-efi],
+ AS_HELP_STRING([--disable-eltorito-efi], [disable limine-eltorito-efi.bin build]),
+ BUILD_ELTORITO_EFI="$enableval")
+
AC_CHECK_PROG([MTOOLS_FOUND], [mcopy], [yes])
if ! test "x$MTOOLS_FOUND" = "xyes"; then
AC_MSG_WARN([mtools not found, install mtools to build limine-eltorito-efi.bin])
+ BUILD_ELTORITO_EFI="no"
+fi
+
+if test "$BUILD_ELTORITO_EFI" = "yes"; then
+ AC_SUBST(build_eltorito_efi, [yes])
fi
AC_ARG_VAR(HOST_CC, [C compiler for the build host [default: $CC]])
