]> git.proxmox.com Git - grub2.git/blobdiff - configure.ac
* grub-core/bus/usb/usbhub.c: Fix recheck logic.
[grub2.git] / configure.ac
index 1b3288c8a0ad6c29a6bfaade20a1108cae9450ec..060568d54d9410422c888cd111130aea90a4b436 100644 (file)
@@ -32,7 +32,7 @@ dnl type, so there is no conflict. Variables with the prefix "TARGET_"
 dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
 dnl type.
 
-AC_INIT([GRUB],[1.99],[bug-grub@gnu.org])
+AC_INIT([GRUB],[2.00],[bug-grub@gnu.org])
 
 AC_CONFIG_AUX_DIR([build-aux])
 
@@ -50,6 +50,23 @@ AC_CONFIG_HEADER([config-util.h])
 
 # Program name transformations
 AC_ARG_PROGRAM
+grub_TRANSFORM([grub-bios-setup])
+grub_TRANSFORM([grub-editenv])
+grub_TRANSFORM([grub-install])
+grub_TRANSFORM([grub-mkconfig])
+grub_TRANSFORM([grub-mkfont])
+grub_TRANSFORM([grub-mkimage])
+grub_TRANSFORM([grub-glue-efi])
+grub_TRANSFORM([grub-mklayout])
+grub_TRANSFORM([grub-mkpasswd-pbkdf2])
+grub_TRANSFORM([grub-mkrelpath])
+grub_TRANSFORM([grub-mkrescue])
+grub_TRANSFORM([grub-probe])
+grub_TRANSFORM([grub-reboot])
+grub_TRANSFORM([grub-script-check])
+grub_TRANSFORM([grub-set-default])
+grub_TRANSFORM([grub-sparc64-setup])
+grub_TRANSFORM([grub-render-label])
 
 # Optimization flag.  Allow user to override.
 if test "x$TARGET_CFLAGS" = x; then
@@ -128,6 +145,7 @@ case "$target_cpu"-"$platform" in
   mips-qemu_mips) ;;
   mips-qemu-mips) platform=qemu_mips;;
   mips-arc) ;;
+  mipsel-arc) ;;
   mipsel-qemu_mips) ;;
   mipsel-qemu-mips) platform=qemu_mips;;
   mipsel-yeeloong) platform=loongson ;;
@@ -155,6 +173,7 @@ case "$host_os" in
   freebsd* | kfreebsd*-gnu)    host_kernel=kfreebsd ;;
   netbsd*)                     host_kernel=netbsd ;;
   solaris*)                    host_kernel=illumos ;;
+  darwin*)                     host_kernel=xnu ;;
   cygwin)                      host_kernel=windows ;;
 esac
 
@@ -177,10 +196,26 @@ esac
 if test x${target_cpu} = xmipsel ; then
    machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
 else
-   machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
-fi
+   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"
+fi
+
+case "${target_cpu}-$platform" in
+     mips-arc)
+        TARGET_LINK_ADDR=0x88200000
+        TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000
+       ;;
+     mipsel-arc)
+        TARGET_LINK_ADDR=0x80700000
+       TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000
+       ;;
+     mips*-qemu_mips | mips*-loongson)
+        TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000
+       ;;
+esac
+
+AC_SUBST(TARGET_LINK_ADDR)
+AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR)
 
-HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CPPFLAGS"
 TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
 
 AC_SUBST(host_cpu)
@@ -191,18 +226,34 @@ AC_SUBST(target_cpu)
 AC_SUBST(platform)
 
 # Define default variables
-case "$host_os" in
-  netbsd* | openbsd*)
+
+have_with_bootdir=n
+AC_ARG_WITH([bootdir],
+            AS_HELP_STRING([--with-bootdir=DIR],
+                           [set the name of /boot directory [[guessed]]]),
+                          [have_with_bootdir=y],
+                          [have_with_bootdir=n])
+if test x$have_with_bootdir = xy; then
+   bootdirname="$with_bootdir"
+else
+   case "$host_os" in
+     netbsd* | openbsd*)
         # Because /boot is used for the boot block in NetBSD and OpenBSD,
-        bootdirname=''      ;;
-  *)    bootdirname='boot'  ;;
-esac
-bootdirname=`echo "$bootdirname" | sed "$program_transform_name"`
+           bootdirname=''      ;;
+     *)    bootdirname='boot'  ;;
+   esac
+fi
+
 AC_SUBST(bootdirname)
 AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
     [Default boot directory name]")
 
