113 lines
4.3 KiB
Plaintext
113 lines
4.3 KiB
Plaintext
# Copyright (C) 2024 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
AC_INIT([gnuboot],[0.1],[gnuboot@gnu.org])
|
|
AM_INIT_AUTOMAKE([foreign])
|
|
AC_CONFIG_FILES([
|
|
Makefile
|
|
resources/packages/i945-thinkpads-install-utilities/Makefile
|
|
])
|
|
|
|
AC_SUBST([ENABLE_KVM], [])
|
|
AC_SUBST([GUIX_BUILD_MAX_CORES], [])
|
|
|
|
# When the Guix revision changes, the output changes, so we need to
|
|
# rebuild it. By not having the revision configurable through
|
|
# configure arguments, we make things easier because when the
|
|
# Makefiles are updated, things should be rebuilt anyway.
|
|
#
|
|
# In addition we currently use a released Guix revision and backport
|
|
# the changes we need from more recent Guix versions for several
|
|
# reasons:
|
|
#
|
|
# - Guix hosts the documentation of its latest release on its website,
|
|
# so by using the latest Guix release, we also enable GNU Boot
|
|
# contributors to have access to the corresponding Guix
|
|
# documentation without having to build and/or host it.
|
|
#
|
|
# - On most distributions, users don't need to run guix pull anymore
|
|
# to start downloading Guix 1.4.0 packages. So that can make things
|
|
# a lot faster.
|
|
|
|
AC_SUBST([GUIX_REVISION], [8e2f32cee982d42a79e53fc1e9aa7b8ff0514714])
|
|
|
|
# --enable-kvm
|
|
AC_ARG_ENABLE(kvm,
|
|
[AS_HELP_STRING([--disable-kvm],
|
|
[Disable KVM virtualization when building VMs.
|
|
(default=enabled)])],
|
|
[kvm="$enableval"],
|
|
[kvm="yes"])
|
|
|
|
AM_CONDITIONAL( [WANT_KVM], [test x"$kvm" = x"yes"])
|
|
|
|
# --with-guix-build-max-cores
|
|
AC_ARG_WITH([guix-build-max-cores],
|
|
[AS_HELP_STRING([--with-guix-build-max-cores=N],
|
|
[Force guix build the use of up to N CPU cores for the build.
|
|
Lowering the number of cores used can help when there is not
|
|
enough RAM per core.])],
|
|
[GUIX_BUILD_MAX_CORES=$withval],
|
|
[GUIX_BUILD_MAX_CORES=0])
|
|
|
|
AC_CHECK_PROG([FOUND_GUIX], [guix], [guix])
|
|
AS_IF([test x"$FOUND_GUIX" = x""],
|
|
[AC_MSG_ERROR(
|
|
[guix was not found in PATH ($PATH)])])
|
|
|
|
dnl In theory we could test KVM with the 'echo quit |
|
|
dnl qemu-system-x86_64 -display none -vga none -enable-kvm -monitor
|
|
dnl stdio' command, but then we would need to require users to install
|
|
dnl qemu just for this test, because in the rest of GNU Boot we use
|
|
dnl Guix's qemu instead. The solution here could then be to use Guix
|
|
dnl here as well to do a real test, but this would require more work
|
|
dnl to make sure guix always works out of the box here too, and so
|
|
dnl help is welcome for doing that.
|
|
AS_IF([test x"$kvm" = x"yes"],
|
|
[AS_IF([test -c /dev/kvm], [], AC_MSG_ERROR([/dev/kvm not found.]))
|
|
AS_IF([test -r /dev/kvm],
|
|
[],
|
|
AC_MSG_ERROR([/dev/kvm: missing read permissions.]))
|
|
AS_IF([test -w /dev/kvm],
|
|
[],
|
|
AC_MSG_ERROR([/dev/kvm: missing write permissions.]))
|
|
])
|
|
|
|
dnl We want to be able to access variables like host_cpu, so we
|
|
dnl (ab)use AC_PROG_LIBTOOL to get that.
|
|
AC_PROG_LIBTOOL
|
|
|
|
# Generate a config.sh file to enable script shell to retrieve some
|
|
# settings by sourcing it.
|
|
printf '#!/usr/bin/env bash\n' > config.sh
|
|
printf '# This file is generated by configure.ac\n' >> config.sh
|
|
printf 'GUIX_BUILD_MAX_CORES=%s\n' "$GUIX_BUILD_MAX_CORES" >> config.sh
|
|
printf 'GUIX_REVISION=%s\n' "$GUIX_REVISION" >> config.sh
|
|
printf 'build_cpu=%s\n' "$build_cpu" >> config.sh
|
|
printf 'kvm=%s # kvm possible values: yes, no\n' "$kvm" >> config.sh
|
|
chmod +x config.sh
|
|
|
|
AC_OUTPUT
|
|
|
|
AS_ECHO(["Configuration options:"])
|
|
|
|
AS_IF([test x"$GUIX_BUILD_MAX_CORES" = x"0"],
|
|
AS_ECHO([" GUIX_BUILD_MAX_CORES: not limited."]),
|
|
AS_ECHO([" GUIX_BUILD_MAX_CORES: $GUIX_BUILD_MAX_CORES"]))
|
|
AS_IF([test x"$kvm" = x"yes"],
|
|
[AS_ECHO([" KVM: enabled"])],
|
|
[AS_ECHO([" KVM: disabled"])])
|
|
AS_ECHO([" build_cpu: $build_cpu"])
|