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
94 x86_64-*) target_cpu=i386 ;;
95 powerpc64-ieee1275) target_cpu=powerpc ;;
99 # Check if the platform is supported, make final adjustments.
100 case "$target_cpu"-"$platform" in
105 i386-linuxbios) platform=coreboot ;;
113 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
116 case "$target_cpu" in
117 i386 | powerpc) target_m32=1 ;;
118 x86_64 | sparc64) target_m64=1 ;;
122 mingw32*) host_os=cygwin ;;
125 # This normalizes the names, and creates a new variable ("host_kernel")
126 # while at it, since the mapping is not always 1:1 (e.g. different OSes
127 # using the same kernel type).
129 gnu*) host_kernel=hurd ;;
130 linux*) host_kernel=linux ;;
131 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
132 cygwin) host_kernel=windows ;;
136 coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
137 efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
138 ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
139 qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
140 pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
141 emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
142 yeeloong) machine_CFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
143 qemu-mips) machine_CFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
145 CFLAGS="$CFLAGS $machine_CFLAGS"
146 TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
147 TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
151 AC_SUBST(host_kernel)
157 # Checks for build programs.
160 # Although cmp is listed in the GNU Coding Standards as a command which
161 # can used directly, OpenBSD lacks cmp in the default installation.
162 AC_CHECK_PROGS([CMP], [cmp])
163 if test "x$CMP" = x; then
164 AC_MSG_ERROR([cmp is not found])
167 AC_CHECK_PROGS([YACC], [bison])
168 if test "x$YACC" = x; then
169 AC_MSG_ERROR([bison is not found])
172 for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz /usr/share/fonts/unifont/unifont.pcf.gz; do
173 if test -e $file ; then
174 AC_SUBST([FONT_SOURCE], [$file])
184 # These are not a "must".
185 AC_PATH_PROG(RUBY, ruby)
186 AC_PATH_PROG(MAKEINFO, makeinfo)
189 # Checks for host programs.
194 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
197 AM_GNU_GETTEXT([external])
200 # Identify characteristics of the host architecture.
202 AC_CHECK_SIZEOF(void *)
203 AC_CHECK_SIZEOF(long)
206 if test x$grub_cv_apple_cc = xyes ; then
207 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
208 ASFLAGS="$ASFLAGS -DAPPLE_CC=1"
211 if test "x$cross_compiling" = xyes; then
212 AC_MSG_WARN([cannot generate manual pages while cross compiling])
214 AC_PATH_PROG(HELP2MAN, help2man)
217 # Check for functions.
218 AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
223 AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid)
224 AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h)
225 AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h limits.h)
228 # Check for target programs.
231 # Find tools for the target.
232 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
233 tmp_ac_tool_prefix="$ac_tool_prefix"
234 ac_tool_prefix=$target_alias-
236 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
237 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
238 AC_CHECK_TOOL(OBJCOPY, objcopy)
239 AC_CHECK_TOOL(STRIP, strip)
240 AC_CHECK_TOOL(NM, nm)
242 ac_tool_prefix="$tmp_ac_tool_prefix"
244 if test "x$TARGET_CC" = x; then
247 AC_CHECK_TOOL(OBJCOPY, objcopy)
248 AC_CHECK_TOOL(STRIP, strip)
249 AC_CHECK_TOOL(NM, nm)
254 # Test the C compiler for the target environment.
257 tmp_LDFLAGS="$LDFLAGS"
258 tmp_CPPFLAGS="$CPPFLAGS"
261 CFLAGS="$TARGET_CFLAGS"
262 CPPFLAGS="$TARGET_CPPFLAGS"
263 LDFLAGS="$TARGET_LDFLAGS"
267 TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
268 -Wundef -Wstrict-prototypes -g"
270 # Force no alignment to save space on i386.
271 if test "x$target_cpu" = xi386; then
272 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
273 CFLAGS="$CFLAGS -falign-loops=1"
274 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
275 [grub_cv_cc_falign_loop=yes],
276 [grub_cv_cc_falign_loop=no])
279 if test "x$grub_cv_cc_falign_loop" = xyes; then
280 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
282 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
285 # Some toolchains enable these features by default, but they need
286 # registers that aren't set up properly in GRUB.
287 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
290 # By default, GCC 4.4 generates .eh_frame sections containing unwind
291 # information in some cases where it previously did not. GRUB doesn't need
292 # these and they just use up vital space. Restore the old compiler
294 AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
295 SAVE_CFLAGS="$CFLAGS"
296 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
297 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
298 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
299 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
300 CFLAGS="$SAVE_CFLAGS"
303 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
304 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
308 if test x$grub_cv_apple_target_cc = xyes ; then
309 TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions"
310 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
311 TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
313 AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
314 if test "x$OBJCONV" = x ; then
315 AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
317 if test "x$OBJCONV" = x ; then
318 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
321 TARGET_IMG_CFLAGS="-static"
322 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
323 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
326 # Use linker script if present, otherwise use builtin -N script.
327 if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
328 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
329 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext,"
330 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
333 TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
334 TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,'
339 AC_SUBST(TARGET_IMG_LDSCRIPT)
340 AC_SUBST(TARGET_IMG_LDFLAGS)
341 AC_SUBST(TARGET_IMG_CFLAGS)
343 # For platforms where ELF is not the default link format.
344 AC_MSG_CHECKING([for command to convert module to ELF format])
346 cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
349 AC_SUBST(TARGET_OBJ2ELF)
350 AC_MSG_RESULT([$TARGET_OBJ2ELF])
353 if test "x$target_m32" = x1; then
355 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
356 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
357 TARGET_MODULE_FORMAT="elf32"
360 if test "x$target_m64" = x1; then
362 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
363 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
364 TARGET_MODULE_FORMAT="elf64"
367 if test "$target_cpu"-"$platform" = x86_64-efi; then
368 # Use large model to support 4G memory
369 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
371 CFLAGS="$CFLAGS -m64 -mcmodel=large"
372 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
373 [grub_cv_cc_mcmodel=yes],
374 [grub_cv_cc_mcmodel=no])
376 if test "x$grub_cv_cc_mcmodel" = xno; then
377 CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1"
378 TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1"
379 AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc])
381 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
384 # EFI writes to stack below %rsp, we must not use the red zone
385 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
386 CFLAGS="$CFLAGS -m64 -mno-red-zone"
387 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
388 [grub_cv_cc_no_red_zone=yes],
389 [grub_cv_cc_no_red_zone=no])
391 if test "x$grub_cv_cc_no_red_zone" = xno; then
392 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
395 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
402 # Need __enable_execute_stack() for nested function trampolines?
403 grub_CHECK_ENABLE_EXECUTE_STACK
405 # Position independent executable.
407 [# Need that, because some distributions ship compilers that include
408 # `-fPIE' in the default specs.
409 if [ x"$pie_possible" = xyes ]; then
410 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
413 # Smashing stack protector.
414 grub_CHECK_STACK_PROTECTOR
415 # Need that, because some distributions ship compilers that include
416 # `-fstack-protector' in the default specs.
417 if test "x$ssp_possible" = xyes; then
418 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
420 grub_CHECK_STACK_ARG_PROBE
421 # Cygwin's GCC uses alloca() to probe the stackframe on static
422 # stack allocations above some threshold.
423 if test x"$sap_possible" = xyes; then
424 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
427 AC_ARG_ENABLE([werror],
428 [AS_HELP_STRING([--disable-werror],
429 [do not use -Werror when building GRUB])])
430 if test x"$enable_werror" != xno ; then
431 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
434 AC_SUBST(TARGET_CFLAGS)
435 AC_SUBST(TARGET_MODULE_FORMAT)
437 AC_SUBST(TARGET_APPLE_CC)
438 AC_SUBST(TARGET_ASFLAGS)
439 AC_SUBST(TARGET_CPPFLAGS)
440 AC_SUBST(TARGET_LDFLAGS)
442 # Set them to their new values for the tests below.
444 if test "x$TARGET_APPLE_CC" = x1 ; then
445 CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
447 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wl,--defsym,abort=main -Wno-error"
449 CPPFLAGS="$TARGET_CPPFLAGS"
450 LDFLAGS="$TARGET_LDFLAGS"
453 # Check for libgcc symbols
454 AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
456 if test "x$TARGET_APPLE_CC" = x1 ; then
457 CFLAGS="$TARGET_CFLAGS -nostdlib"
459 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
463 # Defined in aclocal.m4.
465 if test "x$TARGET_APPLE_CC" != x1 ; then
466 grub_PROG_OBJCOPY_ABSOLUTE
468 grub_PROG_LD_BUILD_ID_NONE
470 if test "x$target_cpu" = xi386; then
471 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
472 # Check symbols provided by linker script.
473 CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100"
475 if test "x$TARGET_APPLE_CC" != x1 ; then
476 grub_CHECK_BSS_START_SYMBOL
477 grub_CHECK_END_SYMBOL
479 CFLAGS="$TARGET_CFLAGS"
480 grub_I386_ASM_PREFIX_REQUIREMENT
482 grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
484 AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
487 AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
488 #define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
490 #define NESTED_FUNC_ATTR
493 AC_ARG_ENABLE([efiemu],
494 [AS_HELP_STRING([--enable-efiemu],
495 [build and install the efiemu runtimes (default=guessed)])])
496 if test x"$enable_efiemu" = xno ; then
497 efiemu_excuse="explicitly disabled"
499 if test x"$efiemu_excuse" = x ; then
500 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
501 CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
502 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
503 [grub_cv_cc_efiemu=yes],
504 [grub_cv_cc_efiemu=no])
506 if test x$grub_cv_cc_efiemu = xno; then
507 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
510 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
511 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
513 if test x"$efiemu_excuse" = x ; then
518 AC_SUBST([enable_efiemu])
520 AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
521 SAVED_CPPFLAGS="$CPPFLAGS"
522 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
523 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
524 int va_arg_func (int fixed, va_list args);]], [[]])],
525 [grub_cv_cc_isystem=yes],
526 [grub_cv_cc_isystem=no])
527 CPPFLAGS="$SAVED_CPPFLAGS"
530 if test x"$grub_cv_cc_isystem" = xyes ; then
531 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
537 CPPFLAGS="$tmp_CPPFLAGS"
538 LDFLAGS="$tmp_LDFLAGS"
545 # Memory manager debugging.
546 AC_ARG_ENABLE([mm-debug],
547 AS_HELP_STRING([--enable-mm-debug],
548 [include memory manager debugging]),
549 [AC_DEFINE([MM_DEBUG], [1],
550 [Define to 1 if you enable memory manager debugging.])])
552 AC_ARG_ENABLE([grub-emu-usb],
553 [AS_HELP_STRING([--enable-grub-emu-usb],
554 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
556 AC_ARG_ENABLE([grub-emu-sdl],
557 [AS_HELP_STRING([--enable-grub-emu-sdl],
558 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
560 AC_ARG_ENABLE([grub-emu-pci],
561 [AS_HELP_STRING([--enable-grub-emu-pci],
562 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
564 if test "$platform" = emu; then
566 [# Check for curses libraries.]
567 AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
568 [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
569 [missing_ncurses=[true]])])
570 AC_SUBST([LIBCURSES])
571 [if [ x"$missing_ncurses" = x ]; then ]
572 [# Check for headers.]
573 AC_CHECK_HEADERS([ncurses/curses.h], [],
574 [AC_CHECK_HEADERS([ncurses.h], [],
575 [AC_CHECK_HEADERS([curses.h], [],
576 [missing_ncurses=[true]])])])
578 if test x"$missing_ncurses" = xtrue ; then
579 AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
582 if test x"$enable_grub_emu_usb" = xno ; then
583 grub_emu_usb_excuse="explicitly disabled"
586 if test x"$enable_grub_emu_pci" = xyes ; then
587 grub_emu_usb_excuse="conflicts with PCI support"
590 [if [ x"$grub_emu_usb_excuse" = x ]; then
591 # Check for libusb libraries.]
592 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
593 [grub_emu_usb_excuse=["need libusb library"]])
596 [if [ x"$grub_emu_usb_excuse" = x ]; then
597 # Check for headers.]
598 AC_CHECK_HEADERS([usb.h], [],
599 [grub_emu_usb_excuse=["need libusb headers"]])
601 if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
602 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
604 if test x"$grub_emu_usb_excuse" = x ; then
605 enable_grub_emu_usb=yes
607 enable_grub_emu_usb=no
610 if test x"$enable_grub_emu_sdl" = xno ; then
611 grub_emu_sdl_excuse="explicitely disabled"
613 [if [ x"$grub_emu_sdl_excuse" = x ]; then
614 # Check for libSDL libraries.]
615 AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
616 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
620 [if [ x"$grub_emu_sdl_excuse" = x ]; then
621 # Check for headers.]
622 AC_CHECK_HEADERS([SDL/SDL.h], [],
623 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
626 if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
627 AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
629 if test x"$grub_emu_sdl_excuse" = x ; then
630 enable_grub_emu_sdl=yes
632 enable_grub_emu_sdl=no
635 if test x"$enable_grub_emu_pci" != xyes ; then
636 grub_emu_pci_excuse="not enabled"
639 if test x"$enable_grub_emu_usb" = xyes ; then
640 grub_emu_pci_excuse="conflicts with USB support"
643 [if [ x"$grub_emu_pci_excuse" = x ]; then
644 # Check for libpci libraries.]
645 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
646 [grub_emu_pci_excuse=["need libpciaccess library"]])
647 AC_SUBST([LIBPCIACCESS])
649 [if [ x"$grub_emu_pci_excuse" = x ]; then
650 # Check for headers.]
651 AC_CHECK_HEADERS([pci/pci.h], [],
652 [grub_emu_pci_excuse=["need libpciaccess headers"]])
655 if test x"$grub_emu_pci_excuse" = x ; then
656 enable_grub_emu_pci=yes
659 enable_grub_emu_pci=no
662 AC_SUBST([enable_grub_emu_sdl])
663 AC_SUBST([enable_grub_emu_usb])
664 AC_SUBST([enable_grub_emu_pci])
667 AC_ARG_ENABLE([grub-fstest],
668 [AS_HELP_STRING([--enable-grub-fstest],
669 [build and install the `grub-fstest' debugging utility (default=guessed)])])
670 if test x"$enable_grub_fstest" = xno ; then
671 grub_fstest_excuse="explicitly disabled"
673 if test x"$grub_fstest_excuse" = x ; then
674 enable_grub_fstest=yes
676 enable_grub_fstest=no
678 AC_SUBST([enable_grub_fstest])
680 AC_ARG_ENABLE([grub-mkfont],
681 [AS_HELP_STRING([--enable-grub-mkfont],
682 [build and install the `grub-mkfont' utility (default=guessed)])])
683 if test x"$enable_grub_mkfont" = xno ; then
684 grub_mkfont_excuse="explicitly disabled"
687 if test x"$grub_mkfont_excuse" = x ; then
688 # Check for freetype libraries.
689 AC_CHECK_PROGS([FREETYPE], [freetype-config])
690 if test "x$FREETYPE" = x ; then
691 grub_mkfont_excuse=["need freetype2 library"]
693 freetype_cflags=`freetype-config --cflags`
694 freetype_libs=`freetype-config --libs`
697 if test x"$grub_mkfont_excuse" = x ; then
698 # Check for freetype libraries.
699 SAVED_CPPFLAGS="$CPPFLAGS"
700 CPPFLAGS="$CPPFLAGS $freetype_cflags"
701 AC_CHECK_HEADERS([ft2build.h], [],
702 [grub_mkfont_excuse=["need freetype2 headers"]])
703 CPPFLAGS="$SAVED_CPPFLAGS"
706 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
707 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
709 if test x"$grub_mkfont_excuse" = x ; then
710 enable_grub_mkfont=yes
712 enable_grub_mkfont=no
714 AC_SUBST([enable_grub_mkfont])
715 AC_SUBST([freetype_cflags])
716 AC_SUBST([freetype_libs])
722 if test x"$link_dir" = xyes ; then
723 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
724 if test "$platform" != emu ; then
725 AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
728 mkdir -p include/grub 2>/dev/null
729 rm -rf include/grub/cpu
730 cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
731 if test "$platform" != emu ; then
732 rm -rf include/grub/machine
733 cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
736 AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
737 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
740 echo "*******************************************************"
741 echo GRUB2 will be compiled with following components:
742 echo Platform: "$target_cpu"-"$platform"
743 if [ x"$platform" = xemu ]; then
744 if [ x"$grub_emu_usb_excuse" = x ]; then
745 echo USB support for grub-emu: Yes
747 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
749 if [ x"$grub_emu_sdl_excuse" = x ]; then
750 echo SDL support for grub-emu: Yes
752 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
754 if [ x"$grub_emu_pci_excuse" = x ]; then
755 echo PCI support for grub-emu: Yes
757 echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
760 if [ x"$enable_mm_debug" = xyes ]; then
761 echo With memory debugging: Yes
763 echo With memory debugging: No
765 if [ x"$efiemu_excuse" = x ]; then
766 echo efiemu runtime: Yes
768 echo efiemu runtime: No "($efiemu_excuse)"
770 if [ x"$grub_fstest_excuse" = x ]; then
771 echo grub-fstest: Yes
773 echo grub-fstest: No "($grub_fstest_excuse)"
775 if [ x"$grub_mkfont_excuse" = x ]; then
776 echo grub-mkfont: Yes
778 echo grub-mkfont: No "($grub_mkfont_excuse)"
780 echo "*******************************************************"