-grubdirname=`echo "$PACKAGE" | sed "$program_transform_name"`
+AC_ARG_WITH([grubdir],
+            AS_HELP_STRING([--with-grubdir=DIR],
+                           [set the name of grub directory [[guessed]]]),
+                          [grubdirname="$with_grubdir"],
+                          [grubdirname="$PACKAGE"])
+
 AC_SUBST(grubdirname)
 AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
     [Default grub directory name])
@@ -226,7 +277,7 @@ fi
 FONT_SOURCE=
 
 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
-  for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do
+  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
     if test -f "$dir/unifont.$ext"; then
       FONT_SOURCE="$dir/unifont.$ext"
       break 2
@@ -234,7 +285,7 @@ for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
   done
 done
 
-if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson ); then
+if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips); then
    AC_MSG_ERROR([qemu and loongson ports need unifont])
 fi
 
@@ -269,12 +320,15 @@ AC_PATH_PROGS(MAKEINFO, makeinfo true)
 
 AC_PROG_CC
 gl_EARLY
+AC_PROG_CXX
 AM_PROG_CC_C_O
 AM_PROG_AS
 
 # Must be GCC.
 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
 
+AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
+
 AC_GNU_SOURCE
 AM_GNU_GETTEXT([external])
 AC_SYS_LARGEFILE
@@ -286,8 +340,12 @@ AC_CHECK_SIZEOF(long)
 
 grub_apple_cc
 if test x$grub_cv_apple_cc = xyes ; then
-  HOST_CPPFLAGS="$HOST_CPPFLAGS -DAPPLE_CC=1"
-  HOST_CFLAGS="$HOST_CFLAGS -fnested-functions"
+  HOST_CPPFLAGS="$HOST_CPPFLAGS -fnested-functions"
+  HOST_LDFLAGS="$HOST_LDFLAGS -Wl,-allow_stack_execute"
+fi
+
+if test x$USE_NLS = xno; then
+  HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
 fi
 
 if test "x$cross_compiling" = xyes; then
@@ -297,8 +355,8 @@ else
 fi
 
 # Check for functions and headers.
-AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getextmntent)
-AC_CHECK_HEADERS(libzfs.h libnvpair.h sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h)
+AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
+AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
 
 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
 #include <sys/param.h>
@@ -322,6 +380,20 @@ AC_CHECK_HEADER([util.h], [
 ])
 AC_SUBST([LIBUTIL])
 
+AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
+  SAVED_CFLAGS="$CFLAGS"
+  CFLAGS="$HOST_CFLAGS -Wtrampolines"
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
+int va_arg_func (int fixed, va_list args);]], [[]])],
+      [grub_cv_host_cc_wtrampolines=yes],
+      [grub_cv_host_cc_wtrampolines=no])
+  CFLAGS="$SAVED_CFLAGS"
+])
+
+if test x"$grub_host_cv_cc_wtrampolines" = xyes ; then
+  HOST_CFLAGS="$HOST_CFLAGS -Wtrampolines"
+fi
+
 #
 # Check for host and build compilers.
 #
@@ -373,7 +445,9 @@ LDFLAGS="$TARGET_LDFLAGS"
 LIBS=""
 
 # debug flags.
-TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g"
+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 -Wempty-body -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"
+HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS"
+TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
 
 # Force no alignment to save space on i386.
@@ -390,7 +464,9 @@ if test "x$target_cpu" = xi386; then
   else
     TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
   fi
+fi
 
+if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
   # Some toolchains enable these features by default, but they need
   # registers that aren't set up properly in GRUB.
   TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
@@ -413,12 +489,28 @@ if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
   TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
 fi
 
+# By default, GCC 4.6 generates .eh_frame sections containing unwind
+# information in some cases where it previously did not. GRUB doesn't need
+# these and they just use up vital space. Restore the old compiler
+# behaviour.
+AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+      [grub_cv_cc_fno_asynchronous_unwind_tables=yes],
+      [grub_cv_cc_fno_asynchronous_unwind_tables=no])
+  CFLAGS="$SAVE_CFLAGS"
+])
+
+if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
+  TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
+fi
+
 grub_apple_target_cc
 if test x$grub_cv_apple_target_cc = xyes ; then
