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.
250 AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
255 AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid)
256 AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h)
257 AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h limits.h)
259 # For opendisk() and getrawpartition() on NetBSD.
260 # Used in util/deviceiter.c and in util/hostdisk.c.
261 AC_CHECK_HEADER([util.h], [
262 AC_CHECK_LIB([util], [opendisk], [
264 AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
266 AC_CHECK_LIB([util], [getrawpartition], [
268 AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
274 # Check for target programs.
277 # Find tools for the target.
278 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
279 tmp_ac_tool_prefix="$ac_tool_prefix"
280 ac_tool_prefix=$target_alias-
282 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
283 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
284 AC_CHECK_TOOL(OBJCOPY, objcopy)
285 AC_CHECK_TOOL(STRIP, strip)
286 AC_CHECK_TOOL(NM, nm)
288 ac_tool_prefix="$tmp_ac_tool_prefix"
290 if test "x$TARGET_CC" = x; then
293 AC_CHECK_TOOL(OBJCOPY, objcopy)
294 AC_CHECK_TOOL(STRIP, strip)
295 AC_CHECK_TOOL(NM, nm)
300 # Test the C compiler for the target environment.
303 tmp_LDFLAGS="$LDFLAGS"
304 tmp_CPPFLAGS="$CPPFLAGS"
307 CFLAGS="$TARGET_CFLAGS"
308 CPPFLAGS="$TARGET_CPPFLAGS"
309 LDFLAGS="$TARGET_LDFLAGS"
313 TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
314 -Wundef -Wstrict-prototypes -g"
316 # Force no alignment to save space on i386.
317 if test "x$target_cpu" = xi386; then
318 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
319 CFLAGS="$CFLAGS -falign-loops=1"
320 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
321 [grub_cv_cc_falign_loop=yes],
322 [grub_cv_cc_falign_loop=no])
325 if test "x$grub_cv_cc_falign_loop" = xyes; then
326 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
328 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
331 # Some toolchains enable these features by default, but they need
332 # registers that aren't set up properly in GRUB.
333 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
336 # By default, GCC 4.4 generates .eh_frame sections containing unwind
337 # information in some cases where it previously did not. GRUB doesn't need
338 # these and they just use up vital space. Restore the old compiler
340 AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
341 SAVE_CFLAGS="$CFLAGS"
342 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
343 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
344 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
345 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
346 CFLAGS="$SAVE_CFLAGS"
349 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
350 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
354 if test x$grub_cv_apple_target_cc = xyes ; then
355 TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions"
356 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
357 TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
359 AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
360 if test "x$OBJCONV" = x ; then
361 AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
363 if test "x$OBJCONV" = x ; then
364 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
367 TARGET_IMG_CFLAGS="-static"
368 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
369 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
372 # Use linker script if present, otherwise use builtin -N script.
373 if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
374 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
375 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext,"
376 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc -Wl,-Ttext,"
379 TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
380 TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,'
385 AC_SUBST(TARGET_IMG_LDSCRIPT)
386 AC_SUBST(TARGET_IMG_LDFLAGS)
387 AC_SUBST(TARGET_IMG_CFLAGS)
389 # For platforms where ELF is not the default link format.
390 AC_MSG_CHECKING([for command to convert module to ELF format])
392 cygwin) TARGET_OBJ2ELF='grub-pe2elf';
393 # FIXME: put proper test here
394 AC_DEFINE([NEED_REGISTER_FRAME_INFO], 1,
395 [Define to 1 if GCC generates calls to __register_frame_info()])
399 AC_SUBST(TARGET_OBJ2ELF)
400 AC_MSG_RESULT([$TARGET_OBJ2ELF])
403 if test "x$target_m32" = x1; then
405 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
406 TARGET_ASFLAGS="$TARGET_CFLAGS -m32"
407 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
408 TARGET_MODULE_FORMAT="elf32"
411 if test "x$target_m64" = x1; then
413 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
414 TARGET_ASFLAGS="$TARGET_ASFLAGS -m64"
415 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
416 TARGET_MODULE_FORMAT="elf64"
419 if test "$target_cpu"-"$platform" = x86_64-efi; then
420 # Use large model to support 4G memory
421 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
423 CFLAGS="$CFLAGS -m64 -mcmodel=large"
424 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
425 [grub_cv_cc_mcmodel=yes],
426 [grub_cv_cc_mcmodel=no])
428 if test "x$grub_cv_cc_mcmodel" = xno; then
429 AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
431 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
434 # EFI writes to stack below %rsp, we must not use the red zone
435 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
436 CFLAGS="$CFLAGS -m64 -mno-red-zone"
437 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
438 [grub_cv_cc_no_red_zone=yes],
439 [grub_cv_cc_no_red_zone=no])
441 if test "x$grub_cv_cc_no_red_zone" = xno; then
442 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
445 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
452 # Need __enable_execute_stack() for nested function trampolines?
453 grub_CHECK_ENABLE_EXECUTE_STACK
455 # Position independent executable.
457 [# Need that, because some distributions ship compilers that include
458 # `-fPIE' in the default specs.
459 if [ x"$pie_possible" = xyes ]; then
460 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
463 # Smashing stack protector.
464 grub_CHECK_STACK_PROTECTOR
465 # Need that, because some distributions ship compilers that include
466 # `-fstack-protector' in the default specs.
467 if test "x$ssp_possible" = xyes; then
468 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
470 grub_CHECK_STACK_ARG_PROBE
471 # Cygwin's GCC uses alloca() to probe the stackframe on static
472 # stack allocations above some threshold.
473 if test x"$sap_possible" = xyes; then
474 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
477 AC_ARG_ENABLE([werror],
478 [AS_HELP_STRING([--disable-werror],
479 [do not use -Werror when building GRUB])])
480 if test x"$enable_werror" != xno ; then
481 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
484 AC_SUBST(TARGET_CFLAGS)
485 AC_SUBST(TARGET_MODULE_FORMAT)
487 AC_SUBST(TARGET_APPLE_CC)
488 AC_SUBST(TARGET_ASFLAGS)
489 AC_SUBST(TARGET_CPPFLAGS)
490 AC_SUBST(TARGET_LDFLAGS)
492 # Set them to their new values for the tests below.
494 if test "x$TARGET_APPLE_CC" = x1 ; then
495 CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
497 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
499 CPPFLAGS="$TARGET_CPPFLAGS"
500 LDFLAGS="$TARGET_LDFLAGS"
504 if test x$grub_cv_asm_uscore = xyes; then
505 CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main"
507 CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
510 # Check for libgcc symbols
511 AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
513 if test "x$TARGET_APPLE_CC" = x1 ; then
514 CFLAGS="$TARGET_CFLAGS -nostdlib"
516 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
520 # Defined in aclocal.m4.
522 if test "x$TARGET_APPLE_CC" != x1 ; then
523 grub_PROG_OBJCOPY_ABSOLUTE
525 grub_PROG_LD_BUILD_ID_NONE
526 if test "x$target_cpu" = xi386; then
527 if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
528 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
529 # Check symbols provided by linker script.
530 CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC}8000 -Wl,--defsym,___main=0x8100"
532 grub_CHECK_BSS_START_SYMBOL
533 grub_CHECK_END_SYMBOL
535 CFLAGS="$TARGET_CFLAGS"
536 grub_I386_ASM_PREFIX_REQUIREMENT
538 grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
540 AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
543 AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
544 #define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
546 #define NESTED_FUNC_ATTR
549 AC_ARG_ENABLE([efiemu],
550 [AS_HELP_STRING([--enable-efiemu],
551 [build and install the efiemu runtimes (default=guessed)])])
552 if test x"$enable_efiemu" = xno ; then
553 efiemu_excuse="explicitly disabled"
555 if test x"$efiemu_excuse" = x ; then
556 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
557 CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
558 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
559 [grub_cv_cc_efiemu=yes],
560 [grub_cv_cc_efiemu=no])
562 if test x$grub_cv_cc_efiemu = xno; then
563 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
566 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
567 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
569 if test x"$efiemu_excuse" = x ; then
574 AC_SUBST([enable_efiemu])
576 if test "$platform" != emu; then
577 AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
578 SAVED_CPPFLAGS="$CPPFLAGS"
579 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
580 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
581 int va_arg_func (int fixed, va_list args);]], [[]])],
582 [grub_cv_cc_isystem=yes],
583 [grub_cv_cc_isystem=no])
584 CPPFLAGS="$SAVED_CPPFLAGS"
587 if test x"$grub_cv_cc_isystem" = xyes ; then
588 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
595 CPPFLAGS="$tmp_CPPFLAGS"
596 LDFLAGS="$tmp_LDFLAGS"
603 # Memory manager debugging.
604 AC_ARG_ENABLE([mm-debug],
605 AS_HELP_STRING([--enable-mm-debug],
606 [include memory manager debugging]),
607 [AC_DEFINE([MM_DEBUG], [1],
608 [Define to 1 if you enable memory manager debugging.])])
610 AC_ARG_ENABLE([grub-emu-usb],
611 [AS_HELP_STRING([--enable-grub-emu-usb],
612 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
614 AC_ARG_ENABLE([grub-emu-sdl],
615 [AS_HELP_STRING([--enable-grub-emu-sdl],
616 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
618 AC_ARG_ENABLE([grub-emu-pci],
619 [AS_HELP_STRING([--enable-grub-emu-pci],
620 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
622 AC_ARG_ENABLE([grub-emu-modules],
623 [AS_HELP_STRING([--enable-grub-emu-modules],
624 [Support module loading in `grub-emu' debugging utility (default=no)])])
626 if test "$platform" = emu; then
628 [# Check for curses libraries.]
629 AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
630 [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
631 [missing_ncurses=[true]])])
632 AC_SUBST([LIBCURSES])
633 [if [ x"$missing_ncurses" = x ]; then ]
634 [# Check for headers.]
635 AC_CHECK_HEADERS([ncurses/curses.h], [],
636 [AC_CHECK_HEADERS([ncurses.h], [],
637 [AC_CHECK_HEADERS([curses.h], [],
638 [missing_ncurses=[true]])])])
640 if test x"$missing_ncurses" = xtrue ; then
641 AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
644 if test x"$enable_grub_emu_modules" = xyes ; then
647 TARGET_NO_MODULES=yes
649 AC_SUBST(TARGET_NO_MODULES)
651 if test "$TARGET_NO_MODULES" = yes ; then
652 # Do not convert modules, otherwise linkage may fail (Cygwin only).
653 # FIXME: Should be checked above before TARGET_OBJ2ELF is set first.
657 if test x"$enable_grub_emu_usb" = xno ; then
658 grub_emu_usb_excuse="explicitly disabled"
661 if test x"$enable_grub_emu_pci" = xyes ; then
662 grub_emu_usb_excuse="conflicts with PCI support"
665 [if [ x"$grub_emu_usb_excuse" = x ]; then
666 # Check for libusb libraries.]
667 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
668 [grub_emu_usb_excuse=["need libusb library"]])
671 [if [ x"$grub_emu_usb_excuse" = x ]; then
672 # Check for headers.]
673 AC_CHECK_HEADERS([usb.h], [],
674 [grub_emu_usb_excuse=["need libusb headers"]])
676 if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
677 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
679 if test x"$grub_emu_usb_excuse" = x ; then
680 enable_grub_emu_usb=yes
682 enable_grub_emu_usb=no
685 if test x"$enable_grub_emu_sdl" = xno ; then
686 grub_emu_sdl_excuse="explicitely disabled"
688 [if [ x"$grub_emu_sdl_excuse" = x ]; then
689 # Check for libSDL libraries.]
690 AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
691 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
695 [if [ x"$grub_emu_sdl_excuse" = x ]; then
696 # Check for headers.]
697 AC_CHECK_HEADERS([SDL/SDL.h], [],
698 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
701 if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
702 AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
704 if test x"$grub_emu_sdl_excuse" = x ; then
705 enable_grub_emu_sdl=yes
707 enable_grub_emu_sdl=no
710 if test x"$enable_grub_emu_pci" != xyes ; then
711 grub_emu_pci_excuse="not enabled"
714 if test x"$enable_grub_emu_usb" = xyes ; then
715 grub_emu_pci_excuse="conflicts with USB support"
718 [if [ x"$grub_emu_pci_excuse" = x ]; then
719 # Check for libpci libraries.]
720 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
721 [grub_emu_pci_excuse=["need libpciaccess library"]])
722 AC_SUBST([LIBPCIACCESS])
724 [if [ x"$grub_emu_pci_excuse" = x ]; then
725 # Check for headers.]
726 AC_CHECK_HEADERS([pci/pci.h], [],
727 [grub_emu_pci_excuse=["need libpciaccess headers"]])
730 if test x"$grub_emu_pci_excuse" = x ; then
731 enable_grub_emu_pci=yes
734 enable_grub_emu_pci=no
737 AC_SUBST([enable_grub_emu_sdl])
738 AC_SUBST([enable_grub_emu_usb])
739 AC_SUBST([enable_grub_emu_pci])
742 AC_ARG_ENABLE([grub-fstest],
743 [AS_HELP_STRING([--enable-grub-fstest],
744 [build and install the `grub-fstest' debugging utility (default=guessed)])])
745 if test x"$enable_grub_fstest" = xno ; then
746 grub_fstest_excuse="explicitly disabled"
748 if test x"$grub_fstest_excuse" = x ; then
749 enable_grub_fstest=yes
751 enable_grub_fstest=no
753 AC_SUBST([enable_grub_fstest])
755 AC_ARG_ENABLE([grub-mkfont],
756 [AS_HELP_STRING([--enable-grub-mkfont],
757 [build and install the `grub-mkfont' utility (default=guessed)])])
758 if test x"$enable_grub_mkfont" = xno ; then
759 grub_mkfont_excuse="explicitly disabled"
762 if test x"$grub_mkfont_excuse" = x ; then
763 # Check for freetype libraries.
764 AC_CHECK_PROGS([FREETYPE], [freetype-config])
765 if test "x$FREETYPE" = x ; then
766 grub_mkfont_excuse=["need freetype2 library"]
768 freetype_cflags=`freetype-config --cflags`
769 freetype_libs=`freetype-config --libs`
772 if test x"$grub_mkfont_excuse" = x ; then
773 # Check for freetype libraries.
774 SAVED_CPPFLAGS="$CPPFLAGS"
775 CPPFLAGS="$CPPFLAGS $freetype_cflags"
776 AC_CHECK_HEADERS([ft2build.h], [],
777 [grub_mkfont_excuse=["need freetype2 headers"]])
778 CPPFLAGS="$SAVED_CPPFLAGS"
781 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
782 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
784 if test x"$grub_mkfont_excuse" = x ; then
785 enable_grub_mkfont=yes
787 enable_grub_mkfont=no
789 AC_SUBST([enable_grub_mkfont])
790 AC_SUBST([freetype_cflags])
791 AC_SUBST([freetype_libs])
793 AC_ARG_ENABLE([device-mapper],
794 [AS_HELP_STRING([--enable-device-mapper],
795 [enable Linux device-mapper support (default=guessed)])])
796 if test x"$enable_device_mapper" = xno ; then
797 device_mapper_excuse="explicitly disabled"
800 if test x"$device_mapper_excuse" = x ; then
801 # Check for device-mapper library.
802 AC_CHECK_LIB([devmapper], [dm_task_create],
803 [LDFLAGS="$LDFLAGS -ldevmapper"
804 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
805 [Define to 1 if you have the devmapper library.])],
806 [device_mapper_excuse="need devmapper library"])
813 if test x"$link_dir" = xyes ; then
814 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
815 if test "$platform" != emu ; then
816 AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
819 mkdir -p include/grub 2>/dev/null
820 rm -rf include/grub/cpu
821 cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
822 if test "$platform" != emu ; then
823 rm -rf include/grub/machine
824 cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
827 AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
828 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
831 echo "*******************************************************"
832 echo GRUB2 will be compiled with following components:
833 echo Platform: "$target_cpu"-"$platform"
834 if [ x"$platform" = xemu ]; then
835 if [ x"$grub_emu_usb_excuse" = x ]; then
836 echo USB support for grub-emu: Yes
838 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
840 if [ x"$grub_emu_sdl_excuse" = x ]; then
841 echo SDL support for grub-emu: Yes
843 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
845 if [ x"$grub_emu_pci_excuse" = x ]; then
846 echo PCI support for grub-emu: Yes
848 echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
850 if [ x"$TARGET_NO_MODULES" = xno ]; then
851 echo Module support for grub-emu: Yes
853 echo Module support for grub-emu: No
856 if [ x"$enable_mm_debug" = xyes ]; then
857 echo With memory debugging: Yes
859 echo With memory debugging: No
861 if [ x"$efiemu_excuse" = x ]; then
862 echo efiemu runtime: Yes
864 echo efiemu runtime: No "($efiemu_excuse)"
866 if [ x"$grub_fstest_excuse" = x ]; then
867 echo grub-fstest: Yes
869 echo grub-fstest: No "($grub_fstest_excuse)"
871 if [ x"$grub_mkfont_excuse" = x ]; then
872 echo grub-mkfont: Yes
874 echo grub-mkfont: No "($grub_mkfont_excuse)"
876 echo "*******************************************************"