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 as well as the build type,
30 dnl because GRUB does not need to use those variables for the build
31 dnl type, so there is no conflict. Variables with the prefix "TARGET_"
32 dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
35 AC_INIT([GRUB],[2.00],[bug-grub@gnu.org])
37 AC_CONFIG_AUX_DIR([build-aux])
39 # We don't want -g -O2 by default in CFLAGS
42 # Checks for host and target systems.
48 AC_CONFIG_SRCDIR([include/grub/dl.h])
49 AC_CONFIG_HEADER([config-util.h])
51 # Program name transformations
53 grub_TRANSFORM([grub-bios-setup])
54 grub_TRANSFORM([grub-editenv])
55 grub_TRANSFORM([grub-install])
56 grub_TRANSFORM([grub-mkconfig])
57 grub_TRANSFORM([grub-mkfont])
58 grub_TRANSFORM([grub-mkimage])
59 grub_TRANSFORM([grub-glue-efi])
60 grub_TRANSFORM([grub-mklayout])
61 grub_TRANSFORM([grub-mkpasswd-pbkdf2])
62 grub_TRANSFORM([grub-mkrelpath])
63 grub_TRANSFORM([grub-mkrescue])
64 grub_TRANSFORM([grub-probe])
65 grub_TRANSFORM([grub-reboot])
66 grub_TRANSFORM([grub-script-check])
67 grub_TRANSFORM([grub-set-default])
68 grub_TRANSFORM([grub-sparc64-setup])
69 grub_TRANSFORM([grub-render-label])
71 # Optimization flag. Allow user to override.
72 if test "x$TARGET_CFLAGS" = x; then
73 TARGET_CFLAGS="$TARGET_CFLAGS -Os"
76 BUILD_CPPFLAGS="$BUILD_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
78 # Default HOST_CPPFLAGS
79 HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
80 HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
81 HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
82 HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_LIBDIR=\\\"\$(pkglibdir)\\\""
83 HOST_CPPFLAGS="$HOST_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
85 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
86 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
87 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
90 i[[3456]]86) target_cpu=i386 ;;
91 amd64) target_cpu=x86_64 ;;
92 sparc) target_cpu=sparc64 ;;
95 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
99 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1";
106 # Specify the platform (such as firmware).
107 AC_ARG_WITH([platform],
108 AS_HELP_STRING([--with-platform=PLATFORM],
109 [select the host platform [[guessed]]]))
111 # Guess the platform if not specified.
112 if test "x$with_platform" = x; then
113 case "$target_cpu"-"$target_vendor" in
114 i386-apple) platform=efi ;;
115 i386-*) platform=pc ;;
116 x86_64-apple) platform=efi ;;
117 x86_64-*) platform=pc ;;
118 powerpc-*) platform=ieee1275 ;;
119 powerpc64-*) platform=ieee1275 ;;
120 sparc64-*) platform=ieee1275 ;;
121 mipsel-*) platform=loongson ;;
122 mips-*) platform=arc ;;
123 ia64-*) platform=efi ;;
124 arm-*) platform=uboot ;;
125 *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
128 platform="$with_platform"
131 case "$target_cpu"-"$platform" in
134 x86_64-*) target_cpu=i386 ;;
135 powerpc64-ieee1275) target_cpu=powerpc ;;
138 # Check if the platform is supported, make final adjustments.
139 case "$target_cpu"-"$platform" in
145 i386-linuxbios) platform=coreboot ;;
152 mips-qemu-mips) platform=qemu_mips;;
156 mipsel-qemu-mips) platform=qemu_mips;;
157 mipsel-yeeloong) platform=loongson ;;
158 mipsel-fuloong) platform=loongson ;;
163 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
166 case "$target_cpu" in
167 i386 | powerpc) target_m32=1 ;;
168 x86_64 | sparc64) target_m64=1 ;;
172 mingw32*) host_os=cygwin ;;
176 mingw32*) target_os=cygwin ;;
179 # This normalizes the names, and creates a new variable ("host_kernel")
180 # while at it, since the mapping is not always 1:1 (e.g. different OSes
181 # using the same kernel type).
183 gnu*) host_kernel=hurd ;;
184 linux*) host_kernel=linux ;;
185 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
186 netbsd*) host_kernel=netbsd ;;
187 solaris*) host_kernel=illumos ;;
188 darwin*) host_kernel=xnu ;;
189 cygwin) host_kernel=windows ;;
193 coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
194 multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
195 efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
196 ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
197 uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;;
198 qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
199 pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
200 emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
201 loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
202 qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
203 arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
205 case "$target_cpu" in
206 arm) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARM=1" ;;
207 mips |mipsel) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
208 sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
210 if test x${target_cpu} = xmipsel ; then
211 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
213 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,` -DGRUB_TARGET_CPU_`echo ${target_cpu} | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`=1"
216 case "${target_cpu}-$platform" in
218 TARGET_LINK_ADDR=0x88200000
219 TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000
222 TARGET_LINK_ADDR=0x80700000
223 TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000
225 mips*-qemu_mips | mips*-loongson)
226 TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000
230 AC_SUBST(TARGET_LINK_ADDR)
231 AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR)
233 TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
237 AC_SUBST(host_kernel)
242 # Define default variables
245 AC_ARG_WITH([bootdir],
246 AS_HELP_STRING([--with-bootdir=DIR],
247 [set the name of /boot directory [[guessed]]]),
248 [have_with_bootdir=y],
249 [have_with_bootdir=n])
250 if test x$have_with_bootdir = xy; then
251 bootdirname="$with_bootdir"
255 # Because /boot is used for the boot block in NetBSD and OpenBSD,
257 *) bootdirname='boot' ;;
261 AC_SUBST(bootdirname)
262 AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
263 [Default boot directory name]")
265 AC_ARG_WITH([grubdir],
266 AS_HELP_STRING([--with-grubdir=DIR],
267 [set the name of grub directory [[guessed]]]),
268 [grubdirname="$with_grubdir"],
269 [grubdirname="$PACKAGE"])
271 AC_SUBST(grubdirname)
272 AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
273 [Default grub directory name])
276 # Checks for build programs.
279 # Although cmp is listed in the GNU Coding Standards as a command which
280 # can used directly, OpenBSD lacks cmp in the default installation.
281 AC_CHECK_PROGS([CMP], [cmp])
282 if test "x$CMP" = x; then
283 AC_MSG_ERROR([cmp is not found])
286 AC_CHECK_PROGS([YACC], [bison])
287 if test "x$YACC" = x; then
288 AC_MSG_ERROR([bison is not found])
300 if test "x$LEX" = "x:"; then
301 AC_MSG_ERROR([flex is not found])
303 version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
304 if test -n "$version" -a "$version" -ge 20535; then
307 AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
311 # These are not a "must".
312 AC_PATH_PROGS(MAKEINFO, makeinfo true)
315 # Checks for host programs.
325 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
327 AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
330 AM_GNU_GETTEXT([external])
333 # Identify characteristics of the host architecture.
334 unset ac_cv_c_bigendian
337 AC_CHECK_SIZEOF(void *)
338 AC_CHECK_SIZEOF(long)
341 if test x$grub_cv_apple_cc = xyes ; then
342 HOST_CPPFLAGS="$HOST_CPPFLAGS -fnested-functions"
343 HOST_LDFLAGS="$HOST_LDFLAGS -Wl,-allow_stack_execute"
346 if test x$USE_NLS = xno; then
347 HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
350 if test "x$cross_compiling" = xyes; then
351 AC_MSG_WARN([cannot generate manual pages while cross compiling])
353 AC_PATH_PROG(HELP2MAN, help2man)
356 # Check for functions and headers.
357 AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
358 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
360 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
361 #include <sys/param.h>
362 #include <sys/mount.h>])
364 AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default
365 #include <sys/param.h>
366 #include <sys/mount.h>])
368 # For opendisk() and getrawpartition() on NetBSD.
369 # Used in util/deviceiter.c and in util/hostdisk.c.
370 AC_CHECK_HEADER([util.h], [
371 AC_CHECK_LIB([util], [opendisk], [
373 AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
375 AC_CHECK_LIB([util], [getrawpartition], [
377 AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
382 AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
383 SAVED_CFLAGS="$CFLAGS"
384 CFLAGS="$HOST_CFLAGS -Wtrampolines"
385 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
386 int va_arg_func (int fixed, va_list args);]], [[]])],
387 [grub_cv_host_cc_wtrampolines=yes],
388 [grub_cv_host_cc_wtrampolines=no])
389 CFLAGS="$SAVED_CFLAGS"
392 if test x"$grub_host_cv_cc_wtrampolines" = xyes ; then
393 HOST_CFLAGS="$HOST_CFLAGS -Wtrampolines"
397 # Check for host and build compilers.
400 AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc])
401 test -z "$BUILD_CC" && AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])
407 # Check for target programs.
410 # Find tools for the target.
411 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
412 tmp_ac_tool_prefix="$ac_tool_prefix"
413 ac_tool_prefix=$target_alias-
415 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
416 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
417 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
418 AC_CHECK_TOOL(TARGET_STRIP, strip)
419 AC_CHECK_TOOL(TARGET_NM, nm)
421 ac_tool_prefix="$tmp_ac_tool_prefix"
423 if test "x$TARGET_CC" = x; then
426 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
427 AC_CHECK_TOOL(TARGET_STRIP, strip)
428 AC_CHECK_TOOL(TARGET_NM, nm)
433 AC_SUBST(BUILD_CFLAGS)
434 AC_SUBST(BUILD_CPPFLAGS)
437 AC_SUBST(TARGET_STRIP)
438 AC_SUBST(TARGET_OBJCOPY)
440 # Test the C compiler for the target environment.
443 tmp_LDFLAGS="$LDFLAGS"
444 tmp_CPPFLAGS="$CPPFLAGS"
447 CFLAGS="$TARGET_CFLAGS"
448 CPPFLAGS="$TARGET_CPPFLAGS"
449 LDFLAGS="$TARGET_LDFLAGS"
453 grub_PROG_NM_DEFINED_ONLY
454 AC_SUBST(TARGET_NMFLAGS_MINUS_P)
455 AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
458 WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Waddress -Wattributes -Wcast-align -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
459 HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS"
460 TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
461 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
463 # Force no alignment to save space on i386.
464 if test "x$target_cpu" = xi386; then
465 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
466 CFLAGS="$CFLAGS -falign-loops=1"
467 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
468 [grub_cv_cc_falign_loop=yes],
469 [grub_cv_cc_falign_loop=no])
472 if test "x$grub_cv_cc_falign_loop" = xyes; then
473 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
475 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
479 if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
480 # Some toolchains enable these features by default, but they need
481 # registers that aren't set up properly in GRUB.
482 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
485 # By default, GCC 4.4 generates .eh_frame sections containing unwind
486 # information in some cases where it previously did not. GRUB doesn't need
487 # these and they just use up vital space. Restore the old compiler
489 AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
490 SAVE_CFLAGS="$CFLAGS"
491 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
492 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
493 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
494 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
495 CFLAGS="$SAVE_CFLAGS"
498 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
499 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
502 # By default, GCC 4.6 generates .eh_frame sections containing unwind
503 # information in some cases where it previously did not. GRUB doesn't need
504 # these and they just use up vital space. Restore the old compiler
506 AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
507 SAVE_CFLAGS="$CFLAGS"
508 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
509 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
510 [grub_cv_cc_fno_asynchronous_unwind_tables=yes],
511 [grub_cv_cc_fno_asynchronous_unwind_tables=no])
512 CFLAGS="$SAVE_CFLAGS"
515 if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
516 TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
520 if test x$grub_cv_apple_target_cc = xyes ; then
521 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -fnested-functions"
523 CFLAGS="$CFLAGS -fnested-functions"
525 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], [])
526 if test "x$TARGET_OBJCONV" = x ; then
527 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.])
529 if test "x$TARGET_OBJCONV" = x ; then
530 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
533 TARGET_IMG_CFLAGS="-static"
534 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
535 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
536 TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
537 TARGET_LDFLAGS_OLDMAGIC=""
540 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
541 # Use linker script if present, otherwise use builtin -N script.
542 if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc"; then
543 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc"
544 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
545 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc"
546 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
549 TARGET_IMG_LDFLAGS='-Wl,-N'
550 TARGET_IMG_LDFLAGS_AC='-Wl,-N'
551 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
556 AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
558 # For platforms where ELF is not the default link format.
559 AC_MSG_CHECKING([for command to convert module to ELF format])
560 case "${target_os}" in
561 cygwin) TARGET_OBJ2ELF='./build-grub-pe2elf';
562 # FIXME: put proper test here
563 NEED_REGISTER_FRAME_INFO=1
565 *) NEED_REGISTER_FRAME_INFO=0 ;;
567 AC_MSG_RESULT([$TARGET_OBJ2ELF])
570 AC_ARG_ENABLE([efiemu],
571 [AS_HELP_STRING([--enable-efiemu],
572 [build and install the efiemu runtimes (default=guessed)])])
573 if test x"$enable_efiemu" = xno ; then
574 efiemu_excuse="explicitly disabled"
576 if test x"$target_cpu" != xi386 ; then
577 efiemu_excuse="only available on i386"
579 if test x"$platform" = xefi ; then
580 efiemu_excuse="not available on efi"
582 if test x"$efiemu_excuse" = x ; then
583 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
584 SAVED_CFLAGS="$CFLAGS"
585 CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
586 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
587 [grub_cv_cc_efiemu=yes],
588 [grub_cv_cc_efiemu=no])
589 CFLAGS="$SAVED_CFLAGS"
591 if test x$grub_cv_cc_efiemu = xno; then
592 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
595 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
596 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
598 if test x"$efiemu_excuse" = x ; then
603 AC_SUBST([enable_efiemu])
605 if test "x$target_m32" = x1; then
607 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
608 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
609 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
610 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
611 TARGET_MODULE_FORMAT="elf32"
614 if test "x$target_m64" = x1; then
616 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
617 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
618 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
619 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
620 TARGET_MODULE_FORMAT="elf64"
623 if test "$target_cpu" = x86_64; then
624 # Use large model to support 4G memory
625 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
627 CFLAGS="$CFLAGS -m64 -mcmodel=large"
628 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
629 [grub_cv_cc_mcmodel=yes],
630 [grub_cv_cc_mcmodel=no])
632 if test "x$grub_cv_cc_mcmodel" = xno; then
633 AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
635 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
639 if test "$target_cpu"-"$platform" = x86_64-efi; then
640 # EFI writes to stack below %rsp, we must not use the red zone
641 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
642 CFLAGS="$CFLAGS -m64 -mno-red-zone"
643 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
644 [grub_cv_cc_no_red_zone=yes],
645 [grub_cv_cc_no_red_zone=no])
647 if test "x$grub_cv_cc_no_red_zone" = xno; then
648 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
651 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
658 # Position independent executable.
660 [# Need that, because some distributions ship compilers that include
661 # `-fPIE' in the default specs.
662 if [ x"$pie_possible" = xyes ]; then
663 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
666 # Position independent executable.
668 [# Need that, because some distributions ship compilers that include
669 # `-fPIC' in the default specs.
670 if [ x"$pic_possible" = xyes ]; then
671 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
674 # Smashing stack protector.
675 grub_CHECK_STACK_PROTECTOR
676 # Need that, because some distributions ship compilers that include
677 # `-fstack-protector' in the default specs.
678 if test "x$ssp_possible" = xyes; then
679 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
681 grub_CHECK_STACK_ARG_PROBE
682 # Cygwin's GCC uses alloca() to probe the stackframe on static
683 # stack allocations above some threshold.
684 if test x"$sap_possible" = xyes; then
685 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
688 # -mno-unaligned-access
689 if test "$target_cpu" = arm; then
690 grub_CHECK_NO_UNALIGNED_ACCESS
691 if test x"$nua_possible" = xyes; then
692 TARGET_CFLAGS="$TARGET_CFLAGS -mno-unaligned-access"
696 AC_ARG_ENABLE([werror],
697 [AS_HELP_STRING([--disable-werror],
698 [do not use -Werror when building GRUB])])
699 if test x"$enable_werror" != xno ; then
700 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
701 HOST_CFLAGS="$HOST_CFLAGS -Werror"
704 TARGET_CPP="$TARGET_CC -E"
705 TARGET_CCAS=$TARGET_CC
707 GRUB_TARGET_CPU="${target_cpu}"
708 GRUB_PLATFORM="${platform}"
710 AC_SUBST(GRUB_TARGET_CPU)
711 AC_SUBST(GRUB_PLATFORM)
713 AC_SUBST(TARGET_OBJCONV)
715 AC_SUBST(TARGET_CCAS)
716 AC_SUBST(TARGET_OBJ2ELF)
717 AC_SUBST(TARGET_APPLE_CC)
718 AC_SUBST(TARGET_MODULE_FORMAT)
720 AC_SUBST(TARGET_CFLAGS)
721 AC_SUBST(TARGET_LDFLAGS)
722 AC_SUBST(TARGET_CPPFLAGS)
723 AC_SUBST(TARGET_CCASFLAGS)
725 AC_SUBST(TARGET_IMG_LDSCRIPT)
726 AC_SUBST(TARGET_IMG_LDFLAGS)
727 AC_SUBST(TARGET_IMG_CFLAGS)
728 AC_SUBST(TARGET_IMG_BASE_LDOPT)
730 AC_SUBST(HOST_CFLAGS)
731 AC_SUBST(HOST_LDFLAGS)
732 AC_SUBST(HOST_CPPFLAGS)
733 AC_SUBST(HOST_CCASFLAGS)
735 # Set them to their new values for the tests below.
737 if test "x$TARGET_APPLE_CC" = x1 ; then
738 CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
740 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
742 CPPFLAGS="$TARGET_CPPFLAGS"
743 if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 ; then
750 if test x$grub_cv_asm_uscore = xyes; then
751 CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main"
753 CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
756 # Check for libgcc symbols
757 AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x __udivsi3 __umoddi3 __udivdi3 __divsi3 __modsi3 __umodsi3 __moddi3 __divdi3 __ctzdi2 __ctzsi2)
759 if test "x$TARGET_APPLE_CC" = x1 ; then
760 CFLAGS="$TARGET_CFLAGS -nostdlib"
762 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
766 # Defined in aclocal.m4.
768 if test "x$TARGET_APPLE_CC" != x1 ; then
769 grub_PROG_OBJCOPY_ABSOLUTE
771 grub_PROG_LD_BUILD_ID_NONE
772 if test "x$target_cpu" = xi386; then
773 if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
774 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
775 # Check symbols provided by linker script.
776 CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},8000 -Wl,--defsym,___main=0x8100"
778 grub_CHECK_BSS_START_SYMBOL
779 grub_CHECK_END_SYMBOL
781 CFLAGS="$TARGET_CFLAGS"
782 grub_I386_ASM_PREFIX_REQUIREMENT
786 if test "$platform" != emu; then
787 AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
788 SAVED_CPPFLAGS="$CPPFLAGS"
789 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
790 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
792 int va_arg_func (int fixed, va_list args);]], [[]])],
793 [grub_cv_cc_isystem=yes],
794 [grub_cv_cc_isystem=no])
795 CPPFLAGS="$SAVED_CPPFLAGS"
798 if test x"$grub_cv_cc_isystem" = xyes ; then
799 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
803 AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [
804 SAVED_CFLAGS="$CFLAGS"
805 CFLAGS="$TARGET_CFLAGS -Wtrampolines"
806 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
807 int va_arg_func (int fixed, va_list args);]], [[]])],
808 [grub_cv_cc_wtrampolines=yes],
809 [grub_cv_cc_wtrampolines=no])
810 CFLAGS="$SAVED_CFLAGS"
813 if test x"$grub_cv_cc_wtrampolines" = xyes ; then
814 TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines"
820 CPPFLAGS="$tmp_CPPFLAGS"
821 LDFLAGS="$tmp_LDFLAGS"
828 # Memory manager debugging.
829 AC_ARG_ENABLE([mm-debug],
830 AS_HELP_STRING([--enable-mm-debug],
831 [include memory manager debugging]),
832 [AC_DEFINE([MM_DEBUG], [1],
833 [Define to 1 if you enable memory manager debugging.])])
835 AC_ARG_ENABLE([cache-stats],
836 AS_HELP_STRING([--enable-cache-stats],
837 [enable disk cache statistics collection]))
839 if test x$enable_cache_stats = xyes; then
844 AC_SUBST([DISK_CACHE_STATS])
846 AC_ARG_ENABLE([boot-time],
847 AS_HELP_STRING([--enable-boot-time],
848 [enable boot time statistics collection]))
850 if test x$enable_boot_time = xyes; then
855 AC_SUBST([BOOT_TIME_STATS])
857 AC_ARG_ENABLE([grub-emu-usb],
858 [AS_HELP_STRING([--enable-grub-emu-usb],
859 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
861 AC_ARG_ENABLE([grub-emu-sdl],
862 [AS_HELP_STRING([--enable-grub-emu-sdl],
863 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
865 AC_ARG_ENABLE([grub-emu-pci],
866 [AS_HELP_STRING([--enable-grub-emu-pci],
867 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
869 if test "$platform" = emu; then
871 if test x"$enable_grub_emu_usb" != xyes ; then
872 grub_emu_usb_excuse="not enabled"
875 if test x"$enable_grub_emu_pci" = xyes ; then
876 grub_emu_usb_excuse="conflicts with PCI support"
879 [if [ x"$grub_emu_usb_excuse" = x ]; then
880 # Check for libusb libraries.]
881 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
882 [grub_emu_usb_excuse=["need libusb library"]])
885 [if [ x"$grub_emu_usb_excuse" = x ]; then
886 # Check for headers.]
887 AC_CHECK_HEADERS([usb.h], [],
888 [grub_emu_usb_excuse=["need libusb headers"]])
890 if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
891 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
893 if test x"$grub_emu_usb_excuse" = x ; then
894 enable_grub_emu_usb=yes
896 enable_grub_emu_usb=no
899 if test x"$enable_grub_emu_sdl" = xno ; then
900 grub_emu_sdl_excuse="explicitely disabled"
902 [if [ x"$grub_emu_sdl_excuse" = x ]; then
903 # Check for libSDL libraries.]
904 AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
905 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
909 [if [ x"$grub_emu_sdl_excuse" = x ]; then
910 # Check for headers.]
911 AC_CHECK_HEADERS([SDL/SDL.h], [],
912 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
915 if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
916 AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
918 if test x"$grub_emu_sdl_excuse" = x ; then
919 enable_grub_emu_sdl=yes
921 enable_grub_emu_sdl=no
924 if test x"$enable_grub_emu_pci" != xyes ; then
925 grub_emu_pci_excuse="not enabled"
928 if test x"$enable_grub_emu_usb" = xyes ; then
929 grub_emu_pci_excuse="conflicts with USB support"
932 [if [ x"$grub_emu_pci_excuse" = x ]; then
933 # Check for libpci libraries.]
934 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
935 [grub_emu_pci_excuse=["need libpciaccess library"]])
936 AC_SUBST([LIBPCIACCESS])
938 [if [ x"$grub_emu_pci_excuse" = x ]; then
939 # Check for headers.]
940 AC_CHECK_HEADERS([pci/pci.h], [],
941 [grub_emu_pci_excuse=["need libpciaccess headers"]])
944 if test x"$grub_emu_pci_excuse" = x ; then
945 enable_grub_emu_pci=yes
948 enable_grub_emu_pci=no
951 AC_SUBST([enable_grub_emu_sdl])
952 AC_SUBST([enable_grub_emu_usb])
953 AC_SUBST([enable_grub_emu_pci])
956 AC_ARG_ENABLE([grub-mkfont],
957 [AS_HELP_STRING([--enable-grub-mkfont],
958 [build and install the `grub-mkfont' utility (default=guessed)])])
959 if test x"$enable_grub_mkfont" = xno ; then
960 grub_mkfont_excuse="explicitly disabled"
963 if test x"$grub_mkfont_excuse" = x ; then
964 # Check for freetype libraries.
965 AC_CHECK_TOOLS([FREETYPE], [freetype-config])
966 if test "x$FREETYPE" = x ; then
967 grub_mkfont_excuse=["need freetype2 library"]
971 unset ac_cv_header_ft2build_h
973 if test x"$grub_mkfont_excuse" = x ; then
974 # Check for freetype libraries.
975 freetype_cflags=`$FREETYPE --cflags`
976 freetype_libs=`$FREETYPE --libs`
977 SAVED_CPPFLAGS="$CPPFLAGS"
978 CPPFLAGS="$CPPFLAGS $freetype_cflags"
979 AC_CHECK_HEADERS([ft2build.h], [],
980 [grub_mkfont_excuse=["need freetype2 headers"]])
981 CPPFLAGS="$SAVED_CPPFLAGS"
984 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
985 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
987 if test x"$grub_mkfont_excuse" = x ; then
988 enable_grub_mkfont=yes
990 enable_grub_mkfont=no
992 AC_SUBST([enable_grub_mkfont])
993 AC_SUBST([freetype_cflags])
994 AC_SUBST([freetype_libs])
997 SAVED_CFLAGS="$CFLAGS"
998 SAVED_CPPFLAGS="$CPPFLAGS"
1000 CFLAGS="$BUILD_CFLAGS"
1001 CPPFLAGS="$BUILD_CPPFLAGS"
1003 unset ac_cv_c_bigendian
1004 unset ac_cv_header_ft2build_h
1006 AC_COMPUTE_INT([BUILD_SIZEOF_VOID_P], [sizeof (void *)])
1007 AC_COMPUTE_INT([BUILD_SIZEOF_LONG], [sizeof (long)])
1008 AC_C_BIGENDIAN([BUILD_WORDS_BIGENDIAN=1], [BUILD_WORDS_BIGENDIAN=0], [BUILD_WORDS_BIGENDIAN=err], [BUILD_WORDS_BIGENDIAN=err])
1010 if test x$BUILD_WORDS_BIGENDIAN = xerr ; then
1011 AC_MSG_ERROR([couldnt determine build endianness])
1014 AC_SUBST([BUILD_SIZEOF_LONG])
1015 AC_SUBST([BUILD_SIZEOF_VOID_P])
1016 AC_SUBST([BUILD_WORDS_BIGENDIAN])
1018 if test x"$grub_build_mkfont_excuse" = x ; then
1019 # Check for freetype libraries.
1020 AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config])
1021 if test "x$BUILD_FREETYPE" = x ; then
1022 grub_build_mkfont_excuse=["need freetype2 library"]
1026 if test x"$grub_build_mkfont_excuse" = x ; then
1027 # Check for freetype libraries.
1028 build_freetype_cflags=`$BUILD_FREETYPE --cflags`
1029 build_freetype_libs=`$BUILD_FREETYPE --libs`
1030 SAVED_CPPFLAGS_2="$CPPFLAGS"
1031 CPPFLAGS="$CPPFLAGS $build_freetype_cflags"
1032 AC_CHECK_HEADERS([ft2build.h], [],
1033 [grub_build_mkfont_excuse=["need freetype2 headers"]])
1034 CPPFLAGS="$SAVED_CPPFLAGS_2"
1037 if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
1038 AC_MSG_ERROR([build-grub-mkfont was explicitly requested but can't be compiled])
1040 if test x"$grub_build_mkfont_excuse" = x ; then
1041 enable_build_grub_mkfont=yes
1043 enable_build_grub_mkfont=no
1045 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 ); then
1046 AC_MSG_ERROR([qemu, powerpc-ieee1275 and loongson ports needs build-time grub-mkfont])
1049 AC_SUBST([build_freetype_cflags])
1050 AC_SUBST([build_freetype_libs])
1053 CFLAGS="$SAVED_CFLAGS"
1054 CPPFLAGS="$SAVED_CPPFLAGS"
1061 if test x"$enable_build_grub_mkfont" = xno ; then
1062 starfield_excuse="No build-time grub-mkfont"
1065 if test x"$starfield_excuse" = x; then
1066 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
1067 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do
1068 if test -f "$dir/DejaVuSans.$ext"; then
1069 DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
1075 if test "x$DJVU_FONT_SOURCE" = x; then
1076 starfield_excuse="No DejaVu found"
1080 AC_SUBST([DJVU_FONT_SOURCE])
1084 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
1085 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
1086 if test -f "$dir/unifont.$ext"; then
1087 FONT_SOURCE="$dir/unifont.$ext"
1093 if test x"$enable_build_grub_mkfont" = xno ; then
1097 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 ); then
1098 AC_MSG_ERROR([qemu, powerpc-ieee1275 and loongson ports need unifont])
1101 AC_SUBST([FONT_SOURCE])
1103 if test x"$FONT_SOURCE" = x && test x"$DJVU_FONT_SOURCE" = x && test x"$grub_build_mkfont_excuse" = x; then
1104 grub_build_mkfont_excuse="no fonts"
1108 AC_ARG_ENABLE([grub-mount],
1109 [AS_HELP_STRING([--enable-grub-mount],
1110 [build and install the `grub-mount' utility (default=guessed)])])
1111 if test x"$enable_grub_mount" = xno ; then
1112 grub_mount_excuse="explicitly disabled"
1115 if test x"$grub_mount_excuse" = x ; then
1116 AC_CHECK_LIB([fuse], [fuse_main_real], [],
1117 [grub_mount_excuse="need FUSE library"])
1120 if test x"$grub_mount_excuse" = x ; then
1121 # Check for fuse headers.
1122 SAVED_CPPFLAGS="$CPPFLAGS"
1123 CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
1124 AC_CHECK_HEADERS([fuse/fuse.h], [],
1125 [grub_mount_excuse=["need FUSE headers"]])
1126 CPPFLAGS="$SAVED_CPPFLAGS"
1129 if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
1130 AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled])
1132 if test x"$grub_mount_excuse" = x ; then
1133 enable_grub_mount=yes
1135 enable_grub_mount=no
1137 AC_SUBST([enable_grub_mount])
1139 AC_ARG_ENABLE([device-mapper],
1140 [AS_HELP_STRING([--enable-device-mapper],
1141 [enable Linux device-mapper support (default=guessed)])])
1142 if test x"$enable_device_mapper" = xno ; then
1143 device_mapper_excuse="explicitly disabled"
1146 if test x"$device_mapper_excuse" = x ; then
1147 # Check for device-mapper header.
1148 AC_CHECK_HEADER([libdevmapper.h], [],
1149 [device_mapper_excuse="need libdevmapper header"])
1152 if test x"$device_mapper_excuse" = x ; then
1153 # Check for device-mapper library.
1154 AC_CHECK_LIB([devmapper], [dm_task_create], [],
1155 [device_mapper_excuse="need devmapper library"])
1158 if test x"$device_mapper_excuse" = x ; then
1159 # Check for device-mapper library.
1160 AC_CHECK_LIB([devmapper], [dm_log_with_errno_init],
1162 [device_mapper_excuse="need devmapper library"])
1165 if test x"$device_mapper_excuse" = x ; then
1166 LIBDEVMAPPER="-ldevmapper";
1167 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
1168 [Define to 1 if you have the devmapper library.])
1171 AC_SUBST([LIBDEVMAPPER])
1174 if test x$host_kernel = xkfreebsd; then
1175 AC_CHECK_LIB([geom], [geom_gettree], [],
1176 [AC_MSG_ERROR([Your platform requires libgeom])])
1182 AC_CHECK_LIB([lzma], [lzma_code],
1184 AC_DEFINE([HAVE_LIBLZMA], [1],
1185 [Define to 1 if you have the LZMA library.])],)
1188 AC_ARG_ENABLE([libzfs],
1189 [AS_HELP_STRING([--enable-libzfs],
1190 [enable libzfs integration (default=guessed)])])
1191 if test x"$enable_libzfs" = xno ; then
1192 libzfs_excuse="explicitly disabled"
1195 if test x"$libzfs_excuse" = x ; then
1196 # Only check for system headers if libzfs support has not been disabled.
1197 AC_CHECK_HEADERS(libzfs.h libnvpair.h)
1200 if test x"$libzfs_excuse" = x ; then
1201 AC_CHECK_LIB([zfs], [libzfs_init],
1203 [libzfs_excuse="need zfs library"])
1206 if test x"$libzfs_excuse" = x ; then
1207 AC_CHECK_LIB([nvpair], [nvlist_print],
1209 [libzfs_excuse="need nvpair library"])
1212 if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
1213 AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied])
1216 if test x"$libzfs_excuse" = x ; then
1217 # We need both libzfs and libnvpair for a successful build.
1219 AC_DEFINE([HAVE_LIBZFS], [1],
1220 [Define to 1 if you have the ZFS library.])
1221 LIBNVPAIR="-lnvpair"
1222 AC_DEFINE([HAVE_LIBNVPAIR], [1],
1223 [Define to 1 if you have the NVPAIR library.])
1227 AC_SUBST([LIBNVPAIR])
1231 AC_SUBST([FONT_SOURCE])
1232 AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
1233 [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
1234 AS_IF([test x$TARGET_APPLE_CC = x1],
1235 [AC_SUBST([USE_APPLE_CC_FIXES], yes)])
1237 AC_SUBST(HAVE_ASM_USCORE)
1240 AC_SUBST(BSS_START_SYMBOL)
1241 AC_SUBST(END_SYMBOL)
1244 AC_SUBST(NEED_REGISTER_FRAME_INFO)
1247 # Automake conditionals
1250 AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
1251 AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
1252 AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
1253 AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
1254 AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
1255 AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
1256 AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
1257 AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
1258 AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
1259 AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
1260 AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
1261 AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc])
1262 AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
1263 AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
1264 AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
1265 AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
1266 AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
1267 AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ])
1268 AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot])
1269 AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi])
1271 AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
1272 AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
1273 AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
1274 AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
1275 AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
1276 AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
1277 AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
1279 AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
1280 AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
1281 AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
1282 AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
1283 AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
1284 AM_CONDITIONAL([COND_BUILD_GRUB_MKFONT], [test x$enable_build_grub_mkfont = xyes])
1285 AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
1286 AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
1287 AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x])
1288 AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
1289 AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
1290 AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
1291 AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
1293 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
1295 AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
1296 AM_CONDITIONAL([COND_CYGWIN], [test x$target_os = xcygwin])
1297 AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
1300 cpudir="${target_cpu}"
1301 if test x${cpudir} = xmipsel; then
1305 if test x"$link_dir" = xyes ; then
1306 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
1307 if test "$platform" != emu ; then
1308 AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
1311 mkdir -p include/grub 2>/dev/null
1312 rm -rf include/grub/cpu
1313 cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
1314 if test "$platform" != emu ; then
1315 rm -rf include/grub/machine
1316 cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
1320 AC_CONFIG_FILES([Makefile])
1321 AC_CONFIG_FILES([grub-core/Makefile])
1322 AC_CONFIG_FILES([grub-core/gnulib/Makefile])
1323 AC_CONFIG_FILES([po/Makefile.in])
1324 AC_CONFIG_FILES([docs/Makefile])
1325 AC_CONFIG_FILES([util/bash-completion.d/Makefile])
1326 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
1327 AC_CONFIG_FILES([config.h])
1331 echo "*******************************************************"
1332 echo GRUB2 will be compiled with following components:
1333 echo Platform: "$target_cpu"-"$platform"
1334 if [ x"$platform" = xemu ]; then
1335 if [ x"$grub_emu_usb_excuse" = x ]; then
1336 echo USB support for grub-emu: Yes
1338 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
1340 if [ x"$grub_emu_sdl_excuse" = x ]; then
1341 echo SDL support for grub-emu: Yes
1343 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
1345 if [ x"$grub_emu_pci_excuse" = x ]; then
1346 echo PCI support for grub-emu: Yes
1348 echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
1351 if test x"$device_mapper_excuse" = x ; then
1352 echo With devmapper support: Yes
1354 echo With devmapper support: No "($device_mapper_excuse)"
1356 if [ x"$enable_mm_debug" = xyes ]; then
1357 echo With memory debugging: Yes
1359 echo With memory debugging: No
1361 if [ x"$enable_cache_stats" = xyes ]; then
1362 echo With disk cache statistics: Yes
1364 echo With disk cache statistics: No
1367 if [ x"$enable_boot_time" = xyes ]; then
1368 echo With boot time statistics: Yes
1370 echo With boot time statistics: No
1373 if [ x"$efiemu_excuse" = x ]; then
1374 echo efiemu runtime: Yes
1376 echo efiemu runtime: No "($efiemu_excuse)"
1378 if [ x"$grub_mkfont_excuse" = x ]; then
1379 echo grub-mkfont: Yes
1381 echo grub-mkfont: No "($grub_mkfont_excuse)"
1383 if [ x"$grub_mount_excuse" = x ]; then
1384 echo grub-mount: Yes
1386 echo grub-mount: No "($grub_mount_excuse)"
1388 if [ x"$starfield_excuse" = x ]; then
1389 echo starfield theme: Yes
1391 echo starfield theme: No "($starfield_excuse)"
1393 if [ x"$libzfs_excuse" = x ]; then
1394 echo With libzfs support: Yes
1396 echo With libzfs support: No "($libzfs_excuse)"
1398 if [ x"$grub_build_mkfont_excuse" = x ]; then
1399 echo Build-time grub-mkfont: Yes
1400 if test "x$FONT_SOURCE" = x ; then
1401 echo "Without unifont"
1403 echo "With unifont from $FONT_SOURCE"
1406 echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)"
1407 echo "Without unifont (no build-time grub-mkfont)"
1409 if test "x$LIBLZMA" = x ; then
1410 echo "Without liblzma (no support for XZ-compressed mips images)"
1412 echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
1414 echo "*******************************************************"