-  TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1"
-  TARGET_CFLAGS="$TARGET_CFLAGS -fnested-functions"
+  TARGET_CPPFLAGS="$TARGET_CPPFLAGS -fnested-functions"
 
-  CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
+  CFLAGS="$CFLAGS -fnested-functions"
   TARGET_APPLE_CC=1
   AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
   if test "x$OBJCONV" = x ; then
@@ -432,8 +524,10 @@ if test x$grub_cv_apple_target_cc = xyes ; then
   TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
   TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
   TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
+  TARGET_LDFLAGS_OLDMAGIC=""
 else
   TARGET_APPLE_CC=0
+  TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
 # Use linker script if present, otherwise use builtin -N script.
 if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
   TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
@@ -449,6 +543,8 @@ fi
 TARGET_IMG_CFLAGS=
 fi
 
+AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
+
 # For platforms where ELF is not the default link format.
 AC_MSG_CHECKING([for command to convert module to ELF format])
 case "${host_os}" in
@@ -460,6 +556,42 @@ case "${host_os}" in
 esac
 AC_MSG_RESULT([$TARGET_OBJ2ELF])
 
+
+AC_ARG_ENABLE([efiemu],
+             [AS_HELP_STRING([--enable-efiemu],
+                             [build and install the efiemu runtimes (default=guessed)])])
+if test x"$enable_efiemu" = xno ; then
+  efiemu_excuse="explicitly disabled"
+fi
+if test x"$target_cpu" != xi386 ; then
+  efiemu_excuse="only available on i386"
+fi
+if test x"$platform" = xefi ; then
+  efiemu_excuse="not available on efi"
+fi
+if test x"$efiemu_excuse" = x ; then
+  AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
+    SAVED_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+                     [grub_cv_cc_efiemu=yes],
+                     [grub_cv_cc_efiemu=no])
+    CFLAGS="$SAVED_CFLAGS"
+  ])
+  if test x$grub_cv_cc_efiemu = xno; then
+     efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
+  fi
+fi
+if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
+  AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
+fi
+if test x"$efiemu_excuse" = x ; then
+enable_efiemu=yes
+else
+enable_efiemu=no
+fi
+AC_SUBST([enable_efiemu])
+
 if test "x$target_m32" = x1; then
   # Force 32-bit mode.
   TARGET_CFLAGS="$TARGET_CFLAGS -m32"
@@ -478,7 +610,7 @@ if test "x$target_m64" = x1; then
   TARGET_MODULE_FORMAT="elf64"
 fi
 
-if test "$target_cpu"-"$platform" = x86_64-efi; then
+if test "$target_cpu" = x86_64; then
   # Use large model to support 4G memory
   AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
     SAVED_CFLAGS=$CFLAGS
@@ -492,7 +624,9 @@ if test "$target_cpu"-"$platform" = x86_64-efi; then
   else
     TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
   fi
+fi
 
+if test "$target_cpu"-"$platform" = x86_64-efi; then
   # EFI writes to stack below %rsp, we must not use the red zone
   AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
     CFLAGS="$CFLAGS -m64 -mno-red-zone"
@@ -511,9 +645,6 @@ fi
 # Compiler features.
 #
 
-# Need __enable_execute_stack() for nested function trampolines?
-grub_CHECK_ENABLE_EXECUTE_STACK
-
 # Position independent executable.
 grub_CHECK_PIE
 [# Need that, because some distributions ship compilers that include
@@ -522,6 +653,14 @@ if [ x"$pie_possible" = xyes ]; then
   TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
 fi]
 
+# Position independent executable.
+grub_CHECK_PIC
+[# Need that, because some distributions ship compilers that include
+# `-fPIC' in the default specs.
+if [ x"$pic_possible" = xyes ]; then
+  TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
+fi]
+
 # Smashing stack protector.
 grub_CHECK_STACK_PROTECTOR
 # Need that, because some distributions ship compilers that include
@@ -541,11 +680,18 @@ AC_ARG_ENABLE([werror],
                              [do not use -Werror when building GRUB])])
 if test x"$enable_werror" != xno ; then
   TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
+  HOST_CFLAGS="$HOST_CFLAGS -Werror"
 fi
 
 TARGET_CPP="$TARGET_CC -E"
 TARGET_CCAS=$TARGET_CC
 
+GRUB_TARGET_CPU="${target_cpu}"
+GRUB_PLATFORM="${platform}"
+
+AC_SUBST(GRUB_TARGET_CPU)
+AC_SUBST(GRUB_PLATFORM)
+
 AC_SUBST(OBJCONV)
 AC_SUBST(TARGET_CPP)
 AC_SUBST(TARGET_CCAS)
