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])
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
106 i386-linuxbios) platform=coreboot ;;
114 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
117 case "$target_cpu" in
118 i386 | powerpc) target_m32=1 ;;
119 x86_64 | sparc64) target_m64=1 ;;
123 mingw32*) host_os=cygwin ;;
126 # This normalizes the names, and creates a new variable ("host_kernel")
127 # while at it, since the mapping is not always 1:1 (e.g. different OSes
128 # using the same kernel type).
130 gnu*) host_kernel=hurd ;;
131 linux*) host_kernel=linux ;;
132 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
133 cygwin) host_kernel=windows ;;
137 coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
138 efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
139 ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
140 qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
141 pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
142 emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
143 yeeloong) machine_CFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
144 qemu-mips) machine_CFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
146 case "$target_cpu" in
147 mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;;
148 sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
151 CFLAGS="$CFLAGS $machine_CFLAGS"
152 TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
153 TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
157 AC_SUBST(host_kernel)
163 # Checks for build programs.
166 # Although cmp is listed in the GNU Coding Standards as a command which
167 # can used directly, OpenBSD lacks cmp in the default installation.
168 AC_CHECK_PROGS([CMP], [cmp])
169 if test "x$CMP" = x; then
170 AC_MSG_ERROR([cmp is not found])
173 AC_CHECK_PROGS([LEX], [flex])
174 if test "x$LEX" = x; then
175 AC_MSG_ERROR([flex is not found])
178 AC_CHECK_PROGS([YACC], [bison])
179 if test "x$YACC" = x; then
180 AC_MSG_ERROR([bison is not found])
183 for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz /usr/share/fonts/unifont/unifont.pcf.gz; do
184 if test -e $file ; then
185 AC_SUBST([FONT_SOURCE], [$file])
195 # These are not a "must".
196 AC_PATH_PROG(RUBY, ruby)
197 AC_PATH_PROG(MAKEINFO, makeinfo)
200 # Checks for host programs.
205 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
208 AM_GNU_GETTEXT([external])
211 # Identify characteristics of the host architecture.
213 AC_CHECK_SIZEOF(void *)
214 AC_CHECK_SIZEOF(long)
217 if test x$grub_cv_apple_cc = xyes ; then
218 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
219 ASFLAGS="$ASFLAGS -DAPPLE_CC=1"
222 if test "x$cross_compiling" = xyes; then
223 AC_MSG_WARN([cannot generate manual pages while cross compiling])
225 AC_PATH_PROG(HELP2MAN, help2man)
228 # Check for functions.
229 AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
234 AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid)
235 AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h)
236 AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h limits.h)
239 # Check for target programs.
242 # Find tools for the target.
243 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
244 tmp_ac_tool_prefix="$ac_tool_prefix"
245 ac_tool_prefix=$target_alias-
247 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
248 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
249 AC_CHECK_TOOL(OBJCOPY, objcopy)
250 AC_CHECK_TOOL(STRIP, strip)
251 AC_CHECK_TOOL(NM, nm)
253 ac_tool_prefix="$tmp_ac_tool_prefix"
255 if test "x$TARGET_CC" = x; then
258 AC_CHECK_TOOL(OBJCOPY, objcopy)
259 AC_CHECK_TOOL(STRIP, strip)
260 AC_CHECK_TOOL(NM, nm)
265 # Test the C compiler for the target environment.
268 tmp_LDFLAGS="$LDFLAGS"
269 tmp_CPPFLAGS="$CPPFLAGS"
272 CFLAGS="$TARGET_CFLAGS"
273 CPPFLAGS="$TARGET_CPPFLAGS"
274 LDFLAGS="$TARGET_LDFLAGS"
278 TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
279 -Wundef -Wstrict-prototypes -g"
281 # Force no alignment to save space on i386.
282 if test "x$target_cpu" = xi386; then
283 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
284 CFLAGS="$CFLAGS -falign-loops=1"
285 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
286 [grub_cv_cc_falign_loop=yes],
287 [grub_cv_cc_falign_loop=no])
290 if test "x$grub_cv_cc_falign_loop" = xyes; then
291 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
293 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
296 # Some toolchains enable these features by default, but they need
297 # registers that aren't set up properly in GRUB.
298 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
301 # By default, GCC 4.4 generates .eh_frame sections containing unwind
302 # information in some cases where it previously did not. GRUB doesn't need
303 # these and they just use up vital space. Restore the old compiler
305 AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
306 SAVE_CFLAGS="$CFLAGS"
307 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
308 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
309 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
310 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
311 CFLAGS="$SAVE_CFLAGS"
314 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
315 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
319 if test x$grub_cv_apple_target_cc = xyes ; then
320 TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions"
321 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
322 TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
324 AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
325 if test "x$OBJCONV" = x ; then
326 AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
328 if test "x$OBJCONV" = x ; then
329 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
332 TARGET_IMG_CFLAGS="-static"
333 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
334 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
337 # Use linker script if present, otherwise use builtin -N script.
338 if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
339 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
340 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext,"
341 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
344 TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
345 TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,'
350 AC_SUBST(TARGET_IMG_LDSCRIPT)
351 AC_SUBST(TARGET_IMG_LDFLAGS)
352 AC_SUBST(TARGET_IMG_CFLAGS)
354 # For platforms where ELF is not the default link format.
355 AC_MSG_CHECKING([for command to convert module to ELF format])
357 cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
360 AC_SUBST(TARGET_OBJ2ELF)
361 AC_MSG_RESULT([$TARGET_OBJ2ELF])
364 if test "x$target_m32" = x1; then
366 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
367 TARGET_ASFLAGS="$TARGET_CFLAGS -m32"
368 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
369 TARGET_MODULE_FORMAT="elf32"
372 if test "x$target_m64" = x1; then
374 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
375 TARGET_ASFLAGS="$TARGET_ASFLAGS -m64"
376 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
377 TARGET_MODULE_FORMAT="elf64"
380 if test "$target_cpu"-"$platform" = x86_64-efi; then
381 # Use large model to support 4G memory
382 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
384 CFLAGS="$CFLAGS -m64 -mcmodel=large"
385 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
386 [grub_cv_cc_mcmodel=yes],
387 [grub_cv_cc_mcmodel=no])
389 if test "x$grub_cv_cc_mcmodel" = xno; then
390 CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1"
391 TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1"
392 AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc])
394 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
397 # EFI writes to stack below %rsp, we must not use the red zone
398 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
399 CFLAGS="$CFLAGS -m64 -mno-red-zone"
400 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
401 [grub_cv_cc_no_red_zone=yes],
402 [grub_cv_cc_no_red_zone=no])
404 if test "x$grub_cv_cc_no_red_zone" = xno; then
405 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
408 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
415 # Need __enable_execute_stack() for nested function trampolines?
416 grub_CHECK_ENABLE_EXECUTE_STACK
418 # Position independent executable.
420 [# Need that, because some distributions ship compilers that include
421 # `-fPIE' in the default specs.
422 if [ x"$pie_possible" = xyes ]; then
423 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
426 # Smashing stack protector.
427 grub_CHECK_STACK_PROTECTOR
428 # Need that, because some distributions ship compilers that include
429 # `-fstack-protector' in the default specs.
430 if test "x$ssp_possible" = xyes; then
431 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
433 grub_CHECK_STACK_ARG_PROBE
434 # Cygwin's GCC uses alloca() to probe the stackframe on static
435 # stack allocations above some threshold.
436 if test x"$sap_possible" = xyes; then
437 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
440 AC_ARG_ENABLE([werror],
441 [AS_HELP_STRING([--disable-werror],
442 [do not use -Werror when building GRUB])])
443 if test x"$enable_werror" != xno ; then
444 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
447 AC_SUBST(TARGET_CFLAGS)
448 AC_SUBST(TARGET_MODULE_FORMAT)
450 AC_SUBST(TARGET_APPLE_CC)
451 AC_SUBST(TARGET_ASFLAGS)
452 AC_SUBST(TARGET_CPPFLAGS)
453 AC_SUBST(TARGET_LDFLAGS)
455 # Set them to their new values for the tests below.
457 if test "x$TARGET_APPLE_CC" = x1 ; then
458 CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
460 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wl,--defsym,abort=main -Wno-error"
462 CPPFLAGS="$TARGET_CPPFLAGS"
463 LDFLAGS="$TARGET_LDFLAGS"
466 # Check for libgcc symbols
467 AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
469 if test "x$TARGET_APPLE_CC" = x1 ; then
470 CFLAGS="$TARGET_CFLAGS -nostdlib"
472 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
476 # Defined in aclocal.m4.
478 if test "x$TARGET_APPLE_CC" != x1 ; then
479 grub_PROG_OBJCOPY_ABSOLUTE
481 grub_PROG_LD_BUILD_ID_NONE
483 if test "x$target_cpu" = xi386; then
484 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
485 # Check symbols provided by linker script.
486 CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100"
488 if test "x$TARGET_APPLE_CC" != x1 ; then
489 grub_CHECK_BSS_START_SYMBOL
490 grub_CHECK_END_SYMBOL
492 CFLAGS="$TARGET_CFLAGS"
493 grub_I386_ASM_PREFIX_REQUIREMENT
495 grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
497 AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
500 AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
501 #define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
503 #define NESTED_FUNC_ATTR
506 AC_ARG_ENABLE([efiemu],
507 [AS_HELP_STRING([--enable-efiemu],
508 [build and install the efiemu runtimes (default=guessed)])])
509 if test x"$enable_efiemu" = xno ; then
510 efiemu_excuse="explicitly disabled"
512 if test x"$efiemu_excuse" = x ; then
513 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
514 CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
515 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
516 [grub_cv_cc_efiemu=yes],
517 [grub_cv_cc_efiemu=no])
519 if test x$grub_cv_cc_efiemu = xno; then
520 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
523 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
524 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
526 if test x"$efiemu_excuse" = x ; then
531 AC_SUBST([enable_efiemu])
533 if test "$platform" != emu; then
534 AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
535 SAVED_CPPFLAGS="$CPPFLAGS"
536 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
537 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
538 int va_arg_func (int fixed, va_list args);]], [[]])],
539 [grub_cv_cc_isystem=yes],
540 [grub_cv_cc_isystem=no])
541 CPPFLAGS="$SAVED_CPPFLAGS"
544 if test x"$grub_cv_cc_isystem" = xyes ; then
545 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
552 CPPFLAGS="$tmp_CPPFLAGS"
553 LDFLAGS="$tmp_LDFLAGS"
560 # Memory manager debugging.
561 AC_ARG_ENABLE([mm-debug],
562 AS_HELP_STRING([--enable-mm-debug],
563 [include memory manager debugging]),
564 [AC_DEFINE([MM_DEBUG], [1],
565 [Define to 1 if you enable memory manager debugging.])])
567 AC_ARG_ENABLE([grub-emu-usb],
568 [AS_HELP_STRING([--enable-grub-emu-usb],
569 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
571 AC_ARG_ENABLE([grub-emu-sdl],
572 [AS_HELP_STRING([--enable-grub-emu-sdl],
573 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
575 AC_ARG_ENABLE([grub-emu-pci],
576 [AS_HELP_STRING([--enable-grub-emu-pci],
577 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
579 AC_ARG_ENABLE([grub-emu-modules],
580 [AS_HELP_STRING([--enable-grub-emu-modules],
581 [Support module loading in `grub-emu' debugging utility (default=no)])])
583 if test "$platform" = emu; then
585 [# Check for curses libraries.]
586 AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
587 [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
588 [missing_ncurses=[true]])])
589 AC_SUBST([LIBCURSES])
590 [if [ x"$missing_ncurses" = x ]; then ]
591 [# Check for headers.]
592 AC_CHECK_HEADERS([ncurses/curses.h], [],
593 [AC_CHECK_HEADERS([ncurses.h], [],
594 [AC_CHECK_HEADERS([curses.h], [],
595 [missing_ncurses=[true]])])])
597 if test x"$missing_ncurses" = xtrue ; then
598 AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
601 if test x"$enable_grub_emu_modules" = xyes ; then
604 TARGET_NO_MODULES=yes
606 AC_SUBST(TARGET_NO_MODULES)
608 if test x"$enable_grub_emu_usb" = xno ; then
609 grub_emu_usb_excuse="explicitly disabled"
612 if test x"$enable_grub_emu_pci" = xyes ; then
613 grub_emu_usb_excuse="conflicts with PCI support"
616 [if [ x"$grub_emu_usb_excuse" = x ]; then
617 # Check for libusb libraries.]
618 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
619 [grub_emu_usb_excuse=["need libusb library"]])
622 [if [ x"$grub_emu_usb_excuse" = x ]; then
623 # Check for headers.]
624 AC_CHECK_HEADERS([usb.h], [],
625 [grub_emu_usb_excuse=["need libusb headers"]])
627 if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
628 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
630 if test x"$grub_emu_usb_excuse" = x ; then
631 enable_grub_emu_usb=yes
633 enable_grub_emu_usb=no
636 if test x"$enable_grub_emu_sdl" = xno ; then
637 grub_emu_sdl_excuse="explicitely disabled"
639 [if [ x"$grub_emu_sdl_excuse" = x ]; then
640 # Check for libSDL libraries.]
641 AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
642 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
646 [if [ x"$grub_emu_sdl_excuse" = x ]; then
647 # Check for headers.]
648 AC_CHECK_HEADERS([SDL/SDL.h], [],
649 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
652 if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
653 AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
655 if test x"$grub_emu_sdl_excuse" = x ; then
656 enable_grub_emu_sdl=yes
658 enable_grub_emu_sdl=no
661 if test x"$enable_grub_emu_pci" != xyes ; then
662 grub_emu_pci_excuse="not enabled"
665 if test x"$enable_grub_emu_usb" = xyes ; then
666 grub_emu_pci_excuse="conflicts with USB support"
669 [if [ x"$grub_emu_pci_excuse" = x ]; then
670 # Check for libpci libraries.]
671 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
672 [grub_emu_pci_excuse=["need libpciaccess library"]])
673 AC_SUBST([LIBPCIACCESS])
675 [if [ x"$grub_emu_pci_excuse" = x ]; then
676 # Check for headers.]
677 AC_CHECK_HEADERS([pci/pci.h], [],
678 [grub_emu_pci_excuse=["need libpciaccess headers"]])
681 if test x"$grub_emu_pci_excuse" = x ; then
682 enable_grub_emu_pci=yes
685 enable_grub_emu_pci=no
688 AC_SUBST([enable_grub_emu_sdl])
689 AC_SUBST([enable_grub_emu_usb])
690 AC_SUBST([enable_grub_emu_pci])
693 AC_ARG_ENABLE([grub-fstest],
694 [AS_HELP_STRING([--enable-grub-fstest],
695 [build and install the `grub-fstest' debugging utility (default=guessed)])])
696 if test x"$enable_grub_fstest" = xno ; then
697 grub_fstest_excuse="explicitly disabled"
699 if test x"$grub_fstest_excuse" = x ; then
700 enable_grub_fstest=yes
702 enable_grub_fstest=no
704 AC_SUBST([enable_grub_fstest])
706 AC_ARG_ENABLE([grub-mkfont],
707 [AS_HELP_STRING([--enable-grub-mkfont],
708 [build and install the `grub-mkfont' utility (default=guessed)])])
709 if test x"$enable_grub_mkfont" = xno ; then
710 grub_mkfont_excuse="explicitly disabled"
713 if test x"$grub_mkfont_excuse" = x ; then
714 # Check for freetype libraries.
715 AC_CHECK_PROGS([FREETYPE], [freetype-config])
716 if test "x$FREETYPE" = x ; then
717 grub_mkfont_excuse=["need freetype2 library"]
719 freetype_cflags=`freetype-config --cflags`
720 freetype_libs=`freetype-config --libs`
723 if test x"$grub_mkfont_excuse" = x ; then
724 # Check for freetype libraries.
725 SAVED_CPPFLAGS="$CPPFLAGS"
726 CPPFLAGS="$CPPFLAGS $freetype_cflags"
727 AC_CHECK_HEADERS([ft2build.h], [],
728 [grub_mkfont_excuse=["need freetype2 headers"]])
729 CPPFLAGS="$SAVED_CPPFLAGS"
732 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
733 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
735 if test x"$grub_mkfont_excuse" = x ; then
736 enable_grub_mkfont=yes
738 enable_grub_mkfont=no
740 AC_SUBST([enable_grub_mkfont])
741 AC_SUBST([freetype_cflags])
742 AC_SUBST([freetype_libs])
748 if test x"$link_dir" = xyes ; then
749 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
750 if test "$platform" != emu ; then
751 AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
754 mkdir -p include/grub 2>/dev/null
755 rm -rf include/grub/cpu
756 cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
757 if test "$platform" != emu ; then
758 rm -rf include/grub/machine
759 cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
762 AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
763 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
766 echo "*******************************************************"
767 echo GRUB2 will be compiled with following components:
768 echo Platform: "$target_cpu"-"$platform"
769 if [ x"$platform" = xemu ]; then
770 if [ x"$grub_emu_usb_excuse" = x ]; then
771 echo USB support for grub-emu: Yes
773 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
775 if [ x"$grub_emu_sdl_excuse" = x ]; then
776 echo SDL support for grub-emu: Yes
778 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
780 if [ x"$grub_emu_pci_excuse" = x ]; then
781 echo PCI support for grub-emu: Yes
783 echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
785 if [ x"$TARGET_NO_MODULES" = xno ]; then
786 echo Module support for grub-emu: Yes
788 echo Module support for grub-emu: No
791 if [ x"$enable_mm_debug" = xyes ]; then
792 echo With memory debugging: Yes
794 echo With memory debugging: No
796 if [ x"$efiemu_excuse" = x ]; then
797 echo efiemu runtime: Yes
799 echo efiemu runtime: No "($efiemu_excuse)"
801 if [ x"$grub_fstest_excuse" = x ]; then
802 echo grub-fstest: Yes
804 echo grub-fstest: No "($grub_fstest_excuse)"
806 if [ x"$grub_mkfont_excuse" = x ]; then
807 echo grub-mkfont: Yes
809 echo grub-mkfont: No "($grub_mkfont_excuse)"
811 echo "*******************************************************"