3 # Process this file with autoconf to produce a configure script.
5 # Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
7 # This configure.ac is free software; the author
8 # gives unlimited permission to copy and/or distribute it,
9 # with or without modifications, as long as this notice is preserved.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
13 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
16 dnl This configure script is complicated, because GRUB needs to deal
17 dnl with three potentially different types:
19 dnl build -- the environment for building GRUB
20 dnl host -- the environment for running utilities
21 dnl target -- the environment for running GRUB
23 dnl In addition, GRUB needs to deal with a platform specification
24 dnl which specifies the system running GRUB, such as firmware.
25 dnl This is necessary because the target type in autoconf does not
26 dnl describe such a system very well.
28 dnl The current strategy is to use variables with no prefix (such as
29 dnl CC, CFLAGS, etc.) for the host type as well as the build type,
30 dnl because GRUB does not need to use those variables for the build
31 dnl type, so there is no conflict. Variables with the prefix "TARGET_"
32 dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
35 AC_INIT([GRUB],[2.00],[bug-grub@gnu.org])
37 AC_CONFIG_AUX_DIR([build-aux])
39 # We don't want -g -O2 by default in CFLAGS
42 # Checks for host and target systems.
44 save_program_prefix="${program_prefix}"
46 program_prefix="${save_program_prefix}"
48 AM_INIT_AUTOMAKE([1.10.1])
50 AC_CONFIG_SRCDIR([include/grub/dl.h])
51 AC_CONFIG_HEADER([config-util.h])
53 # Program name transformations
55 grub_TRANSFORM([grub-bios-setup])
56 grub_TRANSFORM([grub-editenv])
57 grub_TRANSFORM([grub-install])
58 grub_TRANSFORM([grub-mkconfig])
59 grub_TRANSFORM([grub-mkfont])
60 grub_TRANSFORM([grub-mkimage])
61 grub_TRANSFORM([grub-glue-efi])
62 grub_TRANSFORM([grub-mklayout])
63 grub_TRANSFORM([grub-mkpasswd-pbkdf2])
64 grub_TRANSFORM([grub-mkrelpath])
65 grub_TRANSFORM([grub-mkrescue])
66 grub_TRANSFORM([grub-probe])
67 grub_TRANSFORM([grub-reboot])
68 grub_TRANSFORM([grub-script-check])
69 grub_TRANSFORM([grub-set-default])
70 grub_TRANSFORM([grub-sparc64-setup])
71 grub_TRANSFORM([grub-render-label])
73 # Optimization flag. Allow user to override.
74 if test "x$TARGET_CFLAGS" = x; then
75 TARGET_CFLAGS="$TARGET_CFLAGS -Os"
78 BUILD_CPPFLAGS="$BUILD_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
80 # Default HOST_CPPFLAGS
81 HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
82 HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
83 HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
84 HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_LIBDIR=\\\"\$(pkglibdir)\\\""
85 HOST_CPPFLAGS="$HOST_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
87 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
88 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
89 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
92 i[[3456]]86) target_cpu=i386 ;;
93 amd64) target_cpu=x86_64 ;;
94 sparc) target_cpu=sparc64 ;;
97 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
101 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1";
108 # Specify the platform (such as firmware).
109 AC_ARG_WITH([platform],
110 AS_HELP_STRING([--with-platform=PLATFORM],
111 [select the host platform [[guessed]]]))
113 # Guess the platform if not specified.
114 if test "x$with_platform" = x; then
115 case "$target_cpu"-"$target_vendor" in
116 i386-apple) platform=efi ;;
117 i386-*) platform=pc ;;
118 x86_64-apple) platform=efi ;;
119 x86_64-*) platform=pc ;;
120 powerpc-*) platform=ieee1275 ;;
121 powerpc64-*) platform=ieee1275 ;;
122 sparc64-*) platform=ieee1275 ;;
123 mipsel-*) platform=loongson ;;
124 mips-*) platform=arc ;;
125 ia64-*) platform=efi ;;
126 arm-*) platform=uboot ;;
127 *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
130 platform="$with_platform"
133 case "$target_cpu"-"$platform" in
137 x86_64-*) target_cpu=i386 ;;
138 powerpc64-ieee1275) target_cpu=powerpc ;;
141 # Check if the platform is supported, make final adjustments.
142 case "$target_cpu"-"$platform" in
150 i386-linuxbios) platform=coreboot ;;
157 mips-qemu-mips) platform=qemu_mips;;
161 mipsel-qemu-mips) platform=qemu_mips;;
162 mipsel-yeeloong) platform=loongson ;;
163 mipsel-fuloong) platform=loongson ;;
168 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
171 if test x$platform != xemu ; then
172 case "$target_cpu" in
173 i386 | powerpc) target_m32=1 ;;
174 x86_64 | sparc64) target_m64=1 ;;
179 windows* | mingw32*) target_os=cygwin ;;
182 # This normalizes the names, and creates a new variable ("host_kernel")
183 # while at it, since the mapping is not always 1:1 (e.g. different OSes
184 # using the same kernel type).
186 gnu*) host_kernel=hurd ;;
187 linux*) host_kernel=linux ;;
188 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
189 netbsd*) host_kernel=netbsd ;;
190 solaris*) host_kernel=illumos ;;
191 darwin*) host_kernel=xnu ;;
192 cygwin | windows* | mingw32*) host_kernel=windows ;;
196 coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
197 multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
198 efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
199 xen) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XEN=1" ;;
200 ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
201 uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;;
202 qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
203 pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
204 emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
205 loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
206 qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
207 arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
209 case "$target_cpu" in
210 arm) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARM=1" ;;
211 mips |mipsel) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
212 sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
214 if test x${target_cpu} = xmipsel ; then
215 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
217 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,` -DGRUB_TARGET_CPU_`echo ${target_cpu} | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`=1"
220 case "${target_cpu}-$platform" in
222 TARGET_LINK_ADDR=0x88200000
223 TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000
226 TARGET_LINK_ADDR=0x80700000
227 TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000
229 mips*-qemu_mips | mips*-loongson)
230 TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000
234 AC_SUBST(TARGET_LINK_ADDR)
235 AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR)
237 TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
241 AC_SUBST(host_kernel)
246 # Define default variables
249 AC_ARG_WITH([bootdir],
250 AS_HELP_STRING([--with-bootdir=DIR],
251 [set the name of /boot directory [[guessed]]]),
252 [have_with_bootdir=y],
253 [have_with_bootdir=n])
254 if test x$have_with_bootdir = xy; then
255 bootdirname="$with_bootdir"
259 # Because /boot is used for the boot block in NetBSD and OpenBSD,
261 *) bootdirname='boot' ;;
265 AC_SUBST(bootdirname)
266 AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
267 [Default boot directory name]")
269 AC_ARG_WITH([grubdir],
270 AS_HELP_STRING([--with-grubdir=DIR],
271 [set the name of grub directory [[guessed]]]),
272 [grubdirname="$with_grubdir"],
273 [grubdirname="$PACKAGE"])
275 AC_SUBST(grubdirname)
276 AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
277 [Default grub directory name])
280 # Checks for build programs.
283 # Although cmp is listed in the GNU Coding Standards as a command which
284 # can used directly, OpenBSD lacks cmp in the default installation.
285 AC_CHECK_PROGS([CMP], [cmp])
286 if test "x$CMP" = x; then
287 AC_MSG_ERROR([cmp is not found])
290 AC_CHECK_PROGS([YACC], [bison])
291 if test "x$YACC" = x; then
292 AC_MSG_ERROR([bison is not found])
304 if test "x$LEX" = "x:"; then
305 AC_MSG_ERROR([flex is not found])
307 version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
308 if test -n "$version" -a "$version" -ge 20535; then
311 AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
315 # These are not a "must".
316 AC_PATH_PROGS(MAKEINFO, makeinfo true)
319 # Checks for host programs.
329 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
331 AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
334 AM_GNU_GETTEXT([external])
337 # Identify characteristics of the host architecture.
338 unset ac_cv_c_bigendian
341 AC_CHECK_SIZEOF(void *)
342 AC_CHECK_SIZEOF(long)
345 cygwin | windows* | mingw32*)
346 HOST_CPPFLAGS="$HOST_CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
347 CPPFLAGS="$CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
348 AC_CHECK_SIZEOF(TCHAR,,[#include <windows.h>])
352 if test x$USE_NLS = xno; then
353 HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
356 if test "x$cross_compiling" = xyes; then
357 AC_MSG_WARN([cannot generate manual pages while cross compiling])
359 AC_PATH_PROG(HELP2MAN, help2man)
362 # Check for functions and headers.
363 AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
364 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
366 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
367 #include <sys/param.h>
368 #include <sys/mount.h>])
370 AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default
371 #include <sys/param.h>
372 #include <sys/mount.h>])
374 # For opendisk() and getrawpartition() on NetBSD.
375 # Used in util/deviceiter.c and in util/hostdisk.c.
376 AC_CHECK_HEADER([util.h], [
377 AC_CHECK_LIB([util], [opendisk], [
379 AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
381 AC_CHECK_LIB([util], [getrawpartition], [
383 AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
388 AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
389 SAVED_CFLAGS="$CFLAGS"
390 CFLAGS="$HOST_CFLAGS -Wtrampolines -Werror"
391 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
392 int va_arg_func (int fixed, va_list args);]], [[]])],
393 [grub_cv_host_cc_wtrampolines=yes],
394 [grub_cv_host_cc_wtrampolines=no])
395 CFLAGS="$SAVED_CFLAGS"
398 if test x"$grub_host_cv_cc_wtrampolines" = xyes ; then
399 HOST_CFLAGS="$HOST_CFLAGS -Wtrampolines"
403 # Check for host and build compilers.
406 AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc])
407 test -z "$BUILD_CC" && AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])
408 BUILD_CPP="$BUILD_CC -E"
411 haiku*) BUILD_LIBM= ;;
418 # Check for target programs.
421 # Find tools for the target.
422 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
423 tmp_ac_tool_prefix="$ac_tool_prefix"
424 ac_tool_prefix=$target_alias-
426 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
427 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
428 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
429 AC_CHECK_TOOL(TARGET_STRIP, strip)
430 AC_CHECK_TOOL(TARGET_NM, nm)
431 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
433 ac_tool_prefix="$tmp_ac_tool_prefix"
435 if test "x$TARGET_CC" = x; then
438 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
439 AC_CHECK_TOOL(TARGET_STRIP, strip)
440 AC_CHECK_TOOL(TARGET_NM, nm)
441 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
446 AC_SUBST(BUILD_CFLAGS)
447 AC_SUBST(BUILD_CPPFLAGS)
450 AC_SUBST(TARGET_RANLIB)
451 AC_SUBST(TARGET_STRIP)
452 AC_SUBST(TARGET_OBJCOPY)
454 # Test the C compiler for the target environment.
457 tmp_LDFLAGS="$LDFLAGS"
458 tmp_CPPFLAGS="$CPPFLAGS"
461 CFLAGS="$TARGET_CFLAGS"
462 CPPFLAGS="$TARGET_CPPFLAGS"
463 LDFLAGS="$TARGET_LDFLAGS"
467 WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Wattributes -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
468 HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"
469 TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
470 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
472 if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then
473 TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align"
476 AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang]
478 [AC_LANG_PROGRAM([], [[
483 [grub_cv_cc_target_clang=no], [grub_cv_cc_target_clang=yes])])
485 # on x86 clang doesn't support .code16
486 # on arm clang doesn't support .arch directive
487 if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 || test "x$target_cpu" = xarm ); then
488 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
491 if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
492 TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
495 if test "x$target_m32" = x1; then
497 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
498 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
499 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
500 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
501 TARGET_MODULE_FORMAT="elf32"
504 if test "x$target_m64" = x1; then
506 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
507 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
508 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
509 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
510 TARGET_MODULE_FORMAT="elf64"
513 if test "x$grub_cv_cc_target_clang" = xno && test "x$target_cpu" = xi386 && test "x$platform" != xemu && test "x$platform" != xefi; then
514 TARGET_CFLAGS="$TARGET_CFLAGS -mrtd -mregparm=3"
517 # Force no alignment to save space on i386.
518 if test "x$target_cpu" = xi386; then
519 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
520 CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror"
521 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
522 [grub_cv_cc_falign_loop=yes],
523 [grub_cv_cc_falign_loop=no])
526 AC_CACHE_CHECK([whether -malign-loops works], [grub_cv_cc_malign_loop], [
527 CFLAGS="$TARGET_CFLAGS -malign-loops=1 -Werror"
528 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
529 [grub_cv_cc_malign_loop=yes],
530 [grub_cv_cc_malign_loop=no])
533 if test "x$grub_cv_cc_falign_loop" = xyes; then
534 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
535 elif test "x$grub_cv_cc_malign_loop" = xyes; then
536 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
540 AC_CACHE_CHECK([whether -freg-struct-return works], [grub_cv_cc_freg_struct_return], [
541 CFLAGS="$TARGET_CFLAGS -freg-struct-return -Werror"
542 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
543 [grub_cv_cc_freg_struct_return=yes],
544 [grub_cv_cc_freg_struct_return=no])
547 if test "x$grub_cv_cc_freg_struct_return" = xyes; then
548 TARGET_CFLAGS="$TARGET_CFLAGS -freg-struct-return"
551 if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
552 # Some toolchains enable these features by default, but they need
553 # registers that aren't set up properly in GRUB.
554 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
557 # By default, GCC 4.4 generates .eh_frame sections containing unwind
558 # information in some cases where it previously did not. GRUB doesn't need
559 # these and they just use up vital space. Restore the old compiler
561 AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
562 CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
563 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
564 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
565 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
568 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
569 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
572 if test x"$target_os" = xcygwin; then
573 AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [
574 CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
575 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
576 [grub_cv_cc_no_reorder_functions=yes],
577 [grub_cv_cc_no_reorder_functions=no])
581 if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xyes; then
582 TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
585 # By default, GCC 4.6 generates .eh_frame sections containing unwind
586 # information in some cases where it previously did not. GRUB doesn't need
587 # these and they just use up vital space. Restore the old compiler
589 AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
590 CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
591 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
592 [grub_cv_cc_fno_asynchronous_unwind_tables=yes],
593 [grub_cv_cc_fno_asynchronous_unwind_tables=no])
596 if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
597 TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
600 # For platforms where ELF is not the default link format.
601 case "${target_os}" in
603 # FIXME: put proper test here
604 NEED_REGISTER_FRAME_INFO=1
606 *) NEED_REGISTER_FRAME_INFO=0 ;;
610 AC_ARG_ENABLE([efiemu],
611 [AS_HELP_STRING([--enable-efiemu],
612 [build and install the efiemu runtimes (default=guessed)])])
613 if test x"$enable_efiemu" = xno ; then
614 efiemu_excuse="explicitly disabled"
616 if test x"$target_os" = xcygwin ; then
617 efiemu_excuse="not available on cygwin"
619 if test x"$target_cpu" != xi386 ; then
620 efiemu_excuse="only available on i386"
622 if test x"$platform" = xefi ; then
623 efiemu_excuse="not available on efi"
625 if test x"$efiemu_excuse" = x ; then
626 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
627 CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
628 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
629 [grub_cv_cc_efiemu=yes],
630 [grub_cv_cc_efiemu=no])
632 if test x$grub_cv_cc_efiemu = xno; then
633 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
636 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
637 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
639 if test x"$efiemu_excuse" = x ; then
644 AC_SUBST([enable_efiemu])
646 CFLAGS="$TARGET_CFLAGS"
648 if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
649 AC_CACHE_CHECK([for linking format], [grub_cv_target_cc_link_format], [
650 grub_cv_target_cc_link_format=unknown
651 for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -m${target_cpu}pe -arch,${target_cpu}; do
652 if test x${target_cpu} != xi386 && test x$format = x${target_cpu}pe; then
655 CFLAGS="$TARGET_CFLAGS -static"
656 LDFLAGS="$TARGET_LDFLAGS -Wl,$format -nostdlib"
657 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
658 asm (".globl start; start:");
659 asm (".globl _start; _start:");
660 asm (".globl __start; __start:");
662 void __main (void) {}
663 ]], [[]])], [flag=1], [])
664 if test x"$flag" = x1; then
665 grub_cv_target_cc_link_format="$format"
669 if test x"$grub_cv_target_cc_link_format" = xunknown; then
670 AC_MSG_ERROR([no suitable link format found])
672 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
673 if test x"$grub_cv_target_cc_link_format" = x-mi386pe; then
674 TARGET_OBJ2ELF='./build-grub-pe2elf';
678 if test x$grub_cv_target_cc_link_format = x-arch,i386 || test x$grub_cv_target_cc_link_format = x-arch,x86_64; then
679 TARGET_APPLE_LINKER=1
680 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], [])
681 if test "x$TARGET_OBJCONV" = x ; then
682 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.])
684 if test "x$TARGET_OBJCONV" = x ; then
685 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
688 TARGET_IMG_CFLAGS="-static"
689 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
690 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
691 TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
692 TARGET_LDFLAGS_OLDMAGIC=""
693 elif test x$grub_cv_target_cc_link_format = x-mi386pe && test x$platform = xpc; then
694 TARGET_APPLE_LINKER=0
695 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
696 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/i386-pc-cygwin-img-ld.sc"
697 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
698 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/i386-pc-cygwin-img-ld.sc"
699 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
702 TARGET_APPLE_LINKER=0
703 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
705 TARGET_IMG_LDFLAGS='-Wl,-N'
706 TARGET_IMG_LDFLAGS_AC='-Wl,-N'
707 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
711 AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
714 LDFLAGS="$TARGET_LDFLAGS"
716 if test "$target_cpu" = x86_64; then
717 # Use large model to support 4G memory
718 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
719 CFLAGS="$TARGET_CFLAGS -m64 -mcmodel=large"
720 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
721 [grub_cv_cc_mcmodel=yes],
722 [grub_cv_cc_mcmodel=no])
724 if test "x$grub_cv_cc_mcmodel" = xno; then
725 AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
727 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
731 if test "$target_cpu"-"$platform" = x86_64-efi; then
732 # EFI writes to stack below %rsp, we must not use the red zone
733 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
734 CFLAGS="$TARGET_CFLAGS -m64 -mno-red-zone"
735 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
736 [grub_cv_cc_no_red_zone=yes],
737 [grub_cv_cc_no_red_zone=no])
739 if test "x$grub_cv_cc_no_red_zone" = xno; then
740 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
743 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
750 CFLAGS="$TARGET_CFLAGS"
752 # Position independent executable.
754 [# Need that, because some distributions ship compilers that include
755 # `-fPIE' in the default specs.
756 if [ x"$pie_possible" = xyes ]; then
757 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
760 CFLAGS="$TARGET_CFLAGS"
762 # Position independent executable.
764 [# Need that, because some distributions ship compilers that include
765 # `-fPIC' in the default specs.
766 if [ x"$pic_possible" = xyes ]; then
767 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
770 CFLAGS="$TARGET_CFLAGS"
772 # Smashing stack protector.
773 grub_CHECK_STACK_PROTECTOR
774 # Need that, because some distributions ship compilers that include
775 # `-fstack-protector' in the default specs.
776 if test "x$ssp_possible" = xyes; then
777 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
780 CFLAGS="$TARGET_CFLAGS"
782 grub_CHECK_STACK_ARG_PROBE
783 # Cygwin's GCC uses alloca() to probe the stackframe on static
784 # stack allocations above some threshold.
785 if test x"$sap_possible" = xyes; then
786 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
789 CFLAGS="$TARGET_CFLAGS"
791 # -mno-unaligned-access
792 if test "$target_cpu" = arm; then
793 grub_CHECK_NO_UNALIGNED_ACCESS
794 if test x"$nua_possible" = xyes; then
795 TARGET_CFLAGS="$TARGET_CFLAGS -mno-unaligned-access"
799 # Set them to their new values for the tests below.
801 if test "x$TARGET_APPLE_LINKER" = x1 ; then
802 CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
804 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
806 CPPFLAGS="$TARGET_CPPFLAGS"
807 if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes ; then
813 LIBS="$TARGET_LIBGCC"
816 if test "x$TARGET_APPLE_LINKER" = x0 ; then
817 if test x$grub_cv_asm_uscore = xyes; then
818 CFLAGS="$TARGET_CFLAGS -Wl,--defsym,_abort=_main"
820 CFLAGS="$TARGET_CFLAGS -Wl,--defsym,abort=main"
824 # Check for libgcc symbols
825 AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x __ctzdi2 __ctzsi2)
827 if test "x$TARGET_APPLE_LINKER" = x1 ; then
828 CFLAGS="$TARGET_CFLAGS -nostdlib"
830 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
834 # Defined in aclocal.m4.
836 if test "x$TARGET_APPLE_LINKER" != x1 ; then
837 grub_PROG_OBJCOPY_ABSOLUTE
839 grub_PROG_LD_BUILD_ID_NONE
840 if test "x$target_cpu" = xi386; then
841 if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then
842 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
843 # Check symbols provided by linker script.
844 CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},0x8000 -Wl,--defsym,___main=0x8100"
846 grub_CHECK_BSS_START_SYMBOL
847 grub_CHECK_END_SYMBOL
849 CFLAGS="$TARGET_CFLAGS"
850 grub_I386_ASM_PREFIX_REQUIREMENT
856 grub_PROG_NM_DEFINED_ONLY
857 AC_SUBST(TARGET_NMFLAGS_MINUS_P)
858 AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
860 if test "$platform" != emu; then
861 AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
862 SAVED_CPPFLAGS="$CPPFLAGS"
863 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
864 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
866 int va_arg_func (int fixed, va_list args);]], [[]])],
867 [grub_cv_cc_isystem=yes],
868 [grub_cv_cc_isystem=no])
869 CPPFLAGS="$SAVED_CPPFLAGS"
872 if test x"$grub_cv_cc_isystem" = xyes ; then
873 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
877 AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [
878 CFLAGS="$TARGET_CFLAGS -Wtrampolines -Werror"
879 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
880 int va_arg_func (int fixed, va_list args);]], [[]])],
881 [grub_cv_cc_wtrampolines=yes],
882 [grub_cv_cc_wtrampolines=no])
885 if test x"$grub_cv_cc_wtrampolines" = xyes ; then
886 TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines"
892 CPPFLAGS="$tmp_CPPFLAGS"
893 LDFLAGS="$tmp_LDFLAGS"
900 # Memory manager debugging.
901 AC_ARG_ENABLE([mm-debug],
902 AS_HELP_STRING([--enable-mm-debug],
903 [include memory manager debugging]),
904 [AC_DEFINE([MM_DEBUG], [1],
905 [Define to 1 if you enable memory manager debugging.])])
907 AC_ARG_ENABLE([cache-stats],
908 AS_HELP_STRING([--enable-cache-stats],
909 [enable disk cache statistics collection]))
911 if test x$enable_cache_stats = xyes; then
916 AC_SUBST([DISK_CACHE_STATS])
918 AC_ARG_ENABLE([boot-time],
919 AS_HELP_STRING([--enable-boot-time],
920 [enable boot time statistics collection]))
922 if test x$enable_boot_time = xyes; then
927 AC_SUBST([BOOT_TIME_STATS])
929 AC_ARG_ENABLE([grub-emu-usb],
930 [AS_HELP_STRING([--enable-grub-emu-usb],
931 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
933 AC_ARG_ENABLE([grub-emu-sdl],
934 [AS_HELP_STRING([--enable-grub-emu-sdl],
935 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
937 AC_ARG_ENABLE([grub-emu-pci],
938 [AS_HELP_STRING([--enable-grub-emu-pci],
939 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
941 if test "$platform" = emu; then
943 if test x"$enable_grub_emu_usb" != xyes ; then
944 grub_emu_usb_excuse="not enabled"
947 if test x"$enable_grub_emu_pci" = xyes ; then
948 grub_emu_usb_excuse="conflicts with PCI support"
951 [if [ x"$grub_emu_usb_excuse" = x ]; then
952 # Check for libusb libraries.]
953 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
954 [grub_emu_usb_excuse=["need libusb library"]])
957 [if [ x"$grub_emu_usb_excuse" = x ]; then
958 # Check for headers.]
959 AC_CHECK_HEADERS([usb.h], [],
960 [grub_emu_usb_excuse=["need libusb headers"]])
962 if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
963 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
965 if test x"$grub_emu_usb_excuse" = x ; then
966 enable_grub_emu_usb=yes
968 enable_grub_emu_usb=no
971 if test x"$enable_grub_emu_sdl" = xno ; then
972 grub_emu_sdl_excuse="explicitely disabled"
974 [if [ x"$grub_emu_sdl_excuse" = x ]; then
975 # Check for libSDL libraries.]
976 AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
977 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
981 [if [ x"$grub_emu_sdl_excuse" = x ]; then
982 # Check for headers.]
983 AC_CHECK_HEADERS([SDL/SDL.h], [],
984 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
987 if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
988 AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
990 if test x"$grub_emu_sdl_excuse" = x ; then
991 enable_grub_emu_sdl=yes
993 enable_grub_emu_sdl=no
996 if test x"$enable_grub_emu_pci" != xyes ; then
997 grub_emu_pci_excuse="not enabled"
1000 if test x"$enable_grub_emu_usb" = xyes ; then
1001 grub_emu_pci_excuse="conflicts with USB support"
1004 [if [ x"$grub_emu_pci_excuse" = x ]; then
1005 # Check for libpci libraries.]
1006 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
1007 [grub_emu_pci_excuse=["need libpciaccess library"]])
1008 AC_SUBST([LIBPCIACCESS])
1010 [if [ x"$grub_emu_pci_excuse" = x ]; then
1011 # Check for headers.]
1012 AC_CHECK_HEADERS([pci/pci.h], [],
1013 [grub_emu_pci_excuse=["need libpciaccess headers"]])
1016 if test x"$grub_emu_pci_excuse" = x ; then
1017 enable_grub_emu_pci=yes
1020 enable_grub_emu_pci=no
1023 AC_SUBST([enable_grub_emu_sdl])
1024 AC_SUBST([enable_grub_emu_usb])
1025 AC_SUBST([enable_grub_emu_pci])
1029 # Ignore --enable-emu-* if platform is not emu
1030 enable_grub_emu_sdl=no
1031 enable_grub_emu_usb=no
1032 enable_grub_emu_pci=no
1035 AC_ARG_ENABLE([grub-mkfont],
1036 [AS_HELP_STRING([--enable-grub-mkfont],
1037 [build and install the `grub-mkfont' utility (default=guessed)])])
1038 if test x"$enable_grub_mkfont" = xno ; then
1039 grub_mkfont_excuse="explicitly disabled"
1042 if test x"$grub_mkfont_excuse" = x ; then
1043 # Check for freetype libraries.
1044 AC_CHECK_TOOLS([FREETYPE], [freetype-config])
1045 if test "x$FREETYPE" = x ; then
1046 grub_mkfont_excuse=["need freetype2 library"]
1050 unset ac_cv_header_ft2build_h
1052 if test x"$grub_mkfont_excuse" = x ; then
1053 # Check for freetype libraries.
1054 freetype_cflags=`$FREETYPE --cflags`
1055 freetype_libs=`$FREETYPE --libs`
1056 SAVED_CPPFLAGS="$CPPFLAGS"
1057 CPPFLAGS="$CPPFLAGS $freetype_cflags"
1058 AC_CHECK_HEADERS([ft2build.h], [],
1059 [grub_mkfont_excuse=["need freetype2 headers"]])
1060 CPPFLAGS="$SAVED_CPPFLAGS"
1063 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
1064 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
1066 if test x"$grub_mkfont_excuse" = x ; then
1067 enable_grub_mkfont=yes
1069 enable_grub_mkfont=no
1071 AC_SUBST([enable_grub_mkfont])
1072 AC_SUBST([freetype_cflags])
1073 AC_SUBST([freetype_libs])
1077 SAVED_CFLAGS="$CFLAGS"
1078 SAVED_CPPFLAGS="$CPPFLAGS"
1081 CFLAGS="$BUILD_CFLAGS"
1082 CPPFLAGS="$BUILD_CPPFLAGS"
1084 unset ac_cv_c_bigendian
1085 unset ac_cv_header_ft2build_h
1087 AC_COMPUTE_INT([BUILD_SIZEOF_VOID_P], [sizeof (void *)])
1088 AC_COMPUTE_INT([BUILD_SIZEOF_LONG], [sizeof (long)])
1089 AC_C_BIGENDIAN([BUILD_WORDS_BIGENDIAN=1], [BUILD_WORDS_BIGENDIAN=0], [BUILD_WORDS_BIGENDIAN=err], [BUILD_WORDS_BIGENDIAN=err])
1091 if test x$BUILD_WORDS_BIGENDIAN = xerr ; then
1092 AC_MSG_ERROR([couldnt determine build endianness])
1095 AC_SUBST([BUILD_SIZEOF_LONG])
1096 AC_SUBST([BUILD_SIZEOF_VOID_P])
1097 AC_SUBST([BUILD_WORDS_BIGENDIAN])
1099 if test x"$grub_build_mkfont_excuse" = x ; then
1100 # Check for freetype libraries.
1101 AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config])
1102 if test "x$BUILD_FREETYPE" = x ; then
1103 grub_build_mkfont_excuse=["need freetype2 library"]
1107 if test x"$grub_build_mkfont_excuse" = x ; then
1108 # Check for freetype libraries.
1109 build_freetype_cflags=`$BUILD_FREETYPE --cflags`
1110 build_freetype_libs=`$BUILD_FREETYPE --libs`
1111 SAVED_CPPFLAGS_2="$CPPFLAGS"
1112 CPPFLAGS="$CPPFLAGS $build_freetype_cflags"
1113 AC_CHECK_HEADERS([ft2build.h], [],
1114 [grub_build_mkfont_excuse=["need freetype2 headers"]])
1115 CPPFLAGS="$SAVED_CPPFLAGS_2"
1118 if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
1119 AC_MSG_ERROR([build-grub-mkfont was explicitly requested but can't be compiled])
1121 if test x"$grub_build_mkfont_excuse" = x ; then
1122 enable_build_grub_mkfont=yes
1124 enable_build_grub_mkfont=no
1126 if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 ); then
1127 AC_MSG_ERROR([qemu, powerpc-ieee1275 and loongson ports needs build-time grub-mkfont])
1130 AC_SUBST([build_freetype_cflags])
1131 AC_SUBST([build_freetype_libs])
1135 CFLAGS="$SAVED_CFLAGS"
1136 CPPFLAGS="$SAVED_CPPFLAGS"
1143 AC_ARG_ENABLE([grub-themes],
1144 [AS_HELP_STRING([--enable-grub-themes],
1145 [build and install GRUB themes (default=guessed)])])
1146 if test x"$enable_grub_themes" = xno ; then
1147 starfield_excuse="explicitly disabled"
1150 if test x"$starfield_excuse" = x && test x"$enable_build_grub_mkfont" = xno ; then
1151 starfield_excuse="No build-time grub-mkfont"
1154 if test x"$starfield_excuse" = x; then
1155 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
1156 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do
1157 if test -f "$dir/DejaVuSans.$ext"; then
1158 DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
1164 if test "x$DJVU_FONT_SOURCE" = x; then
1165 starfield_excuse="No DejaVu found"
1169 if test x"$enable_grub_themes" = xyes && test x"$starfield_excuse" != x; then
1170 AC_MSG_ERROR([themes were explicitly requested but requirements are not satisfied])
1173 AC_SUBST([DJVU_FONT_SOURCE])
1177 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
1178 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont /usr/share/fonts/uni /usr/share/fonts/truetype/unifont /usr/share/fonts/misc; do
1179 if test -f "$dir/unifont.$ext"; then
1180 FONT_SOURCE="$dir/unifont.$ext"
1186 if test x"$enable_build_grub_mkfont" = xno ; then
1190 if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 ); then
1191 AC_MSG_ERROR([qemu, powerpc-ieee1275 and loongson ports need unifont])
1194 AC_SUBST([FONT_SOURCE])
1196 if test x"$FONT_SOURCE" = x && test x"$DJVU_FONT_SOURCE" = x && test x"$grub_build_mkfont_excuse" = x; then
1197 grub_build_mkfont_excuse="no fonts"
1201 AC_ARG_ENABLE([grub-mount],
1202 [AS_HELP_STRING([--enable-grub-mount],
1203 [build and install the `grub-mount' utility (default=guessed)])])
1204 if test x"$enable_grub_mount" = xno ; then
1205 grub_mount_excuse="explicitly disabled"
1208 if test x"$grub_mount_excuse" = x ; then
1209 AC_CHECK_LIB([fuse], [fuse_main_real], [],
1210 [grub_mount_excuse="need FUSE library"])
1213 if test x"$grub_mount_excuse" = x ; then
1214 # Check for fuse headers.
1215 SAVED_CPPFLAGS="$CPPFLAGS"
1216 CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
1217 AC_CHECK_HEADERS([fuse/fuse.h], [],
1218 [grub_mount_excuse=["need FUSE headers"]])
1219 CPPFLAGS="$SAVED_CPPFLAGS"
1222 if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
1223 AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled])
1225 if test x"$grub_mount_excuse" = x ; then
1226 enable_grub_mount=yes
1228 enable_grub_mount=no
1230 AC_SUBST([enable_grub_mount])
1232 AC_ARG_ENABLE([device-mapper],
1233 [AS_HELP_STRING([--enable-device-mapper],
1234 [enable Linux device-mapper support (default=guessed)])])
1235 if test x"$enable_device_mapper" = xno ; then
1236 device_mapper_excuse="explicitly disabled"
1239 if test x"$device_mapper_excuse" = x ; then
1240 # Check for device-mapper header.
1241 AC_CHECK_HEADER([libdevmapper.h], [],
1242 [device_mapper_excuse="need libdevmapper header"])
1245 if test x"$device_mapper_excuse" = x ; then
1246 # Check for device-mapper library.
1247 AC_CHECK_LIB([devmapper], [dm_task_create], [],
1248 [device_mapper_excuse="need devmapper library"])
1251 if test x"$device_mapper_excuse" = x ; then
1252 # Check for device-mapper library.
1253 AC_CHECK_LIB([devmapper], [dm_log_with_errno_init],
1255 [device_mapper_excuse="need devmapper library"])
1258 if test x"$device_mapper_excuse" = x ; then
1259 LIBDEVMAPPER="-ldevmapper";
1260 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
1261 [Define to 1 if you have the devmapper library.])
1264 AC_SUBST([LIBDEVMAPPER])
1267 if test x$host_kernel = xkfreebsd; then
1268 AC_CHECK_LIB([geom], [geom_gettree], [],
1269 [AC_MSG_ERROR([Your platform requires libgeom])])
1275 AC_ARG_ENABLE([liblzma],
1276 [AS_HELP_STRING([--enable-liblzma],
1277 [enable liblzma integration (default=guessed)])])
1278 if test x"$enable_liblzma" = xno ; then
1279 liblzma_excuse="explicitly disabled"
1282 if test x"$liblzma_excuse" = x ; then
1283 AC_CHECK_LIB([lzma], [lzma_code],
1284 [],[liblzma_excuse="need lzma library"])
1286 if test x"$liblzma_excuse" = x ; then
1287 AC_CHECK_HEADER([lzma.h], [], [liblzma_excuse="need lzma header"])
1290 if test x"$enable_liblzma" = xyes && test x"$liblzma_excuse" != x ; then
1291 AC_MSG_ERROR([liblzma support was explicitly requested but requirements are not satisfied])
1295 if test x"$liblzma_excuse" = x ; then
1297 AC_DEFINE([USE_LIBLZMA], [1],
1298 [Define to 1 if you have the LZMA library.])
1303 AC_ARG_ENABLE([libzfs],
1304 [AS_HELP_STRING([--enable-libzfs],
1305 [enable libzfs integration (default=guessed)])])
1306 if test x"$enable_libzfs" = xno ; then
1307 libzfs_excuse="explicitly disabled"
1310 if test x"$libzfs_excuse" = x ; then
1311 # Only check for system headers if libzfs support has not been disabled.
1312 AC_CHECK_HEADERS(libzfs.h libnvpair.h)
1315 if test x"$libzfs_excuse" = x ; then
1316 AC_CHECK_LIB([zfs], [libzfs_init],
1318 [libzfs_excuse="need zfs library"])
1321 if test x"$libzfs_excuse" = x ; then
1322 AC_CHECK_LIB([nvpair], [nvlist_lookup_string],
1324 [libzfs_excuse="need nvpair library"])
1327 if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
1328 AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied])
1331 if test x"$libzfs_excuse" = x ; then
1332 # We need both libzfs and libnvpair for a successful build.
1334 AC_DEFINE([HAVE_LIBZFS], [1],
1335 [Define to 1 if you have the ZFS library.])
1336 LIBNVPAIR="-lnvpair"
1337 AC_DEFINE([HAVE_LIBNVPAIR], [1],
1338 [Define to 1 if you have the NVPAIR library.])
1342 AC_SUBST([LIBNVPAIR])
1346 AC_SUBST([FONT_SOURCE])
1347 AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
1348 [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
1350 AC_SUBST(HAVE_ASM_USCORE)
1353 AC_SUBST(BSS_START_SYMBOL)
1354 AC_SUBST(END_SYMBOL)
1357 AC_SUBST(NEED_REGISTER_FRAME_INFO)
1359 AC_ARG_ENABLE([werror],
1360 [AS_HELP_STRING([--disable-werror],
1361 [do not use -Werror when building GRUB])])
1362 if test x"$enable_werror" != xno ; then
1363 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
1364 HOST_CFLAGS="$HOST_CFLAGS -Werror"
1367 if test "x$grub_cv_cc_target_clang" = xno; then
1368 TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc"
1370 TARGET_LDFLAGS_STATIC_LIBGCC=
1373 TARGET_CPP="$TARGET_CC -E"
1374 TARGET_CCAS=$TARGET_CC
1376 GRUB_TARGET_CPU="${target_cpu}"
1377 GRUB_PLATFORM="${platform}"
1379 AC_SUBST(GRUB_TARGET_CPU)
1380 AC_SUBST(GRUB_PLATFORM)
1382 AC_SUBST(TARGET_OBJCONV)
1383 AC_SUBST(TARGET_LIBGCC)
1384 AC_SUBST(TARGET_LDFLAGS_STATIC_LIBGCC)
1385 AC_SUBST(TARGET_CPP)
1386 AC_SUBST(TARGET_CCAS)
1387 AC_SUBST(TARGET_OBJ2ELF)
1388 AC_SUBST(TARGET_MODULE_FORMAT)
1390 AC_SUBST(TARGET_CFLAGS)
1391 AC_SUBST(TARGET_LDFLAGS)
1392 AC_SUBST(TARGET_CPPFLAGS)
1393 AC_SUBST(TARGET_CCASFLAGS)
1395 AC_SUBST(TARGET_IMG_LDSCRIPT)
1396 AC_SUBST(TARGET_IMG_LDFLAGS)
1397 AC_SUBST(TARGET_IMG_CFLAGS)
1398 AC_SUBST(TARGET_IMG_BASE_LDOPT)
1399 AC_SUBST(TARGET_APPLE_LINKER)
1401 AC_SUBST(HOST_CFLAGS)
1402 AC_SUBST(HOST_LDFLAGS)
1403 AC_SUBST(HOST_CPPFLAGS)
1404 AC_SUBST(HOST_CCASFLAGS)
1406 AC_SUBST(BUILD_LIBM)
1409 # Automake conditionals
1412 AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
1413 AM_CONDITIONAL([COND_clang], [test x$grub_cv_cc_target_clang = xyes])
1414 AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
1415 AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
1416 AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
1417 AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
1418 AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
1419 AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
1420 AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
1421 AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
1422 AM_CONDITIONAL([COND_i386_xen], [test x$target_cpu = xi386 -a x$platform = xxen])
1423 AM_CONDITIONAL([COND_x86_64_xen], [test x$target_cpu = xx86_64 -a x$platform = xxen])
1424 AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
1425 AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
1426 AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc])
1427 AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
1428 AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
1429 AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
1430 AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
1431 AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
1432 AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ])
1433 AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot])
1434 AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi])
1436 AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
1437 AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
1438 AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
1439 AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
1440 AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
1441 AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
1442 AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
1444 AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
1445 AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
1446 AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
1447 AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
1448 AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
1449 AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
1450 AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
1451 AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1])
1452 AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
1453 AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
1454 AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
1456 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
1458 AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
1459 AM_CONDITIONAL([COND_CYGWIN], [test x$target_os = xcygwin])
1460 AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
1463 cpudir="${target_cpu}"
1464 if test x${cpudir} = xmipsel; then
1468 if test x"$link_dir" = xyes ; then
1469 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
1470 if test "$platform" != emu ; then
1471 AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
1474 mkdir -p include/grub 2>/dev/null
1475 rm -rf include/grub/cpu
1476 cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
1477 if test "$platform" != emu ; then
1478 rm -rf include/grub/machine
1479 cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
1483 AC_CONFIG_FILES([Makefile])
1484 AC_CONFIG_FILES([grub-core/Makefile])
1485 AC_CONFIG_FILES([grub-core/gnulib/Makefile])
1486 AC_CONFIG_FILES([po/Makefile.in])
1487 AC_CONFIG_FILES([docs/Makefile])
1488 AC_CONFIG_FILES([util/bash-completion.d/Makefile])
1489 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
1490 AC_CONFIG_FILES([config.h])
1494 echo "*******************************************************"
1495 echo GRUB2 will be compiled with following components:
1496 echo Platform: "$target_cpu"-"$platform"
1497 if [ x"$platform" = xemu ]; then
1498 if [ x"$grub_emu_usb_excuse" = x ]; then
1499 echo USB support for grub-emu: Yes
1501 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
1503 if [ x"$grub_emu_sdl_excuse" = x ]; then
1504 echo SDL support for grub-emu: Yes
1506 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
1508 if [ x"$grub_emu_pci_excuse" = x ]; then
1509 echo PCI support for grub-emu: Yes
1511 echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
1514 if test x"$device_mapper_excuse" = x ; then
1515 echo With devmapper support: Yes
1517 echo With devmapper support: No "($device_mapper_excuse)"
1519 if [ x"$enable_mm_debug" = xyes ]; then
1520 echo With memory debugging: Yes
1522 echo With memory debugging: No
1524 if [ x"$enable_cache_stats" = xyes ]; then
1525 echo With disk cache statistics: Yes
1527 echo With disk cache statistics: No
1530 if [ x"$enable_boot_time" = xyes ]; then
1531 echo With boot time statistics: Yes
1533 echo With boot time statistics: No
1536 if [ x"$efiemu_excuse" = x ]; then
1537 echo efiemu runtime: Yes
1539 echo efiemu runtime: No "($efiemu_excuse)"
1541 if [ x"$grub_mkfont_excuse" = x ]; then
1542 echo grub-mkfont: Yes
1544 echo grub-mkfont: No "($grub_mkfont_excuse)"
1546 if [ x"$grub_mount_excuse" = x ]; then
1547 echo grub-mount: Yes
1549 echo grub-mount: No "($grub_mount_excuse)"
1551 if [ x"$starfield_excuse" = x ]; then
1552 echo starfield theme: Yes
1554 echo starfield theme: No "($starfield_excuse)"
1556 if [ x"$libzfs_excuse" = x ]; then
1557 echo With libzfs support: Yes
1559 echo With libzfs support: No "($libzfs_excuse)"
1561 if [ x"$grub_build_mkfont_excuse" = x ]; then
1562 echo Build-time grub-mkfont: Yes
1563 if test "x$FONT_SOURCE" = x ; then
1564 echo "Without unifont"
1566 echo "With unifont from $FONT_SOURCE"
1569 echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)"
1570 echo "Without unifont (no build-time grub-mkfont)"
1572 if test x"$liblzma_excuse" != x ; then
1573 echo "Without liblzma (no support for XZ-compressed mips images) ($liblzma_excuse)"
1575 echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
1577 echo "*******************************************************"