3 # Process this file with autoconf to produce a configure script.
5 # Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
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.
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
16 dnl This configure script is complicated, because GRUB needs to deal
17 dnl with three potentially different types:
19 dnl build -- the environment for building GRUB
20 dnl host -- the environment for running utilities
21 dnl target -- the environment for running GRUB
23 dnl In addition, GRUB needs to deal with a platform specification
24 dnl which specifies the system running GRUB, such as firmware.
25 dnl This is necessary because the target type in autoconf does not
26 dnl describe such a system very well.
28 dnl The current strategy is to use variables with no prefix (such as
29 dnl CC, CFLAGS, etc.) for the host type, variables with prefix "BUILD_"
30 dnl (such as BUILD_CC, BUILD_CFLAGS, etc.) for the build type and variables
31 dnl with the prefix "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are
32 dnl used for the target type. See INSTALL for full list of variables.
34 AC_INIT([GRUB],[2.02~beta2],[bug-grub@gnu.org])
36 AC_CONFIG_AUX_DIR([build-aux])
38 # We don't want -g -O2 by default in CFLAGS
41 # Checks for build, host and target systems.
44 save_program_prefix="${program_prefix}"
46 program_prefix="${save_program_prefix}"
48 AM_INIT_AUTOMAKE([1.10.1])
50 AC_CONFIG_SRCDIR([include/grub/dl.h])
51 AC_CONFIG_HEADER([config-util.h])
53 # Program name transformations
55 grub_TRANSFORM([grub-bios-setup])
56 grub_TRANSFORM([grub-editenv])
57 grub_TRANSFORM([grub-install])
58 grub_TRANSFORM([grub-mkconfig])
59 grub_TRANSFORM([grub-mkfont])
60 grub_TRANSFORM([grub-mkimage])
61 grub_TRANSFORM([grub-glue-efi])
62 grub_TRANSFORM([grub-mklayout])
63 grub_TRANSFORM([grub-mkpasswd-pbkdf2])
64 grub_TRANSFORM([grub-mkrelpath])
65 grub_TRANSFORM([grub-mkrescue])
66 grub_TRANSFORM([grub-probe])
67 grub_TRANSFORM([grub-reboot])
68 grub_TRANSFORM([grub-script-check])
69 grub_TRANSFORM([grub-set-default])
70 grub_TRANSFORM([grub-sparc64-setup])
71 grub_TRANSFORM([grub-render-label])
72 grub_TRANSFORM([grub-file])
74 # Optimization flag. Allow user to override.
75 if test "x$TARGET_CFLAGS" = x; then
76 TARGET_CFLAGS="$TARGET_CFLAGS -Os"
79 # Default HOST_CPPFLAGS
80 HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
81 HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
82 HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
84 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
85 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
86 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
89 i[[3456]]86) target_cpu=i386 ;;
90 amd64) target_cpu=x86_64 ;;
91 sparc) target_cpu=sparc64 ;;
94 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1"
98 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1"
108 # Specify the platform (such as firmware).
109 AC_ARG_WITH([platform],
110 AS_HELP_STRING([--with-platform=PLATFORM],
111 [select the host platform [[guessed]]]))
113 # Guess the platform if not specified.
114 if test "x$with_platform" = x; then
115 case "$target_cpu"-"$target_vendor" in
116 i386-apple) platform=efi ;;
117 i386-*) platform=pc ;;
118 x86_64-apple) platform=efi ;;
119 x86_64-*) platform=pc ;;
120 powerpc-*) platform=ieee1275 ;;
121 powerpc64-*) platform=ieee1275 ;;
122 sparc64-*) platform=ieee1275 ;;
123 mipsel-*) platform=loongson ;;
124 mips-*) platform=arc ;;
125 ia64-*) platform=efi ;;
126 arm-*) platform=uboot ;;
127 arm64-*) platform=efi ;;
128 *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
131 platform="$with_platform"
134 case "$target_cpu"-"$platform" in
138 x86_64-*) target_cpu=i386 ;;
139 powerpc64-ieee1275) target_cpu=powerpc ;;
142 # Check if the platform is supported, make final adjustments.
143 case "$target_cpu"-"$platform" in
151 i386-linuxbios) platform=coreboot ;;
158 mips-qemu-mips) platform=qemu_mips;;
162 mipsel-qemu-mips) platform=qemu_mips;;
163 mipsel-yeeloong) platform=loongson ;;
164 mipsel-fuloong) platform=loongson ;;
170 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
173 if test x$platform != xemu ; then
174 case "$target_cpu" in
175 i386 | powerpc) target_m32=1 ;;
176 x86_64 | sparc64) target_m64=1 ;;
180 if test x"$target_cpu-$platform" = xsparc64-emu ; then
185 windows* | mingw32*) target_os=cygwin ;;
188 # This normalizes the names, and creates a new variable ("host_kernel")
189 # while at it, since the mapping is not always 1:1 (e.g. different OSes
190 # using the same kernel type).
192 gnu*) host_kernel=hurd ;;
193 linux*) host_kernel=linux ;;
194 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
195 netbsd*) host_kernel=netbsd ;;
196 solaris*) host_kernel=illumos ;;
197 darwin*) host_kernel=xnu ;;
198 cygwin | windows* | mingw32*) host_kernel=windows ;;
202 cygwin | windows* | mingw32*) have_exec=n ;;
203 aros*) have_exec=n ;;
208 coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
209 multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
210 efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
211 xen) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XEN=1" ;;
212 ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
213 uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;;
214 qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
215 pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
216 emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
217 loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1" ;;
218 qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1" ;;
219 arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
221 if test x${target_cpu} = xmipsel ; then
222 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
224 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
227 case "${target_cpu}-$platform" in
229 TARGET_LINK_ADDR=0x88200000
230 TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000
233 TARGET_LINK_ADDR=0x80700000
234 TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000
236 mips*-qemu_mips | mips*-loongson)
237 TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000
241 AC_SUBST(TARGET_LINK_ADDR)
242 AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR)
244 TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
248 AC_SUBST(host_kernel)
253 # Define default variables
256 AC_ARG_WITH([bootdir],
257 AS_HELP_STRING([--with-bootdir=DIR],
258 [set the name of /boot directory [[guessed]]]),
259 [have_with_bootdir=y],
260 [have_with_bootdir=n])
261 if test x$have_with_bootdir = xy; then
262 bootdirname="$with_bootdir"
266 # Because /boot is used for the boot block in NetBSD and OpenBSD,
268 *) bootdirname='boot' ;;
272 AC_SUBST(bootdirname)
273 AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
274 [Default boot directory name]")
276 AC_ARG_WITH([grubdir],
277 AS_HELP_STRING([--with-grubdir=DIR],
278 [set the name of grub directory [[guessed]]]),
279 [grubdirname="$with_grubdir"],
280 [grubdirname="$PACKAGE"])
282 AC_SUBST(grubdirname)
283 AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
284 [Default grub directory name])
287 # Checks for build programs.
290 # Although cmp is listed in the GNU Coding Standards as a command which
291 # can used directly, OpenBSD lacks cmp in the default installation.
292 AC_CHECK_PROGS([CMP], [cmp])
293 if test "x$CMP" = x; then
294 AC_MSG_ERROR([cmp is not found])
297 AC_CHECK_PROGS([YACC], [bison])
298 if test "x$YACC" = x; then
299 AC_MSG_ERROR([bison is not found])
311 if test "x$LEX" = "x:"; then
312 AC_MSG_ERROR([flex is not found])
314 version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
315 if test -n "$version" -a "$version" -ge 20535; then
318 AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
322 # These are not a "must".
323 AC_PATH_PROGS(MAKEINFO, makeinfo true)
326 # Checks for host programs.
336 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
338 AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
341 AM_GNU_GETTEXT([external])
344 # Identify characteristics of the host architecture.
345 unset ac_cv_c_bigendian
347 if test x"$target_cpu-$platform" = xsparc64-emu ; then
348 CFLAGS="$CFLAGS -m64"
349 HOST_CFLAGS="$HOST_CFLAGS -m64"
353 AC_CHECK_SIZEOF(void *)
354 AC_CHECK_SIZEOF(long)
357 cygwin | windows* | mingw32*)
358 HOST_CPPFLAGS="$HOST_CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
359 CPPFLAGS="$CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
360 AC_CHECK_SIZEOF(TCHAR,,[#include <windows.h>])
364 if test x$USE_NLS = xno; then
365 HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
368 if test "x$cross_compiling" = xyes; then
369 AC_MSG_WARN([cannot generate manual pages while cross compiling])
371 AC_PATH_PROG(HELP2MAN, help2man)
374 # Check for functions and headers.
375 AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
376 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
378 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
379 #include <sys/param.h>
380 #include <sys/mount.h>])
382 AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default
383 #include <sys/param.h>
384 #include <sys/mount.h>])
386 # For opendisk() and getrawpartition() on NetBSD.
387 # Used in util/deviceiter.c and in util/hostdisk.c.
388 AC_CHECK_HEADER([util.h], [
389 AC_CHECK_LIB([util], [opendisk], [
391 AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
393 AC_CHECK_LIB([util], [getrawpartition], [
395 AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
400 AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
401 SAVED_CFLAGS="$CFLAGS"
402 CFLAGS="$HOST_CFLAGS -Wtrampolines -Werror"
403 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
404 int va_arg_func (int fixed, va_list args);]], [[]])],
405 [grub_cv_host_cc_wtrampolines=yes],
406 [grub_cv_host_cc_wtrampolines=no])
407 CFLAGS="$SAVED_CFLAGS"
410 if test x"$grub_host_cv_cc_wtrampolines" = xyes ; then
411 HOST_CFLAGS="$HOST_CFLAGS -Wtrampolines"
415 # Check for host and build compilers.
418 AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc])
419 test -z "$BUILD_CC" && AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])
420 BUILD_CPP="$BUILD_CC -E"
423 haiku*) BUILD_LIBM= ;;
427 dnl FIXME proper test seems to require too deep dive into Autoconf internals.
428 dnl For now just list known platforms that we support.
431 cygwin*|mingw32*|mingw64*) BUILD_EXEEXT=.exe ;;
434 AC_SUBST(BUILD_EXEEXT)
439 WARN_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"
440 EXTRA_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"
442 HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"
444 AC_CACHE_CHECK([which extra warnings work], [grub_cv_cc_w_extra_flags], [
445 SAVED_CFLAGS="$CFLAGS"
446 grub_cv_cc_w_extra_flags=
447 for x in $EXTRA_WARN_FLAGS; do
448 CFLAGS="$HOST_CFLAGS $x -Werror"
449 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
450 if test x$flag = x1 ; then
451 grub_cv_cc_w_extra_flags="$grub_cv_cc_w_extra_flags $x"
454 CFLAGS="$SAVED_CFLAGS"
457 HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags"
460 # Check for target programs.
463 # Find tools for the target.
464 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
465 tmp_ac_tool_prefix="$ac_tool_prefix"
466 ac_tool_prefix=$target_alias-
468 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
469 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
470 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
471 AC_CHECK_TOOL(TARGET_STRIP, strip)
472 AC_CHECK_TOOL(TARGET_NM, nm)
473 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
475 ac_tool_prefix="$tmp_ac_tool_prefix"
477 if test "x$TARGET_CC" = x; then
480 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
481 AC_CHECK_TOOL(TARGET_STRIP, strip)
482 AC_CHECK_TOOL(TARGET_NM, nm)
483 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
488 AC_SUBST(BUILD_CFLAGS)
489 AC_SUBST(BUILD_CPPFLAGS)
490 AC_SUBST(BUILD_LDFLAGS)
493 AC_SUBST(TARGET_RANLIB)
494 AC_SUBST(TARGET_STRIP)
495 AC_SUBST(TARGET_OBJCOPY)
497 # Test the C compiler for the target environment.
500 tmp_LDFLAGS="$LDFLAGS"
501 tmp_CPPFLAGS="$CPPFLAGS"
504 CFLAGS="$TARGET_CFLAGS"
505 CPPFLAGS="$TARGET_CPPFLAGS"
506 LDFLAGS="$TARGET_LDFLAGS"
510 TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
511 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
513 if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then
514 TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align"
517 TARGET_CC_VERSION="$(LC_ALL=C $TARGET_CC --version | head -n1)"
519 AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [
520 LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
522 grub_cv_target_cc_w_extra_flags=
523 for x in $EXTRA_WARN_FLAGS; do
524 CFLAGS="$TARGET_CFLAGS $x -Werror"
525 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
526 asm (".globl start; start:");
528 void __main (void) {}
530 ]], [[]])], [flag=1], [flag=0])
531 if test x$flag = x1 ; then
532 grub_cv_target_cc_w_extra_flags="$grub_cv_target_cc_w_extra_flags $x"
537 TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_w_extra_flags"
539 AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang]
541 CFLAGS="$TARGET_CFLAGS"
543 [AC_LANG_PROGRAM([], [[
548 [grub_cv_cc_target_clang=no], [grub_cv_cc_target_clang=yes])])
550 # on x86 clang doesn't support .code16
551 # on arm clang doesn't support .arch directive
552 # on mips clang doesn't support privilegied instructions, doubleword store/load
553 # and crashes with hand-written assembly
554 if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \
555 || test "x$target_cpu" = xx86_64 || test "x$target_cpu" = xarm \
556 || test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ); then
557 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
560 if test "x$grub_cv_cc_target_clang" = xyes && test "x$target_cpu" = xpowerpc; then
561 AC_CACHE_CHECK([if clang can handle ame instruction], [grub_cv_cc_target_clang_ame]
563 CFLAGS="$TARGET_CFLAGS"
565 [AC_LANG_PROGRAM([], [[
566 unsigned int a = 0, b = 0;
567 asm volatile ("{ame|addme} %0,%1" : "=r" (a) : "r" (b));
571 [grub_cv_cc_target_clang_ame=yes], [grub_cv_cc_target_clang_ame=no])])
572 # clang <= 3.3 doesn't handle most of ppc assembly, not even inline assembly
574 if test x$grub_cv_cc_target_clang_ame = xno ; then
575 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
576 TARGET_CFLAGS="$TARGET_CFLAGS -no-integrated-as"
580 if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
581 TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
584 if test "x$target_m32" = x1; then
586 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
587 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
588 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
589 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
590 TARGET_MODULE_FORMAT="elf32"
593 if test "x$target_m64" = x1; then
595 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
596 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
597 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
598 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
599 TARGET_MODULE_FORMAT="elf64"
602 if test "x$grub_cv_cc_target_clang" = xno && test "x$target_cpu" = xi386 && test "x$platform" != xemu && test "x$platform" != xefi; then
603 TARGET_CFLAGS="$TARGET_CFLAGS -mrtd -mregparm=3"
606 # on mips redirect cache flushing function to non-existant one.
607 if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then
608 AC_CACHE_CHECK([whether -mflush-func=grub_red_herring works], [grub_cv_cc_mflush_func], [
609 CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring -Werror"
610 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
611 [grub_cv_cc_mflush_func=yes],
612 [grub_cv_cc_mflush_func=no])
615 if test "x$grub_cv_cc_mflush_func" = xyes; then
616 TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring"
621 # Force no alignment to save space on i386.
622 if test "x$target_cpu" = xi386; then
623 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
624 CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror"
625 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
626 [grub_cv_cc_falign_loop=yes],
627 [grub_cv_cc_falign_loop=no])
630 AC_CACHE_CHECK([whether -malign-loops works], [grub_cv_cc_malign_loop], [
631 CFLAGS="$TARGET_CFLAGS -malign-loops=1 -Werror"
632 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
633 [grub_cv_cc_malign_loop=yes],
634 [grub_cv_cc_malign_loop=no])
637 if test "x$grub_cv_cc_falign_loop" = xyes; then
638 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
639 elif test "x$grub_cv_cc_malign_loop" = xyes; then
640 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
644 AC_CACHE_CHECK([whether -freg-struct-return works], [grub_cv_cc_freg_struct_return], [
645 CFLAGS="$TARGET_CFLAGS -freg-struct-return -Werror"
646 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
647 [grub_cv_cc_freg_struct_return=yes],
648 [grub_cv_cc_freg_struct_return=no])
651 if test "x$grub_cv_cc_freg_struct_return" = xyes; then
652 TARGET_CFLAGS="$TARGET_CFLAGS -freg-struct-return"
655 if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
656 # Some toolchains enable these features by default, but they need
657 # registers that aren't set up properly in GRUB.
658 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
661 # By default, GCC 4.4 generates .eh_frame sections containing unwind
662 # information in some cases where it previously did not. GRUB doesn't need
663 # these and they just use up vital space. Restore the old compiler
665 AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
666 CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
667 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
668 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
669 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
672 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
673 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
676 if test x"$target_os" = xcygwin; then
677 AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [
678 CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
679 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
680 [grub_cv_cc_no_reorder_functions=yes],
681 [grub_cv_cc_no_reorder_functions=no])
685 if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xyes; then
686 TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
689 # By default, GCC 4.6 generates .eh_frame sections containing unwind
690 # information in some cases where it previously did not. GRUB doesn't need
691 # these and they just use up vital space. Restore the old compiler
693 AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
694 CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
695 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
696 [grub_cv_cc_fno_asynchronous_unwind_tables=yes],
697 [grub_cv_cc_fno_asynchronous_unwind_tables=no])
700 if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
701 TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
704 AC_ARG_ENABLE([efiemu],
705 [AS_HELP_STRING([--enable-efiemu],
706 [build and install the efiemu runtimes (default=guessed)])])
707 if test x"$enable_efiemu" = xno ; then
708 efiemu_excuse="explicitly disabled"
710 if test x"$grub_cv_target_cc_link_format" = x-mi386pe || test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
711 efiemu_excuse="not available on cygwin"
713 if test x"$target_cpu" != xi386 ; then
714 efiemu_excuse="only available on i386"
716 if test x"$platform" = xefi ; then
717 efiemu_excuse="not available on efi"
719 if test x"$efiemu_excuse" = x ; then
720 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
721 CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
722 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
723 [grub_cv_cc_efiemu=yes],
724 [grub_cv_cc_efiemu=no])
726 if test x$grub_cv_cc_efiemu = xno; then
727 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
730 if test x"$efiemu_excuse" = x ; then
731 AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [
732 grub_cv_target_cc_efiemu64_link_format=unknown
733 for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -arch,x86_64; do
734 CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
735 LDFLAGS="-m64 -Wl,$format -nostdlib -static"
736 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
737 asm (".globl start; start:");
738 asm (".globl _start; _start:");
739 asm (".globl __start; __start:");
741 void __main (void) {}
742 ]], [[]])], [flag=1], [flag=0])
743 if test x"$flag" = x1; then
744 grub_cv_target_cc_efiemu64_link_format="$format"
748 if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then
749 efiemu_excuse="no suitable link format for efiemu64 found"
751 EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format"
754 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
755 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled ($efiemu_excuse)])
757 if test x"$efiemu_excuse" = x ; then
762 AC_SUBST([enable_efiemu])
763 AC_SUBST([EFIEMU64_LINK_FORMAT])
765 CFLAGS="$TARGET_CFLAGS"
768 if test x"$platform" = xemu ; then
770 grub_cv_target_cc_link_format=
773 grub_cv_target_cc_link_format="-arch,${target_cpu}"
774 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
776 *windows* | *cygwin* | *mingw*)
777 if test x${target_cpu} = xi386 ; then
778 grub_cv_target_cc_link_format=-mi386pe
779 TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)'
781 if test x${target_cpu} = xx86_64 ; then
782 grub_cv_target_cc_link_format=-mi386pep
783 TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)'
785 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
788 elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
789 AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_format], [
790 grub_cv_target_cc_link_format=unknown
791 for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -mi386pe -mi386pep -arch,${target_cpu}; do
792 if test x${target_cpu} != xi386 && test x$format = x-mi386pe; then
795 if test x${target_cpu} != xx86_64 && test x$format = x-mi386pep; then
798 CFLAGS="$TARGET_CFLAGS"
799 LDFLAGS="$TARGET_LDFLAGS -Wl,$format -nostdlib -static"
800 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
801 asm (".globl start; start:");
802 asm (".globl _start; _start:");
803 asm (".globl __start; __start:");
805 void __main (void) {}
806 ]], [[]])], [flag=1], [flag=0])
807 if test x"$flag" = x1; then
808 grub_cv_target_cc_link_format="$format"
812 if test x"$grub_cv_target_cc_link_format" = xunknown; then
813 AC_MSG_ERROR([no suitable link format found])
815 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
816 if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then
817 TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)'
819 if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
820 TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)'
824 if test x$grub_cv_target_cc_link_format = x-arch,i386 || test x$grub_cv_target_cc_link_format = x-arch,x86_64; then
825 TARGET_APPLE_LINKER=1
826 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], [])
827 if test "x$TARGET_OBJCONV" = x ; then
828 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.])
830 if test "x$TARGET_OBJCONV" = x ; then
831 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
834 TARGET_IMG_CFLAGS="-static"
835 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
836 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
837 TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
838 TARGET_LDFLAGS_OLDMAGIC=""
839 elif test x$grub_cv_target_cc_link_format = x-mi386pe || test x$grub_cv_target_cc_link_format = x-mi386pep ; then
840 TARGET_APPLE_LINKER=0
841 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
842 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/i386-cygwin-img-ld.sc"
843 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
844 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/i386-cygwin-img-ld.sc"
845 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
848 TARGET_APPLE_LINKER=0
849 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
851 TARGET_IMG_LDFLAGS='-Wl,-N'
852 TARGET_IMG_LDFLAGS_AC='-Wl,-N'
853 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
857 AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
860 LDFLAGS="$TARGET_LDFLAGS"
862 if test "$target_cpu" = x86_64 || test "$target_cpu-$platform" = sparc64-emu ; then
863 # Use large model to support 4G memory
864 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
865 CFLAGS="$TARGET_CFLAGS -mcmodel=large"
866 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
867 [grub_cv_cc_mcmodel=yes],
868 [grub_cv_cc_mcmodel=no])
870 if test "x$grub_cv_cc_mcmodel" = xyes; then
871 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
872 elif test "$target_cpu-$platform" = sparc64-emu; then
873 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany"
877 if test "$target_cpu"-"$platform" = x86_64-efi; then
878 # EFI writes to stack below %rsp, we must not use the red zone
879 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
880 CFLAGS="$TARGET_CFLAGS -mno-red-zone"
881 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
882 [grub_cv_cc_no_red_zone=yes],
883 [grub_cv_cc_no_red_zone=no])
885 if test "x$grub_cv_cc_no_red_zone" = xno; then
886 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
889 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
892 if test "x$target_cpu" = xarm; then
893 AC_CACHE_CHECK([whether option -mlong-calls works], grub_cv_cc_mlong_calls, [
894 CFLAGS="$TARGET_CFLAGS -mlong-calls -Werror"
895 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
896 [grub_cv_cc_mlong_calls=yes],
897 [grub_cv_cc_mlong_calls=no])
899 if test "x$grub_cv_cc_mlong_calls" = xyes; then
900 TARGET_CFLAGS="$TARGET_CFLAGS -mlong-calls"
902 AC_CACHE_CHECK([whether option -mthumb-interwork works], grub_cv_cc_mthumb_interwork, [
903 CFLAGS="$TARGET_CFLAGS -mthumb-interwork -Werror"
904 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
905 [grub_cv_cc_mthumb_interwork=yes],
906 [grub_cv_cc_mthumb_interwork=no])
908 if test "x$grub_cv_cc_mthumb_interwork" = xyes; then
909 TARGET_CFLAGS="$TARGET_CFLAGS -mthumb-interwork"
910 elif test "x$grub_cv_cc_target_clang" = xno ; then
911 AC_MSG_ERROR([your compiler doesn't support -mthumb-interwork])
913 CFLAGS="$TARGET_CFLAGS"
914 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
915 #if defined (__thumb__) && !defined (__thumb2__)
916 #error thumb without interworking
919 [no_interwork_ok=yes],
920 [no_interwork_ok=no])
921 if test x$no_interwork_ok = xno ; then
922 AC_MSG_ERROR([attempt to compile to thumb with no thumb interwork])
927 AC_CACHE_CHECK([whether option -Qn works], grub_cv_target_cc_qn, [
928 CFLAGS="$TARGET_CFLAGS -Qn -Werror"
929 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
930 [grub_cv_target_cc_qn=yes],
931 [grub_cv_target_cc_qn=no])])
932 if test "x$grub_cv_target_cc_qn" = xyes; then
933 TARGET_CFLAGS="$TARGET_CFLAGS -Qn"
940 CFLAGS="$TARGET_CFLAGS"
942 # Position independent executable.
944 [# Need that, because some distributions ship compilers that include
945 # `-fPIE' in the default specs.
946 if [ x"$pie_possible" = xyes ]; then
947 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
950 CFLAGS="$TARGET_CFLAGS"
952 # Position independent executable.
954 [# On most platforms we don't want PIC as it only makes relocations harder
955 # and code less efficient. On mips we want to have one got table per module
956 # and reload $gp in every function.
957 # GCC implements it using symbol __gnu_local_gp in non-PIC as well.
958 # However with clang we need PIC for this reloading to happen.
959 # Since default varies across dictributions use either -fPIC or -fno-PIC
961 if ( test x$target_cpu = xmips || test x$target_cpu = xmipsel ) && test "x$grub_cv_cc_target_clang" = xyes ; then
962 TARGET_CFLAGS="$TARGET_CFLAGS -fPIC"
963 elif [ x"$pic_possible" = xyes ]; then
964 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
967 CFLAGS="$TARGET_CFLAGS"
969 # Smashing stack protector.
970 grub_CHECK_STACK_PROTECTOR
971 # Need that, because some distributions ship compilers that include
972 # `-fstack-protector' in the default specs.
973 if test "x$ssp_possible" = xyes; then
974 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
977 CFLAGS="$TARGET_CFLAGS"
979 grub_CHECK_STACK_ARG_PROBE
980 # Cygwin's GCC uses alloca() to probe the stackframe on static
981 # stack allocations above some threshold.
982 if test x"$sap_possible" = xyes; then
983 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
986 CFLAGS="$TARGET_CFLAGS"
988 # -mno-unaligned-access -mstrict-align
989 if test "$target_cpu" = arm; then
990 AC_CACHE_CHECK([for compile options to get strict alignment], [grub_cv_target_cc_strict_align], [
991 grub_cv_target_cc_strict_align=
992 for arg in -mno-unaligned-access "-Xclang -mstrict-align" -mstrict-align; do
993 CFLAGS="$TARGET_CFLAGS $arg -Werror"
994 LDFLAGS="$TARGET_LDFLAGS"
995 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
996 if test x"$flag" = x1; then
997 grub_cv_target_cc_strict_align="$arg"
1002 TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_strict_align"
1003 if test x"$grub_cv_target_cc_strict_align" = x"-Xclang -mstrict-align"; then
1004 TARGET_LDFLAGS="$TARGET_LDFLAGS -Qunused-arguments"
1006 AC_CACHE_CHECK([if compiler generates unaligned accesses], [grub_cv_cc_target_emits_unaligned],
1007 [CFLAGS="$TARGET_CFLAGS"
1008 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
1009 #ifdef __ARM_FEATURE_UNALIGNED
1013 [grub_cv_cc_target_emits_unaligned=no], [grub_cv_cc_target_emits_unaligned=yes])])
1014 if test x$grub_cv_cc_target_emits_unaligned = xyes; then
1015 AC_MSG_ERROR([compiler generates unaligned accesses])
1019 # Set them to their new values for the tests below.
1021 if test "x$TARGET_APPLE_LINKER" = x1 ; then
1022 CFLAGS="$TARGET_CFLAGS -nostdlib -static -Wno-error"
1024 CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
1026 CPPFLAGS="$TARGET_CPPFLAGS"
1027 if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes ; then
1033 LIBS="$TARGET_LIBGCC"
1036 if test "x$TARGET_APPLE_LINKER" = x0 ; then
1037 if test x$grub_cv_asm_uscore = xyes; then
1038 DEFSYM="-Wl,--defsym,_abort=_main -Wl,--defsym,__main=_main"
1040 DEFSYM="-Wl,--defsym,abort=main -Wl,--defsym,_main=main -Wl,--defsym,__main=main"
1042 CFLAGS="$TARGET_CFLAGS -nostdlib $DEFSYM"
1045 # Check for libgcc symbols
1046 AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x)
1048 if test "x$TARGET_APPLE_LINKER" = x1 ; then
1049 CFLAGS="$TARGET_CFLAGS -nostdlib -static"
1051 CFLAGS="$TARGET_CFLAGS -nostdlib"
1055 # Defined in aclocal.m4.
1057 if test "x$TARGET_APPLE_LINKER" != x1 ; then
1058 grub_PROG_OBJCOPY_ABSOLUTE
1060 grub_PROG_LD_BUILD_ID_NONE
1061 if test "x$target_cpu" = xi386; then
1062 if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then
1063 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
1064 # Check symbols provided by linker script.
1065 CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},0x8000"
1067 grub_CHECK_BSS_START_SYMBOL
1068 grub_CHECK_END_SYMBOL
1070 CFLAGS="$TARGET_CFLAGS"
1071 grub_I386_ASM_PREFIX_REQUIREMENT
1072 grub_I386_ASM_ADDR32
1076 grub_PROG_NM_MINUS_P
1077 grub_PROG_NM_DEFINED_ONLY
1078 AC_SUBST(TARGET_NMFLAGS_MINUS_P)
1079 AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
1081 if test "$platform" != emu; then
1082 AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
1083 SAVED_CPPFLAGS="$CPPFLAGS"
1084 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
1085 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
1087 int va_arg_func (int fixed, va_list args);]], [[]])],
1088 [grub_cv_cc_isystem=yes],
1089 [grub_cv_cc_isystem=no])
1090 CPPFLAGS="$SAVED_CPPFLAGS"
1093 if test x"$grub_cv_cc_isystem" = xyes ; then
1094 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
1098 AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [
1099 CFLAGS="$TARGET_CFLAGS -Wtrampolines -Werror"
1100 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
1101 int va_arg_func (int fixed, va_list args);]], [[]])],
1102 [grub_cv_cc_wtrampolines=yes],
1103 [grub_cv_cc_wtrampolines=no])
1106 if test x"$grub_cv_cc_wtrampolines" = xyes ; then
1107 TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines"
1110 # Restore the flags.
1112 CFLAGS="$tmp_CFLAGS"
1113 CPPFLAGS="$tmp_CPPFLAGS"
1114 LDFLAGS="$tmp_LDFLAGS"
1118 # Check for options.
1121 # Memory manager debugging.
1122 AC_ARG_ENABLE([mm-debug],
1123 AS_HELP_STRING([--enable-mm-debug],
1124 [include memory manager debugging]),
1125 [AC_DEFINE([MM_DEBUG], [1],
1126 [Define to 1 if you enable memory manager debugging.])])
1128 AC_ARG_ENABLE([cache-stats],
1129 AS_HELP_STRING([--enable-cache-stats],
1130 [enable disk cache statistics collection]))
1132 if test x$enable_cache_stats = xyes; then
1137 AC_SUBST([DISK_CACHE_STATS])
1139 AC_ARG_ENABLE([boot-time],
1140 AS_HELP_STRING([--enable-boot-time],
1141 [enable boot time statistics collection]))
1143 if test x$enable_boot_time = xyes; then
1148 AC_SUBST([BOOT_TIME_STATS])
1150 AC_ARG_ENABLE([grub-emu-usb],
1151 [AS_HELP_STRING([--enable-grub-emu-usb],
1152 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
1154 AC_ARG_ENABLE([grub-emu-sdl],
1155 [AS_HELP_STRING([--enable-grub-emu-sdl],
1156 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
1158 AC_ARG_ENABLE([grub-emu-pci],
1159 [AS_HELP_STRING([--enable-grub-emu-pci],
1160 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
1162 if test "$platform" = emu; then
1164 if test x"$enable_grub_emu_usb" != xyes ; then
1165 grub_emu_usb_excuse="not enabled"
1168 if test x"$enable_grub_emu_pci" = xyes ; then
1169 grub_emu_usb_excuse="conflicts with PCI support"
1172 [if [ x"$grub_emu_usb_excuse" = x ]; then
1173 # Check for libusb libraries.]
1174 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
1175 [grub_emu_usb_excuse=["need libusb library"]])
1178 [if [ x"$grub_emu_usb_excuse" = x ]; then
1179 # Check for headers.]
1180 AC_CHECK_HEADERS([usb.h], [],
1181 [grub_emu_usb_excuse=["need libusb headers"]])
1183 if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
1184 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled ($grub_emu_usb_excuse)])
1186 if test x"$grub_emu_usb_excuse" = x ; then
1187 enable_grub_emu_usb=yes
1189 enable_grub_emu_usb=no
1192 if test x"$enable_grub_emu_sdl" = xno ; then
1193 grub_emu_sdl_excuse="explicitly disabled"
1195 [if [ x"$grub_emu_sdl_excuse" = x ]; then
1196 # Check for libSDL libraries.]
1197 AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
1198 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
1202 [if [ x"$grub_emu_sdl_excuse" = x ]; then
1203 # Check for headers.]
1204 AC_CHECK_HEADERS([SDL/SDL.h], [],
1205 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
1208 if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
1209 AC_MSG_ERROR([SDL support for grub-emu was explicitly requested but can't be compiled ($grub_emu_sdl_excuse)])
1211 if test x"$grub_emu_sdl_excuse" = x ; then
1212 enable_grub_emu_sdl=yes
1214 enable_grub_emu_sdl=no
1217 if test x"$enable_grub_emu_pci" != xyes ; then
1218 grub_emu_pci_excuse="not enabled"
1221 if test x"$enable_grub_emu_usb" = xyes ; then
1222 grub_emu_pci_excuse="conflicts with USB support"
1225 [if [ x"$grub_emu_pci_excuse" = x ]; then
1226 # Check for libpci libraries.]
1227 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
1228 [grub_emu_pci_excuse=["need libpciaccess library"]])
1229 AC_SUBST([LIBPCIACCESS])
1231 [if [ x"$grub_emu_pci_excuse" = x ]; then
1232 # Check for headers.]
1233 AC_CHECK_HEADERS([pci/pci.h], [],
1234 [grub_emu_pci_excuse=["need libpciaccess headers"]])
1237 if test x"$grub_emu_pci_excuse" = x ; then
1238 enable_grub_emu_pci=yes
1241 enable_grub_emu_pci=no
1244 AC_SUBST([enable_grub_emu_sdl])
1245 AC_SUBST([enable_grub_emu_usb])
1246 AC_SUBST([enable_grub_emu_pci])
1250 # Ignore --enable-emu-* if platform is not emu
1251 enable_grub_emu_sdl=no
1252 enable_grub_emu_usb=no
1253 enable_grub_emu_pci=no
1256 AC_ARG_ENABLE([grub-mkfont],
1257 [AS_HELP_STRING([--enable-grub-mkfont],
1258 [build and install the `grub-mkfont' utility (default=guessed)])])
1259 if test x"$enable_grub_mkfont" = xno ; then
1260 grub_mkfont_excuse="explicitly disabled"
1263 if test x"$grub_mkfont_excuse" = x ; then
1264 # Check for freetype libraries.
1265 AC_CHECK_TOOLS([FREETYPE], [freetype-config])
1266 if test "x$FREETYPE" = x ; then
1267 grub_mkfont_excuse=["need freetype2 library"]
1271 unset ac_cv_header_ft2build_h
1273 if test x"$grub_mkfont_excuse" = x ; then
1274 # Check for freetype libraries.
1275 freetype_cflags=`$FREETYPE --cflags`
1276 freetype_libs=`$FREETYPE --libs`
1277 SAVED_CPPFLAGS="$CPPFLAGS"
1279 CPPFLAGS="$CPPFLAGS $freetype_cflags"
1280 LIBS="$LIBS $freetype_libs"
1281 AC_CHECK_HEADERS([ft2build.h], [],
1282 [grub_mkfont_excuse=["need freetype2 headers"]])
1283 AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]])
1284 CPPFLAGS="$SAVED_CPPFLAGS"
1288 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
1289 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled ($grub_mkfont_excuse)])
1291 if test x"$grub_mkfont_excuse" = x ; then
1292 enable_grub_mkfont=yes
1294 enable_grub_mkfont=no
1296 AC_SUBST([enable_grub_mkfont])
1297 AC_SUBST([freetype_cflags])
1298 AC_SUBST([freetype_libs])
1302 SAVED_CFLAGS="$CFLAGS"
1303 SAVED_CPPFLAGS="$CPPFLAGS"
1304 SAVED_LDFLAGS="$LDFLAGS"
1307 CFLAGS="$BUILD_CFLAGS"
1308 CPPFLAGS="$BUILD_CPPFLAGS"
1309 LDFLAGS="$BUILD_LDFAGS"
1311 unset ac_cv_c_bigendian
1312 unset ac_cv_header_ft2build_h
1314 AC_COMPUTE_INT([BUILD_SIZEOF_VOID_P], [sizeof (void *)])
1315 AC_COMPUTE_INT([BUILD_SIZEOF_LONG], [sizeof (long)])
1316 AC_C_BIGENDIAN([BUILD_WORDS_BIGENDIAN=1], [BUILD_WORDS_BIGENDIAN=0], [BUILD_WORDS_BIGENDIAN=err], [BUILD_WORDS_BIGENDIAN=err])
1318 if test x$BUILD_WORDS_BIGENDIAN = xerr ; then
1319 AC_MSG_ERROR([couldnt determine build endianness])
1322 AC_SUBST([BUILD_SIZEOF_LONG])
1323 AC_SUBST([BUILD_SIZEOF_VOID_P])
1324 AC_SUBST([BUILD_WORDS_BIGENDIAN])
1326 if test x"$grub_build_mkfont_excuse" = x ; then
1327 # Check for freetype libraries.
1328 AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config])
1329 if test "x$BUILD_FREETYPE" = x ; then
1330 grub_build_mkfont_excuse=["need freetype2 library"]
1334 if test x"$grub_build_mkfont_excuse" = x ; then
1335 # Check for freetype libraries.
1336 build_freetype_cflags=`$BUILD_FREETYPE --cflags`
1337 build_freetype_libs=`$BUILD_FREETYPE --libs`
1338 SAVED_CPPFLAGS_2="$CPPFLAGS"
1340 CPPFLAGS="$CPPFLAGS $build_freetype_cflags"
1341 LIBS="$LIBS $build_freetype_libs"
1342 AC_CHECK_HEADERS([ft2build.h], [],
1343 [grub_build_mkfont_excuse=["need freetype2 headers"]])
1344 AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_build_mkfont_excuse=["freetype2 library unusable"]])
1346 CPPFLAGS="$SAVED_CPPFLAGS_2"
1349 if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
1350 AC_MSG_ERROR([build-grub-mkfont was explicitly requested but can't be compiled ($grub_build_mkfont_excuse)])
1352 if test x"$grub_build_mkfont_excuse" = x ; then
1353 enable_build_grub_mkfont=yes
1355 enable_build_grub_mkfont=no
1357 if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 || test "x$platform" = xcoreboot ); then
1358 if test x"$grub_build_mkfont_excuse" = x ; then
1359 AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports needs build-time grub-mkfont])
1361 AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports needs build-time grub-mkfont ($grub_build_mkfont_excuse)])
1365 AC_SUBST([build_freetype_cflags])
1366 AC_SUBST([build_freetype_libs])
1370 CFLAGS="$SAVED_CFLAGS"
1371 CPPFLAGS="$SAVED_CPPFLAGS"
1372 LDFLAGS="$SAVED_LDFLAGS"
1379 AC_ARG_ENABLE([grub-themes],
1380 [AS_HELP_STRING([--enable-grub-themes],
1381 [build and install GRUB themes (default=guessed)])])
1382 if test x"$enable_grub_themes" = xno ; then
1383 starfield_excuse="explicitly disabled"
1386 if test x"$starfield_excuse" = x && test x"$enable_build_grub_mkfont" = xno ; then
1387 starfield_excuse="No build-time grub-mkfont"
1390 if test x"$starfield_excuse" = x; then
1391 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
1392 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype; do
1393 if test -f "$dir/DejaVuSans.$ext"; then
1394 DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
1400 if test "x$DJVU_FONT_SOURCE" = x; then
1401 starfield_excuse="No DejaVu found"
1405 if test x"$enable_grub_themes" = xyes && test x"$starfield_excuse" != x; then
1406 AC_MSG_ERROR([themes were explicitly requested but requirements are not satisfied ($starfield_excuse)])
1409 AC_SUBST([DJVU_FONT_SOURCE])
1413 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
1414 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
1415 if test -f "$dir/unifont.$ext"; then
1416 md5="$(md5sum "$dir/unifont.$ext"|awk '{ print $1; }')"
1417 # PCF and BDF from version 6.3 isn't hanled properly by libfreetype.
1418 if test "$md5" = 0a54834d2788c83886a3e1785a6a1e61 || test "$md5" = 28f2565c7a41d8d407e2551159385edb || test "$md5" = dae5e588461b3b92b87b6ffee734f936 || test "$md5" = 4a3d687aa5bb329ed05f4263a1016791 ; then
1421 FONT_SOURCE="$dir/unifont.$ext"
1427 if test x"$enable_build_grub_mkfont" = xno ; then
1431 if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 || test "x$platform" = xcoreboot ); then
1432 if test x"$grub_build_mkfont_excuse" = x ; then
1433 AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports need unifont])
1435 AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports need unifont ($grub_build_mkfont_excuse)])
1439 AC_SUBST([FONT_SOURCE])
1441 if test x"$FONT_SOURCE" = x && test x"$DJVU_FONT_SOURCE" = x && test x"$grub_build_mkfont_excuse" = x; then
1442 grub_build_mkfont_excuse="no fonts"
1446 AC_ARG_ENABLE([grub-mount],
1447 [AS_HELP_STRING([--enable-grub-mount],
1448 [build and install the `grub-mount' utility (default=guessed)])])
1449 if test x"$enable_grub_mount" = xno ; then
1450 grub_mount_excuse="explicitly disabled"
1453 if test x"$grub_mount_excuse" = x ; then
1454 AC_CHECK_LIB([fuse], [fuse_main_real], [],
1455 [grub_mount_excuse="need FUSE library"])
1458 if test x"$grub_mount_excuse" = x ; then
1459 # Check for fuse headers.
1460 SAVED_CPPFLAGS="$CPPFLAGS"
1461 CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
1462 AC_CHECK_HEADERS([fuse/fuse.h], [],
1463 [grub_mount_excuse=["need FUSE headers"]])
1464 CPPFLAGS="$SAVED_CPPFLAGS"
1467 if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
1468 AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled ($grub_mount_excuse)])
1470 if test x"$grub_mount_excuse" = x ; then
1471 enable_grub_mount=yes
1473 enable_grub_mount=no
1475 AC_SUBST([enable_grub_mount])
1477 AC_ARG_ENABLE([device-mapper],
1478 [AS_HELP_STRING([--enable-device-mapper],
1479 [enable Linux device-mapper support (default=guessed)])])
1480 if test x"$enable_device_mapper" = xno ; then
1481 device_mapper_excuse="explicitly disabled"
1484 if test x"$device_mapper_excuse" = x ; then
1485 # Check for device-mapper header.
1486 AC_CHECK_HEADER([libdevmapper.h], [],
1487 [device_mapper_excuse="need libdevmapper header"])
1490 if test x"$device_mapper_excuse" = x ; then
1491 # Check for device-mapper library.
1492 AC_CHECK_LIB([devmapper], [dm_task_create], [],
1493 [device_mapper_excuse="need devmapper library"])
1496 if test x"$device_mapper_excuse" = x ; then
1497 # Check for device-mapper library.
1498 AC_CHECK_LIB([devmapper], [dm_log_with_errno_init],
1500 [device_mapper_excuse="need devmapper library"])
1503 if test x"$device_mapper_excuse" = x ; then
1504 LIBDEVMAPPER="-ldevmapper"
1505 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
1506 [Define to 1 if you have the devmapper library.])
1509 AC_SUBST([LIBDEVMAPPER])
1512 if test x$host_kernel = xkfreebsd; then
1513 AC_CHECK_LIB([geom], [geom_gettree], [],
1514 [AC_MSG_ERROR([Your platform requires libgeom])])
1520 AC_ARG_ENABLE([liblzma],
1521 [AS_HELP_STRING([--enable-liblzma],
1522 [enable liblzma integration (default=guessed)])])
1523 if test x"$enable_liblzma" = xno ; then
1524 liblzma_excuse="explicitly disabled"
1527 if test x"$liblzma_excuse" = x ; then
1528 AC_CHECK_LIB([lzma], [lzma_code],
1529 [],[liblzma_excuse="need lzma library"])
1531 if test x"$liblzma_excuse" = x ; then
1532 AC_CHECK_HEADER([lzma.h], [], [liblzma_excuse="need lzma header"])
1535 if test x"$enable_liblzma" = xyes && test x"$liblzma_excuse" != x ; then
1536 AC_MSG_ERROR([liblzma support was explicitly requested but requirements are not satisfied ($liblzma_excuse)])
1540 if test x"$liblzma_excuse" = x ; then
1542 AC_DEFINE([USE_LIBLZMA], [1],
1543 [Define to 1 if you have the LZMA library.])
1548 AC_ARG_ENABLE([libzfs],
1549 [AS_HELP_STRING([--enable-libzfs],
1550 [enable libzfs integration (default=guessed)])])
1551 if test x"$enable_libzfs" = xno ; then
1552 libzfs_excuse="explicitly disabled"
1555 if test x"$libzfs_excuse" = x ; then
1556 # Only check for system headers if libzfs support has not been disabled.
1557 AC_CHECK_HEADERS(libzfs.h libnvpair.h)
1560 if test x"$libzfs_excuse" = x ; then
1561 AC_CHECK_LIB([zfs], [libzfs_init],
1563 [libzfs_excuse="need zfs library"])
1566 if test x"$libzfs_excuse" = x ; then
1567 AC_CHECK_LIB([nvpair], [nvlist_lookup_string],
1569 [libzfs_excuse="need nvpair library"])
1572 if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
1573 AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied ($libzfs_excuse)])
1576 if test x"$libzfs_excuse" = x ; then
1577 # We need both libzfs and libnvpair for a successful build.
1579 AC_DEFINE([HAVE_LIBZFS], [1],
1580 [Define to 1 if you have the ZFS library.])
1581 LIBNVPAIR="-lnvpair"
1582 AC_DEFINE([HAVE_LIBNVPAIR], [1],
1583 [Define to 1 if you have the NVPAIR library.])
1587 AC_SUBST([LIBNVPAIR])
1591 AC_SUBST([FONT_SOURCE])
1592 AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
1593 [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
1595 AC_SUBST(HAVE_ASM_USCORE)
1598 AC_SUBST(BSS_START_SYMBOL)
1599 AC_SUBST(END_SYMBOL)
1603 AC_ARG_ENABLE([werror],
1604 [AS_HELP_STRING([--disable-werror],
1605 [do not use -Werror when building GRUB])])
1606 if test x"$enable_werror" != xno ; then
1607 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
1608 HOST_CFLAGS="$HOST_CFLAGS -Werror"
1611 if test "x$grub_cv_cc_target_clang" = xno; then
1612 TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc"
1614 TARGET_LDFLAGS_STATIC_LIBGCC=
1617 TARGET_CPP="$TARGET_CC -E"
1618 TARGET_CCAS=$TARGET_CC
1620 GRUB_TARGET_CPU="${target_cpu}"
1621 GRUB_PLATFORM="${platform}"
1623 AC_SUBST(GRUB_TARGET_CPU)
1624 AC_SUBST(GRUB_PLATFORM)
1626 AC_SUBST(TARGET_OBJCONV)
1627 AC_SUBST(TARGET_LIBGCC)
1628 AC_SUBST(TARGET_LDFLAGS_STATIC_LIBGCC)
1629 AC_SUBST(TARGET_CPP)
1630 AC_SUBST(TARGET_CCAS)
1631 AC_SUBST(TARGET_OBJ2ELF)
1632 AC_SUBST(TARGET_MODULE_FORMAT)
1633 AC_SUBST(TARGET_CC_VERSION)
1635 AC_SUBST(TARGET_CFLAGS)
1636 AC_SUBST(TARGET_LDFLAGS)
1637 AC_SUBST(TARGET_CPPFLAGS)
1638 AC_SUBST(TARGET_CCASFLAGS)
1640 AC_SUBST(TARGET_IMG_LDFLAGS)
1641 AC_SUBST(TARGET_IMG_CFLAGS)
1642 AC_SUBST(TARGET_IMG_BASE_LDOPT)
1643 AC_SUBST(TARGET_APPLE_LINKER)
1645 AC_SUBST(HOST_CFLAGS)
1646 AC_SUBST(HOST_LDFLAGS)
1647 AC_SUBST(HOST_CPPFLAGS)
1648 AC_SUBST(HOST_CCASFLAGS)
1650 AC_SUBST(BUILD_LIBM)
1653 # Automake conditionals
1656 AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
1657 AM_CONDITIONAL([COND_clang], [test x$grub_cv_cc_target_clang = xyes])
1658 AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
1659 AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
1660 AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
1661 AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
1662 AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
1663 AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
1664 AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
1665 AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
1666 AM_CONDITIONAL([COND_i386_xen], [test x$target_cpu = xi386 -a x$platform = xxen])
1667 AM_CONDITIONAL([COND_x86_64_xen], [test x$target_cpu = xx86_64 -a x$platform = xxen])
1668 AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
1669 AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
1670 AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc])
1671 AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
1672 AM_CONDITIONAL([COND_sparc64_emu], [test x$target_cpu = xsparc64 -a x$platform = xemu])
1673 AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
1674 AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
1675 AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
1676 AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
1677 AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ])
1678 AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot])
1679 AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi])
1680 AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ])
1681 AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi])
1683 AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
1684 AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
1685 AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
1686 AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
1687 AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
1688 AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
1689 AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
1691 AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
1692 AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
1693 AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
1694 AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
1695 AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
1696 AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
1697 AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
1698 if test x$FONT_SOURCE != x ; then
1703 AC_SUBST(HAVE_FONT_SOURCE)
1704 AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1])
1705 AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
1706 AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
1707 AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
1709 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
1711 AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
1712 AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
1713 AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy])
1715 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
1716 test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
1717 datarootdir="$(eval echo "$datarootdir")"
1718 grub_libdir="$(eval echo "$libdir")"
1719 grub_localedir="$(eval echo "$localedir")"
1720 grub_datadir="$(eval echo "$datadir")"
1721 grub_sysconfdir="$(eval echo "$sysconfdir")"
1722 AC_DEFINE_UNQUOTED(LOCALEDIR, "$grub_localedir", [Locale dir])
1723 AC_DEFINE_UNQUOTED(GRUB_LIBDIR, "$grub_libdir", [Library dir])
1724 AC_DEFINE_UNQUOTED(GRUB_DATADIR, "$grub_datadir", [Data dir])
1725 AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "$grub_sysconfdir", [Configuration dir])
1729 cpudir="${target_cpu}"
1730 if test x${cpudir} = xmipsel; then
1734 if test x"$link_dir" = xyes ; then
1735 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
1736 if test "$platform" != emu ; then
1737 AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
1740 mkdir -p include/grub 2>/dev/null
1741 rm -rf include/grub/cpu
1742 cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
1743 if test "$platform" != emu ; then
1744 rm -rf include/grub/machine
1745 cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
1749 AC_CONFIG_FILES([Makefile])
1750 AC_CONFIG_FILES([grub-core/Makefile])
1751 AC_CONFIG_FILES([grub-core/gnulib/Makefile])
1752 AC_CONFIG_FILES([po/Makefile.in])
1753 AC_CONFIG_FILES([docs/Makefile])
1754 AC_CONFIG_FILES([util/bash-completion.d/Makefile])
1755 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
1756 AC_CONFIG_FILES([config.h])
1760 echo "*******************************************************"
1761 echo GRUB2 will be compiled with following components:
1762 echo Platform: "$target_cpu"-"$platform"
1763 if [ x"$platform" = xemu ]; then
1764 if [ x"$grub_emu_usb_excuse" = x ]; then
1765 echo USB support for grub-emu: Yes
1767 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
1769 if [ x"$grub_emu_sdl_excuse" = x ]; then
1770 echo SDL support for grub-emu: Yes
1772 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
1774 if [ x"$grub_emu_pci_excuse" = x ]; then
1775 echo PCI support for grub-emu: Yes
1777 echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
1780 if test x"$device_mapper_excuse" = x ; then
1781 echo With devmapper support: Yes
1783 echo With devmapper support: No "($device_mapper_excuse)"
1785 if [ x"$enable_mm_debug" = xyes ]; then
1786 echo With memory debugging: Yes
1788 echo With memory debugging: No
1790 if [ x"$enable_cache_stats" = xyes ]; then
1791 echo With disk cache statistics: Yes
1793 echo With disk cache statistics: No
1796 if [ x"$enable_boot_time" = xyes ]; then
1797 echo With boot time statistics: Yes
1799 echo With boot time statistics: No
1802 if [ x"$efiemu_excuse" = x ]; then
1803 echo efiemu runtime: Yes
1805 echo efiemu runtime: No "($efiemu_excuse)"
1807 if [ x"$grub_mkfont_excuse" = x ]; then
1808 echo grub-mkfont: Yes
1810 echo grub-mkfont: No "($grub_mkfont_excuse)"
1812 if [ x"$grub_mount_excuse" = x ]; then
1813 echo grub-mount: Yes
1815 echo grub-mount: No "($grub_mount_excuse)"
1817 if [ x"$starfield_excuse" = x ]; then
1818 echo starfield theme: Yes
1819 echo With DejaVuSans font from $DJVU_FONT_SOURCE
1821 echo starfield theme: No "($starfield_excuse)"
1823 if [ x"$libzfs_excuse" = x ]; then
1824 echo With libzfs support: Yes
1826 echo With libzfs support: No "($libzfs_excuse)"
1828 if [ x"$grub_build_mkfont_excuse" = x ]; then
1829 echo Build-time grub-mkfont: Yes
1830 if test "x$FONT_SOURCE" = x ; then
1831 echo "Without unifont"
1833 echo "With unifont from $FONT_SOURCE"
1836 echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)"
1837 echo "Without unifont (no build-time grub-mkfont)"
1839 if test x"$liblzma_excuse" != x ; then
1840 echo "Without liblzma (no support for XZ-compressed mips images) ($liblzma_excuse)"
1842 echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
1844 echo "*******************************************************"