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 if [ x$platform != xemu ]; then
167 case "$target_cpu" in
168 i386 | powerpc) target_m32=1 ;;
169 x86_64 | sparc64) target_m64=1 ;;
174 windows* | mingw32*) target_os=cygwin ;;
177 # This normalizes the names, and creates a new variable ("host_kernel")
178 # while at it, since the mapping is not always 1:1 (e.g. different OSes
179 # using the same kernel type).
181 gnu*) host_kernel=hurd ;;
182 linux*) host_kernel=linux ;;
183 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
184 netbsd*) host_kernel=netbsd ;;
185 solaris*) host_kernel=illumos ;;
186 darwin*) host_kernel=xnu ;;
187 cygwin | windows* | mingw32*) host_kernel=windows ;;
191 coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
192 multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
193 efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
194 ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
195 uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;;
196 qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
197 pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
198 emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
199 loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
200 qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
201 arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
203 case "$target_cpu" in
204 arm) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARM=1" ;;
205 mips |mipsel) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
206 sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
208 if test x${target_cpu} = xmipsel ; then
209 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
211 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"
214 case "${target_cpu}-$platform" in
216 TARGET_LINK_ADDR=0x88200000
217 TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000
220 TARGET_LINK_ADDR=0x80700000
221 TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000
223 mips*-qemu_mips | mips*-loongson)
224 TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000
228 AC_SUBST(TARGET_LINK_ADDR)
229 AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR)
231 TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
235 AC_SUBST(host_kernel)
240 # Define default variables
243 AC_ARG_WITH([bootdir],
244 AS_HELP_STRING([--with-bootdir=DIR],
245 [set the name of /boot directory [[guessed]]]),
246 [have_with_bootdir=y],
247 [have_with_bootdir=n])
248 if test x$have_with_bootdir = xy; then
249 bootdirname="$with_bootdir"
253 # Because /boot is used for the boot block in NetBSD and OpenBSD,
255 *) bootdirname='boot' ;;
259 AC_SUBST(bootdirname)
260 AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
261 [Default boot directory name]")
263 AC_ARG_WITH([grubdir],
264 AS_HELP_STRING([--with-grubdir=DIR],
265 [set the name of grub directory [[guessed]]]),
266 [grubdirname="$with_grubdir"],
267 [grubdirname="$PACKAGE"])
269 AC_SUBST(grubdirname)
270 AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
271 [Default grub directory name])
274 # Checks for build programs.
277 # Although cmp is listed in the GNU Coding Standards as a command which
278 # can used directly, OpenBSD lacks cmp in the default installation.
279 AC_CHECK_PROGS([CMP], [cmp])
280 if test "x$CMP" = x; then
281 AC_MSG_ERROR([cmp is not found])
284 AC_CHECK_PROGS([YACC], [bison])
285 if test "x$YACC" = x; then
286 AC_MSG_ERROR([bison is not found])
298 if test "x$LEX" = "x:"; then
299 AC_MSG_ERROR([flex is not found])
301 version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
302 if test -n "$version" -a "$version" -ge 20535; then
305 AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
309 # These are not a "must".
310 AC_PATH_PROGS(MAKEINFO, makeinfo true)
313 # Checks for host programs.
323 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
325 AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
328 AM_GNU_GETTEXT([external])
331 # Identify characteristics of the host architecture.
332 unset ac_cv_c_bigendian
335 AC_CHECK_SIZEOF(void *)
336 AC_CHECK_SIZEOF(long)
339 cygwin | windows* | mingw32*)
340 HOST_CPPFLAGS="$HOST_CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
341 CPPFLAGS="$CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
342 AC_CHECK_SIZEOF(TCHAR,,[#include <windows.h>])
347 if test x$grub_cv_apple_cc = xyes ; then
348 HOST_CPPFLAGS="$HOST_CPPFLAGS -fnested-functions"
349 HOST_LDFLAGS="$HOST_LDFLAGS -Wl,-allow_stack_execute"
352 if test x$USE_NLS = xno; then
353 HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
356 if test "x$cross_compiling" = xyes; then
357 AC_MSG_WARN([cannot generate manual pages while cross compiling])
359 AC_PATH_PROG(HELP2MAN, help2man)
362 # Check for functions and headers.
363 AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
364 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
366 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
367 #include <sys/param.h>
368 #include <sys/mount.h>])
370 AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default
371 #include <sys/param.h>
372 #include <sys/mount.h>])
374 # For opendisk() and getrawpartition() on NetBSD.
375 # Used in util/deviceiter.c and in util/hostdisk.c.
376 AC_CHECK_HEADER([util.h], [
377 AC_CHECK_LIB([util], [opendisk], [
379 AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
381 AC_CHECK_LIB([util], [getrawpartition], [
383 AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
388 AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
389 SAVED_CFLAGS="$CFLAGS"
390 CFLAGS="$HOST_CFLAGS -Wtrampolines"
391 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
392 int va_arg_func (int fixed, va_list args);]], [[]])],
393 [grub_cv_host_cc_wtrampolines=yes],
394 [grub_cv_host_cc_wtrampolines=no])
395 CFLAGS="$SAVED_CFLAGS"
398 if test x"$grub_host_cv_cc_wtrampolines" = xyes ; then
399 HOST_CFLAGS="$HOST_CFLAGS -Wtrampolines"
403 # Check for host and build compilers.
406 AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc])
407 test -z "$BUILD_CC" && AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])
408 BUILD_CPP="$BUILD_CC -E"
411 haiku*) BUILD_LIBM= ;;
418 # Check for target programs.
421 # Find tools for the target.
422 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
423 tmp_ac_tool_prefix="$ac_tool_prefix"
424 ac_tool_prefix=$target_alias-
426 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
427 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
428 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
429 AC_CHECK_TOOL(TARGET_STRIP, strip)
430 AC_CHECK_TOOL(TARGET_NM, nm)
431 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
433 ac_tool_prefix="$tmp_ac_tool_prefix"
435 if test "x$TARGET_CC" = x; then
438 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
439 AC_CHECK_TOOL(TARGET_STRIP, strip)
440 AC_CHECK_TOOL(TARGET_NM, nm)
441 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
446 AC_SUBST(BUILD_CFLAGS)
447 AC_SUBST(BUILD_CPPFLAGS)
450 AC_SUBST(TARGET_RANLIB)
451 AC_SUBST(TARGET_STRIP)
452 AC_SUBST(TARGET_OBJCOPY)
454 # Test the C compiler for the target environment.
457 tmp_LDFLAGS="$LDFLAGS"
458 tmp_CPPFLAGS="$CPPFLAGS"
461 CFLAGS="$TARGET_CFLAGS"
462 CPPFLAGS="$TARGET_CPPFLAGS"
463 LDFLAGS="$TARGET_LDFLAGS"
467 grub_PROG_NM_DEFINED_ONLY
468 AC_SUBST(TARGET_NMFLAGS_MINUS_P)
469 AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
472 WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -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 -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"
473 HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS"
474 TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
475 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
477 # Force no alignment to save space on i386.
478 if test "x$target_cpu" = xi386; then
479 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
480 CFLAGS="$CFLAGS -falign-loops=1"
481 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
482 [grub_cv_cc_falign_loop=yes],
483 [grub_cv_cc_falign_loop=no])
486 if test "x$grub_cv_cc_falign_loop" = xyes; then
487 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
489 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
493 if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
494 # Some toolchains enable these features by default, but they need
495 # registers that aren't set up properly in GRUB.
496 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
499 if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
500 TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
503 # By default, GCC 4.4 generates .eh_frame sections containing unwind
504 # information in some cases where it previously did not. GRUB doesn't need
505 # these and they just use up vital space. Restore the old compiler
507 AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
508 SAVE_CFLAGS="$CFLAGS"
509 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
510 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
511 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
512 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
513 CFLAGS="$SAVE_CFLAGS"
516 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
517 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
520 if test x"$target_os" = xcygwin; then
521 AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [
522 CFLAGS="$CFLAGS -fno-reorder-functions"
523 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
524 [grub_cv_cc_no_reorder_functions=yes],
525 [grub_cv_cc_no_reorder_functions=no])
529 if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xyes; then
530 TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
533 # By default, GCC 4.6 generates .eh_frame sections containing unwind
534 # information in some cases where it previously did not. GRUB doesn't need
535 # these and they just use up vital space. Restore the old compiler
537 AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
538 SAVE_CFLAGS="$CFLAGS"
539 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
540 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
541 [grub_cv_cc_fno_asynchronous_unwind_tables=yes],
542 [grub_cv_cc_fno_asynchronous_unwind_tables=no])
543 CFLAGS="$SAVE_CFLAGS"
546 if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
547 TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
551 if test x$grub_cv_apple_target_cc = xyes ; then
552 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -fnested-functions"
554 CFLAGS="$CFLAGS -fnested-functions"
556 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], [])
557 if test "x$TARGET_OBJCONV" = x ; then
558 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.])
560 if test "x$TARGET_OBJCONV" = x ; then
561 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
564 TARGET_IMG_CFLAGS="-static"
565 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
566 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
567 TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
568 TARGET_LDFLAGS_OLDMAGIC=""
571 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
572 # Use linker script if present, otherwise use builtin -N script.
573 if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc"; then
574 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc"
575 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
576 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc"
577 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
580 TARGET_IMG_LDFLAGS='-Wl,-N'
581 TARGET_IMG_LDFLAGS_AC='-Wl,-N'
582 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
587 AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
589 # For platforms where ELF is not the default link format.
590 AC_MSG_CHECKING([for command to convert module to ELF format])
591 case "${target_os}" in
592 cygwin) TARGET_OBJ2ELF='./build-grub-pe2elf';
593 # FIXME: put proper test here
594 NEED_REGISTER_FRAME_INFO=1
596 *) NEED_REGISTER_FRAME_INFO=0 ;;
598 AC_MSG_RESULT([$TARGET_OBJ2ELF])
601 AC_ARG_ENABLE([efiemu],
602 [AS_HELP_STRING([--enable-efiemu],
603 [build and install the efiemu runtimes (default=guessed)])])
604 if test x"$enable_efiemu" = xno ; then
605 efiemu_excuse="explicitly disabled"
607 if test x"$target_os" = xcygwin ; then
608 efiemu_excuse="not available on cygwin"
610 if test x"$target_cpu" != xi386 ; then
611 efiemu_excuse="only available on i386"
613 if test x"$platform" = xefi ; then
614 efiemu_excuse="not available on efi"
616 if test x"$efiemu_excuse" = x ; then
617 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
618 SAVED_CFLAGS="$CFLAGS"
619 CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
620 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
621 [grub_cv_cc_efiemu=yes],
622 [grub_cv_cc_efiemu=no])
623 CFLAGS="$SAVED_CFLAGS"
625 if test x$grub_cv_cc_efiemu = xno; then
626 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
629 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
630 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
632 if test x"$efiemu_excuse" = x ; then
637 AC_SUBST([enable_efiemu])
639 if test "x$target_m32" = x1; then
641 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
642 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
643 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
644 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
645 TARGET_MODULE_FORMAT="elf32"
648 if test "x$target_m64" = x1; then
650 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
651 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
652 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
653 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
654 TARGET_MODULE_FORMAT="elf64"
661 if test x"$target_cpu" = xi386; then
662 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386_fbsd"
664 if test x"$target_cpu" = xx86_64; then
665 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64_fbsd"
669 if test x"$target_cpu" = xi386; then
670 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386_obsd"
672 if test x"$target_cpu" = xx86_64; then
673 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64_obsd"
677 if test x"$target_cpu" = xi386; then
678 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386_haiku"
680 if test x"$target_cpu" = xx86_64; then
681 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64_haiku"
685 if test x"$target_cpu" = xi386; then
686 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386"
688 if test x"$target_cpu" = xx86_64; then
689 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64"
694 if test "$target_cpu" = x86_64; then
695 # Use large model to support 4G memory
696 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
698 CFLAGS="$CFLAGS -m64 -mcmodel=large"
699 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
700 [grub_cv_cc_mcmodel=yes],
701 [grub_cv_cc_mcmodel=no])
703 if test "x$grub_cv_cc_mcmodel" = xno; then
704 AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
706 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
710 if test "$target_cpu"-"$platform" = x86_64-efi; then
711 # EFI writes to stack below %rsp, we must not use the red zone
712 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
713 CFLAGS="$CFLAGS -m64 -mno-red-zone"
714 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
715 [grub_cv_cc_no_red_zone=yes],
716 [grub_cv_cc_no_red_zone=no])
718 if test "x$grub_cv_cc_no_red_zone" = xno; then
719 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
722 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
729 # Position independent executable.
731 [# Need that, because some distributions ship compilers that include
732 # `-fPIE' in the default specs.
733 if [ x"$pie_possible" = xyes ]; then
734 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
737 # Position independent executable.
739 [# Need that, because some distributions ship compilers that include
740 # `-fPIC' in the default specs.
741 if [ x"$pic_possible" = xyes ]; then
742 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
745 # Smashing stack protector.
746 grub_CHECK_STACK_PROTECTOR
747 # Need that, because some distributions ship compilers that include
748 # `-fstack-protector' in the default specs.
749 if test "x$ssp_possible" = xyes; then
750 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
752 grub_CHECK_STACK_ARG_PROBE
753 # Cygwin's GCC uses alloca() to probe the stackframe on static
754 # stack allocations above some threshold.
755 if test x"$sap_possible" = xyes; then
756 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
759 # -mno-unaligned-access
760 if test "$target_cpu" = arm; then
761 grub_CHECK_NO_UNALIGNED_ACCESS
762 if test x"$nua_possible" = xyes; then
763 TARGET_CFLAGS="$TARGET_CFLAGS -mno-unaligned-access"
767 AC_ARG_ENABLE([werror],
768 [AS_HELP_STRING([--disable-werror],
769 [do not use -Werror when building GRUB])])
770 if test x"$enable_werror" != xno ; then
771 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
772 HOST_CFLAGS="$HOST_CFLAGS -Werror"
775 TARGET_CPP="$TARGET_CC -E"
776 TARGET_CCAS=$TARGET_CC
778 GRUB_TARGET_CPU="${target_cpu}"
779 GRUB_PLATFORM="${platform}"
781 AC_SUBST(GRUB_TARGET_CPU)
782 AC_SUBST(GRUB_PLATFORM)
784 AC_SUBST(TARGET_OBJCONV)
786 AC_SUBST(TARGET_CCAS)
787 AC_SUBST(TARGET_OBJ2ELF)
788 AC_SUBST(TARGET_APPLE_CC)
789 AC_SUBST(TARGET_MODULE_FORMAT)
791 AC_SUBST(TARGET_CFLAGS)
792 AC_SUBST(TARGET_LDFLAGS)
793 AC_SUBST(TARGET_CPPFLAGS)
794 AC_SUBST(TARGET_CCASFLAGS)
796 AC_SUBST(TARGET_IMG_LDSCRIPT)
797 AC_SUBST(TARGET_IMG_LDFLAGS)
798 AC_SUBST(TARGET_IMG_CFLAGS)
799 AC_SUBST(TARGET_IMG_BASE_LDOPT)
801 AC_SUBST(HOST_CFLAGS)
802 AC_SUBST(HOST_LDFLAGS)
803 AC_SUBST(HOST_CPPFLAGS)
804 AC_SUBST(HOST_CCASFLAGS)
808 # Set them to their new values for the tests below.
810 if test "x$TARGET_APPLE_CC" = x1 ; then
811 CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
813 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
815 CPPFLAGS="$TARGET_CPPFLAGS"
816 if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 ; then
823 if test x$grub_cv_asm_uscore = xyes; then
824 CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main"
826 CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
829 # Check for libgcc symbols
830 AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x __udivsi3 __umoddi3 __udivdi3 __divsi3 __modsi3 __umodsi3 __moddi3 __divdi3 __ctzdi2 __ctzsi2)
832 if test "x$TARGET_APPLE_CC" = x1 ; then
833 CFLAGS="$TARGET_CFLAGS -nostdlib"
835 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
839 # Defined in aclocal.m4.
841 if test "x$TARGET_APPLE_CC" != x1 ; then
842 grub_PROG_OBJCOPY_ABSOLUTE
844 grub_PROG_LD_BUILD_ID_NONE
845 if test "x$target_cpu" = xi386; then
846 if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
847 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
848 # Check symbols provided by linker script.
849 CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},0x8000 -Wl,--defsym,___main=0x8100"
851 grub_CHECK_BSS_START_SYMBOL
852 grub_CHECK_END_SYMBOL
854 CFLAGS="$TARGET_CFLAGS"
855 grub_I386_ASM_PREFIX_REQUIREMENT
859 if test "$platform" != emu; then
860 AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
861 SAVED_CPPFLAGS="$CPPFLAGS"
862 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
863 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
865 int va_arg_func (int fixed, va_list args);]], [[]])],
866 [grub_cv_cc_isystem=yes],
867 [grub_cv_cc_isystem=no])
868 CPPFLAGS="$SAVED_CPPFLAGS"
871 if test x"$grub_cv_cc_isystem" = xyes ; then
872 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
876 AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [
877 SAVED_CFLAGS="$CFLAGS"
878 CFLAGS="$TARGET_CFLAGS -Wtrampolines"
879 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
880 int va_arg_func (int fixed, va_list args);]], [[]])],
881 [grub_cv_cc_wtrampolines=yes],
882 [grub_cv_cc_wtrampolines=no])
883 CFLAGS="$SAVED_CFLAGS"
886 if test x"$grub_cv_cc_wtrampolines" = xyes ; then
887 TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines"
893 CPPFLAGS="$tmp_CPPFLAGS"
894 LDFLAGS="$tmp_LDFLAGS"
901 # Memory manager debugging.
902 AC_ARG_ENABLE([mm-debug],
903 AS_HELP_STRING([--enable-mm-debug],
904 [include memory manager debugging]),
905 [AC_DEFINE([MM_DEBUG], [1],
906 [Define to 1 if you enable memory manager debugging.])])
908 AC_ARG_ENABLE([cache-stats],
909 AS_HELP_STRING([--enable-cache-stats],
910 [enable disk cache statistics collection]))
912 if test x$enable_cache_stats = xyes; then
917 AC_SUBST([DISK_CACHE_STATS])
919 AC_ARG_ENABLE([boot-time],
920 AS_HELP_STRING([--enable-boot-time],
921 [enable boot time statistics collection]))
923 if test x$enable_boot_time = xyes; then
928 AC_SUBST([BOOT_TIME_STATS])
930 AC_ARG_ENABLE([grub-emu-usb],
931 [AS_HELP_STRING([--enable-grub-emu-usb],
932 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
934 AC_ARG_ENABLE([grub-emu-sdl],
935 [AS_HELP_STRING([--enable-grub-emu-sdl],
936 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
938 AC_ARG_ENABLE([grub-emu-pci],
939 [AS_HELP_STRING([--enable-grub-emu-pci],
940 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
942 if test "$platform" = emu; then
944 if test x"$enable_grub_emu_usb" != xyes ; then
945 grub_emu_usb_excuse="not enabled"
948 if test x"$enable_grub_emu_pci" = xyes ; then
949 grub_emu_usb_excuse="conflicts with PCI support"
952 [if [ x"$grub_emu_usb_excuse" = x ]; then
953 # Check for libusb libraries.]
954 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
955 [grub_emu_usb_excuse=["need libusb library"]])
958 [if [ x"$grub_emu_usb_excuse" = x ]; then
959 # Check for headers.]
960 AC_CHECK_HEADERS([usb.h], [],
961 [grub_emu_usb_excuse=["need libusb headers"]])
963 if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
964 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
966 if test x"$grub_emu_usb_excuse" = x ; then
967 enable_grub_emu_usb=yes
969 enable_grub_emu_usb=no
972 if test x"$enable_grub_emu_sdl" = xno ; then
973 grub_emu_sdl_excuse="explicitely disabled"
975 [if [ x"$grub_emu_sdl_excuse" = x ]; then
976 # Check for libSDL libraries.]
977 AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
978 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
982 [if [ x"$grub_emu_sdl_excuse" = x ]; then
983 # Check for headers.]
984 AC_CHECK_HEADERS([SDL/SDL.h], [],
985 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
988 if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
989 AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
991 if test x"$grub_emu_sdl_excuse" = x ; then
992 enable_grub_emu_sdl=yes
994 enable_grub_emu_sdl=no
997 if test x"$enable_grub_emu_pci" != xyes ; then
998 grub_emu_pci_excuse="not enabled"
1001 if test x"$enable_grub_emu_usb" = xyes ; then
1002 grub_emu_pci_excuse="conflicts with USB support"
1005 [if [ x"$grub_emu_pci_excuse" = x ]; then
1006 # Check for libpci libraries.]
1007 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
1008 [grub_emu_pci_excuse=["need libpciaccess library"]])
1009 AC_SUBST([LIBPCIACCESS])
1011 [if [ x"$grub_emu_pci_excuse" = x ]; then
1012 # Check for headers.]
1013 AC_CHECK_HEADERS([pci/pci.h], [],
1014 [grub_emu_pci_excuse=["need libpciaccess headers"]])
1017 if test x"$grub_emu_pci_excuse" = x ; then
1018 enable_grub_emu_pci=yes
1021 enable_grub_emu_pci=no
1024 AC_SUBST([enable_grub_emu_sdl])
1025 AC_SUBST([enable_grub_emu_usb])
1026 AC_SUBST([enable_grub_emu_pci])
1029 AC_ARG_ENABLE([grub-mkfont],
1030 [AS_HELP_STRING([--enable-grub-mkfont],
1031 [build and install the `grub-mkfont' utility (default=guessed)])])
1032 if test x"$enable_grub_mkfont" = xno ; then
1033 grub_mkfont_excuse="explicitly disabled"
1036 if test x"$grub_mkfont_excuse" = x ; then
1037 # Check for freetype libraries.
1038 AC_CHECK_TOOLS([FREETYPE], [freetype-config])
1039 if test "x$FREETYPE" = x ; then
1040 grub_mkfont_excuse=["need freetype2 library"]
1044 unset ac_cv_header_ft2build_h
1046 if test x"$grub_mkfont_excuse" = x ; then
1047 # Check for freetype libraries.
1048 freetype_cflags=`$FREETYPE --cflags`
1049 freetype_libs=`$FREETYPE --libs`
1050 SAVED_CPPFLAGS="$CPPFLAGS"
1051 CPPFLAGS="$CPPFLAGS $freetype_cflags"
1052 AC_CHECK_HEADERS([ft2build.h], [],
1053 [grub_mkfont_excuse=["need freetype2 headers"]])
1054 CPPFLAGS="$SAVED_CPPFLAGS"
1057 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
1058 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
1060 if test x"$grub_mkfont_excuse" = x ; then
1061 enable_grub_mkfont=yes
1063 enable_grub_mkfont=no
1065 AC_SUBST([enable_grub_mkfont])
1066 AC_SUBST([freetype_cflags])
1067 AC_SUBST([freetype_libs])
1071 SAVED_CFLAGS="$CFLAGS"
1072 SAVED_CPPFLAGS="$CPPFLAGS"
1075 CFLAGS="$BUILD_CFLAGS"
1076 CPPFLAGS="$BUILD_CPPFLAGS"
1078 unset ac_cv_c_bigendian
1079 unset ac_cv_header_ft2build_h
1081 AC_COMPUTE_INT([BUILD_SIZEOF_VOID_P], [sizeof (void *)])
1082 AC_COMPUTE_INT([BUILD_SIZEOF_LONG], [sizeof (long)])
1083 AC_C_BIGENDIAN([BUILD_WORDS_BIGENDIAN=1], [BUILD_WORDS_BIGENDIAN=0], [BUILD_WORDS_BIGENDIAN=err], [BUILD_WORDS_BIGENDIAN=err])
1085 if test x$BUILD_WORDS_BIGENDIAN = xerr ; then
1086 AC_MSG_ERROR([couldnt determine build endianness])
1089 AC_SUBST([BUILD_SIZEOF_LONG])
1090 AC_SUBST([BUILD_SIZEOF_VOID_P])
1091 AC_SUBST([BUILD_WORDS_BIGENDIAN])
1093 if test x"$grub_build_mkfont_excuse" = x ; then
1094 # Check for freetype libraries.
1095 AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config])
1096 if test "x$BUILD_FREETYPE" = x ; then
1097 grub_build_mkfont_excuse=["need freetype2 library"]
1101 if test x"$grub_build_mkfont_excuse" = x ; then
1102 # Check for freetype libraries.
1103 build_freetype_cflags=`$BUILD_FREETYPE --cflags`
1104 build_freetype_libs=`$BUILD_FREETYPE --libs`
1105 SAVED_CPPFLAGS_2="$CPPFLAGS"
1106 CPPFLAGS="$CPPFLAGS $build_freetype_cflags"
1107 AC_CHECK_HEADERS([ft2build.h], [],
1108 [grub_build_mkfont_excuse=["need freetype2 headers"]])
1109 CPPFLAGS="$SAVED_CPPFLAGS_2"
1112 if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
1113 AC_MSG_ERROR([build-grub-mkfont was explicitly requested but can't be compiled])
1115 if test x"$grub_build_mkfont_excuse" = x ; then
1116 enable_build_grub_mkfont=yes
1118 enable_build_grub_mkfont=no
1120 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
1121 AC_MSG_ERROR([qemu, powerpc-ieee1275 and loongson ports needs build-time grub-mkfont])
1124 AC_SUBST([build_freetype_cflags])
1125 AC_SUBST([build_freetype_libs])
1129 CFLAGS="$SAVED_CFLAGS"
1130 CPPFLAGS="$SAVED_CPPFLAGS"
1137 if test x"$enable_build_grub_mkfont" = xno ; then
1138 starfield_excuse="No build-time grub-mkfont"
1141 if test x"$starfield_excuse" = x; then
1142 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
1143 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do
1144 if test -f "$dir/DejaVuSans.$ext"; then
1145 DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
1151 if test "x$DJVU_FONT_SOURCE" = x; then
1152 starfield_excuse="No DejaVu found"
1156 AC_SUBST([DJVU_FONT_SOURCE])
1160 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
1161 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
1162 if test -f "$dir/unifont.$ext"; then
1163 FONT_SOURCE="$dir/unifont.$ext"
1169 if test x"$enable_build_grub_mkfont" = xno ; then
1173 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
1174 AC_MSG_ERROR([qemu, powerpc-ieee1275 and loongson ports need unifont])
1177 AC_SUBST([FONT_SOURCE])
1179 if test x"$FONT_SOURCE" = x && test x"$DJVU_FONT_SOURCE" = x && test x"$grub_build_mkfont_excuse" = x; then
1180 grub_build_mkfont_excuse="no fonts"
1184 AC_ARG_ENABLE([grub-mount],
1185 [AS_HELP_STRING([--enable-grub-mount],
1186 [build and install the `grub-mount' utility (default=guessed)])])
1187 if test x"$enable_grub_mount" = xno ; then
1188 grub_mount_excuse="explicitly disabled"
1191 if test x"$grub_mount_excuse" = x ; then
1192 AC_CHECK_LIB([fuse], [fuse_main_real], [],
1193 [grub_mount_excuse="need FUSE library"])
1196 if test x"$grub_mount_excuse" = x ; then
1197 # Check for fuse headers.
1198 SAVED_CPPFLAGS="$CPPFLAGS"
1199 CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
1200 AC_CHECK_HEADERS([fuse/fuse.h], [],
1201 [grub_mount_excuse=["need FUSE headers"]])
1202 CPPFLAGS="$SAVED_CPPFLAGS"
1205 if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
1206 AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled])
1208 if test x"$grub_mount_excuse" = x ; then
1209 enable_grub_mount=yes
1211 enable_grub_mount=no
1213 AC_SUBST([enable_grub_mount])
1215 AC_ARG_ENABLE([device-mapper],
1216 [AS_HELP_STRING([--enable-device-mapper],
1217 [enable Linux device-mapper support (default=guessed)])])
1218 if test x"$enable_device_mapper" = xno ; then
1219 device_mapper_excuse="explicitly disabled"
1222 if test x"$device_mapper_excuse" = x ; then
1223 # Check for device-mapper header.
1224 AC_CHECK_HEADER([libdevmapper.h], [],
1225 [device_mapper_excuse="need libdevmapper header"])
1228 if test x"$device_mapper_excuse" = x ; then
1229 # Check for device-mapper library.
1230 AC_CHECK_LIB([devmapper], [dm_task_create], [],
1231 [device_mapper_excuse="need devmapper library"])
1234 if test x"$device_mapper_excuse" = x ; then
1235 # Check for device-mapper library.
1236 AC_CHECK_LIB([devmapper], [dm_log_with_errno_init],
1238 [device_mapper_excuse="need devmapper library"])
1241 if test x"$device_mapper_excuse" = x ; then
1242 LIBDEVMAPPER="-ldevmapper";
1243 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
1244 [Define to 1 if you have the devmapper library.])
1247 AC_SUBST([LIBDEVMAPPER])
1250 if test x$host_kernel = xkfreebsd; then
1251 AC_CHECK_LIB([geom], [geom_gettree], [],
1252 [AC_MSG_ERROR([Your platform requires libgeom])])
1258 AC_CHECK_LIB([lzma], [lzma_code],
1260 AC_DEFINE([HAVE_LIBLZMA], [1],
1261 [Define to 1 if you have the LZMA library.])],)
1264 AC_ARG_ENABLE([libzfs],
1265 [AS_HELP_STRING([--enable-libzfs],
1266 [enable libzfs integration (default=guessed)])])
1267 if test x"$enable_libzfs" = xno ; then
1268 libzfs_excuse="explicitly disabled"
1271 if test x"$libzfs_excuse" = x ; then
1272 # Only check for system headers if libzfs support has not been disabled.
1273 AC_CHECK_HEADERS(libzfs.h libnvpair.h)
1276 if test x"$libzfs_excuse" = x ; then
1277 AC_CHECK_LIB([zfs], [libzfs_init],
1279 [libzfs_excuse="need zfs library"])
1282 if test x"$libzfs_excuse" = x ; then
1283 AC_CHECK_LIB([nvpair], [nvlist_lookup_string],
1285 [libzfs_excuse="need nvpair library"])
1288 if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
1289 AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied])
1292 if test x"$libzfs_excuse" = x ; then
1293 # We need both libzfs and libnvpair for a successful build.
1295 AC_DEFINE([HAVE_LIBZFS], [1],
1296 [Define to 1 if you have the ZFS library.])
1297 LIBNVPAIR="-lnvpair"
1298 AC_DEFINE([HAVE_LIBNVPAIR], [1],
1299 [Define to 1 if you have the NVPAIR library.])
1303 AC_SUBST([LIBNVPAIR])
1307 AC_SUBST([FONT_SOURCE])
1308 AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
1309 [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
1310 AS_IF([test x$TARGET_APPLE_CC = x1],
1311 [AC_SUBST([USE_APPLE_CC_FIXES], yes)])
1313 AC_SUBST(HAVE_ASM_USCORE)
1316 AC_SUBST(BSS_START_SYMBOL)
1317 AC_SUBST(END_SYMBOL)
1320 AC_SUBST(NEED_REGISTER_FRAME_INFO)
1323 # Automake conditionals
1326 AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
1327 AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
1328 AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
1329 AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
1330 AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
1331 AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
1332 AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
1333 AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
1334 AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
1335 AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
1336 AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
1337 AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc])
1338 AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
1339 AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
1340 AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
1341 AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
1342 AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
1343 AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ])
1344 AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot])
1345 AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi])
1347 AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
1348 AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
1349 AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
1350 AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
1351 AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
1352 AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
1353 AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
1355 AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
1356 AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
1357 AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
1358 AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
1359 AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
1360 AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
1361 AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
1362 AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
1363 AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
1364 AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
1365 AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
1367 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
1369 AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
1370 AM_CONDITIONAL([COND_CYGWIN], [test x$target_os = xcygwin])
1371 AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
1374 cpudir="${target_cpu}"
1375 if test x${cpudir} = xmipsel; then
1379 if test x"$link_dir" = xyes ; then
1380 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
1381 if test "$platform" != emu ; then
1382 AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
1385 mkdir -p include/grub 2>/dev/null
1386 rm -rf include/grub/cpu
1387 cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
1388 if test "$platform" != emu ; then
1389 rm -rf include/grub/machine
1390 cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
1394 AC_CONFIG_FILES([Makefile])
1395 AC_CONFIG_FILES([grub-core/Makefile])
1396 AC_CONFIG_FILES([grub-core/gnulib/Makefile])
1397 AC_CONFIG_FILES([po/Makefile.in])
1398 AC_CONFIG_FILES([docs/Makefile])
1399 AC_CONFIG_FILES([util/bash-completion.d/Makefile])
1400 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
1401 AC_CONFIG_FILES([config.h])
1405 echo "*******************************************************"
1406 echo GRUB2 will be compiled with following components:
1407 echo Platform: "$target_cpu"-"$platform"
1408 if [ x"$platform" = xemu ]; then
1409 if [ x"$grub_emu_usb_excuse" = x ]; then
1410 echo USB support for grub-emu: Yes
1412 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
1414 if [ x"$grub_emu_sdl_excuse" = x ]; then
1415 echo SDL support for grub-emu: Yes
1417 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
1419 if [ x"$grub_emu_pci_excuse" = x ]; then
1420 echo PCI support for grub-emu: Yes
1422 echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
1425 if test x"$device_mapper_excuse" = x ; then
1426 echo With devmapper support: Yes
1428 echo With devmapper support: No "($device_mapper_excuse)"
1430 if [ x"$enable_mm_debug" = xyes ]; then
1431 echo With memory debugging: Yes
1433 echo With memory debugging: No
1435 if [ x"$enable_cache_stats" = xyes ]; then
1436 echo With disk cache statistics: Yes
1438 echo With disk cache statistics: No
1441 if [ x"$enable_boot_time" = xyes ]; then
1442 echo With boot time statistics: Yes
1444 echo With boot time statistics: No
1447 if [ x"$efiemu_excuse" = x ]; then
1448 echo efiemu runtime: Yes
1450 echo efiemu runtime: No "($efiemu_excuse)"
1452 if [ x"$grub_mkfont_excuse" = x ]; then
1453 echo grub-mkfont: Yes
1455 echo grub-mkfont: No "($grub_mkfont_excuse)"
1457 if [ x"$grub_mount_excuse" = x ]; then
1458 echo grub-mount: Yes
1460 echo grub-mount: No "($grub_mount_excuse)"
1462 if [ x"$starfield_excuse" = x ]; then
1463 echo starfield theme: Yes
1465 echo starfield theme: No "($starfield_excuse)"
1467 if [ x"$libzfs_excuse" = x ]; then
1468 echo With libzfs support: Yes
1470 echo With libzfs support: No "($libzfs_excuse)"
1472 if [ x"$grub_build_mkfont_excuse" = x ]; then
1473 echo Build-time grub-mkfont: Yes
1474 if test "x$FONT_SOURCE" = x ; then
1475 echo "Without unifont"
1477 echo "With unifont from $FONT_SOURCE"
1480 echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)"
1481 echo "Without unifont (no build-time grub-mkfont)"
1483 if test "x$LIBLZMA" = x ; then
1484 echo "Without liblzma (no support for XZ-compressed mips images)"
1486 echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
1488 echo "*******************************************************"