2022-02-11 22:46:57 +03:00
|
|
|
AC_INIT([Limine], m4_esyscmd([./version.sh]), [https://github.com/limine-bootloader/limine/issues], [limine], [https://limine-bootloader.org/])
|
2022-01-16 08:09:36 +03:00
|
|
|
|
|
|
|
AC_PREREQ(2.69)
|
|
|
|
|
2022-01-31 13:46:19 +03:00
|
|
|
AC_CONFIG_AUX_DIR([build-aux])
|
2022-07-05 10:14:48 +03:00
|
|
|
AC_CONFIG_SUBDIRS([cross-detect])
|
2022-01-31 13:46:19 +03:00
|
|
|
|
2022-02-11 22:46:57 +03:00
|
|
|
SRCDIR="$(cd "$srcdir" && pwd -P)"
|
|
|
|
BUILDDIR="$(pwd -P)"
|
2022-01-16 08:09:36 +03:00
|
|
|
|
2022-08-26 11:23:35 +03:00
|
|
|
AC_SUBST(SRCDIR)
|
|
|
|
AC_SUBST(BUILDDIR)
|
2022-02-11 22:46:57 +03:00
|
|
|
|
2022-01-28 12:23:26 +03:00
|
|
|
test "x$CFLAGS" = "x" && CFLAGS='-g -O2 -pipe -Wall -Wextra'
|
2022-01-31 13:46:19 +03:00
|
|
|
AC_PROG_CC
|
2022-01-28 12:23:26 +03:00
|
|
|
|
|
|
|
werror_state="no"
|
|
|
|
AC_ARG_ENABLE([werror],
|
|
|
|
AS_HELP_STRING([--enable-werror], [treat warnings as errors]),
|
|
|
|
werror_state="$enableval")
|
|
|
|
|
|
|
|
if test "$werror_state" = "yes"; then
|
2022-02-11 22:46:57 +03:00
|
|
|
AC_SUBST(WERROR, [-Werror])
|
2022-01-28 12:23:26 +03:00
|
|
|
CFLAGS="$CFLAGS -Werror"
|
|
|
|
fi
|
|
|
|
|
2022-08-08 23:00:25 +03:00
|
|
|
AC_PROG_MKDIR_P
|
2022-08-22 19:41:32 +03:00
|
|
|
case "$MKDIR_P" in
|
|
|
|
.*) MKDIR_P="$(cd "$(dirname "$MKDIR_P")" && pwd -P)/$(basename "$MKDIR_P")" ;;
|
|
|
|
esac
|
2022-01-22 05:46:48 +03:00
|
|
|
AC_PROG_INSTALL
|
2022-08-22 19:41:32 +03:00
|
|
|
case "$INSTALL" in
|
|
|
|
.*) INSTALL="$(cd "$(dirname "$INSTALL")" && pwd -P)/$(basename "$INSTALL")" ;;
|
|
|
|
esac
|
2022-02-01 10:04:55 +03:00
|
|
|
AC_PROG_GREP
|
|
|
|
AC_PROG_SED
|
|
|
|
AC_PROG_AWK
|
|
|
|
|
|
|
|
AC_CHECK_PROG([FIND_FOUND], [find], [yes])
|
|
|
|
if ! test "x$FIND_FOUND" = "xyes"; then
|
|
|
|
AC_MSG_ERROR([find not found, please install find before configuring])
|
|
|
|
fi
|
2022-01-16 08:09:36 +03:00
|
|
|
|
2022-01-31 13:46:19 +03:00
|
|
|
AC_CHECK_PROG([NASM_FOUND], [nasm], [yes])
|
|
|
|
if ! test "x$NASM_FOUND" = "xyes"; then
|
2022-02-01 10:04:55 +03:00
|
|
|
AC_MSG_ERROR([nasm not found, please install nasm before configuring])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_CHECK_PROG([GZIP_FOUND], [gzip], [yes])
|
|
|
|
if ! test "x$GZIP_FOUND" = "xyes"; then
|
|
|
|
AC_MSG_ERROR([gzip not found, please install gzip before configuring])
|
|
|
|
fi
|
|
|
|
|
2022-07-05 10:14:48 +03:00
|
|
|
rm -rf "$BUILDDIR/cross-files"
|
2022-07-04 10:09:46 +03:00
|
|
|
|
2022-06-15 06:01:22 +03:00
|
|
|
BUILD_ALL="no"
|
|
|
|
|
|
|
|
AC_ARG_ENABLE([all],
|
|
|
|
AS_HELP_STRING([--enable-all], [enable ALL ports]),
|
|
|
|
BUILD_ALL="$enableval")
|
|
|
|
|
|
|
|
BUILD_BIOS="$BUILD_ALL"
|
2022-02-18 04:23:39 +03:00
|
|
|
|
|
|
|
AC_ARG_ENABLE([bios],
|
2022-06-15 06:01:22 +03:00
|
|
|
AS_HELP_STRING([--enable-bios], [enable building the x86 BIOS port]),
|
2022-02-18 04:23:39 +03:00
|
|
|
BUILD_BIOS="$enableval")
|
|
|
|
|
|
|
|
if test "x$BUILD_BIOS" = "xno"; then
|
|
|
|
BUILD_BIOS=""
|
|
|
|
else
|
2022-06-18 04:03:06 +03:00
|
|
|
(
|
2022-08-08 23:00:25 +03:00
|
|
|
$MKDIR_P "$BUILDDIR/cross-files"
|
2022-07-05 10:14:48 +03:00
|
|
|
cd "$BUILDDIR/cross-files"
|
|
|
|
TRIPLET=i686-elf "$SRCDIR/cross-detect/configure"
|
2022-06-20 01:22:02 +03:00
|
|
|
) || exit 1
|
2022-02-18 04:23:39 +03:00
|
|
|
BUILD_BIOS="limine-bios"
|
|
|
|
fi
|
|
|
|
|
2022-08-26 11:23:35 +03:00
|
|
|
AC_SUBST(BUILD_BIOS)
|
2022-02-18 04:23:39 +03:00
|
|
|
|
2022-06-15 06:01:22 +03:00
|
|
|
BUILD_LIMINE_DEPLOY="$BUILD_ALL"
|
2022-02-18 04:23:39 +03:00
|
|
|
|
2022-04-02 10:31:19 +03:00
|
|
|
AC_ARG_ENABLE([limine-deploy],
|
2022-06-15 06:01:22 +03:00
|
|
|
AS_HELP_STRING([--enable-limine-deploy], [enable building limine-deploy]),
|
2022-04-02 10:31:19 +03:00
|
|
|
BUILD_LIMINE_DEPLOY="$enableval")
|
2022-02-18 04:23:39 +03:00
|
|
|
|
2022-08-26 11:23:35 +03:00
|
|
|
AC_SUBST(BUILD_LIMINE_DEPLOY)
|
2022-02-18 04:23:39 +03:00
|
|
|
|
2022-06-15 06:01:22 +03:00
|
|
|
BUILD_CD="$BUILD_ALL"
|
2022-02-18 04:23:39 +03:00
|
|
|
|
|
|
|
AC_ARG_ENABLE([bios-cd],
|
2022-06-15 06:01:22 +03:00
|
|
|
AS_HELP_STRING([--enable-bios-cd], [enable building the x86 BIOS CD image]),
|
2022-02-18 04:23:39 +03:00
|
|
|
BUILD_CD="$enableval")
|
|
|
|
|
2022-08-26 11:23:35 +03:00
|
|
|
AC_SUBST(BUILD_CD)
|
2022-02-18 04:23:39 +03:00
|
|
|
|
2022-06-15 06:01:22 +03:00
|
|
|
BUILD_PXE="$BUILD_ALL"
|
2022-02-18 04:23:39 +03:00
|
|
|
|
|
|
|
AC_ARG_ENABLE([bios-pxe],
|
2022-06-15 06:01:22 +03:00
|
|
|
AS_HELP_STRING([--enable-bios-pxe], [enable building the x86 BIOS PXE image]),
|
2022-02-18 04:23:39 +03:00
|
|
|
BUILD_PXE="$enableval")
|
|
|
|
|
2022-08-26 11:23:35 +03:00
|
|
|
AC_SUBST(BUILD_PXE)
|
2022-02-18 04:23:39 +03:00
|
|
|
|
2022-06-15 06:01:22 +03:00
|
|
|
BUILD_UEFI_IA32="$BUILD_ALL"
|
2022-02-18 04:23:39 +03:00
|
|
|
|
2022-06-15 04:25:36 +03:00
|
|
|
AC_ARG_ENABLE([uefi-ia32],
|
2022-06-15 06:01:22 +03:00
|
|
|
AS_HELP_STRING([--enable-uefi-ia32], [enable building the IA-32 UEFI port]),
|
2022-06-15 04:25:36 +03:00
|
|
|
BUILD_UEFI_IA32="$enableval")
|
2022-02-18 04:23:39 +03:00
|
|
|
|
2022-06-15 04:25:36 +03:00
|
|
|
if test "x$BUILD_UEFI_IA32" = "xno"; then
|
|
|
|
BUILD_UEFI_IA32=""
|
2022-02-18 04:23:39 +03:00
|
|
|
else
|
2022-06-18 04:03:06 +03:00
|
|
|
(
|
2022-08-08 23:00:25 +03:00
|
|
|
$MKDIR_P "$BUILDDIR/cross-files"
|
2022-07-05 10:14:48 +03:00
|
|
|
cd "$BUILDDIR/cross-files"
|
|
|
|
TRIPLET=i686-elf "$SRCDIR/cross-detect/configure"
|
2022-06-20 01:22:02 +03:00
|
|
|
) || exit 1
|
2022-06-15 04:25:36 +03:00
|
|
|
BUILD_UEFI_IA32="limine-uefi-ia32"
|
2022-02-18 04:23:39 +03:00
|
|
|
fi
|
|
|
|
|
2022-08-26 11:23:35 +03:00
|
|
|
AC_SUBST(BUILD_UEFI_IA32)
|
2022-02-18 04:23:39 +03:00
|
|
|
|
2022-06-15 06:01:22 +03:00
|
|
|
BUILD_UEFI_X86_64="$BUILD_ALL"
|
2022-02-18 04:23:39 +03:00
|
|
|
|
2022-06-15 04:25:36 +03:00
|
|
|
AC_ARG_ENABLE([uefi-x86-64],
|
2022-06-15 06:01:22 +03:00
|
|
|
AS_HELP_STRING([--enable-uefi-x86_64], [enable building the x86_64 UEFI port]),
|
2022-06-15 04:25:36 +03:00
|
|
|
BUILD_UEFI_X86_64="$enableval")
|
2022-02-18 04:23:39 +03:00
|
|
|
|
2022-06-15 04:25:36 +03:00
|
|
|
if test "x$BUILD_UEFI_X86_64" = "xno"; then
|
|
|
|
BUILD_UEFI_X86_64=""
|
2022-02-18 04:23:39 +03:00
|
|
|
else
|
2022-06-18 04:03:06 +03:00
|
|
|
(
|
2022-08-08 23:00:25 +03:00
|
|
|
$MKDIR_P "$BUILDDIR/cross-files"
|
2022-07-05 10:14:48 +03:00
|
|
|
cd "$BUILDDIR/cross-files"
|
|
|
|
TRIPLET=x86_64-elf "$SRCDIR/cross-detect/configure"
|
2022-06-20 01:22:02 +03:00
|
|
|
) || exit 1
|
2022-06-15 04:25:36 +03:00
|
|
|
BUILD_UEFI_X86_64="limine-uefi-x86-64"
|
2022-02-18 04:23:39 +03:00
|
|
|
fi
|
|
|
|
|
2022-08-26 11:23:35 +03:00
|
|
|
AC_SUBST(BUILD_UEFI_X86_64)
|
2022-02-18 04:23:39 +03:00
|
|
|
|
2022-08-18 18:32:54 +03:00
|
|
|
BUILD_UEFI_AARCH64="$BUILD_ALL"
|
|
|
|
|
|
|
|
AC_ARG_ENABLE([uefi-aarch64],
|
|
|
|
AS_HELP_STRING([--enable-uefi-aarch64], [enable building the aarch64 UEFI port]),
|
|
|
|
BUILD_UEFI_AARCH64="$enableval")
|
|
|
|
|
|
|
|
if test "x$BUILD_UEFI_AARCH64" = "xno"; then
|
|
|
|
BUILD_UEFI_AARCH64=""
|
|
|
|
else
|
|
|
|
(
|
|
|
|
mkdir -p "$BUILDDIR/cross-files"
|
|
|
|
cd "$BUILDDIR/cross-files"
|
2022-08-23 01:21:09 +03:00
|
|
|
TRIPLET=aarch64-elf "$SRCDIR/cross-detect/configure" || exit 1
|
2022-08-18 18:32:54 +03:00
|
|
|
)
|
|
|
|
BUILD_UEFI_AARCH64="limine-uefi-aarch64"
|
|
|
|
fi
|
|
|
|
|
2022-08-26 11:23:35 +03:00
|
|
|
AC_SUBST(BUILD_UEFI_AARCH64)
|
2022-08-18 18:32:54 +03:00
|
|
|
|
2022-06-15 06:01:22 +03:00
|
|
|
BUILD_CD_EFI="$BUILD_ALL"
|
2022-02-08 17:35:54 +03:00
|
|
|
|
2022-03-30 16:14:02 +03:00
|
|
|
AC_ARG_ENABLE([cd-efi],
|
2022-06-22 22:56:41 +03:00
|
|
|
AS_HELP_STRING([--enable-cd-efi], [enable building limine-cd-efi.bin]),
|
2022-03-30 16:14:02 +03:00
|
|
|
BUILD_CD_EFI="$enableval")
|
2022-02-08 17:35:54 +03:00
|
|
|
|
2022-03-30 16:14:02 +03:00
|
|
|
if ! test "x$BUILD_CD_EFI" = "xno"; then
|
2022-02-08 17:43:21 +03:00
|
|
|
AC_CHECK_PROG([MTOOLS_FOUND], [mcopy], [yes])
|
|
|
|
if ! test "x$MTOOLS_FOUND" = "xyes"; then
|
2022-03-30 16:14:02 +03:00
|
|
|
if test "x$BUILD_CD_EFI" = "xyes"; then
|
|
|
|
AC_MSG_ERROR([mtools not found, install mtools to build limine-cd-efi.bin])
|
2022-02-08 17:43:21 +03:00
|
|
|
fi
|
2022-03-30 16:14:02 +03:00
|
|
|
AC_MSG_WARN([mtools not found, install mtools to build limine-cd-efi.bin])
|
|
|
|
BUILD_CD_EFI="no"
|
2022-02-08 17:43:21 +03:00
|
|
|
fi
|
2022-02-08 17:35:54 +03:00
|
|
|
fi
|
|
|
|
|
2022-08-26 11:23:35 +03:00
|
|
|
AC_SUBST(BUILD_CD_EFI)
|
2022-01-31 13:46:19 +03:00
|
|
|
|
2022-07-05 10:14:48 +03:00
|
|
|
AC_ARG_VAR(CROSS_TOOLCHAIN, [alternative toolchain prefix (or 'llvm')])
|
|
|
|
AC_ARG_VAR(CROSS_CC, [C compiler command for Limine])
|
|
|
|
AC_ARG_VAR(CROSS_LD, [linker command for Limine])
|
|
|
|
AC_ARG_VAR(CROSS_OBJCOPY, [objcopy command for Limine])
|
|
|
|
AC_ARG_VAR(CROSS_OBJDUMP, [objdump command for Limine])
|
|
|
|
AC_ARG_VAR(CROSS_READELF, [readelf command for Limine])
|
2022-02-01 10:04:55 +03:00
|
|
|
|
2022-07-05 10:14:48 +03:00
|
|
|
m4_define([DEFAULT_CROSS_CFLAGS], [-O3 -pipe -Wall -Wextra])
|
|
|
|
AC_ARG_VAR(CROSS_CFLAGS, [C flags for Limine @<:@default: ]DEFAULT_CROSS_CFLAGS[@:>@])
|
|
|
|
test "x$CROSS_CFLAGS" = "x" && CROSS_CFLAGS="DEFAULT_CROSS_CFLAGS"
|
2022-02-01 10:04:55 +03:00
|
|
|
|
2022-07-05 10:14:48 +03:00
|
|
|
m4_define([DEFAULT_CROSS_LDFLAGS], [])
|
|
|
|
AC_ARG_VAR(CROSS_LDFLAGS, [Linker flags for Limine @<:@default: ]DEFAULT_CROSS_LDFLAGS[@:>@])
|
|
|
|
test "x$CROSS_LDFLAGS" = "x" && CROSS_LDFLAGS="DEFAULT_CROSS_LDFLAGS"
|
2022-01-16 08:09:36 +03:00
|
|
|
|
2022-02-21 01:05:53 +03:00
|
|
|
LIMINE_COPYRIGHT=$($GREP Copyright "$SRCDIR/LICENSE.md")
|
2022-08-26 11:23:35 +03:00
|
|
|
AC_SUBST(LIMINE_COPYRIGHT)
|
2022-02-21 01:05:53 +03:00
|
|
|
|
2022-01-16 08:09:36 +03:00
|
|
|
AC_PREFIX_DEFAULT(/usr/local)
|
|
|
|
|
2022-02-21 02:40:15 +03:00
|
|
|
AC_CONFIG_FILES(GNUmakefile config.h)
|
2022-01-16 08:09:36 +03:00
|
|
|
AC_OUTPUT
|