@@ -590,7 +736,7 @@ CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
 fi
 
 # Check for libgcc symbols
-AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x __ia64_trampoline __udivsi3 __umoddi3 __udivdi3 __divsi3 __modsi3 __umodsi3 __moddi3 __divdi3 __ctzdi2 __ctzsi2)
+AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x __udivsi3 __umoddi3 __udivdi3 __divsi3 __modsi3 __umodsi3 __moddi3 __divdi3 __ctzdi2 __ctzsi2)
 
 if test "x$TARGET_APPLE_CC" = x1 ; then
 CFLAGS="$TARGET_CFLAGS -nostdlib"
@@ -619,44 +765,12 @@ if test "x$target_cpu" = xi386; then
   grub_I386_ASM_ADDR32
 fi
 
-AC_ARG_ENABLE([efiemu],
-             [AS_HELP_STRING([--enable-efiemu],
-                             [build and install the efiemu runtimes (default=guessed)])])
-if test x"$enable_efiemu" = xno ; then
-  efiemu_excuse="explicitly disabled"
-fi
-if test x"$target_cpu" != xi386 ; then
-  efiemu_excuse="only available on i386"
-fi
-if test x"$platform" = xefi ; then
-  efiemu_excuse="not available on efi"
-fi
-if test x"$efiemu_excuse" = x ; then
-  AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
-    CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
-                     [grub_cv_cc_efiemu=yes],
-                     [grub_cv_cc_efiemu=no])
-  ])
-  if test x$grub_cv_cc_efiemu = xno; then
-     efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
-  fi
-fi
-if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
-  AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
-fi
-if test x"$efiemu_excuse" = x ; then
-enable_efiemu=yes
-else
-enable_efiemu=no
-fi
-AC_SUBST([enable_efiemu])
-
 if test "$platform" != emu; then
 AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
   SAVED_CPPFLAGS="$CPPFLAGS"
   CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
+#include <stddef.h>
 int va_arg_func (int fixed, va_list args);]], [[]])],
       [grub_cv_cc_isystem=yes],
       [grub_cv_cc_isystem=no])
@@ -668,21 +782,18 @@ if test x"$grub_cv_cc_isystem" = xyes ; then
 fi
 fi
 
-AC_CACHE_CHECK([whether -Wno-trampolines work], [grub_cv_cc_wnotrampolines], [
+AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [
   SAVED_CFLAGS="$CFLAGS"
-  # Test for -Wtrampolines rather than -Wno-trampolines to reduce confusion
-  # in the event of later failures (since -Wno-* is always accepted, but
-  # produces a diagnostic if something else is wrong).
   CFLAGS="$TARGET_CFLAGS -Wtrampolines"
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
 int va_arg_func (int fixed, va_list args);]], [[]])],
-      [grub_cv_cc_wnotrampolines=yes],
-      [grub_cv_cc_wnotrampolines=no])
+      [grub_cv_cc_wtrampolines=yes],
+      [grub_cv_cc_wtrampolines=no])
   CFLAGS="$SAVED_CFLAGS"
 ])
 
-if test x"$grub_cv_cc_wnotrampolines" = xyes ; then
-  TARGET_CFLAGS="$TARGET_CFLAGS -Wno-trampolines"
+if test x"$grub_cv_cc_wtrampolines" = xyes ; then
+  TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines"
 fi
 
 # Restore the flags.
@@ -714,6 +825,17 @@ else
 fi
 AC_SUBST([DISK_CACHE_STATS])
 
