]> git.proxmox.com Git - grub2.git/blob - configure.ac
* configure.ac: Probe for linking format rather than guessing it based
[grub2.git] / configure.ac
1 # -*- autoconf -*-
2
3 # Process this file with autoconf to produce a configure script.
4
5 # Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
6 #
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.
10 #
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
14 # PARTICULAR PURPOSE.
15
16 dnl This configure script is complicated, because GRUB needs to deal
17 dnl with three potentially different types:
18 dnl
19 dnl build -- the environment for building GRUB
20 dnl host -- the environment for running utilities
21 dnl target -- the environment for running GRUB
22 dnl
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.
27 dnl
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
33 dnl type.
34
35 AC_INIT([GRUB],[2.00],[bug-grub@gnu.org])
36
37 AC_CONFIG_AUX_DIR([build-aux])
38
39 # We don't want -g -O2 by default in CFLAGS
40 : ${CFLAGS=""}
41
42 # Checks for host and target systems.
43 AC_CANONICAL_HOST
44 save_program_prefix="${program_prefix}"
45 AC_CANONICAL_TARGET
46 program_prefix="${save_program_prefix}"
47
48 AM_INIT_AUTOMAKE([1.10.1])
49 AC_PREREQ(2.60)
50 AC_CONFIG_SRCDIR([include/grub/dl.h])
51 AC_CONFIG_HEADER([config-util.h])
52
53 # Program name transformations
54 AC_ARG_PROGRAM
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])
72
73 # Optimization flag. Allow user to override.
74 if test "x$TARGET_CFLAGS" = x; then
75 TARGET_CFLAGS="$TARGET_CFLAGS -Os"
76 fi
77
78 BUILD_CPPFLAGS="$BUILD_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
79
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)\\\""
86
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"
90
91 case "$target_cpu" in
92 i[[3456]]86) target_cpu=i386 ;;
93 amd64) target_cpu=x86_64 ;;
94 sparc) target_cpu=sparc64 ;;
95 mipsel|mips64el)
96 target_cpu=mipsel;
97 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
98 ;;
99 mips|mips64)
100 target_cpu=mips;
101 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1";
102 ;;
103 arm*)
104 target_cpu=arm;
105 ;;
106 esac
107
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]]]))
112
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"]) ;;
128 esac
129 else
130 platform="$with_platform"
131 fi
132
133 case "$target_cpu"-"$platform" in
134 x86_64-efi) ;;
135 x86_64-emu) ;;
136 x86_64-xen) ;;
137 x86_64-*) target_cpu=i386 ;;
138 powerpc64-ieee1275) target_cpu=powerpc ;;
139 esac
140
141 # Check if the platform is supported, make final adjustments.
142 case "$target_cpu"-"$platform" in
143 i386-efi) ;;
144 x86_64-efi) ;;
145 i386-xen) ;;
146 x86_64-xen) ;;
147 i386-pc) ;;
148 i386-multiboot) ;;
149 i386-coreboot) ;;
150 i386-linuxbios) platform=coreboot ;;
151 i386-ieee1275) ;;
152 i386-qemu) ;;
153 powerpc-ieee1275) ;;
154 sparc64-ieee1275) ;;
155 ia64-efi) ;;
156 mips-qemu_mips) ;;
157 mips-qemu-mips) platform=qemu_mips;;
158 mips-arc) ;;
159 mipsel-arc) ;;
160 mipsel-qemu_mips) ;;
161 mipsel-qemu-mips) platform=qemu_mips;;
162 mipsel-yeeloong) platform=loongson ;;
163 mipsel-fuloong) platform=loongson ;;
164 mipsel-loongson) ;;
165 arm-uboot) ;;
166 arm-efi) ;;
167 *-emu) ;;
168 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
169 esac
170
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 ;;
175 esac
176 fi
177
178 case "$target_os" in
179 windows* | mingw32*) target_os=cygwin ;;
180 esac
181
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).
185 case "$host_os" in
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 ;;
193 esac
194
195 case "$platform" in
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" ;;
208 esac
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" ;;
213 esac
214 if test x${target_cpu} = xmipsel ; then
215 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
216 else
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"
218 fi
219
220 case "${target_cpu}-$platform" in
221 mips-arc)
222 TARGET_LINK_ADDR=0x88200000
223 TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000
224 ;;
225 mipsel-arc)
226 TARGET_LINK_ADDR=0x80700000
227 TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000
228 ;;
229 mips*-qemu_mips | mips*-loongson)
230 TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000
231 ;;
232 esac
233
234 AC_SUBST(TARGET_LINK_ADDR)
235 AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR)
236
237 TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
238
239 AC_SUBST(host_cpu)
240 AC_SUBST(host_os)
241 AC_SUBST(host_kernel)
242
243 AC_SUBST(target_cpu)
244 AC_SUBST(platform)
245
246 # Define default variables
247
248 have_with_bootdir=n
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"
256 else
257 case "$host_os" in
258 netbsd* | openbsd*)
259 # Because /boot is used for the boot block in NetBSD and OpenBSD,
260 bootdirname='' ;;
261 *) bootdirname='boot' ;;
262 esac
263 fi
264
265 AC_SUBST(bootdirname)
266 AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
267 [Default boot directory name]")
268
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"])
274
275 AC_SUBST(grubdirname)
276 AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
277 [Default grub directory name])
278
279 #
280 # Checks for build programs.
281 #
282
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])
288 fi
289
290 AC_CHECK_PROGS([YACC], [bison])
291 if test "x$YACC" = x; then
292 AC_MSG_ERROR([bison is not found])
293 fi
294
295 AC_PROG_RANLIB
296 AC_PROG_INSTALL
297 AC_PROG_AWK
298 AC_PROG_LEX
299 AC_PROG_YACC
300 AC_PROG_MAKE_SET
301 AC_PROG_MKDIR_P
302 AC_PROG_LN_S
303
304 if test "x$LEX" = "x:"; then
305 AC_MSG_ERROR([flex is not found])
306 else
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
309 :
310 else
311 AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
312 fi
313 fi
314
315 # These are not a "must".
316 AC_PATH_PROGS(MAKEINFO, makeinfo true)
317
318 #
319 # Checks for host programs.
320 #
321
322 AC_PROG_CC
323 gl_EARLY
324 AC_PROG_CXX
325 AM_PROG_CC_C_O
326 AM_PROG_AS
327
328 # Must be GCC.
329 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
330
331 AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
332
333 AC_GNU_SOURCE
334 AM_GNU_GETTEXT([external])
335 AC_SYS_LARGEFILE
336
337 # Identify characteristics of the host architecture.
338 unset ac_cv_c_bigendian
339
340 AC_C_BIGENDIAN
341 AC_CHECK_SIZEOF(void *)
342 AC_CHECK_SIZEOF(long)
343
344 case "$host_os" in
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>])
349 ;;
350 esac
351
352 if test x$USE_NLS = xno; then
353 HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
354 fi
355
356 if test "x$cross_compiling" = xyes; then
357 AC_MSG_WARN([cannot generate manual pages while cross compiling])
358 else
359 AC_PATH_PROG(HELP2MAN, help2man)
360 fi
361
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)
365
366 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
367 #include <sys/param.h>
368 #include <sys/mount.h>])
369
370 AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default
371 #include <sys/param.h>
372 #include <sys/mount.h>])
373
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], [
378 LIBUTIL="-lutil"
379 AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
380 ])
381 AC_CHECK_LIB([util], [getrawpartition], [
382 LIBUTIL="-lutil"
383 AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
384 ])
385 ])
386 AC_SUBST([LIBUTIL])
387
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"
396 ])
397
398 if test x"$grub_host_cv_cc_wtrampolines" = xyes ; then
399 HOST_CFLAGS="$HOST_CFLAGS -Wtrampolines"
400 fi
401
402 #
403 # Check for host and build compilers.
404 #
405 HOST_CC=$CC
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"
409
410 case "$build_os" in
411 haiku*) BUILD_LIBM= ;;
412 *) BUILD_LIBM=-lm ;;
413 esac
414 # For gnulib.
415 gl_INIT
416
417 #
418 # Check for target programs.
419 #
420
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-
425
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)
432
433 ac_tool_prefix="$tmp_ac_tool_prefix"
434 else
435 if test "x$TARGET_CC" = x; then
436 TARGET_CC=$CC
437 fi
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)
442 fi
443
444 AC_SUBST(HOST_CC)
445 AC_SUBST(BUILD_CC)
446 AC_SUBST(BUILD_CFLAGS)
447 AC_SUBST(BUILD_CPPFLAGS)
448 AC_SUBST(TARGET_CC)
449 AC_SUBST(TARGET_NM)
450 AC_SUBST(TARGET_RANLIB)
451 AC_SUBST(TARGET_STRIP)
452 AC_SUBST(TARGET_OBJCOPY)
453
454 # Test the C compiler for the target environment.
455 tmp_CC="$CC"
456 tmp_CFLAGS="$CFLAGS"
457 tmp_LDFLAGS="$LDFLAGS"
458 tmp_CPPFLAGS="$CPPFLAGS"
459 tmp_LIBS="$LIBS"
460 CC="$TARGET_CC"
461 CFLAGS="$TARGET_CFLAGS"
462 CPPFLAGS="$TARGET_CPPFLAGS"
463 LDFLAGS="$TARGET_LDFLAGS"
464 LIBS=""
465
466 # debug flags.
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"
471
472 if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then
473 TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align"
474 fi
475
476 AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang]
477 [AC_COMPILE_IFELSE(
478 [AC_LANG_PROGRAM([], [[
479 #ifdef __clang__
480 #error "is clang"
481 #endif
482 ]])],
483 [grub_cv_cc_target_clang=no], [grub_cv_cc_target_clang=yes])])
484
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"
489 fi
490
491 if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
492 TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
493 fi
494
495 if test "x$target_m32" = x1; then
496 # Force 32-bit mode.
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"
502 fi
503
504 if test "x$target_m64" = x1; then
505 # Force 64-bit mode.
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"
511 fi
512
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"
515 fi
516
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])
524 ])
525
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])
531 ])
532
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"
537 fi
538 fi
539
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])
545 ])
546
547 if test "x$grub_cv_cc_freg_struct_return" = xyes; then
548 TARGET_CFLAGS="$TARGET_CFLAGS -freg-struct-return"
549 fi
550
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"
555 fi
556
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
560 # behaviour.
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])
566 ])
567
568 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
569 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
570 fi
571
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])
578 ])
579 fi
580
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"
583 fi
584
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
588 # behaviour.
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])
594 ])
595
596 if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
597 TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
598 fi
599
600 # For platforms where ELF is not the default link format.
601 case "${target_os}" in
602 cygwin)
603 # FIXME: put proper test here
604 NEED_REGISTER_FRAME_INFO=1
605 ;;
606 *) NEED_REGISTER_FRAME_INFO=0 ;;
607 esac
608
609
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"
615 fi
616 if test x"$target_os" = xcygwin ; then
617 efiemu_excuse="not available on cygwin"
618 fi
619 if test x"$target_cpu" != xi386 ; then
620 efiemu_excuse="only available on i386"
621 fi
622 if test x"$platform" = xefi ; then
623 efiemu_excuse="not available on efi"
624 fi
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])
631 ])
632 if test x$grub_cv_cc_efiemu = xno; then
633 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
634 fi
635 fi
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])
638 fi
639 if test x"$efiemu_excuse" = x ; then
640 enable_efiemu=yes
641 else
642 enable_efiemu=no
643 fi
644 AC_SUBST([enable_efiemu])
645
646 CFLAGS="$TARGET_CFLAGS"
647
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
653 continue
654 fi
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:");
661 void __main (void);
662 void __main (void) {}
663 ]], [[]])], [flag=1], [])
664 if test x"$flag" = x1; then
665 grub_cv_target_cc_link_format="$format"
666 break;
667 fi
668 done])
669 if test x"$grub_cv_target_cc_link_format" = xunknown; then
670 AC_MSG_ERROR([no suitable link format found])
671 fi
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';
675 fi
676 fi
677
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], [], [.])
683 fi
684 if test "x$TARGET_OBJCONV" = x ; then
685 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
686 fi
687 TARGET_IMG_LDSCRIPT=
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"
700 TARGET_IMG_CFLAGS=
701 else
702 TARGET_APPLE_LINKER=0
703 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
704 TARGET_IMG_LDSCRIPT=
705 TARGET_IMG_LDFLAGS='-Wl,-N'
706 TARGET_IMG_LDFLAGS_AC='-Wl,-N'
707 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
708 TARGET_IMG_CFLAGS=
709 fi
710
711 AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
712
713
714 LDFLAGS="$TARGET_LDFLAGS"
715
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])
723 ])
724 if test "x$grub_cv_cc_mcmodel" = xno; then
725 AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
726 else
727 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
728 fi
729 fi
730
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])
738 ])
739 if test "x$grub_cv_cc_no_red_zone" = xno; then
740 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
741 fi
742
743 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
744 fi
745
746 #
747 # Compiler features.
748 #
749
750 CFLAGS="$TARGET_CFLAGS"
751
752 # Position independent executable.
753 grub_CHECK_PIE
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"
758 fi]
759
760 CFLAGS="$TARGET_CFLAGS"
761
762 # Position independent executable.
763 grub_CHECK_PIC
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"
768 fi]
769
770 CFLAGS="$TARGET_CFLAGS"
771
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"
778 fi
779
780 CFLAGS="$TARGET_CFLAGS"
781
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"
787 fi
788
789 CFLAGS="$TARGET_CFLAGS"
790
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"
796 fi
797 fi
798
799 # Set them to their new values for the tests below.
800 CC="$TARGET_CC"
801 if test "x$TARGET_APPLE_LINKER" = x1 ; then
802 CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
803 else
804 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
805 fi
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
808 TARGET_LIBGCC=
809 else
810 TARGET_LIBGCC=-lgcc
811 fi
812
813 LIBS="$TARGET_LIBGCC"
814
815 grub_ASM_USCORE
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"
819 else
820 CFLAGS="$TARGET_CFLAGS -Wl,--defsym,abort=main"
821 fi
822 fi
823
824 # Check for libgcc symbols
825 AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x __ctzdi2 __ctzsi2)
826
827 if test "x$TARGET_APPLE_LINKER" = x1 ; then
828 CFLAGS="$TARGET_CFLAGS -nostdlib"
829 else
830 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
831 fi
832 LIBS=""
833
834 # Defined in aclocal.m4.
835 grub_PROG_TARGET_CC
836 if test "x$TARGET_APPLE_LINKER" != x1 ; then
837 grub_PROG_OBJCOPY_ABSOLUTE
838 fi
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"
845 fi
846 grub_CHECK_BSS_START_SYMBOL
847 grub_CHECK_END_SYMBOL
848 fi
849 CFLAGS="$TARGET_CFLAGS"
850 grub_I386_ASM_PREFIX_REQUIREMENT
851 grub_I386_ASM_ADDR32
852 fi
853
854 grub_PROG_NM_WORKS
855 grub_PROG_NM_MINUS_P
856 grub_PROG_NM_DEFINED_ONLY
857 AC_SUBST(TARGET_NMFLAGS_MINUS_P)
858 AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
859
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>
865 #include <stddef.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"
870 ])
871
872 if test x"$grub_cv_cc_isystem" = xyes ; then
873 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
874 fi
875 fi
876
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])
883 ])
884
885 if test x"$grub_cv_cc_wtrampolines" = xyes ; then
886 TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines"
887 fi
888
889 # Restore the flags.
890 CC="$tmp_CC"
891 CFLAGS="$tmp_CFLAGS"
892 CPPFLAGS="$tmp_CPPFLAGS"
893 LDFLAGS="$tmp_LDFLAGS"
894 LIBS="$tmp_LIBS"
895
896 #
897 # Check for options.
898 #
899
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.])])
906
907 AC_ARG_ENABLE([cache-stats],
908 AS_HELP_STRING([--enable-cache-stats],
909 [enable disk cache statistics collection]))
910
911 if test x$enable_cache_stats = xyes; then
912 DISK_CACHE_STATS=1
913 else
914 DISK_CACHE_STATS=0
915 fi
916 AC_SUBST([DISK_CACHE_STATS])
917
918 AC_ARG_ENABLE([boot-time],
919 AS_HELP_STRING([--enable-boot-time],
920 [enable boot time statistics collection]))
921
922 if test x$enable_boot_time = xyes; then
923 BOOT_TIME_STATS=1
924 else
925 BOOT_TIME_STATS=0
926 fi
927 AC_SUBST([BOOT_TIME_STATS])
928
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)])])
932
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)])])
936
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)])])
940
941 if test "$platform" = emu; then
942
943 if test x"$enable_grub_emu_usb" != xyes ; then
944 grub_emu_usb_excuse="not enabled"
945 fi
946
947 if test x"$enable_grub_emu_pci" = xyes ; then
948 grub_emu_usb_excuse="conflicts with PCI support"
949 fi
950
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"]])
955 AC_SUBST([LIBUSB])
956 [fi]
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"]])
961 [fi]
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])
964 fi
965 if test x"$grub_emu_usb_excuse" = x ; then
966 enable_grub_emu_usb=yes
967 else
968 enable_grub_emu_usb=no
969 fi
970
971 if test x"$enable_grub_emu_sdl" = xno ; then
972 grub_emu_sdl_excuse="explicitely disabled"
973 fi
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"]])
978 AC_SUBST([LIBSDL])
979 [fi]
980
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"]])
985 [fi]
986
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])
989 fi
990 if test x"$grub_emu_sdl_excuse" = x ; then
991 enable_grub_emu_sdl=yes
992 else
993 enable_grub_emu_sdl=no
994 fi
995
996 if test x"$enable_grub_emu_pci" != xyes ; then
997 grub_emu_pci_excuse="not enabled"
998 fi
999
1000 if test x"$enable_grub_emu_usb" = xyes ; then
1001 grub_emu_pci_excuse="conflicts with USB support"
1002 fi
1003
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])
1009 [fi]
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"]])
1014 [fi]
1015
1016 if test x"$grub_emu_pci_excuse" = x ; then
1017 enable_grub_emu_pci=yes
1018 else
1019
1020 enable_grub_emu_pci=no
1021 fi
1022
1023 AC_SUBST([enable_grub_emu_sdl])
1024 AC_SUBST([enable_grub_emu_usb])
1025 AC_SUBST([enable_grub_emu_pci])
1026
1027 else
1028
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
1033 fi
1034
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"
1040 fi
1041
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"]
1047 fi
1048 fi
1049
1050 unset ac_cv_header_ft2build_h
1051
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"
1061 fi
1062
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])
1065 fi
1066 if test x"$grub_mkfont_excuse" = x ; then
1067 enable_grub_mkfont=yes
1068 else
1069 enable_grub_mkfont=no
1070 fi
1071 AC_SUBST([enable_grub_mkfont])
1072 AC_SUBST([freetype_cflags])
1073 AC_SUBST([freetype_libs])
1074
1075 SAVED_CC="$CC"
1076 SAVED_CPP="$CPP"
1077 SAVED_CFLAGS="$CFLAGS"
1078 SAVED_CPPFLAGS="$CPPFLAGS"
1079 CC="$BUILD_CC"
1080 CPP="$BUILD_CPP"
1081 CFLAGS="$BUILD_CFLAGS"
1082 CPPFLAGS="$BUILD_CPPFLAGS"
1083
1084 unset ac_cv_c_bigendian
1085 unset ac_cv_header_ft2build_h
1086
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])
1090
1091 if test x$BUILD_WORDS_BIGENDIAN = xerr ; then
1092 AC_MSG_ERROR([couldnt determine build endianness])
1093 fi
1094
1095 AC_SUBST([BUILD_SIZEOF_LONG])
1096 AC_SUBST([BUILD_SIZEOF_VOID_P])
1097 AC_SUBST([BUILD_WORDS_BIGENDIAN])
1098
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"]
1104 fi
1105 fi
1106
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"
1116 fi
1117
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])
1120 fi
1121 if test x"$grub_build_mkfont_excuse" = x ; then
1122 enable_build_grub_mkfont=yes
1123 else
1124 enable_build_grub_mkfont=no
1125 fi
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])
1128 fi
1129
1130 AC_SUBST([build_freetype_cflags])
1131 AC_SUBST([build_freetype_libs])
1132
1133 CC="$SAVED_CC"
1134 CPP="$SAVED_CPP"
1135 CFLAGS="$SAVED_CFLAGS"
1136 CPPFLAGS="$SAVED_CPPFLAGS"
1137
1138
1139 DJVU_FONT_SOURCE=
1140
1141 starfield_excuse=
1142
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"
1148 fi
1149
1150 if test x"$starfield_excuse" = x && test x"$enable_build_grub_mkfont" = xno ; then
1151 starfield_excuse="No build-time grub-mkfont"
1152 fi
1153
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"
1159 break 2
1160 fi
1161 done
1162 done
1163
1164 if test "x$DJVU_FONT_SOURCE" = x; then
1165 starfield_excuse="No DejaVu found"
1166 fi
1167 fi
1168
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])
1171 fi
1172
1173 AC_SUBST([DJVU_FONT_SOURCE])
1174
1175 FONT_SOURCE=
1176
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"
1181 break 2
1182 fi
1183 done
1184 done
1185
1186 if test x"$enable_build_grub_mkfont" = xno ; then
1187 FONT_SOURCE=
1188 fi
1189
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])
1192 fi
1193
1194 AC_SUBST([FONT_SOURCE])
1195
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"
1198 fi
1199
1200
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"
1206 fi
1207
1208 if test x"$grub_mount_excuse" = x ; then
1209 AC_CHECK_LIB([fuse], [fuse_main_real], [],
1210 [grub_mount_excuse="need FUSE library"])
1211 fi
1212
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"
1220 fi
1221
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])
1224 fi
1225 if test x"$grub_mount_excuse" = x ; then
1226 enable_grub_mount=yes
1227 else
1228 enable_grub_mount=no
1229 fi
1230 AC_SUBST([enable_grub_mount])
1231
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"
1237 fi
1238
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"])
1243 fi
1244
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"])
1249 fi
1250
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],
1254 [],
1255 [device_mapper_excuse="need devmapper library"])
1256 fi
1257
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.])
1262 fi
1263
1264 AC_SUBST([LIBDEVMAPPER])
1265
1266 LIBGEOM=
1267 if test x$host_kernel = xkfreebsd; then
1268 AC_CHECK_LIB([geom], [geom_gettree], [],
1269 [AC_MSG_ERROR([Your platform requires libgeom])])
1270 LIBGEOM="-lgeom"
1271 fi
1272
1273 AC_SUBST([LIBGEOM])
1274
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"
1280 fi
1281
1282 if test x"$liblzma_excuse" = x ; then
1283 AC_CHECK_LIB([lzma], [lzma_code],
1284 [],[liblzma_excuse="need lzma library"])
1285 fi
1286 if test x"$liblzma_excuse" = x ; then
1287 AC_CHECK_HEADER([lzma.h], [], [liblzma_excuse="need lzma header"])
1288 fi
1289
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])
1292 fi
1293
1294
1295 if test x"$liblzma_excuse" = x ; then
1296 LIBLZMA="-llzma"
1297 AC_DEFINE([USE_LIBLZMA], [1],
1298 [Define to 1 if you have the LZMA library.])
1299 fi
1300
1301 AC_SUBST([LIBLZMA])
1302
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"
1308 fi
1309
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)
1313 fi
1314
1315 if test x"$libzfs_excuse" = x ; then
1316 AC_CHECK_LIB([zfs], [libzfs_init],
1317 [],
1318 [libzfs_excuse="need zfs library"])
1319 fi
1320
1321 if test x"$libzfs_excuse" = x ; then
1322 AC_CHECK_LIB([nvpair], [nvlist_lookup_string],
1323 [],
1324 [libzfs_excuse="need nvpair library"])
1325 fi
1326
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])
1329 fi
1330
1331 if test x"$libzfs_excuse" = x ; then
1332 # We need both libzfs and libnvpair for a successful build.
1333 LIBZFS="-lzfs"
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.])
1339 fi
1340
1341 AC_SUBST([LIBZFS])
1342 AC_SUBST([LIBNVPAIR])
1343
1344 LIBS=""
1345
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)])
1349
1350 AC_SUBST(HAVE_ASM_USCORE)
1351 AC_SUBST(ADDR32)
1352 AC_SUBST(DATA32)
1353 AC_SUBST(BSS_START_SYMBOL)
1354 AC_SUBST(END_SYMBOL)
1355 AC_SUBST(PACKAGE)
1356 AC_SUBST(VERSION)
1357 AC_SUBST(NEED_REGISTER_FRAME_INFO)
1358
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"
1365 fi
1366
1367 if test "x$grub_cv_cc_target_clang" = xno; then
1368 TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc"
1369 else
1370 TARGET_LDFLAGS_STATIC_LIBGCC=
1371 fi
1372
1373 TARGET_CPP="$TARGET_CC -E"
1374 TARGET_CCAS=$TARGET_CC
1375
1376 GRUB_TARGET_CPU="${target_cpu}"
1377 GRUB_PLATFORM="${platform}"
1378
1379 AC_SUBST(GRUB_TARGET_CPU)
1380 AC_SUBST(GRUB_PLATFORM)
1381
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)
1389
1390 AC_SUBST(TARGET_CFLAGS)
1391 AC_SUBST(TARGET_LDFLAGS)
1392 AC_SUBST(TARGET_CPPFLAGS)
1393 AC_SUBST(TARGET_CCASFLAGS)
1394
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)
1400
1401 AC_SUBST(HOST_CFLAGS)
1402 AC_SUBST(HOST_LDFLAGS)
1403 AC_SUBST(HOST_CPPFLAGS)
1404 AC_SUBST(HOST_CCASFLAGS)
1405
1406 AC_SUBST(BUILD_LIBM)
1407
1408 #
1409 # Automake conditionals
1410 #
1411
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])
1435
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])
1443
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])
1455
1456 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
1457
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])
1461
1462 # Output files.
1463 cpudir="${target_cpu}"
1464 if test x${cpudir} = xmipsel; then
1465 cpudir=mips;
1466 fi
1467 grub_CHECK_LINK_DIR
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])
1472 fi
1473 else
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
1480 fi
1481 fi
1482
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])
1491
1492 AC_OUTPUT
1493 [
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
1500 else
1501 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
1502 fi
1503 if [ x"$grub_emu_sdl_excuse" = x ]; then
1504 echo SDL support for grub-emu: Yes
1505 else
1506 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
1507 fi
1508 if [ x"$grub_emu_pci_excuse" = x ]; then
1509 echo PCI support for grub-emu: Yes
1510 else
1511 echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
1512 fi
1513 fi
1514 if test x"$device_mapper_excuse" = x ; then
1515 echo With devmapper support: Yes
1516 else
1517 echo With devmapper support: No "($device_mapper_excuse)"
1518 fi
1519 if [ x"$enable_mm_debug" = xyes ]; then
1520 echo With memory debugging: Yes
1521 else
1522 echo With memory debugging: No
1523 fi
1524 if [ x"$enable_cache_stats" = xyes ]; then
1525 echo With disk cache statistics: Yes
1526 else
1527 echo With disk cache statistics: No
1528 fi
1529
1530 if [ x"$enable_boot_time" = xyes ]; then
1531 echo With boot time statistics: Yes
1532 else
1533 echo With boot time statistics: No
1534 fi
1535
1536 if [ x"$efiemu_excuse" = x ]; then
1537 echo efiemu runtime: Yes
1538 else
1539 echo efiemu runtime: No "($efiemu_excuse)"
1540 fi
1541 if [ x"$grub_mkfont_excuse" = x ]; then
1542 echo grub-mkfont: Yes
1543 else
1544 echo grub-mkfont: No "($grub_mkfont_excuse)"
1545 fi
1546 if [ x"$grub_mount_excuse" = x ]; then
1547 echo grub-mount: Yes
1548 else
1549 echo grub-mount: No "($grub_mount_excuse)"
1550 fi
1551 if [ x"$starfield_excuse" = x ]; then
1552 echo starfield theme: Yes
1553 else
1554 echo starfield theme: No "($starfield_excuse)"
1555 fi
1556 if [ x"$libzfs_excuse" = x ]; then
1557 echo With libzfs support: Yes
1558 else
1559 echo With libzfs support: No "($libzfs_excuse)"
1560 fi
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"
1565 else
1566 echo "With unifont from $FONT_SOURCE"
1567 fi
1568 else
1569 echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)"
1570 echo "Without unifont (no build-time grub-mkfont)"
1571 fi
1572 if test x"$liblzma_excuse" != x ; then
1573 echo "Without liblzma (no support for XZ-compressed mips images) ($liblzma_excuse)"
1574 else
1575 echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
1576 fi
1577 echo "*******************************************************"
1578 ]