]> git.proxmox.com Git - grub2.git/blame - configure.ac
Enable shim_lock and tpm modules for all efi platforms, not just x86_64_efi
[grub2.git] / configure.ac
CommitLineData
76ed06b9
BC
1# -*- autoconf -*-
2
6a161fa9 3# Process this file with autoconf to produce a configure script.
4
2f1a3acf 5# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
6a161fa9 6#
7# This configure.ac is free software; the author
8# gives unlimited permission to copy and/or distribute it,
9# with or without modifications, as long as this notice is preserved.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14# PARTICULAR PURPOSE.
15
b977bf01 16dnl This configure script is complicated, because GRUB needs to deal
17dnl with three potentially different types:
18dnl
19dnl build -- the environment for building GRUB
20dnl host -- the environment for running utilities
21dnl target -- the environment for running GRUB
22dnl
23dnl In addition, GRUB needs to deal with a platform specification
24dnl which specifies the system running GRUB, such as firmware.
25dnl This is necessary because the target type in autoconf does not
26dnl describe such a system very well.
27dnl
28dnl The current strategy is to use variables with no prefix (such as
dcecae1a
AB
29dnl CC, CFLAGS, etc.) for the host type, variables with prefix "BUILD_"
30dnl (such as BUILD_CC, BUILD_CFLAGS, etc.) for the build type and variables
31dnl with the prefix "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are
32dnl used for the target type. See INSTALL for full list of variables.
b977bf01 33
2a2e10c1 34AC_INIT([GRUB],[2.04],[bug-grub@gnu.org])
6a161fa9 35
15c69261
YB
36AC_CONFIG_AUX_DIR([build-aux])
37
76ed06b9
BC
38# We don't want -g -O2 by default in CFLAGS
39: ${CFLAGS=""}
6a161fa9 40
1ecf96fc
AB
41# Checks for build, host and target systems.
42AC_CANONICAL_BUILD
6a161fa9 43AC_CANONICAL_HOST
ee7fb780 44save_program_prefix="${program_prefix}"
b977bf01 45AC_CANONICAL_TARGET
ee7fb780 46program_prefix="${save_program_prefix}"
6a161fa9 47
35b90906
CW
48AM_INIT_AUTOMAKE([1.11])
49AC_PREREQ(2.63)
6304d292 50AC_CONFIG_SRCDIR([include/grub/dl.h])
742f9232 51AC_CONFIG_HEADER([config-util.h])
e52db1f7 52
7e23437d
CW
53# Explicitly check for pkg-config early on, since otherwise conditional
54# calls are problematic.
55PKG_PROG_PKG_CONFIG
56
1d543c3e 57# Program name transformations
58AC_ARG_PROGRAM
fd49ceb3
CW
59grub_TRANSFORM([grub-bios-setup])
60grub_TRANSFORM([grub-editenv])
61grub_TRANSFORM([grub-install])
62grub_TRANSFORM([grub-mkconfig])
63grub_TRANSFORM([grub-mkfont])
64grub_TRANSFORM([grub-mkimage])
67ab8353 65grub_TRANSFORM([grub-glue-efi])
fd49ceb3
CW
66grub_TRANSFORM([grub-mklayout])
67grub_TRANSFORM([grub-mkpasswd-pbkdf2])
68grub_TRANSFORM([grub-mkrelpath])
69grub_TRANSFORM([grub-mkrescue])
70grub_TRANSFORM([grub-probe])
71grub_TRANSFORM([grub-reboot])
72grub_TRANSFORM([grub-script-check])
73grub_TRANSFORM([grub-set-default])
fd49ceb3 74grub_TRANSFORM([grub-sparc64-setup])
a79b8a15 75grub_TRANSFORM([grub-render-label])
ec824e0f 76grub_TRANSFORM([grub-file])
1d543c3e 77
90d1e879
RM
78# Optimization flag. Allow user to override.
79if test "x$TARGET_CFLAGS" = x; then
80 TARGET_CFLAGS="$TARGET_CFLAGS -Os"
81fi
82
76ed06b9
BC
83# Default HOST_CPPFLAGS
84HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
76ed06b9 85HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
76ed06b9
BC
86
87TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
76ed06b9 88
b977bf01 89case "$target_cpu" in
02164e1b 90 i[[3456]]86) target_cpu=i386 ;;
c7ef54aa 91 amd64) target_cpu=x86_64 ;;
02164e1b 92 sparc) target_cpu=sparc64 ;;
ade85305 93 mipsel|mips64el)
4d94b2db
CW
94 target_cpu=mipsel
95 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1"
4a1eefb6 96 ;;
ade85305 97 mips|mips64)
4d94b2db
CW
98 target_cpu=mips
99 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1"
4a1eefb6 100 ;;
389b31cd 101 arm*)
4d94b2db 102 target_cpu=arm
389b31cd 103 ;;
15a463d7 104 aarch64*)
4d94b2db 105 target_cpu=arm64
15a463d7 106 ;;
f1957dc8
AG
107 riscv32*)
108 target_cpu=riscv32
109 ;;
110 riscv64*)
111 target_cpu=riscv64
112 ;;
6a161fa9 113esac
114
05568c2e 115# Specify the platform (such as firmware).
116AC_ARG_WITH([platform],
117 AS_HELP_STRING([--with-platform=PLATFORM],
83b984de 118 [select the host platform [[guessed]]]))
05568c2e 119
120# Guess the platform if not specified.
121if test "x$with_platform" = x; then
b977bf01 122 case "$target_cpu"-"$target_vendor" in
05568c2e 123 i386-apple) platform=efi ;;
124 i386-*) platform=pc ;;
58393a2d 125 x86_64-apple) platform=efi ;;
737feb35 126 x86_64-*) platform=pc ;;
05568c2e 127 powerpc-*) platform=ieee1275 ;;
58393a2d 128 powerpc64-*) platform=ieee1275 ;;
5c46165a 129 powerpc64le-*) platform=ieee1275 ;;
05568c2e 130 sparc64-*) platform=ieee1275 ;;
4959e111
VS
131 mipsel-*) platform=loongson ;;
132 mips-*) platform=arc ;;
e68d3b24 133 ia64-*) platform=efi ;;
389b31cd 134 arm-*) platform=uboot ;;
15a463d7 135 arm64-*) platform=efi ;;
f1957dc8
AG
136 riscv32-*) platform=efi ;;
137 riscv64-*) platform=efi ;;
5d90f6e5
CW
138 *)
139 AC_MSG_WARN([unsupported CPU: "$target_cpu" - only building utilities])
140 platform=none
141 ;;
05568c2e 142 esac
143else
144 platform="$with_platform"
145fi
146
ec1dfd63
VS
147case "$target_cpu"-"$platform" in
148 x86_64-efi) ;;
149 x86_64-emu) ;;
9612ebc0 150 x86_64-xen) ;;
5d90f6e5 151 x86_64-none) ;;
ec1dfd63
VS
152 x86_64-*) target_cpu=i386 ;;
153 powerpc64-ieee1275) target_cpu=powerpc ;;
5c46165a 154 powerpc64le-ieee1275) target_cpu=powerpc ;;
ec1dfd63 155esac
20011694 156
58393a2d 157# Check if the platform is supported, make final adjustments.
b977bf01 158case "$target_cpu"-"$platform" in
05568c2e 159 i386-efi) ;;
3f4ce737 160 x86_64-efi) ;;
9612ebc0 161 i386-xen) ;;
d789e70e 162 i386-xen_pvh) ;;
9612ebc0 163 x86_64-xen) ;;
05568c2e 164 i386-pc) ;;
7210dca9 165 i386-multiboot) ;;
546f966a 166 i386-coreboot) ;;
58393a2d 167 i386-linuxbios) platform=coreboot ;;
3d04eab8 168 i386-ieee1275) ;;
8231fb77 169 i386-qemu) ;;
05568c2e 170 powerpc-ieee1275) ;;
171 sparc64-ieee1275) ;;
2c40cc78 172 ia64-efi) ;;
f440c33f 173 mips-qemu_mips) ;;
3666d5f6 174 mips-qemu-mips) platform=qemu_mips;;
8906c3dd 175 mips-arc) ;;
7f63a64f 176 mipsel-arc) ;;
4959e111
VS
177 mipsel-qemu_mips) ;;
178 mipsel-qemu-mips) platform=qemu_mips;;
179 mipsel-yeeloong) platform=loongson ;;
180 mipsel-fuloong) platform=loongson ;;
181 mipsel-loongson) ;;
389b31cd 182 arm-uboot) ;;
24e37a88 183 arm-coreboot) ;;
389b31cd 184 arm-efi) ;;
15a463d7 185 arm64-efi) ;;
f1957dc8
AG
186 riscv32-efi) ;;
187 riscv64-efi) ;;
f84b481b 188 *-emu) ;;
5d90f6e5 189 *-none) ;;
58393a2d 190 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
6a161fa9 191esac
192
48145ea3 193if test x$platform != xemu ; then
dd614590
VS
194 case "$target_cpu" in
195 i386 | powerpc) target_m32=1 ;;
196 x86_64 | sparc64) target_m64=1 ;;
197 esac
198fi
3f4ce737 199
eaf01c25 200if test x"$target_cpu-$platform" = xsparc64-emu ; then
4d94b2db 201 target_m64=1
eaf01c25
VS
202fi
203
fc97214f 204case "$target_os" in
c3302aa5 205 windows* | mingw32*) target_os=cygwin ;;
fc97214f
VS
206esac
207
9304eef1 208# This normalizes the names, and creates a new variable ("host_kernel")
209# while at it, since the mapping is not always 1:1 (e.g. different OSes
210# using the same kernel type).
211case "$host_os" in
212 gnu*) host_kernel=hurd ;;
213 linux*) host_kernel=linux ;;
67937d4d 214 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
2c7031b1 215 netbsd*) host_kernel=netbsd ;;
958ee221 216 solaris*) host_kernel=illumos ;;
b105df76 217 darwin*) host_kernel=xnu ;;
7e518ca8 218 cygwin | windows* | mingw32*) host_kernel=windows ;;
9304eef1 219esac
220
cd46aa6c 221case "$host_os" in
5435aaac
XG
222 cygwin) have_exec=y ;;
223 windows* | mingw32*) have_exec=n ;;
cd46aa6c
VS
224 aros*) have_exec=n ;;
225 *) have_exec=y;;
226esac
227
f84b481b 228case "$platform" in
c721825b
BC
229 coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
230 multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
231 efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
9612ebc0 232 xen) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XEN=1" ;;
d789e70e 233 xen_pvh) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XEN_PVH=1" ;;
c721825b 234 ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
389b31cd 235 uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;;
c721825b
BC
236 qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
237 pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
238 emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
0c930a84
VS
239 loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1" ;;
240 qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1" ;;
3666d5f6 241 arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
f84b481b 242esac
4959e111
VS
243if test x${target_cpu} = xmipsel ; then
244 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
245else
0c930a84 246 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
4959e111 247fi
6bea3f89 248
7f63a64f
VS
249case "${target_cpu}-$platform" in
250 mips-arc)
251 TARGET_LINK_ADDR=0x88200000
252 TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000
253 ;;
254 mipsel-arc)
255 TARGET_LINK_ADDR=0x80700000
256 TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000
257 ;;
5fe67f39 258 mips*-qemu_mips | mips*-loongson)
7f63a64f
VS
259 TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000
260 ;;
261esac
262
263AC_SUBST(TARGET_LINK_ADDR)
264AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR)
265
c721825b 266TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
f84b481b 267
56978920 268AC_SUBST(host_cpu)
269AC_SUBST(host_os)
9304eef1 270AC_SUBST(host_kernel)
6e5a42fe 271
071114bb
VS
272AC_SUBST(target_cpu)
273AC_SUBST(platform)
274
d87aedff 275# Define default variables
7134247c
VS
276
277have_with_bootdir=n
278AC_ARG_WITH([bootdir],
279 AS_HELP_STRING([--with-bootdir=DIR],
280 [set the name of /boot directory [[guessed]]]),
281 [have_with_bootdir=y],
282 [have_with_bootdir=n])
283if test x$have_with_bootdir = xy; then
284 bootdirname="$with_bootdir"
285else
286 case "$host_os" in
287 netbsd* | openbsd*)
d87aedff 288 # Because /boot is used for the boot block in NetBSD and OpenBSD,
7134247c
VS
289 bootdirname='' ;;
290 *) bootdirname='boot' ;;
291 esac
292fi
293
d87aedff 294AC_SUBST(bootdirname)
a4c1d277 295AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
a6c83d4a 296 [Default boot directory name])
d87aedff 297
7134247c
VS
298AC_ARG_WITH([grubdir],
299 AS_HELP_STRING([--with-grubdir=DIR],
300 [set the name of grub directory [[guessed]]]),
301 [grubdirname="$with_grubdir"],
302 [grubdirname="$PACKAGE"])
303
d87aedff 304AC_SUBST(grubdirname)
a4c1d277
YB
305AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
306 [Default grub directory name])
d87aedff 307
b977bf01 308#
309# Checks for build programs.
310#
144f1f98 311
6c826348 312# Although cmp is listed in the GNU Coding Standards as a command which
313# can used directly, OpenBSD lacks cmp in the default installation.
314AC_CHECK_PROGS([CMP], [cmp])
315if test "x$CMP" = x; then
316 AC_MSG_ERROR([cmp is not found])
317fi
318
144f1f98 319AC_CHECK_PROGS([YACC], [bison])
1569ec51 320if test "x$YACC" = x; then
6c826348 321 AC_MSG_ERROR([bison is not found])
1569ec51 322fi
323
76ed06b9 324AC_PROG_RANLIB
b977bf01 325AC_PROG_INSTALL
326AC_PROG_AWK
09220190 327AC_PROG_LEX
76ed06b9 328AC_PROG_YACC
b977bf01 329AC_PROG_MAKE_SET
ff420223 330AC_PROG_MKDIR_P
e1fd1939 331AC_PROG_LN_S
b977bf01 332
c7c75cf4 333if test "x$LEX" = "x:"; then
09220190
BC
334 AC_MSG_ERROR([flex is not found])
335else
a2618427 336 version=`$LEX --version | $AWK '{ split($2,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
b777c18e 337 if test -n "$version" -a "$version" -ge 20535; then
09220190
BC
338 :
339 else
340 AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
341 fi
342fi
343
68807e5f 344# These are not a "must".
51fa856c 345AC_PATH_PROGS(MAKEINFO, makeinfo true)
6a161fa9 346
b977bf01 347#
348# Checks for host programs.
349#
350
351AC_PROG_CC
15c69261 352gl_EARLY
1eed0e6e 353AC_PROG_CXX
76ed06b9
BC
354AM_PROG_CC_C_O
355AM_PROG_AS
8b467844 356AM_PATH_PYTHON([2.6])
76ed06b9 357
6a161fa9 358# Must be GCC.
359test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
360
1eed0e6e
VS
361AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
362
4889bdec 363AC_GNU_SOURCE
2f1a3acf 364AM_GNU_GETTEXT([external])
35b90906 365AM_GNU_GETTEXT_VERSION([0.18.3])
b977bf01 366AC_SYS_LARGEFILE
367
368# Identify characteristics of the host architecture.
7b780018
VS
369unset ac_cv_c_bigendian
370
eaf01c25
VS
371if test x"$target_cpu-$platform" = xsparc64-emu ; then
372 CFLAGS="$CFLAGS -m64"
373 HOST_CFLAGS="$HOST_CFLAGS -m64"
374fi
375
fc7a64bc
VS
376CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
377HOST_CPPFLAGS="$HOST_CPPFLAGS -D_FILE_OFFSET_BITS=64"
378
b977bf01 379AC_C_BIGENDIAN
380AC_CHECK_SIZEOF(void *)
381AC_CHECK_SIZEOF(long)
382
7e518ca8
VS
383case "$host_os" in
384 cygwin | windows* | mingw32*)
385 HOST_CPPFLAGS="$HOST_CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
386 CPPFLAGS="$CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
387 AC_CHECK_SIZEOF(TCHAR,,[#include <windows.h>])
388 ;;
389esac
390
3bac4caa
FJ
391case "$host_os" in
392 cygwin | windows* | mingw32* | aros*)
393 ;;
394 *)
395 AC_CHECK_SIZEOF(off_t)
608bec51
VS
396 if test x"$ac_cv_sizeof_off_t" != x8 ; then
397 AC_CHECK_SIZEOF(off64_t)
398 test x"$ac_cv_sizeof_off64_t" = x8 || AC_MSG_ERROR([Large file support is required])
399 fi;;
3bac4caa
FJ
400esac
401
aad32b14
VS
402if test x$USE_NLS = xno; then
403 HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
404fi
405
86695375 406if test "x$cross_compiling" = xyes; then
407 AC_MSG_WARN([cannot generate manual pages while cross compiling])
408else
409 AC_PATH_PROG(HELP2MAN, help2man)
410fi
411
3169f4c7 412# Check for functions and headers.
b7fc63d1 413AC_CHECK_FUNCS(posix_memalign memalign getextmntent on_exit)
7a5b301e 414AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h limits.h)
07662af7
AB
415
416# glibc 2.25 still includes sys/sysmacros.h in sys/types.h but emits deprecation
417# warning which causes compilation failure later with -Werror. So use -Werror here
418# as well to force proper sys/sysmacros.h detection.
419SAVED_CFLAGS="$CFLAGS"
420CFLAGS="$HOST_CFLAGS -Werror"
7a5b301e 421AC_HEADER_MAJOR
07662af7 422CFLAGS="$SAVED_CFLAGS"
7c4e16ff 423
fb90b546
RM
424AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
425#include <sys/param.h>
426#include <sys/mount.h>])
427
428AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default
429#include <sys/param.h>
430#include <sys/mount.h>])
431
2c7031b1
GS
432# For opendisk() and getrawpartition() on NetBSD.
433# Used in util/deviceiter.c and in util/hostdisk.c.
434AC_CHECK_HEADER([util.h], [
435 AC_CHECK_LIB([util], [opendisk], [
436 LIBUTIL="-lutil"
437 AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
438 ])
439 AC_CHECK_LIB([util], [getrawpartition], [
440 LIBUTIL="-lutil"
441 AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
442 ])
443])
444AC_SUBST([LIBUTIL])
445
fc333cf2
CW
446case "$host_os" in
447 cygwin | windows* | mingw32* | aros*)
448 ;;
449 *)
450 # For setting EFI variables in grub-install.
451 PKG_CHECK_MODULES([EFIVAR], [efivar efiboot], [
452 AC_DEFINE([HAVE_EFIVAR], [1],
453 [Define to 1 if you have the efivar and efiboot libraries.])
454 ], [:])
455 ;;
456esac
457
19ce697d 458AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
00c05e22 459 SAVED_CFLAGS="$CFLAGS"
b35ec299 460 CFLAGS="$HOST_CFLAGS -Wtrampolines -Werror"
00c05e22
VS
461 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
462int va_arg_func (int fixed, va_list args);]], [[]])],
19ce697d
VS
463 [grub_cv_host_cc_wtrampolines=yes],
464 [grub_cv_host_cc_wtrampolines=no])
00c05e22
VS
465 CFLAGS="$SAVED_CFLAGS"
466])
467
19ce697d
VS
468if test x"$grub_host_cv_cc_wtrampolines" = xyes ; then
469 HOST_CFLAGS="$HOST_CFLAGS -Wtrampolines"
00c05e22
VS
470fi
471
76ed06b9
BC
472#
473# Check for host and build compilers.
474#
475HOST_CC=$CC
816719c8
VS
476AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc])
477test -z "$BUILD_CC" && AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])
b224c266 478BUILD_CPP="$BUILD_CC -E"
76ed06b9 479
29013cba
VS
480case "$build_os" in
481 haiku*) BUILD_LIBM= ;;
482 *) BUILD_LIBM=-lm ;;
483esac
1ecf96fc
AB
484
485dnl FIXME proper test seems to require too deep dive into Autoconf internals.
486dnl For now just list known platforms that we support.
487
488case "$build_os" in
489 cygwin*|mingw32*|mingw64*) BUILD_EXEEXT=.exe ;;
490 *) BUILD_EXEEXT= ;;
491esac
492AC_SUBST(BUILD_EXEEXT)
493
a827807a
VS
494# In some build environments like termux /bin/sh is not a valid
495# shebang. Use $SHELL instead if it's executable and /bin/sh isn't
496BUILD_SHEBANG=/bin/sh
497for she in /bin/sh "$SHELL"; do
498 if test -x "$she" ; then
499 BUILD_SHEBANG="$she"
500 fi
501done
502AC_SUBST(BUILD_SHEBANG)
503
15c69261
YB
504# For gnulib.
505gl_INIT
506
93bf55e6 507WARN_FLAGS="-Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes"
ae558c2c 508EXTRA_WARN_FLAGS="-Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2"
60d5e9cb
VS
509
510HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"
511
512AC_CACHE_CHECK([which extra warnings work], [grub_cv_cc_w_extra_flags], [
513 SAVED_CFLAGS="$CFLAGS"
514 grub_cv_cc_w_extra_flags=
515 for x in $EXTRA_WARN_FLAGS; do
516 CFLAGS="$HOST_CFLAGS $x -Werror"
517 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
518 if test x$flag = x1 ; then
519 grub_cv_cc_w_extra_flags="$grub_cv_cc_w_extra_flags $x"
520 fi
521 done
522 CFLAGS="$SAVED_CFLAGS"
523])
524
525HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags"
526
b977bf01 527#
528# Check for target programs.
529#
530
5b5d4aa5 531# Find tools for the target.
532if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
b977bf01 533 tmp_ac_tool_prefix="$ac_tool_prefix"
534 ac_tool_prefix=$target_alias-
535
536 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
537 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
fc97214f
VS
538 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
539 AC_CHECK_TOOL(TARGET_STRIP, strip)
540 AC_CHECK_TOOL(TARGET_NM, nm)
0e8daad0 541 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
b977bf01 542
543 ac_tool_prefix="$tmp_ac_tool_prefix"
544else
545 if test "x$TARGET_CC" = x; then
546 TARGET_CC=$CC
547 fi
fc97214f
VS
548 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
549 AC_CHECK_TOOL(TARGET_STRIP, strip)
550 AC_CHECK_TOOL(TARGET_NM, nm)
0e8daad0 551 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
b977bf01 552fi
fc97214f 553
76ed06b9
BC
554AC_SUBST(HOST_CC)
555AC_SUBST(BUILD_CC)
7c9d0c39
VS
556AC_SUBST(BUILD_CFLAGS)
557AC_SUBST(BUILD_CPPFLAGS)
dcecae1a 558AC_SUBST(BUILD_LDFLAGS)
b977bf01 559AC_SUBST(TARGET_CC)
fc97214f 560AC_SUBST(TARGET_NM)
1bd73025 561AC_SUBST(TARGET_RANLIB)
fc97214f
VS
562AC_SUBST(TARGET_STRIP)
563AC_SUBST(TARGET_OBJCOPY)
b977bf01 564
b977bf01 565# Test the C compiler for the target environment.
566tmp_CC="$CC"
567tmp_CFLAGS="$CFLAGS"
568tmp_LDFLAGS="$LDFLAGS"
569tmp_CPPFLAGS="$CPPFLAGS"
aa6d7826 570tmp_LIBS="$LIBS"
b977bf01 571CC="$TARGET_CC"
572CFLAGS="$TARGET_CFLAGS"
573CPPFLAGS="$TARGET_CPPFLAGS"
574LDFLAGS="$TARGET_LDFLAGS"
aa6d7826 575LIBS=""
b977bf01 576
90d1e879 577# debug flags.
4e27343f 578TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
76ed06b9 579TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
6a161fa9 580
c12936c5
VS
581if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then
582TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align"
583fi
584
6a7957f9
VS
585TARGET_CC_VERSION="$(LC_ALL=C $TARGET_CC --version | head -n1)"
586
60d5e9cb
VS
587AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [
588 LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
589
590 grub_cv_target_cc_w_extra_flags=
591 for x in $EXTRA_WARN_FLAGS; do
592 CFLAGS="$TARGET_CFLAGS $x -Werror"
37378f74
VS
593 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
594asm (".globl start; start:");
595void __main (void);
596void __main (void) {}
597int main (void);
598]], [[]])], [flag=1], [flag=0])
60d5e9cb
VS
599 if test x$flag = x1 ; then
600 grub_cv_target_cc_w_extra_flags="$grub_cv_target_cc_w_extra_flags $x"
601 fi
602 done
603])
604
605TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_w_extra_flags"
606
86f05f14 607AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang],
b73b70eb
VS
608[
609CFLAGS="$TARGET_CFLAGS"
610AC_COMPILE_IFELSE(
60375a88
VS
611[AC_LANG_PROGRAM([], [[
612#ifdef __clang__
613#error "is clang"
614#endif
615]])],
616[grub_cv_cc_target_clang=no], [grub_cv_cc_target_clang=yes])])
617
a3645c12 618if test x$target_cpu = xpowerpc -o x$target_cpu = xmips; then
5c46165a
VS
619 AC_CACHE_CHECK([for options to get big-endian compilation], grub_cv_target_cc_big_endian, [
620 grub_cv_target_cc_big_endian=no
a3645c12
AB
621 for cand in "-target $target_cpu -Wl,-EB" "-target $target_cpu" \
622 "-target $target_cpu-linux-gnu -Wl,-EB" "-target $target_cpu-linux-gnu" \
623 "-EB" "-mbig-endian"; do
5c46165a
VS
624 if test x"$grub_cv_target_cc_big_endian" != xno ; then
625 break
626 fi
627 CFLAGS="$TARGET_CFLAGS $cand -Werror"
628 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
629#if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__ORDER_BIG_ENDIAN__ != __BYTE_ORDER__)
630#error still little endian
631#endif
632asm (".globl start; start:");
a3645c12
AB
633asm (".globl _start; _start:");
634asm (".globl __start; __start:");
5c46165a
VS
635void __main (void);
636void __main (void) {}
637int main (void);
638]], [[]])],
639 [grub_cv_target_cc_big_endian="$cand"], [])
640 done
641 ])
642
643 if test x"$grub_cv_target_cc_big_endian" = xno ; then
644 AC_MSG_ERROR([could not force big-endian])
645 fi
646
647 skip_linkflags="$(echo "$grub_cv_target_cc_big_endian"|sed 's@-Wl,-EB@@')"
648
649 TARGET_CFLAGS="$TARGET_CFLAGS $skip_linkflags"
650 TARGET_CPPFLAGS="$TARGET_CPPFLAGS $skip_linkflags"
651 TARGET_CCASFLAGS="$TARGET_CCASFLAGS $skip_linkflags"
652 TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_big_endian"
a3645c12
AB
653elif test x$target_cpu = xmipsel; then
654 AC_CACHE_CHECK([for options to get little-endian compilation], grub_cv_target_cc_little_endian, [
655 grub_cv_target_cc_little_endian=no
656 for cand in "-target $target_cpu -Wl,-EL" "-target $target_cpu" \
657 "-target $target_cpu-linux-gnu -Wl,-EL" "-target $target_cpu-linux-gnu" \
658 "-EL"; do
659 if test x"$grub_cv_target_cc_little_endian" != xno ; then
660 break
661 fi
662 CFLAGS="$TARGET_CFLAGS $cand -Werror"
663 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
664#if defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && (__ORDER_BIG_ENDIAN__ == __BYTE_ORDER__)
665#error still big endian
666#endif
667asm (".globl start; start:");
668asm (".globl _start; _start:");
669asm (".globl __start; __start:");
670void __main (void);
671void __main (void) {}
672int main (void);
673]], [[]])],
674 [grub_cv_target_cc_little_endian="$cand"], [])
675 done
676 ])
677
678 if test x"$grub_cv_target_cc_little_endian" = xno ; then
679 AC_MSG_ERROR([could not force little-endian])
680 fi
681
682 skip_linkflags="$(echo "$grub_cv_target_cc_little_endian"|sed 's@-Wl,-EL@@')"
683
684 TARGET_CFLAGS="$TARGET_CFLAGS $skip_linkflags"
685 TARGET_CPPFLAGS="$TARGET_CPPFLAGS $skip_linkflags"
686 TARGET_CCASFLAGS="$TARGET_CCASFLAGS $skip_linkflags"
687 TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_little_endian"
5c46165a
VS
688fi
689
be25d921
AB
690# GRUB code is N32-compliant but it's experimental and we would prefer to
691# avoid having too much variety when it doesn't result in any real improvement.
692# Moreover N64 isn't supported.
693if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then
694 AC_CACHE_CHECK([for options to force MIPS o32 ABI], grub_cv_target_cc_mips_o32_abi, [
695 grub_cv_target_cc_mips_o32_abi=no
696 for arg in "" "-mabi=32" "-target $target_cpu -mabi=32" ; do
697 if test x"$grub_cv_target_cc_mips_o32_abi" != xno ; then
698 break
699 fi
700 CFLAGS="$TARGET_CFLAGS $arg -Werror"
701 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
702#if !defined(_ABIO32) || !defined(_MIPS_SIM) || (_MIPS_SIM != _ABIO32)
703#error not o32 ABI
704#endif
705asm (".globl start; start:");
706asm (".globl _start; _start:");
707asm (".globl __start; __start:");
708void __main (void);
709void __main (void) {}
710int main (void);
711]], [[]])],
712 [grub_cv_target_cc_mips_o32_abi="$arg"], [])
713 done
714 ])
715
716 if test x"$grub_cv_target_cc_mips_o32_abi" = xno ; then
717 AC_MSG_ERROR([could not force MIPS o32 ABI])
718 fi
719
720 TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_mips_o32_abi"
721 TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_mips_o32_abi"
722fi
723
065ad910
VS
724AC_CACHE_CHECK([for options to compile assembly], [grub_cv_cc_target_asm_compile], [
725test_program=
f16b8c04
VS
726case "x$target_cpu-$platform" in
727 xmips-* | xmipsel-*)
065ad910
VS
728 test_program=mips
729 ;;
f16b8c04
VS
730 xi386-pc)
731 test_program=i386-pc
732 ;;
733 xi386-* | xx86_64-*)
065ad910
VS
734 test_program=i386
735 ;;
f16b8c04 736 xpowerpc-* | xsparc64-* | xarm-*)
065ad910
VS
737 test_program=$target_cpu
738 ;;
739esac
740if test x"$test_program" = x ; then
741 grub_cv_cc_target_asm_compile=
742else
743 found=no
744 for arg in "" "-no-integrated-as"; do
745 cmdline="$TARGET_CC -c -o /dev/null $TARGET_CCASFLAGS $arg $TARGET_CPPFLAGS $srcdir/asm-tests/$test_program.S"
746 echo "Running $cmdline" >&AS_MESSAGE_LOG_FD
747 if $cmdline >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
748 grub_cv_cc_target_asm_compile="$arg"
749 found=yes
750 break
751 fi
752 done
753 if test x"$found" = xno ; then
754 AC_MSG_ERROR([could not compile assembly])
755 fi
60375a88 756fi
065ad910 757])
60375a88 758
065ad910 759TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_cc_target_asm_compile"
b73b70eb 760
60375a88
VS
761if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
762 TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
763fi
764
765if test "x$target_m32" = x1; then
766 # Force 32-bit mode.
767 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
768 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
769 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
770 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
771 TARGET_MODULE_FORMAT="elf32"
772fi
773
774if test "x$target_m64" = x1; then
775 # Force 64-bit mode.
776 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
777 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
778 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
779 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
780 TARGET_MODULE_FORMAT="elf64"
781fi
782
783if test "x$grub_cv_cc_target_clang" = xno && test "x$target_cpu" = xi386 && test "x$platform" != xemu && test "x$platform" != xefi; then
784 TARGET_CFLAGS="$TARGET_CFLAGS -mrtd -mregparm=3"
785fi
786
f93ddcfd
VS
787# on mips redirect cache flushing function to non-existant one.
788if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then
789 AC_CACHE_CHECK([whether -mflush-func=grub_red_herring works], [grub_cv_cc_mflush_func], [
790 CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring -Werror"
791 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
792 [grub_cv_cc_mflush_func=yes],
793 [grub_cv_cc_mflush_func=no])
794 ])
795
796 if test "x$grub_cv_cc_mflush_func" = xyes; then
797 TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring"
798 fi
799fi
800
801
90d1e879
RM
802# Force no alignment to save space on i386.
803if test "x$target_cpu" = xi386; then
804 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
b35ec299 805 CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror"
eb73121d 806 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
90d1e879
RM
807 [grub_cv_cc_falign_loop=yes],
808 [grub_cv_cc_falign_loop=no])
6a161fa9 809 ])
6a161fa9 810
c966a489 811 AC_CACHE_CHECK([whether -malign-loops works], [grub_cv_cc_malign_loop], [
b35ec299 812 CFLAGS="$TARGET_CFLAGS -malign-loops=1 -Werror"
c966a489
VS
813 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
814 [grub_cv_cc_malign_loop=yes],
815 [grub_cv_cc_malign_loop=no])
816 ])
817
90d1e879
RM
818 if test "x$grub_cv_cc_falign_loop" = xyes; then
819 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
c966a489 820 elif test "x$grub_cv_cc_malign_loop" = xyes; then
90d1e879 821 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
6a161fa9 822 fi
89e0240c 823fi
6a161fa9 824
cdc17f60
VS
825AC_CACHE_CHECK([whether -freg-struct-return works], [grub_cv_cc_freg_struct_return], [
826 CFLAGS="$TARGET_CFLAGS -freg-struct-return -Werror"
827 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
828 [grub_cv_cc_freg_struct_return=yes],
829 [grub_cv_cc_freg_struct_return=no])
830])
831
832if test "x$grub_cv_cc_freg_struct_return" = xyes; then
833 TARGET_CFLAGS="$TARGET_CFLAGS -freg-struct-return"
834fi
835
ee0220bc 836if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
90d1e879
RM
837 # Some toolchains enable these features by default, but they need
838 # registers that aren't set up properly in GRUB.
cd6d79cd 839 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow"
90d1e879 840fi
77c55a87 841
3661261f
VS
842# GRUB doesn't use float or doubles at all. Yet some toolchains may decide
843# that floats are a good fit to run instead of what's written in the code.
844# Given that floating point unit is disabled (if present to begin with)
845# when GRUB is running which may result in various hard crashes.
ebe316e4
VS
846if test x"$platform" != xemu ; then
847 AC_CACHE_CHECK([for options to get soft-float], grub_cv_target_cc_soft_float, [
848 grub_cv_target_cc_soft_float=no
849 if test "x$target_cpu" = xarm64; then
43d42314 850 CFLAGS="$TARGET_CFLAGS -mgeneral-regs-only -Werror"
ebe316e4 851 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
43d42314 852 [grub_cv_target_cc_soft_float="-mgeneral-regs-only"], [])
ebe316e4 853 fi
f1957dc8
AG
854 if test "x$target_cpu" = xriscv32; then
855 CFLAGS="$TARGET_CFLAGS -march=rv32imac -mabi=ilp32 -Werror"
856 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
857 [grub_cv_target_cc_soft_float="-march=rv32imac -mabi=ilp32"], [])
858 fi
859 if test "x$target_cpu" = xriscv64; then
860 CFLAGS="$TARGET_CFLAGS -march=rv64imac -mabi=lp64 -Werror"
861 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
862 [grub_cv_target_cc_soft_float="-march=rv64imac -mabi=lp64"], [])
863 fi
ea39b87a
VS
864 if test "x$target_cpu" = xia64; then
865 CFLAGS="$TARGET_CFLAGS -mno-inline-float-divide -mno-inline-sqrt -Werror"
866 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
867 [grub_cv_target_cc_soft_float="-mno-inline-float-divide -mno-inline-sqrt"], [])
868 fi
6a4ecd27
VS
869 for cand in "-msoft-float -Xclang -msoft-float -Xclang -no-implicit-float" \
870 "-Xclang -msoft-float -Xclang -no-implicit-float" \
ebe316e4
VS
871 "-Xclang -msoft-float" "-msoft-float"; do
872 if test x"$grub_cv_target_cc_soft_float" != xno ; then
873 break
874 fi
875 CFLAGS="$TARGET_CFLAGS $cand -Werror"
876 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
877 [grub_cv_target_cc_soft_float="$cand"], [])
878 done
879 ])
880
881 if test x"$grub_cv_target_cc_soft_float" = xno ; then
882 AC_MSG_ERROR([could not force soft-float])
883 fi
884
885 case x"$grub_cv_target_cc_soft_float" in
6a4ecd27 886 x*"-Xclang"*)
ebe316e4
VS
887 # A trick so that clang doesn't see it on link stаge
888 TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_soft_float"
889 ;;
890 *)
891 TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_soft_float"
892 ;;
893 esac
43d42314 894 TARGET_CCASFLAGS="$TARGET_CCASFLAGS $grub_cv_target_cc_soft_float"
345076a7 895
2da4171e 896fi
3661261f 897
155f334f
VS
898if test x"$target_cpu" = xsparc64 ; then
899 AC_CACHE_CHECK([for options to reserve application registers], grub_cv_target_cc_mno_app_regs, [
900 grub_cv_target_cc_mno_app_regs=no
901 for cand in "-mllvm -sparc-reserve-app-registers" \
902 "-mno-app-regs"; do
903 if test x"$grub_cv_target_cc_mno_app_regs" != xno ; then
904 break
905 fi
906 CFLAGS="$TARGET_CFLAGS $cand -Werror"
aa6ccc05 907 CPPFLAGS="$TARGET_CPPFLAGS"
155f334f
VS
908 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
909 [grub_cv_target_cc_mno_app_regs="$cand"], [])
910 done
911 ])
912
913 if test x"$grub_cv_target_cc_mno_app_regs" = xno ; then
914 AC_MSG_ERROR([could not reserve application registers])
915 fi
916 if test x"$grub_cv_target_cc_mno_app_regs" = x"-mllvm -sparc-reserve-app-registers" ; then
917 # A trick so that clang doesn't see it on link stаge
918 TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_mno_app_regs"
919 else
920 TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_mno_app_regs"
921 fi
922
923 AC_CACHE_CHECK([for no-relax options], grub_cv_target_cc_mno_relax, [
924 grub_cv_target_cc_mno_relax=no
925 for cand in "-mno-relax" "-Wl,--no-relax"; do
926 if test x"$grub_cv_target_cc_mno_relax" != xno ; then
927 break
928 fi
929 LDFLAGS="$TARGET_LDFLAGS $cand -nostdlib -static"
930 CFLAGS="$TARGET_CFLAGS -Werror"
931 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
932 asm (".globl start; start:");
933 void __main (void);
934 void __main (void) {}
935 int main (void);
936 ]], [[]])], [grub_cv_target_cc_mno_relax="$cand"], [])
937 done
938 ])
939 LDFLAGS="$TARGET_LDFLAGS"
940 CFLAGS="$TARGET_CFLAGS"
941
942 if test x"$grub_cv_target_cc_mno_relax" = xno ; then
943 AC_MSG_ERROR([could not find no-relax options])
944 fi
945 TARGET_LDFLAGS="$TARGET_LDFLAGS $grub_cv_target_cc_mno_relax"
946fi
947
90d1e879
RM
948# By default, GCC 4.4 generates .eh_frame sections containing unwind
949# information in some cases where it previously did not. GRUB doesn't need
950# these and they just use up vital space. Restore the old compiler
951# behaviour.
952AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
24f4e57c 953 CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
90d1e879
RM
954 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
955 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
956 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
90d1e879 957])
77c55a87 958
90d1e879
RM
959if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
960 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
b977bf01 961fi
6a161fa9 962
1c1f31e5
VS
963if test x"$target_os" = xcygwin; then
964 AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [
24f4e57c 965 CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
1c1f31e5
VS
966 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
967 [grub_cv_cc_no_reorder_functions=yes],
968 [grub_cv_cc_no_reorder_functions=no])
969 ])
970fi
971
972if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xyes; then
973 TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
974fi
975
f1b35253
VS
976AC_CACHE_CHECK([whether -mno-stack-arg-probe works], [grub_cv_cc_mno_stack_arg_probe], [
977 CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
978 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
979 [grub_cv_cc_mno_stack_arg_probe=yes],
980 [grub_cv_cc_mno_stack_arg_probe=no])
981])
982
983if test "x$grub_cv_cc_mno_stack_arg_probe" = xyes; then
984 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
985fi
986
987
e9d3421c
VS
988# By default, GCC 4.6 generates .eh_frame sections containing unwind
989# information in some cases where it previously did not. GRUB doesn't need
990# these and they just use up vital space. Restore the old compiler
991# behaviour.
992AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
5ae590b3 993 CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
e9d3421c
VS
994 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
995 [grub_cv_cc_fno_asynchronous_unwind_tables=yes],
996 [grub_cv_cc_fno_asynchronous_unwind_tables=no])
e9d3421c
VS
997])
998
999if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
1000 TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
1001fi
1002
40051fed
VS
1003AC_CACHE_CHECK([whether -fno-unwind-tables works], [grub_cv_cc_fno_unwind_tables], [
1004 CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
1005 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1006 [grub_cv_cc_fno_unwind_tables=yes],
1007 [grub_cv_cc_fno_unwind_tables=no])
1008])
1009
1010if test "x$grub_cv_cc_fno_unwind_tables" = xyes; then
1011 TARGET_CFLAGS="$TARGET_CFLAGS -fno-unwind-tables"
1012fi
1013
30c7d3ce 1014
a9f25a08
VS
1015CFLAGS="$TARGET_CFLAGS"
1016
bf082198
VS
1017
1018if test x"$platform" = xemu ; then
1019 TARGET_OBJ2ELF=
1020 grub_cv_target_cc_link_format=
1021 case "$host_os" in
1022 *darwin* | *mac*)
1023 grub_cv_target_cc_link_format="-arch,${target_cpu}"
1024 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
1025 ;;
1026 *windows* | *cygwin* | *mingw*)
1027 if test x${target_cpu} = xi386 ; then
4d94b2db
CW
1028 grub_cv_target_cc_link_format=-mi386pe
1029 TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)'
bf082198
VS
1030 fi
1031 if test x${target_cpu} = xx86_64 ; then
4d94b2db
CW
1032 grub_cv_target_cc_link_format=-mi386pep
1033 TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)'
bf082198
VS
1034 fi
1035 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
1036 ;;
1037 esac
1038elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
c2b70d09 1039 AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_format], [
a9f25a08 1040 grub_cv_target_cc_link_format=unknown
6f1f6a0c 1041 for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -mi386pe -mi386pep -arch,${target_cpu}; do
bf082198 1042 if test x${target_cpu} != xi386 && test x$format = x-mi386pe; then
6f1f6a0c
VS
1043 continue
1044 fi
bf082198 1045 if test x${target_cpu} != xx86_64 && test x$format = x-mi386pep; then
a9f25a08
VS
1046 continue
1047 fi
246a434f
VS
1048 CFLAGS="$TARGET_CFLAGS"
1049 LDFLAGS="$TARGET_LDFLAGS -Wl,$format -nostdlib -static"
a9f25a08
VS
1050 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1051 asm (".globl start; start:");
1052 asm (".globl _start; _start:");
1053 asm (".globl __start; __start:");
1054 void __main (void);
1055 void __main (void) {}
c2b70d09 1056 ]], [[]])], [flag=1], [flag=0])
a9f25a08
VS
1057 if test x"$flag" = x1; then
1058 grub_cv_target_cc_link_format="$format"
4d94b2db 1059 break
a9f25a08
VS
1060 fi
1061 done])
1062 if test x"$grub_cv_target_cc_link_format" = xunknown; then
1063 AC_MSG_ERROR([no suitable link format found])
1064 fi
1065 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
6f1f6a0c 1066 if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then
4d94b2db 1067 TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)'
a9f25a08 1068 fi
6f1f6a0c 1069 if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
4d94b2db 1070 TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)'
6f1f6a0c 1071 fi
a9f25a08
VS
1072fi
1073
1074if test x$grub_cv_target_cc_link_format = x-arch,i386 || test x$grub_cv_target_cc_link_format = x-arch,x86_64; then
1075 TARGET_APPLE_LINKER=1
1076 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], [])
1077 if test "x$TARGET_OBJCONV" = x ; then
1078 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.])
1079 fi
1080 if test "x$TARGET_OBJCONV" = x ; then
1081 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
1082 fi
1083 TARGET_IMG_LDSCRIPT=
1084 TARGET_IMG_CFLAGS="-static"
1085 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
1086 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
1087 TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
1088 TARGET_LDFLAGS_OLDMAGIC=""
6f1f6a0c 1089elif test x$grub_cv_target_cc_link_format = x-mi386pe || test x$grub_cv_target_cc_link_format = x-mi386pep ; then
a9f25a08
VS
1090 TARGET_APPLE_LINKER=0
1091 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
60b967be 1092 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/i386-cygwin-img-ld.sc"
a9f25a08 1093 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
60b967be 1094 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/i386-cygwin-img-ld.sc"
a9f25a08
VS
1095 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
1096 TARGET_IMG_CFLAGS=
1097else
1098 TARGET_APPLE_LINKER=0
1099 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
1100 TARGET_IMG_LDSCRIPT=
1101 TARGET_IMG_LDFLAGS='-Wl,-N'
1102 TARGET_IMG_LDFLAGS_AC='-Wl,-N'
1103 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
1104 TARGET_IMG_CFLAGS=
1105fi
1106
80fdaf1d
VS
1107CFLAGS="$TARGET_CFLAGS"
1108
1109AC_ARG_ENABLE([efiemu],
1110 [AS_HELP_STRING([--enable-efiemu],
1111 [build and install the efiemu runtimes (default=guessed)])])
1112if test x"$enable_efiemu" = xno ; then
1113 efiemu_excuse="explicitly disabled"
1114fi
1115
1116if test x"$grub_cv_target_cc_link_format" = x-mi386pe || test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
1117 efiemu_excuse="not available on cygwin"
1118fi
1119if test x"$target_cpu" != xi386 ; then
1120 efiemu_excuse="only available on i386"
1121fi
1122if test x"$platform" = xefi ; then
1123 efiemu_excuse="not available on efi"
1124fi
1125
1126if test x"$efiemu_excuse" = x ; then
1127 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
1128 CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
1129 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1130 [grub_cv_cc_efiemu=yes],
1131 [grub_cv_cc_efiemu=no])
1132 ])
1133 if test x$grub_cv_cc_efiemu = xno; then
1134 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
1135 fi
1136fi
1137if test x"$efiemu_excuse" = x ; then
1138 AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [
1139 grub_cv_target_cc_efiemu64_link_format=unknown
1140 for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -arch,x86_64; do
1141 CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
1142 LDFLAGS="-m64 -Wl,$format -nostdlib -static"
1143 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1144 asm (".globl start; start:");
1145 asm (".globl _start; _start:");
1146 asm (".globl __start; __start:");
1147 void __main (void);
1148 void __main (void) {}
1149 ]], [[]])], [flag=1], [flag=0])
1150 if test x"$flag" = x1; then
1151 grub_cv_target_cc_efiemu64_link_format="$format"
1152 break
1153 fi
1154 done])
1155 if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then
1156 efiemu_excuse="no suitable link format for efiemu64 found"
1157 else
1158 EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format"
1159 fi
1160fi
1161if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
1162 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled ($efiemu_excuse)])
1163fi
1164if test x"$efiemu_excuse" = x ; then
1165enable_efiemu=yes
1166else
1167enable_efiemu=no
1168fi
1169AC_SUBST([enable_efiemu])
1170AC_SUBST([EFIEMU64_LINK_FORMAT])
1171
1172CFLAGS="$TARGET_CFLAGS"
1173
a9f25a08
VS
1174AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
1175
1176
1177LDFLAGS="$TARGET_LDFLAGS"
8f0baaac 1178
f1957dc8 1179if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64 ; then
7e9ca17a 1180 # Use large model to support 4G memory
6e09b8b7 1181 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
2a5a532c 1182 CFLAGS="$TARGET_CFLAGS -mcmodel=large"
6e09b8b7 1183 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1184 [grub_cv_cc_mcmodel=yes],
1185 [grub_cv_cc_mcmodel=no])
1186 ])
a3ba7410 1187 if test "x$grub_cv_cc_mcmodel" = xyes; then
c8600122 1188 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
f1957dc8 1189 elif test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64; then
eaf01c25 1190 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany"
6e09b8b7 1191 fi
46546fc5 1192fi
7e9ca17a 1193
46546fc5 1194if test "$target_cpu"-"$platform" = x86_64-efi; then
7e9ca17a 1195 # EFI writes to stack below %rsp, we must not use the red zone
1196 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
2a5a532c 1197 CFLAGS="$TARGET_CFLAGS -mno-red-zone"
7e9ca17a 1198 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1199 [grub_cv_cc_no_red_zone=yes],
1200 [grub_cv_cc_no_red_zone=no])
1201 ])
1202 if test "x$grub_cv_cc_no_red_zone" = xno; then
1203 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
1204 fi
1205
c8600122 1206 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
20011694 1207fi
1208
41822625 1209if test "x$target_cpu" = xarm; then
d15f17b2
VS
1210 AC_CACHE_CHECK([for options to disable movt and movw], grub_cv_target_cc_mno_movt, [
1211 grub_cv_target_cc_mno_movt=no
1212 for cand in "-mno-movt" \
1213 "-mllvm -arm-use-movt=0"; do
1214 if test x"$grub_cv_target_cc_mno_movt" != xno ; then
1215 break
1216 fi
1217 CFLAGS="$TARGET_CFLAGS $cand -Werror"
1218 CPPFLAGS="$TARGET_CPPFLAGS"
1219 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1220 [grub_cv_target_cc_mno_movt="$cand"], [])
1221 done
bf9c5616 1222 ])
d15f17b2
VS
1223
1224 if test x"$grub_cv_target_cc_mno_movt" != xno ; then
bf9c5616 1225 # A trick so that clang doesn't see it on link stage
d15f17b2 1226 TARGET_CPPFLAGS="$TARGET_CPPFLAGS $grub_cv_target_cc_mno_movt"
bf9c5616 1227 fi
a29f317a
VS
1228 AC_CACHE_CHECK([whether option -mthumb-interwork works], grub_cv_cc_mthumb_interwork, [
1229 CFLAGS="$TARGET_CFLAGS -mthumb-interwork -Werror"
1230 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1231 [grub_cv_cc_mthumb_interwork=yes],
1232 [grub_cv_cc_mthumb_interwork=no])
1233 ])
1234 if test "x$grub_cv_cc_mthumb_interwork" = xyes; then
1235 TARGET_CFLAGS="$TARGET_CFLAGS -mthumb-interwork"
2066c35b 1236 # Clang defaults to thumb interworking
a29f317a
VS
1237 elif test "x$grub_cv_cc_target_clang" = xno ; then
1238 AC_MSG_ERROR([your compiler doesn't support -mthumb-interwork])
a29f317a 1239 fi
41822625
VS
1240fi
1241
57bc5d43 1242AC_CACHE_CHECK([whether option -Qn works], grub_cv_target_cc_qn, [
4dace5f6 1243 CFLAGS="$TARGET_CFLAGS -Qn -Qunused-arguments -Werror"
57bc5d43
VS
1244 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
1245 [grub_cv_target_cc_qn=yes],
1246 [grub_cv_target_cc_qn=no])])
1247if test "x$grub_cv_target_cc_qn" = xyes; then
4dace5f6 1248 TARGET_CFLAGS="$TARGET_CFLAGS -Qn -Qunused-arguments"
57bc5d43
VS
1249fi
1250
baa2a121 1251#
1252# Compiler features.
1253#
1254
28668d80
VS
1255CFLAGS="$TARGET_CFLAGS"
1256
93a81088 1257# Position independent executable.
1258grub_CHECK_PIE
a3e9da05 1259grub_CHECK_NO_PIE
b53f595b
VS
1260grub_CHECK_NO_PIE_ONEWORD
1261grub_CHECK_LINK_PIE
93a81088 1262[# Need that, because some distributions ship compilers that include
a3e9da05 1263# `-fPIE' or '-fpie' and '-pie' in the default specs.
93a81088 1264if [ x"$pie_possible" = xyes ]; then
f4d35d49 1265 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE -fno-pie"
a3e9da05 1266fi
b53f595b
VS
1267
1268if [ x"$link_nopie_needed" = xyes ] || [ x"$pie_possible" = xyes ]; then
1269 if [ x"$nopie_possible" = xyes ]; then
1270 TARGET_LDFLAGS="$TARGET_LDFLAGS -no-pie"
1271 fi
1272 if [ x"$nopie_oneword_possible" = xyes ]; then
1273 TARGET_LDFLAGS="$TARGET_LDFLAGS -nopie"
1274 fi
93a81088 1275fi]
1276
28668d80 1277CFLAGS="$TARGET_CFLAGS"
a3e9da05 1278LDFLAGS="$TARGET_LDFLAGS"
28668d80 1279
7bd8b0c7
VS
1280# Position independent executable.
1281grub_CHECK_PIC
9cf12b20
VS
1282[# On most platforms we don't want PIC as it only makes relocations harder
1283# and code less efficient. On mips we want to have one got table per module
1284# and reload $gp in every function.
1285# GCC implements it using symbol __gnu_local_gp in non-PIC as well.
1286# However with clang we need PIC for this reloading to happen.
393cc591
VS
1287# With arm64 we need relocations that are in some way representable in
1288# PE as we need to support arm64-efi. Without -fPIC clang generates
1289# movk's which aren't representable.
9cf12b20
VS
1290# Since default varies across dictributions use either -fPIC or -fno-PIC
1291# explicitly.
393cc591 1292if ( test x$target_cpu = xmips || test x$target_cpu = xmipsel || test x$target_cpu = xarm64 ) && test "x$grub_cv_cc_target_clang" = xyes ; then
9cf12b20
VS
1293 TARGET_CFLAGS="$TARGET_CFLAGS -fPIC"
1294elif [ x"$pic_possible" = xyes ]; then
1295 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
7bd8b0c7
VS
1296fi]
1297
28668d80
VS
1298CFLAGS="$TARGET_CFLAGS"
1299
149524ea 1300# Stack smashing protector.
baa2a121 1301grub_CHECK_STACK_PROTECTOR
149524ea
CC
1302AC_ARG_ENABLE([stack-protector],
1303 AS_HELP_STRING([--enable-stack-protector],
1304 [enable the stack protector]),
1305 [],
1306 [enable_stack_protector=no])
1307if test "x$enable_stack_protector" = xno; then
1308 if test "x$ssp_possible" = xyes; then
1309 # Need that, because some distributions ship compilers that include
1310 # `-fstack-protector' in the default specs.
1311 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
1312 fi
1313elif test "x$platform" != xefi; then
1314 AC_MSG_ERROR([--enable-stack-protector is only supported on EFI platforms])
1315elif test "x$ssp_global_possible" != xyes; then
1316 AC_MSG_ERROR([--enable-stack-protector is not supported (compiler doesn't support -mstack-protector-guard=global)])
1317else
1318 TARGET_CFLAGS="$TARGET_CFLAGS -mstack-protector-guard=global"
1319 if test "x$enable_stack_protector" = xyes; then
1320 if test "x$ssp_possible" != xyes; then
1321 AC_MSG_ERROR([--enable-stack-protector is not supported (compiler doesn't support -fstack-protector)])
1322 fi
1323 TARGET_CFLAGS="$TARGET_CFLAGS -fstack-protector"
1324 elif test "x$enable_stack_protector" = xstrong; then
1325 if test "x$ssp_strong_possible" != xyes; then
1326 AC_MSG_ERROR([--enable-stack-protector=strong is not supported (compiler doesn't support -fstack-protector-strong)])
1327 fi
1328 TARGET_CFLAGS="$TARGET_CFLAGS -fstack-protector-strong"
1329 else
1330 # Note, -fstack-protector-all requires that the protector is disabled for
1331 # functions that appear in the call stack when the canary is initialized.
1332 AC_MSG_ERROR([invalid value $enable_stack_protector for --enable-stack-protector])
1333 fi
1334 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DGRUB_STACK_PROTECTOR=1"
c3db8364 1335fi
28668d80
VS
1336
1337CFLAGS="$TARGET_CFLAGS"
1338
2a8a80e4 1339grub_CHECK_STACK_ARG_PROBE
1340# Cygwin's GCC uses alloca() to probe the stackframe on static
1341# stack allocations above some threshold.
1342if test x"$sap_possible" = xyes; then
1343 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
1344fi
baa2a121 1345
28668d80
VS
1346CFLAGS="$TARGET_CFLAGS"
1347
d74b9a1d 1348# -mno-unaligned-access -mstrict-align
bb9f92b9 1349if test "$target_cpu" = arm; then
d74b9a1d 1350 AC_CACHE_CHECK([for compile options to get strict alignment], [grub_cv_target_cc_strict_align], [
bdb6090d 1351 grub_cv_target_cc_strict_align=
d74b9a1d
VS
1352 for arg in -mno-unaligned-access "-Xclang -mstrict-align" -mstrict-align; do
1353 CFLAGS="$TARGET_CFLAGS $arg -Werror"
1354 LDFLAGS="$TARGET_LDFLAGS"
1355 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
1356 if test x"$flag" = x1; then
1357 grub_cv_target_cc_strict_align="$arg"
4d94b2db 1358 break
d74b9a1d
VS
1359 fi
1360 done])
1361
d74b9a1d
VS
1362 TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_strict_align"
1363 if test x"$grub_cv_target_cc_strict_align" = x"-Xclang -mstrict-align"; then
1364 TARGET_LDFLAGS="$TARGET_LDFLAGS -Qunused-arguments"
bb9f92b9 1365 fi
bdb6090d
VS
1366 AC_CACHE_CHECK([if compiler generates unaligned accesses], [grub_cv_cc_target_emits_unaligned],
1367 [CFLAGS="$TARGET_CFLAGS"
1368 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
1369#ifdef __ARM_FEATURE_UNALIGNED
1370#error "unaligned"
1371#endif
1372 ]])],
1373 [grub_cv_cc_target_emits_unaligned=no], [grub_cv_cc_target_emits_unaligned=yes])])
1374 if test x$grub_cv_cc_target_emits_unaligned = xyes; then
1375 AC_MSG_ERROR([compiler generates unaligned accesses])
1376 fi
bb9f92b9
LL
1377fi
1378
aa6d7826 1379# Set them to their new values for the tests below.
1380CC="$TARGET_CC"
064360e6
VS
1381if test x"$platform" = xemu ; then
1382CFLAGS="$TARGET_CFLAGS -Wno-error"
1383elif test "x$TARGET_APPLE_LINKER" = x1 ; then
246a434f 1384CFLAGS="$TARGET_CFLAGS -nostdlib -static -Wno-error"
26de2bcd 1385else
37378f74 1386CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
26de2bcd 1387fi
aa6d7826 1388CPPFLAGS="$TARGET_CPPFLAGS"
d5524ca8 1389
01fcf061 1390grub_ASM_USCORE
064360e6 1391if test "x$TARGET_APPLE_LINKER" = x0 && test x"$platform" != xemu; then
01fcf061 1392if test x$grub_cv_asm_uscore = xyes; then
37378f74 1393DEFSYM="-Wl,--defsym,_abort=_main -Wl,--defsym,__main=_main"
01fcf061 1394else
37378f74 1395DEFSYM="-Wl,--defsym,abort=main -Wl,--defsym,_main=main -Wl,--defsym,__main=main"
01fcf061 1396fi
37378f74 1397CFLAGS="$TARGET_CFLAGS -nostdlib $DEFSYM"
a9f25a08 1398fi
01fcf061 1399
69be5b74 1400# Check for libgcc symbols
064360e6 1401if test x"$platform" = xemu; then
ca73ae44 1402AC_CHECK_FUNCS(__udivsi3 __umodsi3 __divsi3 __modsi3 __divdi3 __moddi3 __udivdi3 __umoddi3 __ctzdi2 __ctzsi2 __aeabi_uidiv __aeabi_uidivmod __aeabi_idiv __aeabi_idivmod __aeabi_ulcmp __muldi3 __aeabi_lmul __aeabi_memcpy __aeabi_memcpy4 __aeabi_memcpy8 __aeabi_memclr __aeabi_memclr4 __aeabi_memclr8 __aeabi_memset __aeabi_lasr __aeabi_llsl __aeabi_llsr _restgpr_14_x __ucmpdi2 __ashldi3 __ashrdi3 __lshrdi3 __bswapsi2 __bswapdi2 __bzero __register_frame_info __deregister_frame_info ___chkstk_ms __chkstk_ms)
064360e6 1403fi
69be5b74 1404
a9f25a08 1405if test "x$TARGET_APPLE_LINKER" = x1 ; then
246a434f 1406CFLAGS="$TARGET_CFLAGS -nostdlib -static"
69be5b74 1407else
37378f74 1408CFLAGS="$TARGET_CFLAGS -nostdlib"
69be5b74 1409fi
42e0cba3 1410LIBS=""
aa6d7826 1411
6a161fa9 1412# Defined in aclocal.m4.
f6130a12 1413grub_PROG_TARGET_CC
a9f25a08 1414if test "x$TARGET_APPLE_LINKER" != x1 ; then
b977bf01 1415grub_PROG_OBJCOPY_ABSOLUTE
2b167a72 1416fi
cb71ba20 1417grub_PROG_LD_BUILD_ID_NONE
b977bf01 1418if test "x$target_cpu" = xi386; then
a9f25a08 1419 if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then
2aec1692
CF
1420 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
1421 # Check symbols provided by linker script.
37378f74 1422 CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},0x8000"
2aec1692 1423 fi
2a8a80e4 1424 grub_CHECK_BSS_START_SYMBOL
1425 grub_CHECK_END_SYMBOL
1426 fi
1427 CFLAGS="$TARGET_CFLAGS"
6a161fa9 1428fi
1429
20aea949
VS
1430grub_PROG_NM_WORKS
1431grub_PROG_NM_MINUS_P
1432grub_PROG_NM_DEFINED_ONLY
1433AC_SUBST(TARGET_NMFLAGS_MINUS_P)
1434AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
1435
016a671b 1436if test "$platform" != emu; then
8f9a632b
VS
1437AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
1438 SAVED_CPPFLAGS="$CPPFLAGS"
c25a1c93 1439 CPPFLAGS="$TARGET_CPPFLAGS -nostdlib -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
8f9a632b 1440 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
ce938140 1441#include <stddef.h>
8f9a632b
VS
1442int va_arg_func (int fixed, va_list args);]], [[]])],
1443 [grub_cv_cc_isystem=yes],
1444 [grub_cv_cc_isystem=no])
1445 CPPFLAGS="$SAVED_CPPFLAGS"
1446])
1447
1448if test x"$grub_cv_cc_isystem" = xyes ; then
1449 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
1450fi
dae79b6b 1451fi
5ce5507f 1452
19ce697d 1453AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [
24f4e57c 1454 CFLAGS="$TARGET_CFLAGS -Wtrampolines -Werror"
779dc15b
VS
1455 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
1456int va_arg_func (int fixed, va_list args);]], [[]])],
19ce697d
VS
1457 [grub_cv_cc_wtrampolines=yes],
1458 [grub_cv_cc_wtrampolines=no])
779dc15b
VS
1459])
1460
19ce697d
VS
1461if test x"$grub_cv_cc_wtrampolines" = xyes ; then
1462 TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines"
779dc15b
VS
1463fi
1464
c9a86192 1465# Restore the flags.
9962ed99 1466CC="$tmp_CC"
1467CFLAGS="$tmp_CFLAGS"
1468CPPFLAGS="$tmp_CPPFLAGS"
c9a86192 1469LDFLAGS="$tmp_LDFLAGS"
aa6d7826 1470LIBS="$tmp_LIBS"
6a161fa9 1471
4fe9862e 1472#
2965c7cc 1473# Check for options.
4fe9862e 1474#
1475
1476# Memory manager debugging.
b39f9d20 1477AC_ARG_ENABLE([mm-debug],
2965c7cc 1478 AS_HELP_STRING([--enable-mm-debug],
90ce5d56 1479 [include memory manager debugging]),
2965c7cc 1480 [AC_DEFINE([MM_DEBUG], [1],
1481 [Define to 1 if you enable memory manager debugging.])])
1482
c5dc1690
SJ
1483AC_ARG_ENABLE([cache-stats],
1484 AS_HELP_STRING([--enable-cache-stats],
055e2b8b 1485 [enable disk cache statistics collection]))
c5dc1690
SJ
1486
1487if test x$enable_cache_stats = xyes; then
1488 DISK_CACHE_STATS=1
1489else
1490 DISK_CACHE_STATS=0
1491fi
1492AC_SUBST([DISK_CACHE_STATS])
1493
e744219b
VS
1494AC_ARG_ENABLE([boot-time],
1495 AS_HELP_STRING([--enable-boot-time],
1496 [enable boot time statistics collection]))
1497
1498if test x$enable_boot_time = xyes; then
1499 BOOT_TIME_STATS=1
1500else
1501 BOOT_TIME_STATS=0
1502fi
1503AC_SUBST([BOOT_TIME_STATS])
1504
927d0134
VS
1505AC_ARG_ENABLE([grub-emu-sdl],
1506 [AS_HELP_STRING([--enable-grub-emu-sdl],
1507 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
1508
3affd0ec 1509AC_ARG_ENABLE([grub-emu-pci],
1510 [AS_HELP_STRING([--enable-grub-emu-pci],
1511 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
1512
f84b481b 1513if test "$platform" = emu; then
f84b481b 1514
927d0134 1515if test x"$enable_grub_emu_sdl" = xno ; then
16f7455b 1516 grub_emu_sdl_excuse="explicitly disabled"
927d0134
VS
1517fi
1518[if [ x"$grub_emu_sdl_excuse" = x ]; then
1519 # Check for libSDL libraries.]
1520AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
1521 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
1522 AC_SUBST([LIBSDL])
1523[fi]
9f293ab0 1524
927d0134
VS
1525[if [ x"$grub_emu_sdl_excuse" = x ]; then
1526 # Check for headers.]
1527 AC_CHECK_HEADERS([SDL/SDL.h], [],
1528 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
1529[fi]
9f293ab0 1530
927d0134 1531if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
16f7455b 1532 AC_MSG_ERROR([SDL support for grub-emu was explicitly requested but can't be compiled ($grub_emu_sdl_excuse)])
927d0134
VS
1533fi
1534if test x"$grub_emu_sdl_excuse" = x ; then
1535enable_grub_emu_sdl=yes
1536else
1537enable_grub_emu_sdl=no
1538fi
1539
3affd0ec 1540if test x"$enable_grub_emu_pci" != xyes ; then
325c8258 1541 grub_emu_pci_excuse="not enabled"
1542fi
1543
325c8258 1544[if [ x"$grub_emu_pci_excuse" = x ]; then
1545 # Check for libpci libraries.]
459fed4b 1546 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
1547 [grub_emu_pci_excuse=["need libpciaccess library"]])
1548 AC_SUBST([LIBPCIACCESS])
325c8258 1549[fi]
1550[if [ x"$grub_emu_pci_excuse" = x ]; then
1551 # Check for headers.]
5959b15c 1552 AC_CHECK_HEADERS([pciaccess.h], [],
459fed4b 1553 [grub_emu_pci_excuse=["need libpciaccess headers"]])
325c8258 1554[fi]
1555
1556if test x"$grub_emu_pci_excuse" = x ; then
1557enable_grub_emu_pci=yes
1558else
9f293ab0 1559
325c8258 1560enable_grub_emu_pci=no
3affd0ec 1561fi
1562
927d0134 1563AC_SUBST([enable_grub_emu_sdl])
3affd0ec 1564AC_SUBST([enable_grub_emu_pci])
e7d09ac4
AB
1565
1566else
1567
1568# Ignore --enable-emu-* if platform is not emu
1569enable_grub_emu_sdl=no
e7d09ac4 1570enable_grub_emu_pci=no
f84b481b 1571fi
4fe9862e 1572
e52db1f7 1573AC_ARG_ENABLE([grub-mkfont],
1574 [AS_HELP_STRING([--enable-grub-mkfont],
5ce5507f 1575 [build and install the `grub-mkfont' utility (default=guessed)])])
1576if test x"$enable_grub_mkfont" = xno ; then
ce7a733d 1577 grub_mkfont_excuse="explicitly disabled"
5ce5507f 1578fi
1579
7b780018
VS
1580unset ac_cv_header_ft2build_h
1581
660960d6
VS
1582if test x"$grub_mkfont_excuse" = x ; then
1583 # Check for freetype libraries.
7e23437d
CW
1584 PKG_CHECK_MODULES([FREETYPE], [freetype2], [
1585 SAVED_CPPFLAGS="$CPPFLAGS"
1586 SAVED_LIBS="$LIBS"
1587 CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
1588 LIBS="$LIBS $FREETYPE_LIBS"
1589 AC_CHECK_HEADERS([ft2build.h], [],
1590 [grub_mkfont_excuse=["need freetype2 headers"]])
1591 AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [],
1592 [grub_mkfont_excuse=["freetype2 library unusable"]])
1593 CPPFLAGS="$SAVED_CPPFLAGS"
1594 LIBS="$SAVED_LIBS"
1595 ], [grub_mkfont_excuse=["need freetype2 library"]])
660960d6
VS
1596fi
1597
5ce5507f 1598if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
d642d761 1599 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled ($grub_mkfont_excuse)])
5ce5507f 1600fi
1601if test x"$grub_mkfont_excuse" = x ; then
1602enable_grub_mkfont=yes
1603else
1604enable_grub_mkfont=no
1605fi
e52db1f7 1606AC_SUBST([enable_grub_mkfont])
e52db1f7 1607
7c9d0c39 1608SAVED_CC="$CC"
b224c266 1609SAVED_CPP="$CPP"
7c9d0c39
VS
1610SAVED_CFLAGS="$CFLAGS"
1611SAVED_CPPFLAGS="$CPPFLAGS"
dcecae1a 1612SAVED_LDFLAGS="$LDFLAGS"
7c9d0c39 1613CC="$BUILD_CC"
b224c266 1614CPP="$BUILD_CPP"
7c9d0c39 1615CFLAGS="$BUILD_CFLAGS"
7b780018 1616CPPFLAGS="$BUILD_CPPFLAGS"
dcecae1a 1617LDFLAGS="$BUILD_LDFAGS"
7b780018
VS
1618
1619unset ac_cv_c_bigendian
1620unset ac_cv_header_ft2build_h
1621
1622AC_COMPUTE_INT([BUILD_SIZEOF_VOID_P], [sizeof (void *)])
1623AC_COMPUTE_INT([BUILD_SIZEOF_LONG], [sizeof (long)])
1624AC_C_BIGENDIAN([BUILD_WORDS_BIGENDIAN=1], [BUILD_WORDS_BIGENDIAN=0], [BUILD_WORDS_BIGENDIAN=err], [BUILD_WORDS_BIGENDIAN=err])
1625
1626if test x$BUILD_WORDS_BIGENDIAN = xerr ; then
1627 AC_MSG_ERROR([couldnt determine build endianness])
1628fi
1629
1630AC_SUBST([BUILD_SIZEOF_LONG])
1631AC_SUBST([BUILD_SIZEOF_VOID_P])
1632AC_SUBST([BUILD_WORDS_BIGENDIAN])
c5884973 1633
7c9d0c39
VS
1634if test x"$grub_build_mkfont_excuse" = x ; then
1635 # Check for freetype libraries.
7e23437d
CW
1636 SAVED_PKG_CONFIG="$PKG_CONFIG"
1637 test -z "$BUILD_PKG_CONFIG" || PKG_CONFIG="$BUILD_PKG_CONFIG"
1638 PKG_CHECK_MODULES([BUILD_FREETYPE], [freetype2], [
1639 SAVED_CPPFLAGS_2="$CPPFLAGS"
1640 SAVED_LIBS="$LIBS"
1641 CPPFLAGS="$CPPFLAGS $BUILD_FREETYPE_CFLAGS"
1642 LIBS="$LIBS $BUILD_FREETYPE_LIBS"
1643 AC_CHECK_HEADERS([ft2build.h], [],
1644 [grub_build_mkfont_excuse=["need freetype2 headers"]])
1645 AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [],
1646 [grub_build_mkfont_excuse=["freetype2 library unusable"]])
1647 LIBS="$SAVED_LIBS"
1648 CPPFLAGS="$SAVED_CPPFLAGS_2"
1649 ], [grub_build_mkfont_excuse=["need freetype2 library"]])
1650 PKG_CONFIG="$SAVED_PKG_CONFIG"
7c9d0c39
VS
1651fi
1652
1653if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
d642d761 1654 AC_MSG_ERROR([build-grub-mkfont was explicitly requested but can't be compiled ($grub_build_mkfont_excuse)])
7c9d0c39
VS
1655fi
1656if test x"$grub_build_mkfont_excuse" = x ; then
1657 enable_build_grub_mkfont=yes
1658else
1659 enable_build_grub_mkfont=no
c5884973 1660fi
0af7539b 1661if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$platform" = xcoreboot ); then
d642d761 1662 if test x"$grub_build_mkfont_excuse" = x ; then
0af7539b 1663 AC_MSG_ERROR([qemu, coreboot and loongson ports need build-time grub-mkfont])
d642d761 1664 else
0af7539b 1665 AC_MSG_ERROR([qemu, coreboot and loongson ports need build-time grub-mkfont ($grub_build_mkfont_excuse)])
d642d761 1666 fi
7c9d0c39
VS
1667fi
1668
7c9d0c39 1669CC="$SAVED_CC"
b224c266 1670CPP="$SAVED_CPP"
7c9d0c39
VS
1671CFLAGS="$SAVED_CFLAGS"
1672CPPFLAGS="$SAVED_CPPFLAGS"
dcecae1a 1673LDFLAGS="$SAVED_LDFLAGS"
7c9d0c39
VS
1674
1675
1676DJVU_FONT_SOURCE=
1677
1678starfield_excuse=
c5884973 1679
300f48c5
VS
1680AC_ARG_ENABLE([grub-themes],
1681 [AS_HELP_STRING([--enable-grub-themes],
1682 [build and install GRUB themes (default=guessed)])])
1683if test x"$enable_grub_themes" = xno ; then
1684 starfield_excuse="explicitly disabled"
1685fi
1686
1687if test x"$starfield_excuse" = x && test x"$enable_build_grub_mkfont" = xno ; then
7b966834
VS
1688 starfield_excuse="No build-time grub-mkfont"
1689fi
1690
501b9e4b 1691if test x"$starfield_excuse" = x; then
c5884973 1692 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
c9434fab 1693 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/dejavu /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype; do
c5884973
DO
1694 if test -f "$dir/DejaVuSans.$ext"; then
1695 DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
1696 break 2
1697 fi
1698 done
1699 done
1700
1701 if test "x$DJVU_FONT_SOURCE" = x; then
1702 starfield_excuse="No DejaVu found"
1703 fi
1704fi
1705
300f48c5 1706if test x"$enable_grub_themes" = xyes && test x"$starfield_excuse" != x; then
d642d761 1707 AC_MSG_ERROR([themes were explicitly requested but requirements are not satisfied ($starfield_excuse)])
300f48c5
VS
1708fi
1709
c5884973
DO
1710AC_SUBST([DJVU_FONT_SOURCE])
1711
7c9d0c39
VS
1712FONT_SOURCE=
1713
1714for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
1715 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont /usr/share/fonts/uni /usr/share/fonts/truetype/unifont /usr/share/fonts/misc; do
1716 if test -f "$dir/unifont.$ext"; then
0277eab7
VS
1717 md5="$(md5sum "$dir/unifont.$ext"|awk '{ print $1; }')"
1718 # PCF and BDF from version 6.3 isn't hanled properly by libfreetype.
1719 if test "$md5" = 0a54834d2788c83886a3e1785a6a1e61 || test "$md5" = 28f2565c7a41d8d407e2551159385edb || test "$md5" = dae5e588461b3b92b87b6ffee734f936 || test "$md5" = 4a3d687aa5bb329ed05f4263a1016791 ; then
4d94b2db 1720 continue
0277eab7 1721 fi
7c9d0c39
VS
1722 FONT_SOURCE="$dir/unifont.$ext"
1723 break 2
1724 fi
1725 done
1726done
1727
7b966834
VS
1728if test x"$enable_build_grub_mkfont" = xno ; then
1729 FONT_SOURCE=
1730fi
1731
0af7539b 1732if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$platform" = xcoreboot ); then
d642d761 1733 if test x"$grub_build_mkfont_excuse" = x ; then
0af7539b 1734 AC_MSG_ERROR([qemu, coreboot and loongson ports need unifont])
d642d761 1735 else
0af7539b 1736 AC_MSG_ERROR([qemu, coreboot and loongson ports need unifont ($grub_build_mkfont_excuse)])
d642d761 1737 fi
7c9d0c39
VS
1738fi
1739
1740AC_SUBST([FONT_SOURCE])
1741
7b780018 1742if test x"$FONT_SOURCE" = x && test x"$DJVU_FONT_SOURCE" = x && test x"$grub_build_mkfont_excuse" = x; then
7c9d0c39
VS
1743 grub_build_mkfont_excuse="no fonts"
1744fi
1745
1746
897e6207
CW
1747AC_ARG_ENABLE([grub-mount],
1748 [AS_HELP_STRING([--enable-grub-mount],
1749 [build and install the `grub-mount' utility (default=guessed)])])
1750if test x"$enable_grub_mount" = xno ; then
1751 grub_mount_excuse="explicitly disabled"
92bb0786
VS
1752fi
1753
897e6207 1754if test x"$grub_mount_excuse" = x ; then
92bb0786 1755 AC_CHECK_LIB([fuse], [fuse_main_real], [],
897e6207 1756 [grub_mount_excuse="need FUSE library"])
92bb0786
VS
1757fi
1758
897e6207 1759if test x"$grub_mount_excuse" = x ; then
92bb0786
VS
1760 # Check for fuse headers.
1761 SAVED_CPPFLAGS="$CPPFLAGS"
fc7a64bc 1762 CPPFLAGS="$CPPFLAGS -DFUSE_USE_VERSION=26"
92bb0786 1763 AC_CHECK_HEADERS([fuse/fuse.h], [],
897e6207 1764 [grub_mount_excuse=["need FUSE headers"]])
92bb0786
VS
1765 CPPFLAGS="$SAVED_CPPFLAGS"
1766fi
1767
897e6207 1768if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
d642d761 1769 AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled ($grub_mount_excuse)])
92bb0786 1770fi
897e6207
CW
1771if test x"$grub_mount_excuse" = x ; then
1772enable_grub_mount=yes
92bb0786 1773else
897e6207 1774enable_grub_mount=no
92bb0786 1775fi
897e6207 1776AC_SUBST([enable_grub_mount])
92bb0786 1777
7181e228
CW
1778AC_ARG_ENABLE([device-mapper],
1779 [AS_HELP_STRING([--enable-device-mapper],
1780 [enable Linux device-mapper support (default=guessed)])])
1781if test x"$enable_device_mapper" = xno ; then
1782 device_mapper_excuse="explicitly disabled"
1783fi
1784
53798c4b
GS
1785if test x"$device_mapper_excuse" = x ; then
1786 # Check for device-mapper header.
1787 AC_CHECK_HEADER([libdevmapper.h], [],
1788 [device_mapper_excuse="need libdevmapper header"])
1789fi
1790
7181e228
CW
1791if test x"$device_mapper_excuse" = x ; then
1792 # Check for device-mapper library.
61d720e5 1793 AC_CHECK_LIB([devmapper], [dm_task_create], [],
7181e228 1794 [device_mapper_excuse="need devmapper library"])
7181e228 1795fi
61d720e5
VS
1796
1797if test x"$device_mapper_excuse" = x ; then
1798 # Check for device-mapper library.
1799 AC_CHECK_LIB([devmapper], [dm_log_with_errno_init],
1800 [],
1801 [device_mapper_excuse="need devmapper library"])
1802fi
1803
1804if test x"$device_mapper_excuse" = x ; then
4d94b2db 1805 LIBDEVMAPPER="-ldevmapper"
61d720e5
VS
1806 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
1807 [Define to 1 if you have the devmapper library.])
1808fi
1809
62f7d208 1810AC_SUBST([LIBDEVMAPPER])
76ed06b9 1811
f4727da9
VS
1812LIBGEOM=
1813if test x$host_kernel = xkfreebsd; then
1814 AC_CHECK_LIB([geom], [geom_gettree], [],
1815 [AC_MSG_ERROR([Your platform requires libgeom])])
1816 LIBGEOM="-lgeom"
1817fi
1818
1819AC_SUBST([LIBGEOM])
1820
0d2d30bb
VS
1821AC_ARG_ENABLE([liblzma],
1822 [AS_HELP_STRING([--enable-liblzma],
1823 [enable liblzma integration (default=guessed)])])
1824if test x"$enable_liblzma" = xno ; then
1825 liblzma_excuse="explicitly disabled"
1826fi
1827
1828if test x"$liblzma_excuse" = x ; then
2c44e493 1829AC_CHECK_LIB([lzma], [lzma_code],
0d2d30bb
VS
1830 [],[liblzma_excuse="need lzma library"])
1831fi
1832if test x"$liblzma_excuse" = x ; then
1833AC_CHECK_HEADER([lzma.h], [], [liblzma_excuse="need lzma header"])
1834fi
1835
1836if test x"$enable_liblzma" = xyes && test x"$liblzma_excuse" != x ; then
d642d761 1837 AC_MSG_ERROR([liblzma support was explicitly requested but requirements are not satisfied ($liblzma_excuse)])
0d2d30bb
VS
1838fi
1839
1840
1841if test x"$liblzma_excuse" = x ; then
1842 LIBLZMA="-llzma"
1843 AC_DEFINE([USE_LIBLZMA], [1],
1844 [Define to 1 if you have the LZMA library.])
1845fi
1846
2c44e493
VS
1847AC_SUBST([LIBLZMA])
1848
e4c498a1
MG
1849AC_ARG_ENABLE([libzfs],
1850 [AS_HELP_STRING([--enable-libzfs],
1851 [enable libzfs integration (default=guessed)])])
1852if test x"$enable_libzfs" = xno ; then
1853 libzfs_excuse="explicitly disabled"
1854fi
16c7cb32 1855
e4c498a1
MG
1856if test x"$libzfs_excuse" = x ; then
1857 # Only check for system headers if libzfs support has not been disabled.
1858 AC_CHECK_HEADERS(libzfs.h libnvpair.h)
1859fi
1860
1861if test x"$libzfs_excuse" = x ; then
1862 AC_CHECK_LIB([zfs], [libzfs_init],
1863 [],
1864 [libzfs_excuse="need zfs library"])
1865fi
1866
1867if test x"$libzfs_excuse" = x ; then
27f9d02e 1868 AC_CHECK_LIB([nvpair], [nvlist_lookup_string],
e4c498a1
MG
1869 [],
1870 [libzfs_excuse="need nvpair library"])
1871fi
1872
1873if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
d642d761 1874 AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied ($libzfs_excuse)])
e4c498a1
MG
1875fi
1876
1877if test x"$libzfs_excuse" = x ; then
1878 # We need both libzfs and libnvpair for a successful build.
1879 LIBZFS="-lzfs"
1880 AC_DEFINE([HAVE_LIBZFS], [1],
1881 [Define to 1 if you have the ZFS library.])
1882 LIBNVPAIR="-lnvpair"
1883 AC_DEFINE([HAVE_LIBNVPAIR], [1],
1884 [Define to 1 if you have the NVPAIR library.])
1885fi
1886
1887AC_SUBST([LIBZFS])
16c7cb32
BC
1888AC_SUBST([LIBNVPAIR])
1889
4493c7ab
CW
1890AC_ARG_ENABLE([ubuntu-recovery],
1891 [AS_HELP_STRING([--enable-ubuntu-recovery],
1892 [adjust boot options for the Ubuntu recovery mode (default=no)])],
1893 [], [enable_ubuntu_recovery=no])
1894if test x"$enable_ubuntu_recovery" = xyes ; then
1895 UBUNTU_RECOVERY=1
1896else
1897 UBUNTU_RECOVERY=0
1898fi
1899AC_SUBST([UBUNTU_RECOVERY])
1900
4225ea9e
CW
1901AC_ARG_ENABLE([quiet-boot],
1902 [AS_HELP_STRING([--enable-quiet-boot],
1903 [emit fewer messages at boot time (default=no)])],
1904 [], [enable_quiet_boot=no])
1905if test x"$enable_quiet_boot" = xyes ; then
1906 QUIET_BOOT=1
1907else
1908 QUIET_BOOT=0
1909fi
1910AC_SUBST([QUIET_BOOT])
1911
2184aa27
CW
1912AC_ARG_ENABLE([quick-boot],
1913 [AS_HELP_STRING([--enable-quick-boot],
1914 [bypass boot menu if possible (default=no)])],
1915 [], [enable_quick_boot=no])
1916if test x"$enable_quick_boot" = xyes ; then
1917 QUICK_BOOT=1
1918else
1919 QUICK_BOOT=0
1920fi
1921AC_SUBST([QUICK_BOOT])
1922
f892ba14
EB
1923AC_ARG_ENABLE([gfxpayload-dynamic],
1924 [AS_HELP_STRING([--enable-gfxpayload-dynamic],
1925 [use GRUB_GFXPAYLOAD_LINUX=keep unless explicitly unsupported on current hardware (default=no)])],
1926 [], [enable_gfxpayload_dynamic=no])
1927if test x"$enable_gfxpayload_dynamic" = xyes ; then
1928 GFXPAYLOAD_DYNAMIC=1
1929else
1930 GFXPAYLOAD_DYNAMIC=0
1931fi
1932AC_SUBST([GFXPAYLOAD_DYNAMIC])
1933
3b90c3e7
CW
1934AC_ARG_ENABLE([vt-handoff],
1935 [AS_HELP_STRING([--enable-vt-handoff],
1936 [use Linux vt.handoff option for flicker-free booting (default=no)])],
1937 [], [enable_vt_handoff=no])
1938if test x"$enable_vt_handoff" = xyes ; then
1939 VT_HANDOFF=1
1940else
1941 VT_HANDOFF=0
1942fi
1943AC_SUBST([VT_HANDOFF])
1944
9f915872
VS
1945LIBS=""
1946
76ed06b9 1947AC_SUBST([FONT_SOURCE])
76ed06b9
BC
1948AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
1949 [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
7181e228 1950
742f9232 1951AC_SUBST(HAVE_ASM_USCORE)
742f9232
VS
1952AC_SUBST(BSS_START_SYMBOL)
1953AC_SUBST(END_SYMBOL)
1954AC_SUBST(PACKAGE)
1955AC_SUBST(VERSION)
742f9232 1956
d5524ca8
VS
1957AC_ARG_ENABLE([werror],
1958 [AS_HELP_STRING([--disable-werror],
1959 [do not use -Werror when building GRUB])])
1960if test x"$enable_werror" != xno ; then
1961 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
1962 HOST_CFLAGS="$HOST_CFLAGS -Werror"
1963fi
1964
d5524ca8
VS
1965TARGET_CPP="$TARGET_CC -E"
1966TARGET_CCAS=$TARGET_CC
1967
b46bf3cd
VS
1968# Includes which include make-time substitutions. They must come last
1969# as to avoid executing top_builddir in shell.
1970HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
1971TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
1972TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
1973
d5524ca8
VS
1974GRUB_TARGET_CPU="${target_cpu}"
1975GRUB_PLATFORM="${platform}"
1976
1977AC_SUBST(GRUB_TARGET_CPU)
1978AC_SUBST(GRUB_PLATFORM)
1979
1980AC_SUBST(TARGET_OBJCONV)
d5524ca8
VS
1981AC_SUBST(TARGET_CPP)
1982AC_SUBST(TARGET_CCAS)
1983AC_SUBST(TARGET_OBJ2ELF)
d5524ca8 1984AC_SUBST(TARGET_MODULE_FORMAT)
6a7957f9 1985AC_SUBST(TARGET_CC_VERSION)
d5524ca8
VS
1986
1987AC_SUBST(TARGET_CFLAGS)
1988AC_SUBST(TARGET_LDFLAGS)
1989AC_SUBST(TARGET_CPPFLAGS)
1990AC_SUBST(TARGET_CCASFLAGS)
1991
d5524ca8
VS
1992AC_SUBST(TARGET_IMG_LDFLAGS)
1993AC_SUBST(TARGET_IMG_CFLAGS)
1994AC_SUBST(TARGET_IMG_BASE_LDOPT)
a9f25a08 1995AC_SUBST(TARGET_APPLE_LINKER)
d5524ca8
VS
1996
1997AC_SUBST(HOST_CFLAGS)
1998AC_SUBST(HOST_LDFLAGS)
1999AC_SUBST(HOST_CPPFLAGS)
2000AC_SUBST(HOST_CCASFLAGS)
2001
2002AC_SUBST(BUILD_LIBM)
2003
76ed06b9
BC
2004#
2005# Automake conditionals
2006#
8c411768 2007
5d90f6e5 2008AM_CONDITIONAL([COND_real_platform], [test x$platform != xnone])
76ed06b9
BC
2009AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
2010AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
2011AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
6585de4c 2012AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
76ed06b9
BC
2013AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
2014AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
2015AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
2016AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
2017AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
9612ebc0 2018AM_CONDITIONAL([COND_i386_xen], [test x$target_cpu = xi386 -a x$platform = xxen])
d789e70e 2019AM_CONDITIONAL([COND_i386_xen_pvh], [test x$target_cpu = xi386 -a x$platform = xxen_pvh])
9612ebc0 2020AM_CONDITIONAL([COND_x86_64_xen], [test x$target_cpu = xx86_64 -a x$platform = xxen])
4959e111
VS
2021AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
2022AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
7f63a64f 2023AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc])
76ed06b9 2024AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
eaf01c25 2025AM_CONDITIONAL([COND_sparc64_emu], [test x$target_cpu = xsparc64 -a x$platform = xemu])
76ed06b9 2026AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
4959e111 2027AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
37ba07eb
VS
2028AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
2029AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
389b31cd
LL
2030AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ])
2031AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot])
24e37a88 2032AM_CONDITIONAL([COND_arm_coreboot], [test x$target_cpu = xarm -a x$platform = xcoreboot])
389b31cd 2033AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi])
15a463d7
LL
2034AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ])
2035AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi])
f1957dc8
AG
2036AM_CONDITIONAL([COND_riscv32], [test x$target_cpu = xriscv32 ])
2037AM_CONDITIONAL([COND_riscv64], [test x$target_cpu = xriscv64 ])
2038AM_CONDITIONAL([COND_riscv32_efi], [test x$target_cpu = xriscv32 -a x$platform = xefi])
2039AM_CONDITIONAL([COND_riscv64_efi], [test x$target_cpu = xriscv64 -a x$platform = xefi])
f7711f5e 2040
faf4a65e
VS
2041AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
2042AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
2043AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
f7711f5e 2044AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
faf4a65e
VS
2045AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
2046AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
2047AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
2d465fb0 2048
76ed06b9 2049AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
76ed06b9
BC
2050AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
2051AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
2052AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
897e6207 2053AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
76ed06b9 2054AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
6f07c4e4
VS
2055if test x$FONT_SOURCE != x ; then
2056 HAVE_FONT_SOURCE=1
2057else
2058 HAVE_FONT_SOURCE=0
2059fi
2060AC_SUBST(HAVE_FONT_SOURCE)
a9f25a08 2061AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1])
76ed06b9 2062AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
c5dc1690 2063AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
e744219b 2064AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
fc45fb58 2065
1eed0e6e
VS
2066AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
2067
742f9232 2068AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
c5884973 2069AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
cd46aa6c
VS
2070AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy])
2071
2072test "x$prefix" = xNONE && prefix="$ac_default_prefix"
2073test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
2074datarootdir="$(eval echo "$datarootdir")"
2075grub_libdir="$(eval echo "$libdir")"
2076grub_localedir="$(eval echo "$localedir")"
2077grub_datadir="$(eval echo "$datadir")"
2078grub_sysconfdir="$(eval echo "$sysconfdir")"
2079AC_DEFINE_UNQUOTED(LOCALEDIR, "$grub_localedir", [Locale dir])
2080AC_DEFINE_UNQUOTED(GRUB_LIBDIR, "$grub_libdir", [Library dir])
2081AC_DEFINE_UNQUOTED(GRUB_DATADIR, "$grub_datadir", [Data dir])
2082AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "$grub_sysconfdir", [Configuration dir])
2083
742f9232 2084
6a161fa9 2085# Output files.
5d90f6e5
CW
2086if test "$platform" != none; then
2087 cpudir="${target_cpu}"
2088 if test x${cpudir} = xmipsel; then
2089 cpudir=mips;
f84b481b 2090 fi
5d90f6e5
CW
2091 grub_CHECK_LINK_DIR
2092 if test x"$link_dir" = xyes ; then
2093 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
2094 if test "$platform" != emu ; then
2095 AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
2096 fi
2097 else
2098 mkdir -p include/grub 2>/dev/null
2099 rm -rf include/grub/cpu
2100 cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
2101 if test "$platform" != emu ; then
2102 rm -rf include/grub/machine
2103 cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
2104 fi
f84b481b 2105 fi
5d90f6e5
CW
2106else
2107 # Just enough to stop the compiler failing with -I$(srcdir)/include.
2108 mkdir -p include 2>/dev/null
77063f4c 2109 rm -rf include/grub/cpu include/grub/machine
1f4147aa 2110fi
6304d292 2111
8c411768 2112AC_CONFIG_FILES([Makefile])
6304d292 2113AC_CONFIG_FILES([grub-core/Makefile])
35b90906 2114AC_CONFIG_FILES([grub-core/lib/gnulib/Makefile])
269004c1 2115AC_CONFIG_FILES([po/Makefile.in])
8c411768 2116AC_CONFIG_FILES([docs/Makefile])
b23ffd70 2117AC_CONFIG_FILES([util/bash-completion.d/Makefile])
6a161fa9 2118AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
742f9232 2119AC_CONFIG_FILES([config.h])
8c411768 2120
6a161fa9 2121AC_OUTPUT
5ce5507f 2122[
2123echo "*******************************************************"
2124echo GRUB2 will be compiled with following components:
2125echo Platform: "$target_cpu"-"$platform"
f84b481b 2126if [ x"$platform" = xemu ]; then
927d0134
VS
2127if [ x"$grub_emu_sdl_excuse" = x ]; then
2128echo SDL support for grub-emu: Yes
2129else
2130echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
2131fi
325c8258 2132if [ x"$grub_emu_pci_excuse" = x ]; then
2133echo PCI support for grub-emu: Yes
2134else
2135echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
2136fi
f84b481b 2137fi
61d720e5
VS
2138if test x"$device_mapper_excuse" = x ; then
2139echo With devmapper support: Yes
2140else
2141echo With devmapper support: No "($device_mapper_excuse)"
2142fi
5ce5507f 2143if [ x"$enable_mm_debug" = xyes ]; then
2144echo With memory debugging: Yes
2145else
2146echo With memory debugging: No
2147fi
c5dc1690
SJ
2148if [ x"$enable_cache_stats" = xyes ]; then
2149echo With disk cache statistics: Yes
2150else
2151echo With disk cache statistics: No
2152fi
e744219b
VS
2153
2154if [ x"$enable_boot_time" = xyes ]; then
2155echo With boot time statistics: Yes
2156else
2157echo With boot time statistics: No
2158fi
2159
5ce5507f 2160if [ x"$efiemu_excuse" = x ]; then
2161echo efiemu runtime: Yes
2162else
2163echo efiemu runtime: No "($efiemu_excuse)"
2164fi
5ce5507f 2165if [ x"$grub_mkfont_excuse" = x ]; then
2166echo grub-mkfont: Yes
2167else
2168echo grub-mkfont: No "($grub_mkfont_excuse)"
2169fi
897e6207 2170if [ x"$grub_mount_excuse" = x ]; then
89644ef1 2171echo grub-mount: Yes
92bb0786 2172else
897e6207 2173echo grub-mount: No "($grub_mount_excuse)"
92bb0786 2174fi
c5884973
DO
2175if [ x"$starfield_excuse" = x ]; then
2176echo starfield theme: Yes
443b3222 2177echo With DejaVuSans font from $DJVU_FONT_SOURCE
c5884973
DO
2178else
2179echo starfield theme: No "($starfield_excuse)"
2180fi
e4c498a1
MG
2181if [ x"$libzfs_excuse" = x ]; then
2182echo With libzfs support: Yes
2183else
2184echo With libzfs support: No "($libzfs_excuse)"
2185fi
7b780018 2186if [ x"$grub_build_mkfont_excuse" = x ]; then
7c9d0c39
VS
2187 echo Build-time grub-mkfont: Yes
2188 if test "x$FONT_SOURCE" = x ; then
2189 echo "Without unifont"
2190 else
2191 echo "With unifont from $FONT_SOURCE"
2192 fi
4b80e43c 2193else
7b780018 2194 echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)"
7c9d0c39 2195 echo "Without unifont (no build-time grub-mkfont)"
4b80e43c 2196fi
0d2d30bb
VS
2197if test x"$liblzma_excuse" != x ; then
2198echo "Without liblzma (no support for XZ-compressed mips images) ($liblzma_excuse)"
64fce2d8
VS
2199else
2200echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
2201fi
149524ea
CC
2202if test "x$enable_stack_protector" != xno; then
2203echo "With stack smashing protector: Yes"
2204else
2205echo "With stack smashing protector: No"
2206fi
4225ea9e
CW
2207if [ x"$enable_quiet_boot" = xyes ]; then
2208echo With quiet boot: Yes
2209else
2210echo With quiet boot: No
2211fi
5ce5507f 2212echo "*******************************************************"
2213]