+AC_ARG_ENABLE([boot-time],
+             AS_HELP_STRING([--enable-boot-time],
+                             [enable boot time statistics collection]))
+
+if test x$enable_boot_time = xyes; then
+  BOOT_TIME_STATS=1
+else
+  BOOT_TIME_STATS=0
+fi
+AC_SUBST([BOOT_TIME_STATS])
+
 AC_ARG_ENABLE([grub-emu-usb],
              [AS_HELP_STRING([--enable-grub-emu-usb],
                              [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
@@ -727,22 +849,6 @@ AC_ARG_ENABLE([grub-emu-pci],
                              [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
 
 if test "$platform" = emu; then
-  missing_ncurses=
-[# Check for curses libraries.]
-  AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
-    [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
-      [missing_ncurses=[true]])])
-  AC_SUBST([LIBCURSES])
-[if [ x"$missing_ncurses" = x ]; then ]
-  [# Check for headers.]
-  AC_CHECK_HEADERS([ncurses/curses.h], [],
-    [AC_CHECK_HEADERS([ncurses.h], [],
-      [AC_CHECK_HEADERS([curses.h], [],
-       [missing_ncurses=[true]])])])
-[fi]
-if test x"$missing_ncurses" = xtrue ; then
-  AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
-fi
 
 if test x"$enable_grub_emu_usb" != xyes ; then
    grub_emu_usb_excuse="not enabled"
@@ -838,7 +944,7 @@ fi
 
 if test x"$grub_mkfont_excuse" = x ; then
   # Check for freetype libraries.
-  AC_CHECK_PROGS([FREETYPE], [freetype-config])
+  AC_CHECK_TOOLS([FREETYPE], [freetype-config])
   if test "x$FREETYPE" = x ; then
     grub_mkfont_excuse=["need freetype2 library"]
   fi
@@ -846,8 +952,8 @@ fi
 
 if test x"$grub_mkfont_excuse" = x ; then
   # Check for freetype libraries.
-  freetype_cflags=`freetype-config --cflags`
-  freetype_libs=`freetype-config --libs`
+  freetype_cflags=`$FREETYPE --cflags`
+  freetype_libs=`$FREETYPE --libs`
   SAVED_CPPFLAGS="$CPPFLAGS"
   CPPFLAGS="$CPPFLAGS $freetype_cflags"
   AC_CHECK_HEADERS([ft2build.h], [],
@@ -870,6 +976,62 @@ AC_SUBST([enable_grub_mkfont])
 AC_SUBST([freetype_cflags])
 AC_SUBST([freetype_libs])
 
+DJVU_FONT_SOURCE=
+
+starfield_excuse=
+
+if test x$enable_grub_mkfont = xno; then
+   starfield_excuse="No grub-mkfont"
+fi
+
+if test x"$starfield_excuse" = x; then
+   for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
+     for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do
+        if test -f "$dir/DejaVuSans.$ext"; then
+          DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
+          break 2
+        fi
+     done
+   done
+
+   if test "x$DJVU_FONT_SOURCE" = x; then
+     starfield_excuse="No DejaVu found"
+   fi
+fi
+
+AC_SUBST([DJVU_FONT_SOURCE])
+
+AC_ARG_ENABLE([grub-mount],
+             [AS_HELP_STRING([--enable-grub-mount],
+                             [build and install the `grub-mount' utility (default=guessed)])])
+if test x"$enable_grub_mount" = xno ; then
+  grub_mount_excuse="explicitly disabled"
+fi
+
+if test x"$grub_mount_excuse" = x ; then
+  AC_CHECK_LIB([fuse], [fuse_main_real], [],
+               [grub_mount_excuse="need FUSE library"])
+fi
+
+if test x"$grub_mount_excuse" = x ; then
+  # Check for fuse headers.
+  SAVED_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
+  AC_CHECK_HEADERS([fuse/fuse.h], [],
+       [grub_mount_excuse=["need FUSE headers"]])
+  CPPFLAGS="$SAVED_CPPFLAGS"
+fi
+
+if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
+  AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled])
+fi
+if test x"$grub_mount_excuse" = x ; then
+enable_grub_mount=yes
+else
+enable_grub_mount=no
+fi
+AC_SUBST([enable_grub_mount])
+
 AC_ARG_ENABLE([device-mapper],
               [AS_HELP_STRING([--enable-device-mapper],
                               [enable Linux device-mapper support (default=guessed)])])
@@ -919,23 +1081,49 @@ AC_CHECK_LIB([lzma], [lzma_code],
                         [Define to 1 if you have the LZMA library.])],)
 AC_SUBST([LIBLZMA])
 
-AC_CHECK_LIB([zfs], [libzfs_init],
-             [LIBZFS="-lzfs"
-              AC_DEFINE([HAVE_LIBZFS], [1],
-                        [Define to 1 if you have the ZFS library.])],)
-AC_SUBST([LIBZFS])
+AC_ARG_ENABLE([libzfs],
+              [AS_HELP_STRING([--enable-libzfs],
+                              [enable libzfs integration (default=guessed)])])
+if test x"$enable_libzfs" = xno ; then
+  libzfs_excuse="explicitly disabled"
+fi
+
+if test x"$libzfs_excuse" = x ; then
+  # Only check for system headers if libzfs support has not been disabled.
+  AC_CHECK_HEADERS(libzfs.h libnvpair.h)
+fi
+
+if test x"$libzfs_excuse" = x ; then
+  AC_CHECK_LIB([zfs], [libzfs_init],
+               [],
+               [libzfs_excuse="need zfs library"])
+fi
+
+if test x"$libzfs_excuse" = x ; then
+  AC_CHECK_LIB([nvpair], [nvlist_print],
+               [],
+               [libzfs_excuse="need nvpair library"])
+fi
 
-AC_CHECK_LIB([nvpair], [nvlist_print],
-             [LIBNVPAIR="-lnvpair"
-              AC_DEFINE([HAVE_LIBNVPAIR], [1],
-                        [Define to 1 if you have the NVPAIR library.])],)
+if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
+  AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied])
+fi
+
+if test x"$libzfs_excuse" = x ; then
+  # We need both libzfs and libnvpair for a successful build.
+  LIBZFS="-lzfs"
+  AC_DEFINE([HAVE_LIBZFS], [1],
+            [Define to 1 if you have the ZFS library.])
+  LIBNVPAIR="-lnvpair"
+  AC_DEFINE([HAVE_LIBNVPAIR], [1],
+            [Define to 1 if you have the NVPAIR library.])
+fi
+
+AC_SUBST([LIBZFS])
 AC_SUBST([LIBNVPAIR])
 
 LIBS=""
 
-pkglibrootdir='$(libdir)'/`echo $PACKAGE | sed "$program_transform_name"`
-AC_SUBST(pkglibrootdir)
-
 AC_SUBST([FONT_SOURCE])
 AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
            [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
@@ -949,7 +1137,6 @@ AC_SUBST(BSS_START_SYMBOL)
 AC_SUBST(END_SYMBOL)
 AC_SUBST(PACKAGE)
 AC_SUBST(VERSION)
-AC_SUBST(NEED_ENABLE_EXECUTE_STACK)
 AC_SUBST(NEED_REGISTER_FRAME_INFO)
 
 #
@@ -967,16 +1154,19 @@ AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform =
 AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
 AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
 AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")"  -a x$platform = xqemu_mips])
-AM_CONDITIONAL([COND_mips_arc], [test x$target_cpu = xmips -a x$platform = xarc])
+AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")"  -a x$platform = xarc])
 AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
 AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
 AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
+AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
+AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
 
 AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
 AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
 AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
 AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
 AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
+AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
 AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
 
 AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
@@ -984,14 +1174,19 @@ AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
 AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
 AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
 AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
+AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
 AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
 AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x])
 AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
 AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
 AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
+AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
+
+AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
 
 AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
 AM_CONDITIONAL([COND_CYGWIN], [test x$host_os = xcygwin])
+AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
 
 # Output files.
 cpudir="${target_cpu}"
@@ -1060,6 +1255,13 @@ echo With disk cache statistics: Yes
 else
 echo With disk cache statistics: No
 fi
+
+if [ x"$enable_boot_time" = xyes ]; then
+echo With boot time statistics: Yes
+else
+echo With boot time statistics: No
+fi
+
 if [ x"$efiemu_excuse" = x ]; then
 echo efiemu runtime: Yes
 else
@@ -1070,5 +1272,30 @@ echo grub-mkfont: Yes
 else
 echo grub-mkfont: No "($grub_mkfont_excuse)"
 fi
+if [ x"$grub_mount_excuse" = x ]; then
+echo grub-mount: Yes
+else
+echo grub-mount: No "($grub_mount_excuse)"
+fi
+if [ x"$starfield_excuse" = x ]; then
+echo starfield theme: Yes
+else
+echo starfield theme: No "($starfield_excuse)"
+fi
+if [ x"$libzfs_excuse" = x ]; then
+echo With libzfs support: Yes
+else
+echo With libzfs support: No "($libzfs_excuse)"
+fi
+if test "x$FONT_SOURCE" = x ; then
+echo "Without unifont"
+else
+echo "With unifont from $FONT_SOURCE"
+fi
 echo "*******************************************************"
+if test "x$LIBLZMA" = x ; then
+echo "Without liblzma (no support for XZ-compressed mips images)"
+else
+echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
+fi
 ]