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],[0],[bug-grub@gnu.org]) dnl version is filled by debian/rules
37 AC_CONFIG_SRCDIR([include/grub/dl.h])
38 AC_CONFIG_HEADER([config.h])
40 # Checks for host and target systems.
44 # Program name transformations
47 # Optimization flag. Allow user to override.
48 if test "x$TARGET_CFLAGS" = x; then
49 TARGET_CFLAGS="$TARGET_CFLAGS -Os"
53 i[[3456]]86) target_cpu=i386 ;;
54 amd64) target_cpu=x86_64 ;;
55 sparc) target_cpu=sparc64 ;;
58 TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPSEL=1";
59 CFLAGS="$CFLAGS -DGRUB_CPU_MIPSEL=1";
63 TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPS=1";
64 CFLAGS="$CFLAGS -DGRUB_CPU_MIPS=1";
68 # Specify the platform (such as firmware).
69 AC_ARG_WITH([platform],
70 AS_HELP_STRING([--with-platform=PLATFORM],
71 [select the host platform [[guessed]]]))
73 # Guess the platform if not specified.
74 if test "x$with_platform" = x; then
75 case "$target_cpu"-"$target_vendor" in
76 i386-apple) platform=efi ;;
77 i386-*) platform=pc ;;
78 x86_64-apple) platform=efi ;;
79 x86_64-*) platform=pc ;;
80 powerpc-*) platform=ieee1275 ;;
81 powerpc64-*) platform=ieee1275 ;;
82 sparc64-*) platform=ieee1275 ;;
83 mips-*) platform=yeeloong ;;
84 *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
87 platform="$with_platform"
90 # Adjust CPU unless target was explicitly specified.
91 if test -z "$target_alias"; then
92 case "$target_cpu"-"$platform" in
95 x86_64-*) target_cpu=i386 ;;
96 powerpc64-ieee1275) target_cpu=powerpc ;;
100 # Check if the platform is supported, make final adjustments.
101 case "$target_cpu"-"$platform" in
107 i386-linuxbios) platform=coreboot ;;
115 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
118 case "$target_cpu" in
119 i386 | powerpc) target_m32=1 ;;
120 x86_64 | sparc64) target_m64=1 ;;
124 mingw32*) host_os=cygwin ;;
127 # This normalizes the names, and creates a new variable ("host_kernel")
128 # while at it, since the mapping is not always 1:1 (e.g. different OSes
129 # using the same kernel type).
131 gnu*) host_kernel=hurd ;;
132 linux*) host_kernel=linux ;;
133 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
134 netbsd*) host_kernel=netbsd ;;
135 cygwin) host_kernel=windows ;;
139 coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
140 multiboot) machine_CFLAGS="-DGRUB_MACHINE_MULTIBOOT=1" ;;
141 efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
142 ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
143 qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
144 pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
145 emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
146 yeeloong) machine_CFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
147 qemu-mips) machine_CFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
149 case "$target_cpu" in
150 mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;;
151 sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
153 machine_CFLAGS="$machine_CFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
155 CFLAGS="$CFLAGS $machine_CFLAGS"
156 TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
157 TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
161 AC_SUBST(host_kernel)
167 # Checks for build programs.
170 # Although cmp is listed in the GNU Coding Standards as a command which
171 # can used directly, OpenBSD lacks cmp in the default installation.
172 AC_CHECK_PROGS([CMP], [cmp])
173 if test "x$CMP" = x; then
174 AC_MSG_ERROR([cmp is not found])
177 AC_CHECK_PROGS([YACC], [bison])
178 if test "x$YACC" = x; then
179 AC_MSG_ERROR([bison is not found])
184 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
185 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do
186 if test -f "$dir/unifont.$ext"; then
187 FONT_SOURCE="$dir/unifont.$ext"
193 if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xyeeloong ); then
194 AC_MSG_ERROR([qemu and yeeloong ports need unifont])
197 AC_SUBST([FONT_SOURCE])
205 if test "x$LEX" = "x:"; then
206 AC_MSG_ERROR([flex is not found])
208 version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
209 if test -n "$version" -a "$version" -ge 20535; then
212 AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
216 # These are not a "must".
217 AC_PATH_PROG(RUBY, ruby)
218 AC_PATH_PROG(MAKEINFO, makeinfo)
221 # Checks for host programs.
226 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
229 AM_GNU_GETTEXT([external])
232 # Identify characteristics of the host architecture.
234 AC_CHECK_SIZEOF(void *)
235 AC_CHECK_SIZEOF(long)
238 if test x$grub_cv_apple_cc = xyes ; then
239 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
240 ASFLAGS="$ASFLAGS -DAPPLE_CC=1"
243 if test "x$cross_compiling" = xyes; then
244 AC_MSG_WARN([cannot generate manual pages while cross compiling])
246 AC_PATH_PROG(HELP2MAN, help2man)
249 # Check for functions and headers.
250 AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getfsstat getmntany)
251 AC_CHECK_HEADERS(libzfs.h libnvpair.h)
253 # For opendisk() and getrawpartition() on NetBSD.
254 # Used in util/deviceiter.c and in util/hostdisk.c.
255 AC_CHECK_HEADER([util.h], [
256 AC_CHECK_LIB([util], [opendisk], [
258 AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
260 AC_CHECK_LIB([util], [getrawpartition], [
262 AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
268 # Check for target programs.
271 # Find tools for the target.
272 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
273 tmp_ac_tool_prefix="$ac_tool_prefix"
274 ac_tool_prefix=$target_alias-
276 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
277 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
278 AC_CHECK_TOOL(OBJCOPY, objcopy)
279 AC_CHECK_TOOL(STRIP, strip)
280 AC_CHECK_TOOL(NM, nm)
282 ac_tool_prefix="$tmp_ac_tool_prefix"
284 if test "x$TARGET_CC" = x; then
287 AC_CHECK_TOOL(OBJCOPY, objcopy)
288 AC_CHECK_TOOL(STRIP, strip)
289 AC_CHECK_TOOL(NM, nm)
294 # Test the C compiler for the target environment.
297 tmp_LDFLAGS="$LDFLAGS"
298 tmp_CPPFLAGS="$CPPFLAGS"
301 CFLAGS="$TARGET_CFLAGS"
302 CPPFLAGS="$TARGET_CPPFLAGS"
303 LDFLAGS="$TARGET_LDFLAGS"
307 TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
308 -Wundef -Wstrict-prototypes -g"
310 # Force no alignment to save space on i386.
311 if test "x$target_cpu" = xi386; then
312 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
313 CFLAGS="$CFLAGS -falign-loops=1"
314 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
315 [grub_cv_cc_falign_loop=yes],
316 [grub_cv_cc_falign_loop=no])
319 if test "x$grub_cv_cc_falign_loop" = xyes; then
320 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
322 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
325 # Some toolchains enable these features by default, but they need
326 # registers that aren't set up properly in GRUB.
327 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
330 # By default, GCC 4.4 generates .eh_frame sections containing unwind
331 # information in some cases where it previously did not. GRUB doesn't need
332 # these and they just use up vital space. Restore the old compiler
334 AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
335 SAVE_CFLAGS="$CFLAGS"
336 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
337 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
338 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
339 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
340 CFLAGS="$SAVE_CFLAGS"
343 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
344 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
348 if test x$grub_cv_apple_target_cc = xyes ; then
349 TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions"
350 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
351 TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
353 AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
354 if test "x$OBJCONV" = x ; then
355 AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
357 if test "x$OBJCONV" = x ; then
358 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
361 TARGET_IMG_CFLAGS="-static"
362 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
363 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
366 # Use linker script if present, otherwise use builtin -N script.
367 if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
368 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
369 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext,"
370 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc -Wl,-Ttext,"
373 TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
374 TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,'
379 AC_SUBST(TARGET_IMG_LDSCRIPT)
380 AC_SUBST(TARGET_IMG_LDFLAGS)
381 AC_SUBST(TARGET_IMG_CFLAGS)
383 # For platforms where ELF is not the default link format.
384 AC_MSG_CHECKING([for command to convert module to ELF format])
386 cygwin) TARGET_OBJ2ELF='grub-pe2elf';
387 # FIXME: put proper test here
388 AC_DEFINE([NEED_REGISTER_FRAME_INFO], 1,
389 [Define to 1 if GCC generates calls to __register_frame_info()])
393 AC_SUBST(TARGET_OBJ2ELF)
394 AC_MSG_RESULT([$TARGET_OBJ2ELF])
397 if test "x$target_m32" = x1; then
399 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
400 TARGET_ASFLAGS="$TARGET_CFLAGS -m32"
401 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
402 TARGET_MODULE_FORMAT="elf32"
405 if test "x$target_m64" = x1; then
407 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
408 TARGET_ASFLAGS="$TARGET_ASFLAGS -m64"
409 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
410 TARGET_MODULE_FORMAT="elf64"
413 if test "$target_cpu"-"$platform" = x86_64-efi; then
414 # Use large model to support 4G memory
415 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
417 CFLAGS="$CFLAGS -m64 -mcmodel=large"
418 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
419 [grub_cv_cc_mcmodel=yes],
420 [grub_cv_cc_mcmodel=no])
422 if test "x$grub_cv_cc_mcmodel" = xno; then
423 AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
425 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
428 # EFI writes to stack below %rsp, we must not use the red zone
429 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
430 CFLAGS="$CFLAGS -m64 -mno-red-zone"
431 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
432 [grub_cv_cc_no_red_zone=yes],
433 [grub_cv_cc_no_red_zone=no])
435 if test "x$grub_cv_cc_no_red_zone" = xno; then
436 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
439 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
446 # Need __enable_execute_stack() for nested function trampolines?
447 grub_CHECK_ENABLE_EXECUTE_STACK
449 # Position independent executable.
451 [# Need that, because some distributions ship compilers that include
452 # `-fPIE' in the default specs.
453 if [ x"$pie_possible" = xyes ]; then
454 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
457 # Smashing stack protector.
458 grub_CHECK_STACK_PROTECTOR
459 # Need that, because some distributions ship compilers that include
460 # `-fstack-protector' in the default specs.
461 if test "x$ssp_possible" = xyes; then
462 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
464 grub_CHECK_STACK_ARG_PROBE
465 # Cygwin's GCC uses alloca() to probe the stackframe on static
466 # stack allocations above some threshold.
467 if test x"$sap_possible" = xyes; then
468 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
471 AC_ARG_ENABLE([werror],
472 [AS_HELP_STRING([--disable-werror],
473 [do not use -Werror when building GRUB])])
474 if test x"$enable_werror" != xno ; then
475 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
478 AC_SUBST(TARGET_CFLAGS)
479 AC_SUBST(TARGET_MODULE_FORMAT)
481 AC_SUBST(TARGET_APPLE_CC)
482 AC_SUBST(TARGET_ASFLAGS)
483 AC_SUBST(TARGET_CPPFLAGS)
484 AC_SUBST(TARGET_LDFLAGS)
486 # Set them to their new values for the tests below.
488 if test "x$TARGET_APPLE_CC" = x1 ; then
489 CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
491 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
493 CPPFLAGS="$TARGET_CPPFLAGS"
494 LDFLAGS="$TARGET_LDFLAGS"
498 if test x$grub_cv_asm_uscore = xyes; then
499 CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main"
501 CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
504 # Check for libgcc symbols
505 AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
507 if test "x$TARGET_APPLE_CC" = x1 ; then
508 CFLAGS="$TARGET_CFLAGS -nostdlib"
510 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
514 # Defined in aclocal.m4.
516 if test "x$TARGET_APPLE_CC" != x1 ; then
517 grub_PROG_OBJCOPY_ABSOLUTE
519 grub_PROG_LD_BUILD_ID_NONE
520 if test "x$target_cpu" = xi386; then
521 if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
522 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
523 # Check symbols provided by linker script.
524 CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000 -Wl,--defsym,___main=0x8100"
526 grub_CHECK_BSS_START_SYMBOL
527 grub_CHECK_END_SYMBOL
529 CFLAGS="$TARGET_CFLAGS"
530 grub_I386_ASM_PREFIX_REQUIREMENT
532 grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
534 AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
537 AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
538 #define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
540 #define NESTED_FUNC_ATTR
543 AC_ARG_ENABLE([efiemu],
544 [AS_HELP_STRING([--enable-efiemu],
545 [build and install the efiemu runtimes (default=guessed)])])
546 if test x"$enable_efiemu" = xno ; then
547 efiemu_excuse="explicitly disabled"
549 if test x"$efiemu_excuse" = x ; then
550 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
551 CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
552 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
553 [grub_cv_cc_efiemu=yes],
554 [grub_cv_cc_efiemu=no])
556 if test x$grub_cv_cc_efiemu = xno; then
557 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
560 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
561 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
563 if test x"$efiemu_excuse" = x ; then
568 AC_SUBST([enable_efiemu])
570 if test "$platform" != emu; then
571 AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
572 SAVED_CPPFLAGS="$CPPFLAGS"
573 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
574 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
575 int va_arg_func (int fixed, va_list args);]], [[]])],
576 [grub_cv_cc_isystem=yes],
577 [grub_cv_cc_isystem=no])
578 CPPFLAGS="$SAVED_CPPFLAGS"
581 if test x"$grub_cv_cc_isystem" = xyes ; then
582 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
589 CPPFLAGS="$tmp_CPPFLAGS"
590 LDFLAGS="$tmp_LDFLAGS"
597 # Memory manager debugging.
598 AC_ARG_ENABLE([mm-debug],
599 AS_HELP_STRING([--enable-mm-debug],
600 [include memory manager debugging]),
601 [AC_DEFINE([MM_DEBUG], [1],
602 [Define to 1 if you enable memory manager debugging.])])
604 AC_ARG_ENABLE([grub-emu-usb],
605 [AS_HELP_STRING([--enable-grub-emu-usb],
606 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
608 AC_ARG_ENABLE([grub-emu-sdl],
609 [AS_HELP_STRING([--enable-grub-emu-sdl],
610 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
612 AC_ARG_ENABLE([grub-emu-pci],
613 [AS_HELP_STRING([--enable-grub-emu-pci],
614 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
616 AC_ARG_ENABLE([grub-emu-modules],
617 [AS_HELP_STRING([--enable-grub-emu-modules],
618 [Support module loading in `grub-emu' debugging utility (default=no)])])
620 if test "$platform" = emu; then
622 [# Check for curses libraries.]
623 AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
624 [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
625 [missing_ncurses=[true]])])
626 AC_SUBST([LIBCURSES])
627 [if [ x"$missing_ncurses" = x ]; then ]
628 [# Check for headers.]
629 AC_CHECK_HEADERS([ncurses/curses.h], [],
630 [AC_CHECK_HEADERS([ncurses.h], [],
631 [AC_CHECK_HEADERS([curses.h], [],
632 [missing_ncurses=[true]])])])
634 if test x"$missing_ncurses" = xtrue ; then
635 AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
638 if test x"$enable_grub_emu_modules" = xyes ; then
641 TARGET_NO_MODULES=yes
643 AC_SUBST(TARGET_NO_MODULES)
645 if test "$TARGET_NO_MODULES" = yes ; then
646 # Do not convert modules, otherwise linkage may fail (Cygwin only).
647 # FIXME: Should be checked above before TARGET_OBJ2ELF is set first.
651 if test x"$enable_grub_emu_usb" = xno ; then
652 grub_emu_usb_excuse="explicitly disabled"
655 if test x"$enable_grub_emu_pci" = xyes ; then
656 grub_emu_usb_excuse="conflicts with PCI support"
659 [if [ x"$grub_emu_usb_excuse" = x ]; then
660 # Check for libusb libraries.]
661 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
662 [grub_emu_usb_excuse=["need libusb library"]])
665 [if [ x"$grub_emu_usb_excuse" = x ]; then
666 # Check for headers.]
667 AC_CHECK_HEADERS([usb.h], [],
668 [grub_emu_usb_excuse=["need libusb headers"]])
670 if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
671 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
673 if test x"$grub_emu_usb_excuse" = x ; then
674 enable_grub_emu_usb=yes
676 enable_grub_emu_usb=no
679 if test x"$enable_grub_emu_sdl" = xno ; then
680 grub_emu_sdl_excuse="explicitely disabled"
682 [if [ x"$grub_emu_sdl_excuse" = x ]; then
683 # Check for libSDL libraries.]
684 AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
685 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
689 [if [ x"$grub_emu_sdl_excuse" = x ]; then
690 # Check for headers.]
691 AC_CHECK_HEADERS([SDL/SDL.h], [],
692 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
695 if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
696 AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
698 if test x"$grub_emu_sdl_excuse" = x ; then
699 enable_grub_emu_sdl=yes
701 enable_grub_emu_sdl=no
704 if test x"$enable_grub_emu_pci" != xyes ; then
705 grub_emu_pci_excuse="not enabled"
708 if test x"$enable_grub_emu_usb" = xyes ; then
709 grub_emu_pci_excuse="conflicts with USB support"
712 [if [ x"$grub_emu_pci_excuse" = x ]; then
713 # Check for libpci libraries.]
714 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
715 [grub_emu_pci_excuse=["need libpciaccess library"]])
716 AC_SUBST([LIBPCIACCESS])
718 [if [ x"$grub_emu_pci_excuse" = x ]; then
719 # Check for headers.]
720 AC_CHECK_HEADERS([pci/pci.h], [],
721 [grub_emu_pci_excuse=["need libpciaccess headers"]])
724 if test x"$grub_emu_pci_excuse" = x ; then
725 enable_grub_emu_pci=yes
728 enable_grub_emu_pci=no
731 AC_SUBST([enable_grub_emu_sdl])
732 AC_SUBST([enable_grub_emu_usb])
733 AC_SUBST([enable_grub_emu_pci])
736 AC_ARG_ENABLE([grub-fstest],
737 [AS_HELP_STRING([--enable-grub-fstest],
738 [build and install the `grub-fstest' debugging utility (default=guessed)])])
739 if test x"$enable_grub_fstest" = xno ; then
740 grub_fstest_excuse="explicitly disabled"
742 if test x"$grub_fstest_excuse" = x ; then
743 enable_grub_fstest=yes
745 enable_grub_fstest=no
747 AC_SUBST([enable_grub_fstest])
749 AC_ARG_ENABLE([grub-mkfont],
750 [AS_HELP_STRING([--enable-grub-mkfont],
751 [build and install the `grub-mkfont' utility (default=guessed)])])
752 if test x"$enable_grub_mkfont" = xno ; then
753 grub_mkfont_excuse="explicitly disabled"
756 if test x"$grub_mkfont_excuse" = x ; then
757 # Check for freetype libraries.
758 AC_CHECK_PROGS([FREETYPE], [freetype-config])
759 if test "x$FREETYPE" = x ; then
760 grub_mkfont_excuse=["need freetype2 library"]
762 freetype_cflags=`freetype-config --cflags`
763 freetype_libs=`freetype-config --libs`
766 if test x"$grub_mkfont_excuse" = x ; then
767 # Check for freetype libraries.
768 SAVED_CPPFLAGS="$CPPFLAGS"
769 CPPFLAGS="$CPPFLAGS $freetype_cflags"
770 AC_CHECK_HEADERS([ft2build.h], [],
771 [grub_mkfont_excuse=["need freetype2 headers"]])
772 CPPFLAGS="$SAVED_CPPFLAGS"
775 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
776 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
778 if test x"$grub_mkfont_excuse" = x ; then
779 enable_grub_mkfont=yes
781 enable_grub_mkfont=no
783 AC_SUBST([enable_grub_mkfont])
784 AC_SUBST([freetype_cflags])
785 AC_SUBST([freetype_libs])
787 AC_ARG_ENABLE([device-mapper],
788 [AS_HELP_STRING([--enable-device-mapper],
789 [enable Linux device-mapper support (default=guessed)])])
790 if test x"$enable_device_mapper" = xno ; then
791 device_mapper_excuse="explicitly disabled"
794 if test x"$device_mapper_excuse" = x ; then
795 # Check for device-mapper library.
796 AC_CHECK_LIB([devmapper], [dm_task_create],
797 [LDFLAGS="$LDFLAGS -ldevmapper"
798 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
799 [Define to 1 if you have the devmapper library.])],
800 [device_mapper_excuse="need devmapper library"])
803 AC_CHECK_LIB([zfs], [libzfs_init],
804 [LDFLAGS="$LDFLAGS -lzfs"
805 AC_DEFINE([HAVE_LIBZFS], [1],
806 [Define to 1 if you have the ZFS library.])],)
807 AC_CHECK_LIB([nvpair], [nvlist_print],
808 [LDFLAGS="$LDFLAGS -lnvpair"
809 AC_DEFINE([HAVE_LIBNVPAIR], [1],
810 [Define to 1 if you have the NVPAIR library.])],)
816 if test x"$link_dir" = xyes ; then
817 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
818 if test "$platform" != emu ; then
819 AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
822 mkdir -p include/grub 2>/dev/null
823 rm -rf include/grub/cpu
824 cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
825 if test "$platform" != emu ; then
826 rm -rf include/grub/machine
827 cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
830 AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
831 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
834 echo "*******************************************************"
835 echo GRUB2 will be compiled with following components:
836 echo Platform: "$target_cpu"-"$platform"
837 if [ x"$platform" = xemu ]; then
838 if [ x"$grub_emu_usb_excuse" = x ]; then
839 echo USB support for grub-emu: Yes
841 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
843 if [ x"$grub_emu_sdl_excuse" = x ]; then
844 echo SDL support for grub-emu: Yes
846 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
848 if [ x"$grub_emu_pci_excuse" = x ]; then
849 echo PCI support for grub-emu: Yes
851 echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
853 if [ x"$TARGET_NO_MODULES" = xno ]; then
854 echo Module support for grub-emu: Yes
856 echo Module support for grub-emu: No
859 if [ x"$enable_mm_debug" = xyes ]; then
860 echo With memory debugging: Yes
862 echo With memory debugging: No
864 if [ x"$efiemu_excuse" = x ]; then
865 echo efiemu runtime: Yes
867 echo efiemu runtime: No "($efiemu_excuse)"
869 if [ x"$grub_fstest_excuse" = x ]; then
870 echo grub-fstest: Yes
872 echo grub-fstest: No "($grub_fstest_excuse)"
874 if [ x"$grub_mkfont_excuse" = x ]; then
875 echo grub-mkfont: Yes
877 echo grub-mkfont: No "($grub_mkfont_excuse)"
879 echo "*******************************************************"