1 # Process this file with autoconf to produce a configure script.
3 # Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
5 # This configure.ac is free software; the author
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
14 dnl This configure script is complicated, because GRUB needs to deal
15 dnl with three potentially different types:
17 dnl build -- the environment for building GRUB
18 dnl host -- the environment for running utilities
19 dnl target -- the environment for running GRUB
21 dnl In addition, GRUB needs to deal with a platform specification
22 dnl which specifies the system running GRUB, such as firmware.
23 dnl This is necessary because the target type in autoconf does not
24 dnl describe such a system very well.
26 dnl The current strategy is to use variables with no prefix (such as
27 dnl CC, CFLAGS, etc.) for the host type as well as the build type,
28 dnl because GRUB does not need to use those variables for the build
29 dnl type, so there is no conflict. Variables with the prefix "TARGET_"
30 dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
34 AC_INIT([GRUB],[1.98],[bug-grub@gnu.org])
36 AC_CONFIG_SRCDIR([include/grub/dl.h])
37 AC_CONFIG_HEADER([config.h])
39 # Checks for host and target systems.
45 # Program name transformations
48 # Optimization flag. Allow user to override.
49 if test "x$TARGET_CFLAGS" = x; then
50 TARGET_CFLAGS="$TARGET_CFLAGS -Os"
54 i[[3456]]86) target_cpu=i386 ;;
55 amd64) target_cpu=x86_64 ;;
56 sparc) target_cpu=sparc64 ;;
59 TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPSEL=1";
60 CFLAGS="$CFLAGS -DGRUB_CPU_MIPSEL=1";
64 TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPS=1";
65 CFLAGS="$CFLAGS -DGRUB_CPU_MIPS=1";
69 # Specify the platform (such as firmware).
70 AC_ARG_WITH([platform],
71 AS_HELP_STRING([--with-platform=PLATFORM],
72 [select the host platform [[guessed]]]))
74 # Guess the platform if not specified.
75 if test "x$with_platform" = x; then
76 case "$target_cpu"-"$target_vendor" in
77 i386-apple) platform=efi ;;
78 i386-*) platform=pc ;;
79 x86_64-apple) platform=efi ;;
80 x86_64-*) platform=pc ;;
81 powerpc-*) platform=ieee1275 ;;
82 powerpc64-*) platform=ieee1275 ;;
83 sparc64-*) platform=ieee1275 ;;
84 mips-*) platform=yeeloong ;;
85 *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
88 platform="$with_platform"
91 # Adjust CPU unless target was explicitly specified.
92 if test -z "$target_alias"; then
93 case "$target_cpu"-"$platform" in
96 x86_64-*) target_cpu=i386 ;;
97 powerpc64-ieee1275) target_cpu=powerpc ;;
101 # Check if the platform is supported, make final adjustments.
102 case "$target_cpu"-"$platform" in
108 i386-linuxbios) platform=coreboot ;;
116 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
119 case "$target_cpu" in
120 i386 | powerpc) target_m32=1 ;;
121 x86_64 | sparc64) target_m64=1 ;;
125 mingw32*) host_os=cygwin ;;
128 # This normalizes the names, and creates a new variable ("host_kernel")
129 # while at it, since the mapping is not always 1:1 (e.g. different OSes
130 # using the same kernel type).
132 gnu*) host_kernel=hurd ;;
133 linux*) host_kernel=linux ;;
134 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
135 netbsd*) host_kernel=netbsd ;;
136 cygwin) host_kernel=windows ;;
140 coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
141 multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;;
142 efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
143 ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
144 qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
145 pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
146 emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
147 yeeloong) machine_CFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
148 qemu-mips) machine_CFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
150 case "$target_cpu" in
151 mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;;
152 sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
154 machine_CFLAGS="$machine_CFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
156 CFLAGS="$CFLAGS $machine_CFLAGS"
157 TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
158 TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
162 AC_SUBST(host_kernel)
168 # Checks for build programs.
171 # Although cmp is listed in the GNU Coding Standards as a command which
172 # can used directly, OpenBSD lacks cmp in the default installation.
173 AC_CHECK_PROGS([CMP], [cmp])
174 if test "x$CMP" = x; then
175 AC_MSG_ERROR([cmp is not found])
178 AC_CHECK_PROGS([YACC], [bison])
179 if test "x$YACC" = x; then
180 AC_MSG_ERROR([bison is not found])
185 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
186 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do
187 if test -f "$dir/unifont.$ext"; then
188 FONT_SOURCE="$dir/unifont.$ext"
194 if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xyeeloong ); then
195 AC_MSG_ERROR([qemu and yeeloong ports need unifont])
198 AC_SUBST([FONT_SOURCE])
206 if test "x$LEX" = "x:"; then
207 AC_MSG_ERROR([flex is not found])
209 version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
210 if test -n "$version" -a "$version" -ge 20535; then
213 AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
217 # These are not a "must".
218 AC_PATH_PROG(RUBY, ruby)
219 AC_PATH_PROG(MAKEINFO, makeinfo)
222 # Checks for host programs.
227 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
230 AM_GNU_GETTEXT([external])
233 # Identify characteristics of the host architecture.
235 AC_CHECK_SIZEOF(void *)
236 AC_CHECK_SIZEOF(long)
239 if test x$grub_cv_apple_cc = xyes ; then
240 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
241 ASFLAGS="$ASFLAGS -DAPPLE_CC=1"
244 if test "x$cross_compiling" = xyes; then
245 AC_MSG_WARN([cannot generate manual pages while cross compiling])
247 AC_PATH_PROG(HELP2MAN, help2man)
250 # Check for functions and headers.
251 AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
252 AC_CHECK_HEADERS(libzfs.h libnvpair.h sys/param.h sys/mount.h)
254 # For opendisk() and getrawpartition() on NetBSD.
255 # Used in util/deviceiter.c and in util/hostdisk.c.
256 AC_CHECK_HEADER([util.h], [
257 AC_CHECK_LIB([util], [opendisk], [
259 AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
261 AC_CHECK_LIB([util], [getrawpartition], [
263 AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
269 # Check for target programs.
272 # Find tools for the target.
273 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
274 tmp_ac_tool_prefix="$ac_tool_prefix"
275 ac_tool_prefix=$target_alias-
277 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
278 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
279 AC_CHECK_TOOL(OBJCOPY, objcopy)
280 AC_CHECK_TOOL(STRIP, strip)
281 AC_CHECK_TOOL(NM, nm)
283 ac_tool_prefix="$tmp_ac_tool_prefix"
285 if test "x$TARGET_CC" = x; then
288 AC_CHECK_TOOL(OBJCOPY, objcopy)
289 AC_CHECK_TOOL(STRIP, strip)
290 AC_CHECK_TOOL(NM, nm)
295 # Test the C compiler for the target environment.
298 tmp_LDFLAGS="$LDFLAGS"
299 tmp_CPPFLAGS="$CPPFLAGS"
302 CFLAGS="$TARGET_CFLAGS"
303 CPPFLAGS="$TARGET_CPPFLAGS"
304 LDFLAGS="$TARGET_LDFLAGS"
308 TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
309 -Wundef -Wstrict-prototypes -g"
311 # Force no alignment to save space on i386.
312 if test "x$target_cpu" = xi386; then
313 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
314 CFLAGS="$CFLAGS -falign-loops=1"
315 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
316 [grub_cv_cc_falign_loop=yes],
317 [grub_cv_cc_falign_loop=no])
320 if test "x$grub_cv_cc_falign_loop" = xyes; then
321 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
323 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
326 # Some toolchains enable these features by default, but they need
327 # registers that aren't set up properly in GRUB.
328 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
331 # By default, GCC 4.4 generates .eh_frame sections containing unwind
332 # information in some cases where it previously did not. GRUB doesn't need
333 # these and they just use up vital space. Restore the old compiler
335 AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
336 SAVE_CFLAGS="$CFLAGS"
337 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
338 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
339 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
340 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
341 CFLAGS="$SAVE_CFLAGS"
344 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
345 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
349 if test x$grub_cv_apple_target_cc = xyes ; then
350 TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions"
351 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
352 TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
354 AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
355 if test "x$OBJCONV" = x ; then
356 AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
358 if test "x$OBJCONV" = x ; then
359 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
362 TARGET_IMG_CFLAGS="-static"
363 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
364 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
367 # Use linker script if present, otherwise use builtin -N script.
368 if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
369 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
370 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext,"
371 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc -Wl,-Ttext,"
374 TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
375 TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,'
380 AC_SUBST(TARGET_IMG_LDSCRIPT)
381 AC_SUBST(TARGET_IMG_LDFLAGS)
382 AC_SUBST(TARGET_IMG_CFLAGS)
384 # For platforms where ELF is not the default link format.
385 AC_MSG_CHECKING([for command to convert module to ELF format])
387 cygwin) TARGET_OBJ2ELF='grub-pe2elf';
388 # FIXME: put proper test here
389 AC_DEFINE([NEED_REGISTER_FRAME_INFO], 1,
390 [Define to 1 if GCC generates calls to __register_frame_info()])
394 AC_SUBST(TARGET_OBJ2ELF)
395 AC_MSG_RESULT([$TARGET_OBJ2ELF])
398 if test "x$target_m32" = x1; then
400 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
401 TARGET_ASFLAGS="$TARGET_CFLAGS -m32"
402 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
403 TARGET_MODULE_FORMAT="elf32"
406 if test "x$target_m64" = x1; then
408 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
409 TARGET_ASFLAGS="$TARGET_ASFLAGS -m64"
410 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
411 TARGET_MODULE_FORMAT="elf64"
414 if test "$target_cpu"-"$platform" = x86_64-efi; then
415 # Use large model to support 4G memory
416 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
418 CFLAGS="$CFLAGS -m64 -mcmodel=large"
419 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
420 [grub_cv_cc_mcmodel=yes],
421 [grub_cv_cc_mcmodel=no])
423 if test "x$grub_cv_cc_mcmodel" = xno; then
424 AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
426 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
429 # EFI writes to stack below %rsp, we must not use the red zone
430 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
431 CFLAGS="$CFLAGS -m64 -mno-red-zone"
432 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
433 [grub_cv_cc_no_red_zone=yes],
434 [grub_cv_cc_no_red_zone=no])
436 if test "x$grub_cv_cc_no_red_zone" = xno; then
437 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
440 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
447 # Need __enable_execute_stack() for nested function trampolines?
448 grub_CHECK_ENABLE_EXECUTE_STACK
450 # Position independent executable.
452 [# Need that, because some distributions ship compilers that include
453 # `-fPIE' in the default specs.
454 if [ x"$pie_possible" = xyes ]; then
455 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
458 # Smashing stack protector.
459 grub_CHECK_STACK_PROTECTOR
460 # Need that, because some distributions ship compilers that include
461 # `-fstack-protector' in the default specs.
462 if test "x$ssp_possible" = xyes; then
463 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
465 grub_CHECK_STACK_ARG_PROBE
466 # Cygwin's GCC uses alloca() to probe the stackframe on static
467 # stack allocations above some threshold.
468 if test x"$sap_possible" = xyes; then
469 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
472 AC_ARG_ENABLE([werror],
473 [AS_HELP_STRING([--disable-werror],
474 [do not use -Werror when building GRUB])])
475 if test x"$enable_werror" != xno ; then
476 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
479 AC_SUBST(TARGET_CFLAGS)
480 AC_SUBST(TARGET_MODULE_FORMAT)
482 AC_SUBST(TARGET_APPLE_CC)
483 AC_SUBST(TARGET_ASFLAGS)
484 AC_SUBST(TARGET_CPPFLAGS)
485 AC_SUBST(TARGET_LDFLAGS)
487 # Set them to their new values for the tests below.
489 if test "x$TARGET_APPLE_CC" = x1 ; then
490 CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
492 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
494 CPPFLAGS="$TARGET_CPPFLAGS"
495 LDFLAGS="$TARGET_LDFLAGS"
499 if test x$grub_cv_asm_uscore = xyes; then
500 CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main"
502 CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
505 # Check for libgcc symbols
506 AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
508 if test "x$TARGET_APPLE_CC" = x1 ; then
509 CFLAGS="$TARGET_CFLAGS -nostdlib"
511 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
515 # Defined in aclocal.m4.
517 if test "x$TARGET_APPLE_CC" != x1 ; then
518 grub_PROG_OBJCOPY_ABSOLUTE
520 grub_PROG_LD_BUILD_ID_NONE
521 if test "x$target_cpu" = xi386; then
522 if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
523 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
524 # Check symbols provided by linker script.
525 CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000 -Wl,--defsym,___main=0x8100"
527 grub_CHECK_BSS_START_SYMBOL
528 grub_CHECK_END_SYMBOL
530 CFLAGS="$TARGET_CFLAGS"
531 grub_I386_ASM_PREFIX_REQUIREMENT
533 grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
535 AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
538 AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
539 #define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
541 #define NESTED_FUNC_ATTR
544 AC_ARG_ENABLE([efiemu],
545 [AS_HELP_STRING([--enable-efiemu],
546 [build and install the efiemu runtimes (default=guessed)])])
547 if test x"$enable_efiemu" = xno ; then
548 efiemu_excuse="explicitly disabled"
550 if test x"$efiemu_excuse" = x ; then
551 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
552 CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
553 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
554 [grub_cv_cc_efiemu=yes],
555 [grub_cv_cc_efiemu=no])
557 if test x$grub_cv_cc_efiemu = xno; then
558 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
561 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
562 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
564 if test x"$efiemu_excuse" = x ; then
569 AC_SUBST([enable_efiemu])
571 if test "$platform" != emu; then
572 AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
573 SAVED_CPPFLAGS="$CPPFLAGS"
574 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
575 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
576 int va_arg_func (int fixed, va_list args);]], [[]])],
577 [grub_cv_cc_isystem=yes],
578 [grub_cv_cc_isystem=no])
579 CPPFLAGS="$SAVED_CPPFLAGS"
582 if test x"$grub_cv_cc_isystem" = xyes ; then
583 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
590 CPPFLAGS="$tmp_CPPFLAGS"
591 LDFLAGS="$tmp_LDFLAGS"
598 # Memory manager debugging.
599 AC_ARG_ENABLE([mm-debug],
600 AS_HELP_STRING([--enable-mm-debug],
601 [include memory manager debugging]),
602 [AC_DEFINE([MM_DEBUG], [1],
603 [Define to 1 if you enable memory manager debugging.])])
605 AC_ARG_ENABLE([grub-emu-usb],
606 [AS_HELP_STRING([--enable-grub-emu-usb],
607 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
609 AC_ARG_ENABLE([grub-emu-sdl],
610 [AS_HELP_STRING([--enable-grub-emu-sdl],
611 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
613 AC_ARG_ENABLE([grub-emu-pci],
614 [AS_HELP_STRING([--enable-grub-emu-pci],
615 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
617 AC_ARG_ENABLE([grub-emu-modules],
618 [AS_HELP_STRING([--enable-grub-emu-modules],
619 [Support module loading in `grub-emu' debugging utility (default=no)])])
621 if test "$platform" = emu; then
623 [# Check for curses libraries.]
624 AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
625 [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
626 [missing_ncurses=[true]])])
627 AC_SUBST([LIBCURSES])
628 [if [ x"$missing_ncurses" = x ]; then ]
629 [# Check for headers.]
630 AC_CHECK_HEADERS([ncurses/curses.h], [],
631 [AC_CHECK_HEADERS([ncurses.h], [],
632 [AC_CHECK_HEADERS([curses.h], [],
633 [missing_ncurses=[true]])])])
635 if test x"$missing_ncurses" = xtrue ; then
636 AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
639 if test x"$enable_grub_emu_modules" = xyes ; then
642 TARGET_NO_MODULES=yes
644 AC_SUBST(TARGET_NO_MODULES)
646 if test "$TARGET_NO_MODULES" = yes ; then
647 # Do not convert modules, otherwise linkage may fail (Cygwin only).
648 # FIXME: Should be checked above before TARGET_OBJ2ELF is set first.
652 if test x"$enable_grub_emu_usb" = xno ; then
653 grub_emu_usb_excuse="explicitly disabled"
656 if test x"$enable_grub_emu_pci" = xyes ; then
657 grub_emu_usb_excuse="conflicts with PCI support"
660 [if [ x"$grub_emu_usb_excuse" = x ]; then
661 # Check for libusb libraries.]
662 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
663 [grub_emu_usb_excuse=["need libusb library"]])
666 [if [ x"$grub_emu_usb_excuse" = x ]; then
667 # Check for headers.]
668 AC_CHECK_HEADERS([usb.h], [],
669 [grub_emu_usb_excuse=["need libusb headers"]])
671 if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
672 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
674 if test x"$grub_emu_usb_excuse" = x ; then
675 enable_grub_emu_usb=yes
677 enable_grub_emu_usb=no
680 if test x"$enable_grub_emu_sdl" = xno ; then
681 grub_emu_sdl_excuse="explicitely disabled"
683 [if [ x"$grub_emu_sdl_excuse" = x ]; then
684 # Check for libSDL libraries.]
685 AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
686 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
690 [if [ x"$grub_emu_sdl_excuse" = x ]; then
691 # Check for headers.]
692 AC_CHECK_HEADERS([SDL/SDL.h], [],
693 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
696 if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
697 AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
699 if test x"$grub_emu_sdl_excuse" = x ; then
700 enable_grub_emu_sdl=yes
702 enable_grub_emu_sdl=no
705 if test x"$enable_grub_emu_pci" != xyes ; then
706 grub_emu_pci_excuse="not enabled"
709 if test x"$enable_grub_emu_usb" = xyes ; then
710 grub_emu_pci_excuse="conflicts with USB support"
713 [if [ x"$grub_emu_pci_excuse" = x ]; then
714 # Check for libpci libraries.]
715 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
716 [grub_emu_pci_excuse=["need libpciaccess library"]])
717 AC_SUBST([LIBPCIACCESS])
719 [if [ x"$grub_emu_pci_excuse" = x ]; then
720 # Check for headers.]
721 AC_CHECK_HEADERS([pci/pci.h], [],
722 [grub_emu_pci_excuse=["need libpciaccess headers"]])
725 if test x"$grub_emu_pci_excuse" = x ; then
726 enable_grub_emu_pci=yes
729 enable_grub_emu_pci=no
732 AC_SUBST([enable_grub_emu_sdl])
733 AC_SUBST([enable_grub_emu_usb])
734 AC_SUBST([enable_grub_emu_pci])
737 AC_ARG_ENABLE([grub-fstest],
738 [AS_HELP_STRING([--enable-grub-fstest],
739 [build and install the `grub-fstest' debugging utility (default=guessed)])])
740 if test x"$enable_grub_fstest" = xno ; then
741 grub_fstest_excuse="explicitly disabled"
743 if test x"$grub_fstest_excuse" = x ; then
744 enable_grub_fstest=yes
746 enable_grub_fstest=no
748 AC_SUBST([enable_grub_fstest])
750 AC_ARG_ENABLE([grub-mkfont],
751 [AS_HELP_STRING([--enable-grub-mkfont],
752 [build and install the `grub-mkfont' utility (default=guessed)])])
753 if test x"$enable_grub_mkfont" = xno ; then
754 grub_mkfont_excuse="explicitly disabled"
757 if test x"$grub_mkfont_excuse" = x ; then
758 # Check for freetype libraries.
759 AC_CHECK_PROGS([FREETYPE], [freetype-config])
760 if test "x$FREETYPE" = x ; then
761 grub_mkfont_excuse=["need freetype2 library"]
763 freetype_cflags=`freetype-config --cflags`
764 freetype_libs=`freetype-config --libs`
767 if test x"$grub_mkfont_excuse" = x ; then
768 # Check for freetype libraries.
769 SAVED_CPPFLAGS="$CPPFLAGS"
770 CPPFLAGS="$CPPFLAGS $freetype_cflags"
771 AC_CHECK_HEADERS([ft2build.h], [],
772 [grub_mkfont_excuse=["need freetype2 headers"]])
773 CPPFLAGS="$SAVED_CPPFLAGS"
776 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
777 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
779 if test x"$grub_mkfont_excuse" = x ; then
780 enable_grub_mkfont=yes
782 enable_grub_mkfont=no
784 AC_SUBST([enable_grub_mkfont])
785 AC_SUBST([freetype_cflags])
786 AC_SUBST([freetype_libs])
788 AC_ARG_ENABLE([device-mapper],
789 [AS_HELP_STRING([--enable-device-mapper],
790 [enable Linux device-mapper support (default=guessed)])])
791 if test x"$enable_device_mapper" = xno ; then
792 device_mapper_excuse="explicitly disabled"
795 if test x"$device_mapper_excuse" = x ; then
796 # Check for device-mapper library.
797 AC_CHECK_LIB([devmapper], [dm_task_create],
798 [LDFLAGS="$LDFLAGS -ldevmapper"
799 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
800 [Define to 1 if you have the devmapper library.])],
801 [device_mapper_excuse="need devmapper library"])
804 AC_CHECK_LIB([zfs], [libzfs_init],
805 [LDFLAGS="$LDFLAGS -lzfs"
806 AC_DEFINE([HAVE_LIBZFS], [1],
807 [Define to 1 if you have the ZFS library.])],)
808 AC_CHECK_LIB([nvpair], [nvlist_print],
809 [LDFLAGS="$LDFLAGS -lnvpair"
810 AC_DEFINE([HAVE_LIBNVPAIR], [1],
811 [Define to 1 if you have the NVPAIR library.])],)
817 if test x"$link_dir" = xyes ; then
818 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
819 if test "$platform" != emu ; then
820 AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
823 mkdir -p include/grub 2>/dev/null
824 rm -rf include/grub/cpu
825 cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
826 if test "$platform" != emu ; then
827 rm -rf include/grub/machine
828 cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
831 AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
832 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
835 echo "*******************************************************"
836 echo GRUB2 will be compiled with following components:
837 echo Platform: "$target_cpu"-"$platform"
838 if [ x"$platform" = xemu ]; then
839 if [ x"$grub_emu_usb_excuse" = x ]; then
840 echo USB support for grub-emu: Yes
842 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
844 if [ x"$grub_emu_sdl_excuse" = x ]; then
845 echo SDL support for grub-emu: Yes
847 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
849 if [ x"$grub_emu_pci_excuse" = x ]; then
850 echo PCI support for grub-emu: Yes
852 echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
854 if [ x"$TARGET_NO_MODULES" = xno ]; then
855 echo Module support for grub-emu: Yes
857 echo Module support for grub-emu: No
860 if [ x"$enable_mm_debug" = xyes ]; then
861 echo With memory debugging: Yes
863 echo With memory debugging: No
865 if [ x"$efiemu_excuse" = x ]; then
866 echo efiemu runtime: Yes
868 echo efiemu runtime: No "($efiemu_excuse)"
870 if [ x"$grub_fstest_excuse" = x ]; then
871 echo grub-fstest: Yes
873 echo grub-fstest: No "($grub_fstest_excuse)"
875 if [ x"$grub_mkfont_excuse" = x ]; then
876 echo grub-mkfont: Yes
878 echo grub-mkfont: No "($grub_mkfont_excuse)"
880 echo "*******************************************************"