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([YACC], [bison])
174 if test "x$YACC" = x; then
175 AC_MSG_ERROR([bison is not found])
178 for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz /usr/share/fonts/unifont/unifont.pcf.gz; do
179 if test -e $file ; then
180 AC_SUBST([FONT_SOURCE], [$file])
192 if test "x$LEX" = x; then
193 AC_MSG_ERROR([flex is not found])
195 version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
196 if test -n "$version" -a "$version" -ge 20535; then
199 AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
203 # These are not a "must".
204 AC_PATH_PROG(RUBY, ruby)
205 AC_PATH_PROG(MAKEINFO, makeinfo)
208 # Checks for host programs.
213 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
216 AM_GNU_GETTEXT([external])
219 # Identify characteristics of the host architecture.
221 AC_CHECK_SIZEOF(void *)
222 AC_CHECK_SIZEOF(long)
225 if test x$grub_cv_apple_cc = xyes ; then
226 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
227 ASFLAGS="$ASFLAGS -DAPPLE_CC=1"
230 if test "x$cross_compiling" = xyes; then
231 AC_MSG_WARN([cannot generate manual pages while cross compiling])
233 AC_PATH_PROG(HELP2MAN, help2man)
236 # Check for functions.
237 AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
242 AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid)
243 AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h)
244 AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h limits.h)
247 # Check for target programs.
250 # Find tools for the target.
251 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
252 tmp_ac_tool_prefix="$ac_tool_prefix"
253 ac_tool_prefix=$target_alias-
255 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
256 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
257 AC_CHECK_TOOL(OBJCOPY, objcopy)
258 AC_CHECK_TOOL(STRIP, strip)
259 AC_CHECK_TOOL(NM, nm)
261 ac_tool_prefix="$tmp_ac_tool_prefix"
263 if test "x$TARGET_CC" = x; then
266 AC_CHECK_TOOL(OBJCOPY, objcopy)
267 AC_CHECK_TOOL(STRIP, strip)
268 AC_CHECK_TOOL(NM, nm)
273 # Test the C compiler for the target environment.
276 tmp_LDFLAGS="$LDFLAGS"
277 tmp_CPPFLAGS="$CPPFLAGS"
280 CFLAGS="$TARGET_CFLAGS"
281 CPPFLAGS="$TARGET_CPPFLAGS"
282 LDFLAGS="$TARGET_LDFLAGS"
286 TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
287 -Wundef -Wstrict-prototypes -g"
289 # Force no alignment to save space on i386.
290 if test "x$target_cpu" = xi386; then
291 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
292 CFLAGS="$CFLAGS -falign-loops=1"
293 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
294 [grub_cv_cc_falign_loop=yes],
295 [grub_cv_cc_falign_loop=no])
298 if test "x$grub_cv_cc_falign_loop" = xyes; then
299 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
301 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
304 # Some toolchains enable these features by default, but they need
305 # registers that aren't set up properly in GRUB.
306 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
309 # By default, GCC 4.4 generates .eh_frame sections containing unwind
310 # information in some cases where it previously did not. GRUB doesn't need
311 # these and they just use up vital space. Restore the old compiler
313 AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
314 SAVE_CFLAGS="$CFLAGS"
315 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
316 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
317 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
318 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
319 CFLAGS="$SAVE_CFLAGS"
322 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
323 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
327 if test x$grub_cv_apple_target_cc = xyes ; then
328 TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions"
329 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
330 TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
332 AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
333 if test "x$OBJCONV" = x ; then
334 AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
336 if test "x$OBJCONV" = x ; then
337 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
340 TARGET_IMG_CFLAGS="-static"
341 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
342 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
345 # Use linker script if present, otherwise use builtin -N script.
346 if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
347 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
348 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext,"
349 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
352 TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
353 TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,'
358 AC_SUBST(TARGET_IMG_LDSCRIPT)
359 AC_SUBST(TARGET_IMG_LDFLAGS)
360 AC_SUBST(TARGET_IMG_CFLAGS)
362 # For platforms where ELF is not the default link format.
363 AC_MSG_CHECKING([for command to convert module to ELF format])
365 cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
368 AC_SUBST(TARGET_OBJ2ELF)
369 AC_MSG_RESULT([$TARGET_OBJ2ELF])
372 if test "x$target_m32" = x1; then
374 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
375 TARGET_ASFLAGS="$TARGET_CFLAGS -m32"
376 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
377 TARGET_MODULE_FORMAT="elf32"
380 if test "x$target_m64" = x1; then
382 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
383 TARGET_ASFLAGS="$TARGET_ASFLAGS -m64"
384 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
385 TARGET_MODULE_FORMAT="elf64"
388 if test "$target_cpu"-"$platform" = x86_64-efi; then
389 # Use large model to support 4G memory
390 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
392 CFLAGS="$CFLAGS -m64 -mcmodel=large"
393 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
394 [grub_cv_cc_mcmodel=yes],
395 [grub_cv_cc_mcmodel=no])
397 if test "x$grub_cv_cc_mcmodel" = xno; then
398 CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1"
399 TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1"
400 AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc])
402 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
405 # EFI writes to stack below %rsp, we must not use the red zone
406 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
407 CFLAGS="$CFLAGS -m64 -mno-red-zone"
408 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
409 [grub_cv_cc_no_red_zone=yes],
410 [grub_cv_cc_no_red_zone=no])
412 if test "x$grub_cv_cc_no_red_zone" = xno; then
413 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
416 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
423 # Need __enable_execute_stack() for nested function trampolines?
424 grub_CHECK_ENABLE_EXECUTE_STACK
426 # Position independent executable.
428 [# Need that, because some distributions ship compilers that include
429 # `-fPIE' in the default specs.
430 if [ x"$pie_possible" = xyes ]; then
431 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
434 # Smashing stack protector.
435 grub_CHECK_STACK_PROTECTOR
436 # Need that, because some distributions ship compilers that include
437 # `-fstack-protector' in the default specs.
438 if test "x$ssp_possible" = xyes; then
439 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
441 grub_CHECK_STACK_ARG_PROBE
442 # Cygwin's GCC uses alloca() to probe the stackframe on static
443 # stack allocations above some threshold.
444 if test x"$sap_possible" = xyes; then
445 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
448 AC_ARG_ENABLE([werror],
449 [AS_HELP_STRING([--disable-werror],
450 [do not use -Werror when building GRUB])])
451 if test x"$enable_werror" != xno ; then
452 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
455 AC_SUBST(TARGET_CFLAGS)
456 AC_SUBST(TARGET_MODULE_FORMAT)
458 AC_SUBST(TARGET_APPLE_CC)
459 AC_SUBST(TARGET_ASFLAGS)
460 AC_SUBST(TARGET_CPPFLAGS)
461 AC_SUBST(TARGET_LDFLAGS)
463 # Set them to their new values for the tests below.
465 if test "x$TARGET_APPLE_CC" = x1 ; then
466 CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
468 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wl,--defsym,abort=main -Wno-error"
470 CPPFLAGS="$TARGET_CPPFLAGS"
471 LDFLAGS="$TARGET_LDFLAGS"
474 # Check for libgcc symbols
475 AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
477 if test "x$TARGET_APPLE_CC" = x1 ; then
478 CFLAGS="$TARGET_CFLAGS -nostdlib"
480 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
484 # Defined in aclocal.m4.
486 if test "x$TARGET_APPLE_CC" != x1 ; then
487 grub_PROG_OBJCOPY_ABSOLUTE
489 grub_PROG_LD_BUILD_ID_NONE
491 if test "x$target_cpu" = xi386; then
492 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
493 # Check symbols provided by linker script.
494 CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100"
496 if test "x$TARGET_APPLE_CC" != x1 ; then
497 grub_CHECK_BSS_START_SYMBOL
498 grub_CHECK_END_SYMBOL
500 CFLAGS="$TARGET_CFLAGS"
501 grub_I386_ASM_PREFIX_REQUIREMENT
503 grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
505 AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
508 AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
509 #define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
511 #define NESTED_FUNC_ATTR
514 AC_ARG_ENABLE([efiemu],
515 [AS_HELP_STRING([--enable-efiemu],
516 [build and install the efiemu runtimes (default=guessed)])])
517 if test x"$enable_efiemu" = xno ; then
518 efiemu_excuse="explicitly disabled"
520 if test x"$efiemu_excuse" = x ; then
521 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
522 CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
523 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
524 [grub_cv_cc_efiemu=yes],
525 [grub_cv_cc_efiemu=no])
527 if test x$grub_cv_cc_efiemu = xno; then
528 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
531 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
532 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
534 if test x"$efiemu_excuse" = x ; then
539 AC_SUBST([enable_efiemu])
541 if test "$platform" != emu; then
542 AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
543 SAVED_CPPFLAGS="$CPPFLAGS"
544 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
545 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
546 int va_arg_func (int fixed, va_list args);]], [[]])],
547 [grub_cv_cc_isystem=yes],
548 [grub_cv_cc_isystem=no])
549 CPPFLAGS="$SAVED_CPPFLAGS"
552 if test x"$grub_cv_cc_isystem" = xyes ; then
553 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
560 CPPFLAGS="$tmp_CPPFLAGS"
561 LDFLAGS="$tmp_LDFLAGS"
568 # Memory manager debugging.
569 AC_ARG_ENABLE([mm-debug],
570 AS_HELP_STRING([--enable-mm-debug],
571 [include memory manager debugging]),
572 [AC_DEFINE([MM_DEBUG], [1],
573 [Define to 1 if you enable memory manager debugging.])])
575 AC_ARG_ENABLE([grub-emu-usb],
576 [AS_HELP_STRING([--enable-grub-emu-usb],
577 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
579 AC_ARG_ENABLE([grub-emu-sdl],
580 [AS_HELP_STRING([--enable-grub-emu-sdl],
581 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
583 AC_ARG_ENABLE([grub-emu-pci],
584 [AS_HELP_STRING([--enable-grub-emu-pci],
585 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
587 if test "$platform" = emu; then
589 [# Check for curses libraries.]
590 AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
591 [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
592 [missing_ncurses=[true]])])
593 AC_SUBST([LIBCURSES])
594 [if [ x"$missing_ncurses" = x ]; then ]
595 [# Check for headers.]
596 AC_CHECK_HEADERS([ncurses/curses.h], [],
597 [AC_CHECK_HEADERS([ncurses.h], [],
598 [AC_CHECK_HEADERS([curses.h], [],
599 [missing_ncurses=[true]])])])
601 if test x"$missing_ncurses" = xtrue ; then
602 AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
605 if test x"$enable_grub_emu_usb" = xno ; then
606 grub_emu_usb_excuse="explicitly disabled"
609 if test x"$enable_grub_emu_pci" = xyes ; then
610 grub_emu_usb_excuse="conflicts with PCI support"
613 [if [ x"$grub_emu_usb_excuse" = x ]; then
614 # Check for libusb libraries.]
615 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
616 [grub_emu_usb_excuse=["need libusb library"]])
619 [if [ x"$grub_emu_usb_excuse" = x ]; then
620 # Check for headers.]
621 AC_CHECK_HEADERS([usb.h], [],
622 [grub_emu_usb_excuse=["need libusb headers"]])
624 if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
625 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
627 if test x"$grub_emu_usb_excuse" = x ; then
628 enable_grub_emu_usb=yes
630 enable_grub_emu_usb=no
633 if test x"$enable_grub_emu_sdl" = xno ; then
634 grub_emu_sdl_excuse="explicitely disabled"
636 [if [ x"$grub_emu_sdl_excuse" = x ]; then
637 # Check for libSDL libraries.]
638 AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
639 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
643 [if [ x"$grub_emu_sdl_excuse" = x ]; then
644 # Check for headers.]
645 AC_CHECK_HEADERS([SDL/SDL.h], [],
646 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
649 if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
650 AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
652 if test x"$grub_emu_sdl_excuse" = x ; then
653 enable_grub_emu_sdl=yes
655 enable_grub_emu_sdl=no
658 if test x"$enable_grub_emu_pci" != xyes ; then
659 grub_emu_pci_excuse="not enabled"
662 if test x"$enable_grub_emu_usb" = xyes ; then
663 grub_emu_pci_excuse="conflicts with USB support"
666 [if [ x"$grub_emu_pci_excuse" = x ]; then
667 # Check for libpci libraries.]
668 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
669 [grub_emu_pci_excuse=["need libpciaccess library"]])
670 AC_SUBST([LIBPCIACCESS])
672 [if [ x"$grub_emu_pci_excuse" = x ]; then
673 # Check for headers.]
674 AC_CHECK_HEADERS([pci/pci.h], [],
675 [grub_emu_pci_excuse=["need libpciaccess headers"]])
678 if test x"$grub_emu_pci_excuse" = x ; then
679 enable_grub_emu_pci=yes
682 enable_grub_emu_pci=no
685 AC_SUBST([enable_grub_emu_sdl])
686 AC_SUBST([enable_grub_emu_usb])
687 AC_SUBST([enable_grub_emu_pci])
690 AC_ARG_ENABLE([grub-fstest],
691 [AS_HELP_STRING([--enable-grub-fstest],
692 [build and install the `grub-fstest' debugging utility (default=guessed)])])
693 if test x"$enable_grub_fstest" = xno ; then
694 grub_fstest_excuse="explicitly disabled"
696 if test x"$grub_fstest_excuse" = x ; then
697 enable_grub_fstest=yes
699 enable_grub_fstest=no
701 AC_SUBST([enable_grub_fstest])
703 AC_ARG_ENABLE([grub-mkfont],
704 [AS_HELP_STRING([--enable-grub-mkfont],
705 [build and install the `grub-mkfont' utility (default=guessed)])])
706 if test x"$enable_grub_mkfont" = xno ; then
707 grub_mkfont_excuse="explicitly disabled"
710 if test x"$grub_mkfont_excuse" = x ; then
711 # Check for freetype libraries.
712 AC_CHECK_PROGS([FREETYPE], [freetype-config])
713 if test "x$FREETYPE" = x ; then
714 grub_mkfont_excuse=["need freetype2 library"]
716 freetype_cflags=`freetype-config --cflags`
717 freetype_libs=`freetype-config --libs`
720 if test x"$grub_mkfont_excuse" = x ; then
721 # Check for freetype libraries.
722 SAVED_CPPFLAGS="$CPPFLAGS"
723 CPPFLAGS="$CPPFLAGS $freetype_cflags"
724 AC_CHECK_HEADERS([ft2build.h], [],
725 [grub_mkfont_excuse=["need freetype2 headers"]])
726 CPPFLAGS="$SAVED_CPPFLAGS"
729 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
730 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
732 if test x"$grub_mkfont_excuse" = x ; then
733 enable_grub_mkfont=yes
735 enable_grub_mkfont=no
737 AC_SUBST([enable_grub_mkfont])
738 AC_SUBST([freetype_cflags])
739 AC_SUBST([freetype_libs])
745 if test x"$link_dir" = xyes ; then
746 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
747 if test "$platform" != emu ; then
748 AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
751 mkdir -p include/grub 2>/dev/null
752 rm -rf include/grub/cpu
753 cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
754 if test "$platform" != emu ; then
755 rm -rf include/grub/machine
756 cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
759 AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
760 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
763 echo "*******************************************************"
764 echo GRUB2 will be compiled with following components:
765 echo Platform: "$target_cpu"-"$platform"
766 if [ x"$platform" = xemu ]; then
767 if [ x"$grub_emu_usb_excuse" = x ]; then
768 echo USB support for grub-emu: Yes
770 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
772 if [ x"$grub_emu_sdl_excuse" = x ]; then
773 echo SDL support for grub-emu: Yes
775 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
777 if [ x"$grub_emu_pci_excuse" = x ]; then
778 echo PCI support for grub-emu: Yes
780 echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
783 if [ x"$enable_mm_debug" = xyes ]; then
784 echo With memory debugging: Yes
786 echo With memory debugging: No
788 if [ x"$efiemu_excuse" = x ]; then
789 echo efiemu runtime: Yes
791 echo efiemu runtime: No "($efiemu_excuse)"
793 if [ x"$grub_fstest_excuse" = x ]; then
794 echo grub-fstest: Yes
796 echo grub-fstest: No "($grub_fstest_excuse)"
798 if [ x"$grub_mkfont_excuse" = x ]; then
799 echo grub-mkfont: Yes
801 echo grub-mkfont: No "($grub_mkfont_excuse)"
803 echo "*******************************************************"