]> git.proxmox.com Git - grub2.git/blob - configure.ac
Merge branch 'master' into leiflindholm/arm64
[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 # Default HOST_CPPFLAGS
79 HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
80 HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
81 HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
82
83 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
84 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
85 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
86
87 case "$target_cpu" in
88 i[[3456]]86) target_cpu=i386 ;;
89 amd64) target_cpu=x86_64 ;;
90 sparc) target_cpu=sparc64 ;;
91 mipsel|mips64el)
92 target_cpu=mipsel;
93 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
94 ;;
95 mips|mips64)
96 target_cpu=mips;
97 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1";
98 ;;
99 arm*)
100 target_cpu=arm;
101 ;;
102 aarch64*)
103 target_cpu=arm64;
104 ;;
105 esac
106
107 # Specify the platform (such as firmware).
108 AC_ARG_WITH([platform],
109 AS_HELP_STRING([--with-platform=PLATFORM],
110 [select the host platform [[guessed]]]))
111
112 # Guess the platform if not specified.
113 if test "x$with_platform" = x; then
114 case "$target_cpu"-"$target_vendor" in
115 i386-apple) platform=efi ;;
116 i386-*) platform=pc ;;
117 x86_64-apple) platform=efi ;;
118 x86_64-*) platform=pc ;;
119 powerpc-*) platform=ieee1275 ;;
120 powerpc64-*) platform=ieee1275 ;;
121 sparc64-*) platform=ieee1275 ;;
122 mipsel-*) platform=loongson ;;
123 mips-*) platform=arc ;;
124 ia64-*) platform=efi ;;
125 arm-*) platform=uboot ;;
126 arm64-*) platform=efi ;;
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 arm64-efi) ;;
168 *-emu) ;;
169 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
170 esac
171
172 if test x$platform != xemu ; then
173 case "$target_cpu" in
174 i386 | powerpc) target_m32=1 ;;
175 x86_64 | sparc64) target_m64=1 ;;
176 esac
177 fi
178
179 case "$target_os" in
180 windows* | mingw32*) target_os=cygwin ;;
181 esac
182
183 # This normalizes the names, and creates a new variable ("host_kernel")
184 # while at it, since the mapping is not always 1:1 (e.g. different OSes
185 # using the same kernel type).
186 case "$host_os" in
187 gnu*) host_kernel=hurd ;;
188 linux*) host_kernel=linux ;;
189 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
190 netbsd*) host_kernel=netbsd ;;
191 solaris*) host_kernel=illumos ;;
192 darwin*) host_kernel=xnu ;;
193 cygwin | windows* | mingw32*) host_kernel=windows ;;
194 esac
195
196 case "$host_os" in
197 cygwin | windows* | mingw32*) have_exec=n ;;
198 aros*) have_exec=n ;;
199 *) have_exec=y;;
200 esac
201
202 case "$platform" in
203 coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
204 multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
205 efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
206 xen) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XEN=1" ;;
207 ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
208 uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;;
209 qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
210 pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
211 emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
212 loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
213 qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
214 arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
215 esac
216 case "$target_cpu" in
217 arm) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARM=1" ;;
218 arm64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARM64=1" ;;
219 mips |mipsel) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
220 sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
221 esac
222 if test x${target_cpu} = xmipsel ; then
223 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
224 else
225 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"
226 fi
227
228 case "${target_cpu}-$platform" in
229 mips-arc)
230 TARGET_LINK_ADDR=0x88200000
231 TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000
232 ;;
233 mipsel-arc)
234 TARGET_LINK_ADDR=0x80700000
235 TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000
236 ;;
237 mips*-qemu_mips | mips*-loongson)
238 TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000
239 ;;
240 esac
241
242 AC_SUBST(TARGET_LINK_ADDR)
243 AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR)
244
245 TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
246
247 AC_SUBST(host_cpu)
248 AC_SUBST(host_os)
249 AC_SUBST(host_kernel)
250
251 AC_SUBST(target_cpu)
252 AC_SUBST(platform)
253
254 # Define default variables
255
256 have_with_bootdir=n
257 AC_ARG_WITH([bootdir],
258 AS_HELP_STRING([--with-bootdir=DIR],
259 [set the name of /boot directory [[guessed]]]),
260 [have_with_bootdir=y],
261 [have_with_bootdir=n])
262 if test x$have_with_bootdir = xy; then
263 bootdirname="$with_bootdir"
264 else
265 case "$host_os" in
266 netbsd* | openbsd*)
267 # Because /boot is used for the boot block in NetBSD and OpenBSD,
268 bootdirname='' ;;
269 *) bootdirname='boot' ;;
270 esac
271 fi
272
273 AC_SUBST(bootdirname)
274 AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
275 [Default boot directory name]")
276
277 AC_ARG_WITH([grubdir],
278 AS_HELP_STRING([--with-grubdir=DIR],
279 [set the name of grub directory [[guessed]]]),
280 [grubdirname="$with_grubdir"],
281 [grubdirname="$PACKAGE"])
282
283 AC_SUBST(grubdirname)
284 AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
285 [Default grub directory name])
286
287 #
288 # Checks for build programs.
289 #
290
291 # Although cmp is listed in the GNU Coding Standards as a command which
292 # can used directly, OpenBSD lacks cmp in the default installation.
293 AC_CHECK_PROGS([CMP], [cmp])
294 if test "x$CMP" = x; then
295 AC_MSG_ERROR([cmp is not found])
296 fi
297
298 AC_CHECK_PROGS([YACC], [bison])
299 if test "x$YACC" = x; then
300 AC_MSG_ERROR([bison is not found])
301 fi
302
303 AC_PROG_RANLIB
304 AC_PROG_INSTALL
305 AC_PROG_AWK
306 AC_PROG_LEX
307 AC_PROG_YACC
308 AC_PROG_MAKE_SET
309 AC_PROG_MKDIR_P
310 AC_PROG_LN_S
311
312 if test "x$LEX" = "x:"; then
313 AC_MSG_ERROR([flex is not found])
314 else
315 version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
316 if test -n "$version" -a "$version" -ge 20535; then
317 :
318 else
319 AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
320 fi
321 fi
322
323 # These are not a "must".
324 AC_PATH_PROGS(MAKEINFO, makeinfo true)
325
326 #
327 # Checks for host programs.
328 #
329
330 AC_PROG_CC
331 gl_EARLY
332 AC_PROG_CXX
333 AM_PROG_CC_C_O
334 AM_PROG_AS
335
336 # Must be GCC.
337 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
338
339 AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
340
341 AC_GNU_SOURCE
342 AM_GNU_GETTEXT([external])
343 AC_SYS_LARGEFILE
344
345 # Identify characteristics of the host architecture.
346 unset ac_cv_c_bigendian
347
348 AC_C_BIGENDIAN
349 AC_CHECK_SIZEOF(void *)
350 AC_CHECK_SIZEOF(long)
351
352 case "$host_os" in
353 cygwin | windows* | mingw32*)
354 HOST_CPPFLAGS="$HOST_CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
355 CPPFLAGS="$CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
356 AC_CHECK_SIZEOF(TCHAR,,[#include <windows.h>])
357 ;;
358 esac
359
360 if test x$USE_NLS = xno; then
361 HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
362 fi
363
364 if test "x$cross_compiling" = xyes; then
365 AC_MSG_WARN([cannot generate manual pages while cross compiling])
366 else
367 AC_PATH_PROG(HELP2MAN, help2man)
368 fi
369
370 # Check for functions and headers.
371 AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
372 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
373
374 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
375 #include <sys/param.h>
376 #include <sys/mount.h>])
377
378 AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default
379 #include <sys/param.h>
380 #include <sys/mount.h>])
381
382 # For opendisk() and getrawpartition() on NetBSD.
383 # Used in util/deviceiter.c and in util/hostdisk.c.
384 AC_CHECK_HEADER([util.h], [
385 AC_CHECK_LIB([util], [opendisk], [
386 LIBUTIL="-lutil"
387 AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
388 ])
389 AC_CHECK_LIB([util], [getrawpartition], [
390 LIBUTIL="-lutil"
391 AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
392 ])
393 ])
394 AC_SUBST([LIBUTIL])
395
396 AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
397 SAVED_CFLAGS="$CFLAGS"
398 CFLAGS="$HOST_CFLAGS -Wtrampolines -Werror"
399 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
400 int va_arg_func (int fixed, va_list args);]], [[]])],
401 [grub_cv_host_cc_wtrampolines=yes],
402 [grub_cv_host_cc_wtrampolines=no])
403 CFLAGS="$SAVED_CFLAGS"
404 ])
405
406 if test x"$grub_host_cv_cc_wtrampolines" = xyes ; then
407 HOST_CFLAGS="$HOST_CFLAGS -Wtrampolines"
408 fi
409
410 #
411 # Check for host and build compilers.
412 #
413 HOST_CC=$CC
414 AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc])
415 test -z "$BUILD_CC" && AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])
416 BUILD_CPP="$BUILD_CC -E"
417
418 case "$build_os" in
419 haiku*) BUILD_LIBM= ;;
420 *) BUILD_LIBM=-lm ;;
421 esac
422 # For gnulib.
423 gl_INIT
424
425 #
426 # Check for target programs.
427 #
428
429 # Find tools for the target.
430 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
431 tmp_ac_tool_prefix="$ac_tool_prefix"
432 ac_tool_prefix=$target_alias-
433
434 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
435 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
436 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
437 AC_CHECK_TOOL(TARGET_STRIP, strip)
438 AC_CHECK_TOOL(TARGET_NM, nm)
439 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
440
441 ac_tool_prefix="$tmp_ac_tool_prefix"
442 else
443 if test "x$TARGET_CC" = x; then
444 TARGET_CC=$CC
445 fi
446 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
447 AC_CHECK_TOOL(TARGET_STRIP, strip)
448 AC_CHECK_TOOL(TARGET_NM, nm)
449 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
450 fi
451
452 AC_SUBST(HOST_CC)
453 AC_SUBST(BUILD_CC)
454 AC_SUBST(BUILD_CFLAGS)
455 AC_SUBST(BUILD_CPPFLAGS)
456 AC_SUBST(TARGET_CC)
457 AC_SUBST(TARGET_NM)
458 AC_SUBST(TARGET_RANLIB)
459 AC_SUBST(TARGET_STRIP)
460 AC_SUBST(TARGET_OBJCOPY)
461
462 # Test the C compiler for the target environment.
463 tmp_CC="$CC"
464 tmp_CFLAGS="$CFLAGS"
465 tmp_LDFLAGS="$LDFLAGS"
466 tmp_CPPFLAGS="$CPPFLAGS"
467 tmp_LIBS="$LIBS"
468 CC="$TARGET_CC"
469 CFLAGS="$TARGET_CFLAGS"
470 CPPFLAGS="$TARGET_CPPFLAGS"
471 LDFLAGS="$TARGET_LDFLAGS"
472 LIBS=""
473
474 # debug flags.
475 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"
476 HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"
477 TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
478 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
479
480 if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then
481 TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align"
482 fi
483
484 AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang]
485 [AC_COMPILE_IFELSE(
486 [AC_LANG_PROGRAM([], [[
487 #ifdef __clang__
488 #error "is clang"
489 #endif
490 ]])],
491 [grub_cv_cc_target_clang=no], [grub_cv_cc_target_clang=yes])])
492
493 # on x86 clang doesn't support .code16
494 # on arm clang doesn't support .arch directive
495 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
496 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
497 fi
498
499 if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
500 TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
501 fi
502
503 if test "x$target_m32" = x1; then
504 # Force 32-bit mode.
505 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
506 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
507 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
508 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
509 TARGET_MODULE_FORMAT="elf32"
510 fi
511
512 if test "x$target_m64" = x1; then
513 # Force 64-bit mode.
514 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
515 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
516 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
517 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
518 TARGET_MODULE_FORMAT="elf64"
519 fi
520
521 if test "x$grub_cv_cc_target_clang" = xno && test "x$target_cpu" = xi386 && test "x$platform" != xemu && test "x$platform" != xefi; then
522 TARGET_CFLAGS="$TARGET_CFLAGS -mrtd -mregparm=3"
523 fi
524
525 # Force no alignment to save space on i386.
526 if test "x$target_cpu" = xi386; then
527 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
528 CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror"
529 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
530 [grub_cv_cc_falign_loop=yes],
531 [grub_cv_cc_falign_loop=no])
532 ])
533
534 AC_CACHE_CHECK([whether -malign-loops works], [grub_cv_cc_malign_loop], [
535 CFLAGS="$TARGET_CFLAGS -malign-loops=1 -Werror"
536 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
537 [grub_cv_cc_malign_loop=yes],
538 [grub_cv_cc_malign_loop=no])
539 ])
540
541 if test "x$grub_cv_cc_falign_loop" = xyes; then
542 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
543 elif test "x$grub_cv_cc_malign_loop" = xyes; then
544 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
545 fi
546 fi
547
548 AC_CACHE_CHECK([whether -freg-struct-return works], [grub_cv_cc_freg_struct_return], [
549 CFLAGS="$TARGET_CFLAGS -freg-struct-return -Werror"
550 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
551 [grub_cv_cc_freg_struct_return=yes],
552 [grub_cv_cc_freg_struct_return=no])
553 ])
554
555 if test "x$grub_cv_cc_freg_struct_return" = xyes; then
556 TARGET_CFLAGS="$TARGET_CFLAGS -freg-struct-return"
557 fi
558
559 if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
560 # Some toolchains enable these features by default, but they need
561 # registers that aren't set up properly in GRUB.
562 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
563 fi
564
565 # By default, GCC 4.4 generates .eh_frame sections containing unwind
566 # information in some cases where it previously did not. GRUB doesn't need
567 # these and they just use up vital space. Restore the old compiler
568 # behaviour.
569 AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
570 CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
571 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
572 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
573 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
574 ])
575
576 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
577 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
578 fi
579
580 if test x"$target_os" = xcygwin; then
581 AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [
582 CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
583 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
584 [grub_cv_cc_no_reorder_functions=yes],
585 [grub_cv_cc_no_reorder_functions=no])
586 ])
587 fi
588
589 if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xyes; then
590 TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
591 fi
592
593 # By default, GCC 4.6 generates .eh_frame sections containing unwind
594 # information in some cases where it previously did not. GRUB doesn't need
595 # these and they just use up vital space. Restore the old compiler
596 # behaviour.
597 AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
598 CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
599 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
600 [grub_cv_cc_fno_asynchronous_unwind_tables=yes],
601 [grub_cv_cc_fno_asynchronous_unwind_tables=no])
602 ])
603
604 if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
605 TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
606 fi
607
608 # For platforms where ELF is not the default link format.
609 case "${target_os}" in
610 cygwin)
611 # FIXME: put proper test here
612 NEED_REGISTER_FRAME_INFO=1
613 ;;
614 *) NEED_REGISTER_FRAME_INFO=0 ;;
615 esac
616
617
618 AC_ARG_ENABLE([efiemu],
619 [AS_HELP_STRING([--enable-efiemu],
620 [build and install the efiemu runtimes (default=guessed)])])
621 if test x"$enable_efiemu" = xno ; then
622 efiemu_excuse="explicitly disabled"
623 fi
624 if test x"$target_os" = xcygwin ; then
625 efiemu_excuse="not available on cygwin"
626 fi
627 if test x"$target_cpu" != xi386 ; then
628 efiemu_excuse="only available on i386"
629 fi
630 if test x"$platform" = xefi ; then
631 efiemu_excuse="not available on efi"
632 fi
633 if test x"$efiemu_excuse" = x ; then
634 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
635 CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
636 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
637 [grub_cv_cc_efiemu=yes],
638 [grub_cv_cc_efiemu=no])
639 ])
640 if test x$grub_cv_cc_efiemu = xno; then
641 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
642 fi
643 fi
644 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
645 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
646 fi
647 if test x"$efiemu_excuse" = x ; then
648 enable_efiemu=yes
649 else
650 enable_efiemu=no
651 fi
652 AC_SUBST([enable_efiemu])
653
654 CFLAGS="$TARGET_CFLAGS"
655
656 if test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
657 AC_CACHE_CHECK([for linking format], [grub_cv_target_cc_link_format], [
658 grub_cv_target_cc_link_format=unknown
659 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
660 if test x${target_cpu} != xi386 && test x$format = x${target_cpu}pe; then
661 continue
662 fi
663 CFLAGS="$TARGET_CFLAGS -static"
664 LDFLAGS="$TARGET_LDFLAGS -Wl,$format -nostdlib"
665 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
666 asm (".globl start; start:");
667 asm (".globl _start; _start:");
668 asm (".globl __start; __start:");
669 void __main (void);
670 void __main (void) {}
671 ]], [[]])], [flag=1], [])
672 if test x"$flag" = x1; then
673 grub_cv_target_cc_link_format="$format"
674 break;
675 fi
676 done])
677 if test x"$grub_cv_target_cc_link_format" = xunknown; then
678 AC_MSG_ERROR([no suitable link format found])
679 fi
680 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
681 if test x"$grub_cv_target_cc_link_format" = x-mi386pe; then
682 TARGET_OBJ2ELF='./build-grub-pe2elf';
683 fi
684 fi
685
686 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
687 TARGET_APPLE_LINKER=1
688 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], [])
689 if test "x$TARGET_OBJCONV" = x ; then
690 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.])
691 fi
692 if test "x$TARGET_OBJCONV" = x ; then
693 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
694 fi
695 TARGET_IMG_LDSCRIPT=
696 TARGET_IMG_CFLAGS="-static"
697 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
698 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
699 TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
700 TARGET_LDFLAGS_OLDMAGIC=""
701 elif test x$grub_cv_target_cc_link_format = x-mi386pe && test x$platform = xpc; then
702 TARGET_APPLE_LINKER=0
703 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
704 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/i386-pc-cygwin-img-ld.sc"
705 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
706 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/i386-pc-cygwin-img-ld.sc"
707 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
708 TARGET_IMG_CFLAGS=
709 else
710 TARGET_APPLE_LINKER=0
711 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
712 TARGET_IMG_LDSCRIPT=
713 TARGET_IMG_LDFLAGS='-Wl,-N'
714 TARGET_IMG_LDFLAGS_AC='-Wl,-N'
715 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
716 TARGET_IMG_CFLAGS=
717 fi
718
719 AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
720
721
722 LDFLAGS="$TARGET_LDFLAGS"
723
724 if test "$target_cpu" = x86_64; then
725 # Use large model to support 4G memory
726 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
727 CFLAGS="$TARGET_CFLAGS -m64 -mcmodel=large"
728 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
729 [grub_cv_cc_mcmodel=yes],
730 [grub_cv_cc_mcmodel=no])
731 ])
732 if test "x$grub_cv_cc_mcmodel" = xno; then
733 AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
734 else
735 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
736 fi
737 fi
738
739 if test "$target_cpu"-"$platform" = x86_64-efi; then
740 # EFI writes to stack below %rsp, we must not use the red zone
741 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
742 CFLAGS="$TARGET_CFLAGS -m64 -mno-red-zone"
743 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
744 [grub_cv_cc_no_red_zone=yes],
745 [grub_cv_cc_no_red_zone=no])
746 ])
747 if test "x$grub_cv_cc_no_red_zone" = xno; then
748 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
749 fi
750
751 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
752 fi
753
754 #
755 # Compiler features.
756 #
757
758 CFLAGS="$TARGET_CFLAGS"
759
760 # Position independent executable.
761 grub_CHECK_PIE
762 [# Need that, because some distributions ship compilers that include
763 # `-fPIE' in the default specs.
764 if [ x"$pie_possible" = xyes ]; then
765 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
766 fi]
767
768 CFLAGS="$TARGET_CFLAGS"
769
770 # Position independent executable.
771 grub_CHECK_PIC
772 [# Need that, because some distributions ship compilers that include
773 # `-fPIC' in the default specs.
774 if [ x"$pic_possible" = xyes ]; then
775 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
776 fi]
777
778 CFLAGS="$TARGET_CFLAGS"
779
780 # Smashing stack protector.
781 grub_CHECK_STACK_PROTECTOR
782 # Need that, because some distributions ship compilers that include
783 # `-fstack-protector' in the default specs.
784 if test "x$ssp_possible" = xyes; then
785 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
786 fi
787
788 CFLAGS="$TARGET_CFLAGS"
789
790 grub_CHECK_STACK_ARG_PROBE
791 # Cygwin's GCC uses alloca() to probe the stackframe on static
792 # stack allocations above some threshold.
793 if test x"$sap_possible" = xyes; then
794 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
795 fi
796
797 CFLAGS="$TARGET_CFLAGS"
798
799 # -mno-unaligned-access
800 if test "$target_cpu" = arm; then
801 grub_CHECK_NO_UNALIGNED_ACCESS
802 if test x"$nua_possible" = xyes; then
803 TARGET_CFLAGS="$TARGET_CFLAGS -mno-unaligned-access"
804 fi
805 fi
806
807 # Set them to their new values for the tests below.
808 CC="$TARGET_CC"
809 if test "x$TARGET_APPLE_LINKER" = x1 ; then
810 CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
811 else
812 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
813 fi
814 CPPFLAGS="$TARGET_CPPFLAGS"
815 if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes ; then
816 TARGET_LIBGCC=
817 else
818 TARGET_LIBGCC=-lgcc
819 fi
820
821 LIBS="$TARGET_LIBGCC"
822
823 grub_ASM_USCORE
824 if test "x$TARGET_APPLE_LINKER" = x0 ; then
825 if test x$grub_cv_asm_uscore = xyes; then
826 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,_abort=_main"
827 else
828 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,abort=main"
829 fi
830 fi
831
832 # Check for libgcc symbols
833 AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x)
834
835 if test "x$TARGET_APPLE_LINKER" = x1 ; then
836 CFLAGS="$TARGET_CFLAGS -nostdlib"
837 else
838 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
839 fi
840 LIBS=""
841
842 # Defined in aclocal.m4.
843 grub_PROG_TARGET_CC
844 if test "x$TARGET_APPLE_LINKER" != x1 ; then
845 grub_PROG_OBJCOPY_ABSOLUTE
846 fi
847 grub_PROG_LD_BUILD_ID_NONE
848 if test "x$target_cpu" = xi386; then
849 if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then
850 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
851 # Check symbols provided by linker script.
852 CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},0x8000 -Wl,--defsym,___main=0x8100"
853 fi
854 grub_CHECK_BSS_START_SYMBOL
855 grub_CHECK_END_SYMBOL
856 fi
857 CFLAGS="$TARGET_CFLAGS"
858 grub_I386_ASM_PREFIX_REQUIREMENT
859 grub_I386_ASM_ADDR32
860 fi
861
862 grub_PROG_NM_WORKS
863 grub_PROG_NM_MINUS_P
864 grub_PROG_NM_DEFINED_ONLY
865 AC_SUBST(TARGET_NMFLAGS_MINUS_P)
866 AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
867
868 if test "$platform" != emu; then
869 AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
870 SAVED_CPPFLAGS="$CPPFLAGS"
871 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
872 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
873 #include <stddef.h>
874 int va_arg_func (int fixed, va_list args);]], [[]])],
875 [grub_cv_cc_isystem=yes],
876 [grub_cv_cc_isystem=no])
877 CPPFLAGS="$SAVED_CPPFLAGS"
878 ])
879
880 if test x"$grub_cv_cc_isystem" = xyes ; then
881 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
882 fi
883 fi
884
885 AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [
886 CFLAGS="$TARGET_CFLAGS -Wtrampolines -Werror"
887 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
888 int va_arg_func (int fixed, va_list args);]], [[]])],
889 [grub_cv_cc_wtrampolines=yes],
890 [grub_cv_cc_wtrampolines=no])
891 ])
892
893 if test x"$grub_cv_cc_wtrampolines" = xyes ; then
894 TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines"
895 fi
896
897 # Restore the flags.
898 CC="$tmp_CC"
899 CFLAGS="$tmp_CFLAGS"
900 CPPFLAGS="$tmp_CPPFLAGS"
901 LDFLAGS="$tmp_LDFLAGS"
902 LIBS="$tmp_LIBS"
903
904 #
905 # Check for options.
906 #
907
908 # Memory manager debugging.
909 AC_ARG_ENABLE([mm-debug],
910 AS_HELP_STRING([--enable-mm-debug],
911 [include memory manager debugging]),
912 [AC_DEFINE([MM_DEBUG], [1],
913 [Define to 1 if you enable memory manager debugging.])])
914
915 AC_ARG_ENABLE([cache-stats],
916 AS_HELP_STRING([--enable-cache-stats],
917 [enable disk cache statistics collection]))
918
919 if test x$enable_cache_stats = xyes; then
920 DISK_CACHE_STATS=1
921 else
922 DISK_CACHE_STATS=0
923 fi
924 AC_SUBST([DISK_CACHE_STATS])
925
926 AC_ARG_ENABLE([boot-time],
927 AS_HELP_STRING([--enable-boot-time],
928 [enable boot time statistics collection]))
929
930 if test x$enable_boot_time = xyes; then
931 BOOT_TIME_STATS=1
932 else
933 BOOT_TIME_STATS=0
934 fi
935 AC_SUBST([BOOT_TIME_STATS])
936
937 AC_ARG_ENABLE([grub-emu-usb],
938 [AS_HELP_STRING([--enable-grub-emu-usb],
939 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
940
941 AC_ARG_ENABLE([grub-emu-sdl],
942 [AS_HELP_STRING([--enable-grub-emu-sdl],
943 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
944
945 AC_ARG_ENABLE([grub-emu-pci],
946 [AS_HELP_STRING([--enable-grub-emu-pci],
947 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
948
949 if test "$platform" = emu; then
950
951 if test x"$enable_grub_emu_usb" != xyes ; then
952 grub_emu_usb_excuse="not enabled"
953 fi
954
955 if test x"$enable_grub_emu_pci" = xyes ; then
956 grub_emu_usb_excuse="conflicts with PCI support"
957 fi
958
959 [if [ x"$grub_emu_usb_excuse" = x ]; then
960 # Check for libusb libraries.]
961 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
962 [grub_emu_usb_excuse=["need libusb library"]])
963 AC_SUBST([LIBUSB])
964 [fi]
965 [if [ x"$grub_emu_usb_excuse" = x ]; then
966 # Check for headers.]
967 AC_CHECK_HEADERS([usb.h], [],
968 [grub_emu_usb_excuse=["need libusb headers"]])
969 [fi]
970 if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
971 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
972 fi
973 if test x"$grub_emu_usb_excuse" = x ; then
974 enable_grub_emu_usb=yes
975 else
976 enable_grub_emu_usb=no
977 fi
978
979 if test x"$enable_grub_emu_sdl" = xno ; then
980 grub_emu_sdl_excuse="explicitely disabled"
981 fi
982 [if [ x"$grub_emu_sdl_excuse" = x ]; then
983 # Check for libSDL libraries.]
984 AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
985 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
986 AC_SUBST([LIBSDL])
987 [fi]
988
989 [if [ x"$grub_emu_sdl_excuse" = x ]; then
990 # Check for headers.]
991 AC_CHECK_HEADERS([SDL/SDL.h], [],
992 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
993 [fi]
994
995 if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
996 AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
997 fi
998 if test x"$grub_emu_sdl_excuse" = x ; then
999 enable_grub_emu_sdl=yes
1000 else
1001 enable_grub_emu_sdl=no
1002 fi
1003
1004 if test x"$enable_grub_emu_pci" != xyes ; then
1005 grub_emu_pci_excuse="not enabled"
1006 fi
1007
1008 if test x"$enable_grub_emu_usb" = xyes ; then
1009 grub_emu_pci_excuse="conflicts with USB support"
1010 fi
1011
1012 [if [ x"$grub_emu_pci_excuse" = x ]; then
1013 # Check for libpci libraries.]
1014 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
1015 [grub_emu_pci_excuse=["need libpciaccess library"]])
1016 AC_SUBST([LIBPCIACCESS])
1017 [fi]
1018 [if [ x"$grub_emu_pci_excuse" = x ]; then
1019 # Check for headers.]
1020 AC_CHECK_HEADERS([pci/pci.h], [],
1021 [grub_emu_pci_excuse=["need libpciaccess headers"]])
1022 [fi]
1023
1024 if test x"$grub_emu_pci_excuse" = x ; then
1025 enable_grub_emu_pci=yes
1026 else
1027
1028 enable_grub_emu_pci=no
1029 fi
1030
1031 AC_SUBST([enable_grub_emu_sdl])
1032 AC_SUBST([enable_grub_emu_usb])
1033 AC_SUBST([enable_grub_emu_pci])
1034
1035 else
1036
1037 # Ignore --enable-emu-* if platform is not emu
1038 enable_grub_emu_sdl=no
1039 enable_grub_emu_usb=no
1040 enable_grub_emu_pci=no
1041 fi
1042
1043 AC_ARG_ENABLE([grub-mkfont],
1044 [AS_HELP_STRING([--enable-grub-mkfont],
1045 [build and install the `grub-mkfont' utility (default=guessed)])])
1046 if test x"$enable_grub_mkfont" = xno ; then
1047 grub_mkfont_excuse="explicitly disabled"
1048 fi
1049
1050 if test x"$grub_mkfont_excuse" = x ; then
1051 # Check for freetype libraries.
1052 AC_CHECK_TOOLS([FREETYPE], [freetype-config])
1053 if test "x$FREETYPE" = x ; then
1054 grub_mkfont_excuse=["need freetype2 library"]
1055 fi
1056 fi
1057
1058 unset ac_cv_header_ft2build_h
1059
1060 if test x"$grub_mkfont_excuse" = x ; then
1061 # Check for freetype libraries.
1062 freetype_cflags=`$FREETYPE --cflags`
1063 freetype_libs=`$FREETYPE --libs`
1064 SAVED_CPPFLAGS="$CPPFLAGS"
1065 CPPFLAGS="$CPPFLAGS $freetype_cflags"
1066 AC_CHECK_HEADERS([ft2build.h], [],
1067 [grub_mkfont_excuse=["need freetype2 headers"]])
1068 CPPFLAGS="$SAVED_CPPFLAGS"
1069 fi
1070
1071 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
1072 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
1073 fi
1074 if test x"$grub_mkfont_excuse" = x ; then
1075 enable_grub_mkfont=yes
1076 else
1077 enable_grub_mkfont=no
1078 fi
1079 AC_SUBST([enable_grub_mkfont])
1080 AC_SUBST([freetype_cflags])
1081 AC_SUBST([freetype_libs])
1082
1083 SAVED_CC="$CC"
1084 SAVED_CPP="$CPP"
1085 SAVED_CFLAGS="$CFLAGS"
1086 SAVED_CPPFLAGS="$CPPFLAGS"
1087 CC="$BUILD_CC"
1088 CPP="$BUILD_CPP"
1089 CFLAGS="$BUILD_CFLAGS"
1090 CPPFLAGS="$BUILD_CPPFLAGS"
1091
1092 unset ac_cv_c_bigendian
1093 unset ac_cv_header_ft2build_h
1094
1095 AC_COMPUTE_INT([BUILD_SIZEOF_VOID_P], [sizeof (void *)])
1096 AC_COMPUTE_INT([BUILD_SIZEOF_LONG], [sizeof (long)])
1097 AC_C_BIGENDIAN([BUILD_WORDS_BIGENDIAN=1], [BUILD_WORDS_BIGENDIAN=0], [BUILD_WORDS_BIGENDIAN=err], [BUILD_WORDS_BIGENDIAN=err])
1098
1099 if test x$BUILD_WORDS_BIGENDIAN = xerr ; then
1100 AC_MSG_ERROR([couldnt determine build endianness])
1101 fi
1102
1103 AC_SUBST([BUILD_SIZEOF_LONG])
1104 AC_SUBST([BUILD_SIZEOF_VOID_P])
1105 AC_SUBST([BUILD_WORDS_BIGENDIAN])
1106
1107 if test x"$grub_build_mkfont_excuse" = x ; then
1108 # Check for freetype libraries.
1109 AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config])
1110 if test "x$BUILD_FREETYPE" = x ; then
1111 grub_build_mkfont_excuse=["need freetype2 library"]
1112 fi
1113 fi
1114
1115 if test x"$grub_build_mkfont_excuse" = x ; then
1116 # Check for freetype libraries.
1117 build_freetype_cflags=`$BUILD_FREETYPE --cflags`
1118 build_freetype_libs=`$BUILD_FREETYPE --libs`
1119 SAVED_CPPFLAGS_2="$CPPFLAGS"
1120 CPPFLAGS="$CPPFLAGS $build_freetype_cflags"
1121 AC_CHECK_HEADERS([ft2build.h], [],
1122 [grub_build_mkfont_excuse=["need freetype2 headers"]])
1123 CPPFLAGS="$SAVED_CPPFLAGS_2"
1124 fi
1125
1126 if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
1127 AC_MSG_ERROR([build-grub-mkfont was explicitly requested but can't be compiled])
1128 fi
1129 if test x"$grub_build_mkfont_excuse" = x ; then
1130 enable_build_grub_mkfont=yes
1131 else
1132 enable_build_grub_mkfont=no
1133 fi
1134 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
1135 AC_MSG_ERROR([qemu, powerpc-ieee1275 and loongson ports needs build-time grub-mkfont])
1136 fi
1137
1138 AC_SUBST([build_freetype_cflags])
1139 AC_SUBST([build_freetype_libs])
1140
1141 CC="$SAVED_CC"
1142 CPP="$SAVED_CPP"
1143 CFLAGS="$SAVED_CFLAGS"
1144 CPPFLAGS="$SAVED_CPPFLAGS"
1145
1146
1147 DJVU_FONT_SOURCE=
1148
1149 starfield_excuse=
1150
1151 AC_ARG_ENABLE([grub-themes],
1152 [AS_HELP_STRING([--enable-grub-themes],
1153 [build and install GRUB themes (default=guessed)])])
1154 if test x"$enable_grub_themes" = xno ; then
1155 starfield_excuse="explicitly disabled"
1156 fi
1157
1158 if test x"$starfield_excuse" = x && test x"$enable_build_grub_mkfont" = xno ; then
1159 starfield_excuse="No build-time grub-mkfont"
1160 fi
1161
1162 if test x"$starfield_excuse" = x; then
1163 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
1164 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do
1165 if test -f "$dir/DejaVuSans.$ext"; then
1166 DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
1167 break 2
1168 fi
1169 done
1170 done
1171
1172 if test "x$DJVU_FONT_SOURCE" = x; then
1173 starfield_excuse="No DejaVu found"
1174 fi
1175 fi
1176
1177 if test x"$enable_grub_themes" = xyes && test x"$starfield_excuse" != x; then
1178 AC_MSG_ERROR([themes were explicitly requested but requirements are not satisfied])
1179 fi
1180
1181 AC_SUBST([DJVU_FONT_SOURCE])
1182
1183 FONT_SOURCE=
1184
1185 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
1186 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
1187 if test -f "$dir/unifont.$ext"; then
1188 FONT_SOURCE="$dir/unifont.$ext"
1189 break 2
1190 fi
1191 done
1192 done
1193
1194 if test x"$enable_build_grub_mkfont" = xno ; then
1195 FONT_SOURCE=
1196 fi
1197
1198 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
1199 AC_MSG_ERROR([qemu, powerpc-ieee1275 and loongson ports need unifont])
1200 fi
1201
1202 AC_SUBST([FONT_SOURCE])
1203
1204 if test x"$FONT_SOURCE" = x && test x"$DJVU_FONT_SOURCE" = x && test x"$grub_build_mkfont_excuse" = x; then
1205 grub_build_mkfont_excuse="no fonts"
1206 fi
1207
1208
1209 AC_ARG_ENABLE([grub-mount],
1210 [AS_HELP_STRING([--enable-grub-mount],
1211 [build and install the `grub-mount' utility (default=guessed)])])
1212 if test x"$enable_grub_mount" = xno ; then
1213 grub_mount_excuse="explicitly disabled"
1214 fi
1215
1216 if test x"$grub_mount_excuse" = x ; then
1217 AC_CHECK_LIB([fuse], [fuse_main_real], [],
1218 [grub_mount_excuse="need FUSE library"])
1219 fi
1220
1221 if test x"$grub_mount_excuse" = x ; then
1222 # Check for fuse headers.
1223 SAVED_CPPFLAGS="$CPPFLAGS"
1224 CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
1225 AC_CHECK_HEADERS([fuse/fuse.h], [],
1226 [grub_mount_excuse=["need FUSE headers"]])
1227 CPPFLAGS="$SAVED_CPPFLAGS"
1228 fi
1229
1230 if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
1231 AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled])
1232 fi
1233 if test x"$grub_mount_excuse" = x ; then
1234 enable_grub_mount=yes
1235 else
1236 enable_grub_mount=no
1237 fi
1238 AC_SUBST([enable_grub_mount])
1239
1240 AC_ARG_ENABLE([device-mapper],
1241 [AS_HELP_STRING([--enable-device-mapper],
1242 [enable Linux device-mapper support (default=guessed)])])
1243 if test x"$enable_device_mapper" = xno ; then
1244 device_mapper_excuse="explicitly disabled"
1245 fi
1246
1247 if test x"$device_mapper_excuse" = x ; then
1248 # Check for device-mapper header.
1249 AC_CHECK_HEADER([libdevmapper.h], [],
1250 [device_mapper_excuse="need libdevmapper header"])
1251 fi
1252
1253 if test x"$device_mapper_excuse" = x ; then
1254 # Check for device-mapper library.
1255 AC_CHECK_LIB([devmapper], [dm_task_create], [],
1256 [device_mapper_excuse="need devmapper library"])
1257 fi
1258
1259 if test x"$device_mapper_excuse" = x ; then
1260 # Check for device-mapper library.
1261 AC_CHECK_LIB([devmapper], [dm_log_with_errno_init],
1262 [],
1263 [device_mapper_excuse="need devmapper library"])
1264 fi
1265
1266 if test x"$device_mapper_excuse" = x ; then
1267 LIBDEVMAPPER="-ldevmapper";
1268 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
1269 [Define to 1 if you have the devmapper library.])
1270 fi
1271
1272 AC_SUBST([LIBDEVMAPPER])
1273
1274 LIBGEOM=
1275 if test x$host_kernel = xkfreebsd; then
1276 AC_CHECK_LIB([geom], [geom_gettree], [],
1277 [AC_MSG_ERROR([Your platform requires libgeom])])
1278 LIBGEOM="-lgeom"
1279 fi
1280
1281 AC_SUBST([LIBGEOM])
1282
1283 AC_ARG_ENABLE([liblzma],
1284 [AS_HELP_STRING([--enable-liblzma],
1285 [enable liblzma integration (default=guessed)])])
1286 if test x"$enable_liblzma" = xno ; then
1287 liblzma_excuse="explicitly disabled"
1288 fi
1289
1290 if test x"$liblzma_excuse" = x ; then
1291 AC_CHECK_LIB([lzma], [lzma_code],
1292 [],[liblzma_excuse="need lzma library"])
1293 fi
1294 if test x"$liblzma_excuse" = x ; then
1295 AC_CHECK_HEADER([lzma.h], [], [liblzma_excuse="need lzma header"])
1296 fi
1297
1298 if test x"$enable_liblzma" = xyes && test x"$liblzma_excuse" != x ; then
1299 AC_MSG_ERROR([liblzma support was explicitly requested but requirements are not satisfied])
1300 fi
1301
1302
1303 if test x"$liblzma_excuse" = x ; then
1304 LIBLZMA="-llzma"
1305 AC_DEFINE([USE_LIBLZMA], [1],
1306 [Define to 1 if you have the LZMA library.])
1307 fi
1308
1309 AC_SUBST([LIBLZMA])
1310
1311 AC_ARG_ENABLE([libzfs],
1312 [AS_HELP_STRING([--enable-libzfs],
1313 [enable libzfs integration (default=guessed)])])
1314 if test x"$enable_libzfs" = xno ; then
1315 libzfs_excuse="explicitly disabled"
1316 fi
1317
1318 if test x"$libzfs_excuse" = x ; then
1319 # Only check for system headers if libzfs support has not been disabled.
1320 AC_CHECK_HEADERS(libzfs.h libnvpair.h)
1321 fi
1322
1323 if test x"$libzfs_excuse" = x ; then
1324 AC_CHECK_LIB([zfs], [libzfs_init],
1325 [],
1326 [libzfs_excuse="need zfs library"])
1327 fi
1328
1329 if test x"$libzfs_excuse" = x ; then
1330 AC_CHECK_LIB([nvpair], [nvlist_lookup_string],
1331 [],
1332 [libzfs_excuse="need nvpair library"])
1333 fi
1334
1335 if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
1336 AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied])
1337 fi
1338
1339 if test x"$libzfs_excuse" = x ; then
1340 # We need both libzfs and libnvpair for a successful build.
1341 LIBZFS="-lzfs"
1342 AC_DEFINE([HAVE_LIBZFS], [1],
1343 [Define to 1 if you have the ZFS library.])
1344 LIBNVPAIR="-lnvpair"
1345 AC_DEFINE([HAVE_LIBNVPAIR], [1],
1346 [Define to 1 if you have the NVPAIR library.])
1347 fi
1348
1349 AC_SUBST([LIBZFS])
1350 AC_SUBST([LIBNVPAIR])
1351
1352 LIBS=""
1353
1354 AC_SUBST([FONT_SOURCE])
1355 AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
1356 [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
1357
1358 AC_SUBST(HAVE_ASM_USCORE)
1359 AC_SUBST(ADDR32)
1360 AC_SUBST(DATA32)
1361 AC_SUBST(BSS_START_SYMBOL)
1362 AC_SUBST(END_SYMBOL)
1363 AC_SUBST(PACKAGE)
1364 AC_SUBST(VERSION)
1365 AC_SUBST(NEED_REGISTER_FRAME_INFO)
1366
1367 AC_ARG_ENABLE([werror],
1368 [AS_HELP_STRING([--disable-werror],
1369 [do not use -Werror when building GRUB])])
1370 if test x"$enable_werror" != xno ; then
1371 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
1372 HOST_CFLAGS="$HOST_CFLAGS -Werror"
1373 fi
1374
1375 if test "x$grub_cv_cc_target_clang" = xno; then
1376 TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc"
1377 else
1378 TARGET_LDFLAGS_STATIC_LIBGCC=
1379 fi
1380
1381 TARGET_CPP="$TARGET_CC -E"
1382 TARGET_CCAS=$TARGET_CC
1383
1384 GRUB_TARGET_CPU="${target_cpu}"
1385 GRUB_PLATFORM="${platform}"
1386
1387 AC_SUBST(GRUB_TARGET_CPU)
1388 AC_SUBST(GRUB_PLATFORM)
1389
1390 AC_SUBST(TARGET_OBJCONV)
1391 AC_SUBST(TARGET_LIBGCC)
1392 AC_SUBST(TARGET_LDFLAGS_STATIC_LIBGCC)
1393 AC_SUBST(TARGET_CPP)
1394 AC_SUBST(TARGET_CCAS)
1395 AC_SUBST(TARGET_OBJ2ELF)
1396 AC_SUBST(TARGET_MODULE_FORMAT)
1397
1398 AC_SUBST(TARGET_CFLAGS)
1399 AC_SUBST(TARGET_LDFLAGS)
1400 AC_SUBST(TARGET_CPPFLAGS)
1401 AC_SUBST(TARGET_CCASFLAGS)
1402
1403 AC_SUBST(TARGET_IMG_LDSCRIPT)
1404 AC_SUBST(TARGET_IMG_LDFLAGS)
1405 AC_SUBST(TARGET_IMG_CFLAGS)
1406 AC_SUBST(TARGET_IMG_BASE_LDOPT)
1407 AC_SUBST(TARGET_APPLE_LINKER)
1408
1409 AC_SUBST(HOST_CFLAGS)
1410 AC_SUBST(HOST_LDFLAGS)
1411 AC_SUBST(HOST_CPPFLAGS)
1412 AC_SUBST(HOST_CCASFLAGS)
1413
1414 AC_SUBST(BUILD_LIBM)
1415
1416 #
1417 # Automake conditionals
1418 #
1419
1420 AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
1421 AM_CONDITIONAL([COND_clang], [test x$grub_cv_cc_target_clang = xyes])
1422 AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
1423 AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
1424 AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
1425 AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
1426 AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
1427 AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
1428 AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
1429 AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
1430 AM_CONDITIONAL([COND_i386_xen], [test x$target_cpu = xi386 -a x$platform = xxen])
1431 AM_CONDITIONAL([COND_x86_64_xen], [test x$target_cpu = xx86_64 -a x$platform = xxen])
1432 AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
1433 AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
1434 AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc])
1435 AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
1436 AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
1437 AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
1438 AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
1439 AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
1440 AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ])
1441 AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot])
1442 AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi])
1443 AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ])
1444 AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi])
1445
1446 AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
1447 AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
1448 AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
1449 AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
1450 AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
1451 AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
1452 AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
1453
1454 AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
1455 AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
1456 AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
1457 AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
1458 AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
1459 AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
1460 AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
1461 AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1])
1462 AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
1463 AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
1464 AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
1465
1466 AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
1467
1468 AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
1469 AM_CONDITIONAL([COND_CYGWIN], [test x$target_os = xcygwin])
1470 AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
1471 AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy])
1472
1473 test "x$prefix" = xNONE && prefix="$ac_default_prefix"
1474 test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
1475 datarootdir="$(eval echo "$datarootdir")"
1476 grub_libdir="$(eval echo "$libdir")"
1477 grub_localedir="$(eval echo "$localedir")"
1478 grub_datadir="$(eval echo "$datadir")"
1479 grub_sysconfdir="$(eval echo "$sysconfdir")"
1480 AC_DEFINE_UNQUOTED(LOCALEDIR, "$grub_localedir", [Locale dir])
1481 AC_DEFINE_UNQUOTED(GRUB_LIBDIR, "$grub_libdir", [Library dir])
1482 AC_DEFINE_UNQUOTED(GRUB_DATADIR, "$grub_datadir", [Data dir])
1483 AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "$grub_sysconfdir", [Configuration dir])
1484
1485
1486 # Output files.
1487 cpudir="${target_cpu}"
1488 if test x${cpudir} = xmipsel; then
1489 cpudir=mips;
1490 fi
1491 grub_CHECK_LINK_DIR
1492 if test x"$link_dir" = xyes ; then
1493 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
1494 if test "$platform" != emu ; then
1495 AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
1496 fi
1497 else
1498 mkdir -p include/grub 2>/dev/null
1499 rm -rf include/grub/cpu
1500 cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
1501 if test "$platform" != emu ; then
1502 rm -rf include/grub/machine
1503 cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
1504 fi
1505 fi
1506
1507 AC_CONFIG_FILES([Makefile])
1508 AC_CONFIG_FILES([grub-core/Makefile])
1509 AC_CONFIG_FILES([grub-core/gnulib/Makefile])
1510 AC_CONFIG_FILES([po/Makefile.in])
1511 AC_CONFIG_FILES([docs/Makefile])
1512 AC_CONFIG_FILES([util/bash-completion.d/Makefile])
1513 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
1514 AC_CONFIG_FILES([config.h])
1515
1516 AC_OUTPUT
1517 [
1518 echo "*******************************************************"
1519 echo GRUB2 will be compiled with following components:
1520 echo Platform: "$target_cpu"-"$platform"
1521 if [ x"$platform" = xemu ]; then
1522 if [ x"$grub_emu_usb_excuse" = x ]; then
1523 echo USB support for grub-emu: Yes
1524 else
1525 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
1526 fi
1527 if [ x"$grub_emu_sdl_excuse" = x ]; then
1528 echo SDL support for grub-emu: Yes
1529 else
1530 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
1531 fi
1532 if [ x"$grub_emu_pci_excuse" = x ]; then
1533 echo PCI support for grub-emu: Yes
1534 else
1535 echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
1536 fi
1537 fi
1538 if test x"$device_mapper_excuse" = x ; then
1539 echo With devmapper support: Yes
1540 else
1541 echo With devmapper support: No "($device_mapper_excuse)"
1542 fi
1543 if [ x"$enable_mm_debug" = xyes ]; then
1544 echo With memory debugging: Yes
1545 else
1546 echo With memory debugging: No
1547 fi
1548 if [ x"$enable_cache_stats" = xyes ]; then
1549 echo With disk cache statistics: Yes
1550 else
1551 echo With disk cache statistics: No
1552 fi
1553
1554 if [ x"$enable_boot_time" = xyes ]; then
1555 echo With boot time statistics: Yes
1556 else
1557 echo With boot time statistics: No
1558 fi
1559
1560 if [ x"$efiemu_excuse" = x ]; then
1561 echo efiemu runtime: Yes
1562 else
1563 echo efiemu runtime: No "($efiemu_excuse)"
1564 fi
1565 if [ x"$grub_mkfont_excuse" = x ]; then
1566 echo grub-mkfont: Yes
1567 else
1568 echo grub-mkfont: No "($grub_mkfont_excuse)"
1569 fi
1570 if [ x"$grub_mount_excuse" = x ]; then
1571 echo grub-mount: Yes
1572 else
1573 echo grub-mount: No "($grub_mount_excuse)"
1574 fi
1575 if [ x"$starfield_excuse" = x ]; then
1576 echo starfield theme: Yes
1577 else
1578 echo starfield theme: No "($starfield_excuse)"
1579 fi
1580 if [ x"$libzfs_excuse" = x ]; then
1581 echo With libzfs support: Yes
1582 else
1583 echo With libzfs support: No "($libzfs_excuse)"
1584 fi
1585 if [ x"$grub_build_mkfont_excuse" = x ]; then
1586 echo Build-time grub-mkfont: Yes
1587 if test "x$FONT_SOURCE" = x ; then
1588 echo "Without unifont"
1589 else
1590 echo "With unifont from $FONT_SOURCE"
1591 fi
1592 else
1593 echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)"
1594 echo "Without unifont (no build-time grub-mkfont)"
1595 fi
1596 if test x"$liblzma_excuse" != x ; then
1597 echo "Without liblzma (no support for XZ-compressed mips images) ($liblzma_excuse)"
1598 else
1599 echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
1600 fi
1601 echo "*******************************************************"
1602 ]