]> git.proxmox.com Git - grub2.git/blame - configure.ac
* util/grub-mount.c: Extend GCC warning workaround to grub-mount.
[grub2.git] / configure.ac
CommitLineData
76ed06b9
BC
1# -*- autoconf -*-
2
6a161fa9 3# Process this file with autoconf to produce a configure script.
4
2f1a3acf 5# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
6a161fa9 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
b977bf01 16dnl This configure script is complicated, because GRUB needs to deal
17dnl with three potentially different types:
18dnl
19dnl build -- the environment for building GRUB
20dnl host -- the environment for running utilities
21dnl target -- the environment for running GRUB
22dnl
23dnl In addition, GRUB needs to deal with a platform specification
24dnl which specifies the system running GRUB, such as firmware.
25dnl This is necessary because the target type in autoconf does not
26dnl describe such a system very well.
27dnl
28dnl The current strategy is to use variables with no prefix (such as
29dnl CC, CFLAGS, etc.) for the host type as well as the build type,
30dnl because GRUB does not need to use those variables for the build
31dnl type, so there is no conflict. Variables with the prefix "TARGET_"
32dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
33dnl type.
34
e8f07821 35AC_INIT([GRUB],[2.02~beta2],[bug-grub@gnu.org])
6a161fa9 36
15c69261
YB
37AC_CONFIG_AUX_DIR([build-aux])
38
76ed06b9
BC
39# We don't want -g -O2 by default in CFLAGS
40: ${CFLAGS=""}
6a161fa9 41
b977bf01 42# Checks for host and target systems.
6a161fa9 43AC_CANONICAL_HOST
ee7fb780 44save_program_prefix="${program_prefix}"
b977bf01 45AC_CANONICAL_TARGET
ee7fb780 46program_prefix="${save_program_prefix}"
6a161fa9 47
6fe506b0 48AM_INIT_AUTOMAKE([1.10.1])
8c411768 49AC_PREREQ(2.60)
6304d292 50AC_CONFIG_SRCDIR([include/grub/dl.h])
742f9232 51AC_CONFIG_HEADER([config-util.h])
e52db1f7 52
1d543c3e 53# Program name transformations
54AC_ARG_PROGRAM
fd49ceb3
CW
55grub_TRANSFORM([grub-bios-setup])
56grub_TRANSFORM([grub-editenv])
57grub_TRANSFORM([grub-install])
58grub_TRANSFORM([grub-mkconfig])
59grub_TRANSFORM([grub-mkfont])
60grub_TRANSFORM([grub-mkimage])
67ab8353 61grub_TRANSFORM([grub-glue-efi])
fd49ceb3
CW
62grub_TRANSFORM([grub-mklayout])
63grub_TRANSFORM([grub-mkpasswd-pbkdf2])
64grub_TRANSFORM([grub-mkrelpath])
65grub_TRANSFORM([grub-mkrescue])
66grub_TRANSFORM([grub-probe])
67grub_TRANSFORM([grub-reboot])
68grub_TRANSFORM([grub-script-check])
69grub_TRANSFORM([grub-set-default])
fd49ceb3 70grub_TRANSFORM([grub-sparc64-setup])
a79b8a15 71grub_TRANSFORM([grub-render-label])
ec824e0f 72grub_TRANSFORM([grub-file])
1d543c3e 73
90d1e879
RM
74# Optimization flag. Allow user to override.
75if test "x$TARGET_CFLAGS" = x; then
76 TARGET_CFLAGS="$TARGET_CFLAGS -Os"
77fi
78
76ed06b9
BC
79# Default HOST_CPPFLAGS
80HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
76ed06b9 81HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
76ed06b9 82HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
76ed06b9
BC
83
84TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
85TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
86TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
87
b977bf01 88case "$target_cpu" in
02164e1b 89 i[[3456]]86) target_cpu=i386 ;;
c7ef54aa 90 amd64) target_cpu=x86_64 ;;
02164e1b 91 sparc) target_cpu=sparc64 ;;
ade85305 92 mipsel|mips64el)
4959e111 93 target_cpu=mipsel;
c721825b 94 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
4a1eefb6 95 ;;
ade85305 96 mips|mips64)
76ed06b9 97 target_cpu=mips;
c721825b 98 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1";
4a1eefb6 99 ;;
389b31cd
LL
100 arm*)
101 target_cpu=arm;
102 ;;
15a463d7
LL
103 aarch64*)
104 target_cpu=arm64;
105 ;;
6a161fa9 106esac
107
05568c2e 108# Specify the platform (such as firmware).
109AC_ARG_WITH([platform],
110 AS_HELP_STRING([--with-platform=PLATFORM],
83b984de 111 [select the host platform [[guessed]]]))
05568c2e 112
113# Guess the platform if not specified.
114if test "x$with_platform" = x; then
b977bf01 115 case "$target_cpu"-"$target_vendor" in
05568c2e 116 i386-apple) platform=efi ;;
117 i386-*) platform=pc ;;
58393a2d 118 x86_64-apple) platform=efi ;;
737feb35 119 x86_64-*) platform=pc ;;
05568c2e 120 powerpc-*) platform=ieee1275 ;;
58393a2d 121 powerpc64-*) platform=ieee1275 ;;
05568c2e 122 sparc64-*) platform=ieee1275 ;;
4959e111
VS
123 mipsel-*) platform=loongson ;;
124 mips-*) platform=arc ;;
e68d3b24 125 ia64-*) platform=efi ;;
389b31cd 126 arm-*) platform=uboot ;;
15a463d7 127 arm64-*) platform=efi ;;
58393a2d 128 *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
05568c2e 129 esac
130else
131 platform="$with_platform"
132fi
133
ec1dfd63
VS
134case "$target_cpu"-"$platform" in
135 x86_64-efi) ;;
136 x86_64-emu) ;;
9612ebc0 137 x86_64-xen) ;;
ec1dfd63
VS
138 x86_64-*) target_cpu=i386 ;;
139 powerpc64-ieee1275) target_cpu=powerpc ;;
140esac
20011694 141
58393a2d 142# Check if the platform is supported, make final adjustments.
b977bf01 143case "$target_cpu"-"$platform" in
05568c2e 144 i386-efi) ;;
3f4ce737 145 x86_64-efi) ;;
9612ebc0
VS
146 i386-xen) ;;
147 x86_64-xen) ;;
05568c2e 148 i386-pc) ;;
7210dca9 149 i386-multiboot) ;;
546f966a 150 i386-coreboot) ;;
58393a2d 151 i386-linuxbios) platform=coreboot ;;
3d04eab8 152 i386-ieee1275) ;;
8231fb77 153 i386-qemu) ;;
05568c2e 154 powerpc-ieee1275) ;;
155 sparc64-ieee1275) ;;
2c40cc78 156 ia64-efi) ;;
f440c33f 157 mips-qemu_mips) ;;
3666d5f6 158 mips-qemu-mips) platform=qemu_mips;;
8906c3dd 159 mips-arc) ;;
7f63a64f 160 mipsel-arc) ;;
4959e111
VS
161 mipsel-qemu_mips) ;;
162 mipsel-qemu-mips) platform=qemu_mips;;
163 mipsel-yeeloong) platform=loongson ;;
164 mipsel-fuloong) platform=loongson ;;
165 mipsel-loongson) ;;
389b31cd
LL
166 arm-uboot) ;;
167 arm-efi) ;;
15a463d7 168 arm64-efi) ;;
f84b481b 169 *-emu) ;;
58393a2d 170 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
6a161fa9 171esac
172
48145ea3 173if test x$platform != xemu ; then
dd614590
VS
174 case "$target_cpu" in
175 i386 | powerpc) target_m32=1 ;;
176 x86_64 | sparc64) target_m64=1 ;;
177 esac
178fi
3f4ce737 179
eaf01c25
VS
180if test x"$target_cpu-$platform" = xsparc64-emu ; then
181 target_m64=1 ;
182fi
183
fc97214f 184case "$target_os" in
c3302aa5 185 windows* | mingw32*) target_os=cygwin ;;
fc97214f
VS
186esac
187
9304eef1 188# This normalizes the names, and creates a new variable ("host_kernel")
189# while at it, since the mapping is not always 1:1 (e.g. different OSes
190# using the same kernel type).
191case "$host_os" in
192 gnu*) host_kernel=hurd ;;
193 linux*) host_kernel=linux ;;
67937d4d 194 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
2c7031b1 195 netbsd*) host_kernel=netbsd ;;
958ee221 196 solaris*) host_kernel=illumos ;;
b105df76 197 darwin*) host_kernel=xnu ;;
7e518ca8 198 cygwin | windows* | mingw32*) host_kernel=windows ;;
9304eef1 199esac
200
cd46aa6c
VS
201case "$host_os" in
202 cygwin | windows* | mingw32*) have_exec=n ;;
203 aros*) have_exec=n ;;
204 *) have_exec=y;;
205esac
206
f84b481b 207case "$platform" in
c721825b
BC
208 coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
209 multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
210 efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
9612ebc0 211 xen) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_XEN=1" ;;
c721825b 212 ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
389b31cd 213 uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;;
c721825b
BC
214 qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
215 pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
216 emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
0c930a84
VS
217 loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1" ;;
218 qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1" ;;
3666d5f6 219 arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
f84b481b 220esac
4959e111
VS
221if test x${target_cpu} = xmipsel ; then
222 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
223else
0c930a84 224 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
4959e111 225fi
6bea3f89 226
7f63a64f
VS
227case "${target_cpu}-$platform" in
228 mips-arc)
229 TARGET_LINK_ADDR=0x88200000
230 TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000
231 ;;
232 mipsel-arc)
233 TARGET_LINK_ADDR=0x80700000
234 TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000
235 ;;
5fe67f39 236 mips*-qemu_mips | mips*-loongson)
7f63a64f
VS
237 TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000
238 ;;
239esac
240
241AC_SUBST(TARGET_LINK_ADDR)
242AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR)
243
c721825b 244TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
f84b481b 245
56978920 246AC_SUBST(host_cpu)
247AC_SUBST(host_os)
9304eef1 248AC_SUBST(host_kernel)
6e5a42fe 249
071114bb
VS
250AC_SUBST(target_cpu)
251AC_SUBST(platform)
252
d87aedff 253# Define default variables
7134247c
VS
254
255have_with_bootdir=n
256AC_ARG_WITH([bootdir],
257 AS_HELP_STRING([--with-bootdir=DIR],
258 [set the name of /boot directory [[guessed]]]),
259 [have_with_bootdir=y],
260 [have_with_bootdir=n])
261if test x$have_with_bootdir = xy; then
262 bootdirname="$with_bootdir"
263else
264 case "$host_os" in
265 netbsd* | openbsd*)
d87aedff 266 # Because /boot is used for the boot block in NetBSD and OpenBSD,
7134247c
VS
267 bootdirname='' ;;
268 *) bootdirname='boot' ;;
269 esac
270fi
271
d87aedff 272AC_SUBST(bootdirname)
a4c1d277
YB
273AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
274 [Default boot directory name]")
d87aedff 275
7134247c
VS
276AC_ARG_WITH([grubdir],
277 AS_HELP_STRING([--with-grubdir=DIR],
278 [set the name of grub directory [[guessed]]]),
279 [grubdirname="$with_grubdir"],
280 [grubdirname="$PACKAGE"])
281
d87aedff 282AC_SUBST(grubdirname)
a4c1d277
YB
283AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
284 [Default grub directory name])
d87aedff 285
b977bf01 286#
287# Checks for build programs.
288#
144f1f98 289
6c826348 290# Although cmp is listed in the GNU Coding Standards as a command which
291# can used directly, OpenBSD lacks cmp in the default installation.
292AC_CHECK_PROGS([CMP], [cmp])
293if test "x$CMP" = x; then
294 AC_MSG_ERROR([cmp is not found])
295fi
296
144f1f98 297AC_CHECK_PROGS([YACC], [bison])
1569ec51 298if test "x$YACC" = x; then
6c826348 299 AC_MSG_ERROR([bison is not found])
1569ec51 300fi
301
76ed06b9 302AC_PROG_RANLIB
b977bf01 303AC_PROG_INSTALL
304AC_PROG_AWK
09220190 305AC_PROG_LEX
76ed06b9 306AC_PROG_YACC
b977bf01 307AC_PROG_MAKE_SET
ff420223 308AC_PROG_MKDIR_P
e1fd1939 309AC_PROG_LN_S
b977bf01 310
c7c75cf4 311if test "x$LEX" = "x:"; then
09220190
BC
312 AC_MSG_ERROR([flex is not found])
313else
2663fb5f 314 version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
b777c18e 315 if test -n "$version" -a "$version" -ge 20535; then
09220190
BC
316 :
317 else
318 AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
319 fi
320fi
321
68807e5f 322# These are not a "must".
51fa856c 323AC_PATH_PROGS(MAKEINFO, makeinfo true)
6a161fa9 324
b977bf01 325#
326# Checks for host programs.
327#
328
329AC_PROG_CC
15c69261 330gl_EARLY
1eed0e6e 331AC_PROG_CXX
76ed06b9
BC
332AM_PROG_CC_C_O
333AM_PROG_AS
334
6a161fa9 335# Must be GCC.
336test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
337
1eed0e6e
VS
338AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
339
4889bdec 340AC_GNU_SOURCE
2f1a3acf 341AM_GNU_GETTEXT([external])
b977bf01 342AC_SYS_LARGEFILE
343
344# Identify characteristics of the host architecture.
7b780018
VS
345unset ac_cv_c_bigendian
346
eaf01c25
VS
347if test x"$target_cpu-$platform" = xsparc64-emu ; then
348 CFLAGS="$CFLAGS -m64"
349 HOST_CFLAGS="$HOST_CFLAGS -m64"
350fi
351
b977bf01 352AC_C_BIGENDIAN
353AC_CHECK_SIZEOF(void *)
354AC_CHECK_SIZEOF(long)
355
7e518ca8
VS
356case "$host_os" in
357 cygwin | windows* | mingw32*)
358 HOST_CPPFLAGS="$HOST_CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
359 CPPFLAGS="$CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
360 AC_CHECK_SIZEOF(TCHAR,,[#include <windows.h>])
361 ;;
362esac
363
aad32b14
VS
364if test x$USE_NLS = xno; then
365 HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
366fi
367
86695375 368if test "x$cross_compiling" = xyes; then
369 AC_MSG_WARN([cannot generate manual pages while cross compiling])
370else
371 AC_PATH_PROG(HELP2MAN, help2man)
372fi
373
3169f4c7 374# Check for functions and headers.
0f7e980b 375AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
e4c498a1 376AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
7c4e16ff 377
fb90b546
RM
378AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
379#include <sys/param.h>
380#include <sys/mount.h>])
381
382AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default
383#include <sys/param.h>
384#include <sys/mount.h>])
385
2c7031b1
GS
386# For opendisk() and getrawpartition() on NetBSD.
387# Used in util/deviceiter.c and in util/hostdisk.c.
388AC_CHECK_HEADER([util.h], [
389 AC_CHECK_LIB([util], [opendisk], [
390 LIBUTIL="-lutil"
391 AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
392 ])
393 AC_CHECK_LIB([util], [getrawpartition], [
394 LIBUTIL="-lutil"
395 AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
396 ])
397])
398AC_SUBST([LIBUTIL])
399
19ce697d 400AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
00c05e22 401 SAVED_CFLAGS="$CFLAGS"
b35ec299 402 CFLAGS="$HOST_CFLAGS -Wtrampolines -Werror"
00c05e22
VS
403 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
404int va_arg_func (int fixed, va_list args);]], [[]])],
19ce697d
VS
405 [grub_cv_host_cc_wtrampolines=yes],
406 [grub_cv_host_cc_wtrampolines=no])
00c05e22
VS
407 CFLAGS="$SAVED_CFLAGS"
408])
409
19ce697d
VS
410if test x"$grub_host_cv_cc_wtrampolines" = xyes ; then
411 HOST_CFLAGS="$HOST_CFLAGS -Wtrampolines"
00c05e22
VS
412fi
413
76ed06b9
BC
414#
415# Check for host and build compilers.
416#
417HOST_CC=$CC
816719c8
VS
418AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc])
419test -z "$BUILD_CC" && AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])
b224c266 420BUILD_CPP="$BUILD_CC -E"
76ed06b9 421
29013cba
VS
422case "$build_os" in
423 haiku*) BUILD_LIBM= ;;
424 *) BUILD_LIBM=-lm ;;
425esac
15c69261
YB
426# For gnulib.
427gl_INIT
428
93bf55e6 429WARN_FLAGS="-Wall -W -Wshadow -Wpointer-arith -Wundef -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wmain -Wmissing-braces -Wmissing-format-attribute -Wmultichar -Wparentheses -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wswitch -Wtrigraphs -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wwrite-strings -Wnested-externs -Wstrict-prototypes"
ae558c2c 430EXTRA_WARN_FLAGS="-Wextra -Wattributes -Wendif-labels -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmissing-field-initializers -Wnonnull -Woverflow -Wvla -Wpointer-to-int-cast -Wstrict-aliasing -Wvariadic-macros -Wvolatile-register-var -Wpointer-sign -Wmissing-include-dirs -Wmissing-prototypes -Wmissing-declarations -Wformat=2"
60d5e9cb
VS
431
432HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"
433
434AC_CACHE_CHECK([which extra warnings work], [grub_cv_cc_w_extra_flags], [
435 SAVED_CFLAGS="$CFLAGS"
436 grub_cv_cc_w_extra_flags=
437 for x in $EXTRA_WARN_FLAGS; do
438 CFLAGS="$HOST_CFLAGS $x -Werror"
439 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
440 if test x$flag = x1 ; then
441 grub_cv_cc_w_extra_flags="$grub_cv_cc_w_extra_flags $x"
442 fi
443 done
444 CFLAGS="$SAVED_CFLAGS"
445])
446
447HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags"
448
b977bf01 449#
450# Check for target programs.
451#
452
5b5d4aa5 453# Find tools for the target.
454if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
b977bf01 455 tmp_ac_tool_prefix="$ac_tool_prefix"
456 ac_tool_prefix=$target_alias-
457
458 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
459 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
fc97214f
VS
460 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
461 AC_CHECK_TOOL(TARGET_STRIP, strip)
462 AC_CHECK_TOOL(TARGET_NM, nm)
0e8daad0 463 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
b977bf01 464
465 ac_tool_prefix="$tmp_ac_tool_prefix"
466else
467 if test "x$TARGET_CC" = x; then
468 TARGET_CC=$CC
469 fi
fc97214f
VS
470 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
471 AC_CHECK_TOOL(TARGET_STRIP, strip)
472 AC_CHECK_TOOL(TARGET_NM, nm)
0e8daad0 473 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
b977bf01 474fi
fc97214f 475
76ed06b9
BC
476AC_SUBST(HOST_CC)
477AC_SUBST(BUILD_CC)
7c9d0c39
VS
478AC_SUBST(BUILD_CFLAGS)
479AC_SUBST(BUILD_CPPFLAGS)
b977bf01 480AC_SUBST(TARGET_CC)
fc97214f 481AC_SUBST(TARGET_NM)
1bd73025 482AC_SUBST(TARGET_RANLIB)
fc97214f
VS
483AC_SUBST(TARGET_STRIP)
484AC_SUBST(TARGET_OBJCOPY)
b977bf01 485
b977bf01 486# Test the C compiler for the target environment.
487tmp_CC="$CC"
488tmp_CFLAGS="$CFLAGS"
489tmp_LDFLAGS="$LDFLAGS"
490tmp_CPPFLAGS="$CPPFLAGS"
aa6d7826 491tmp_LIBS="$LIBS"
b977bf01 492CC="$TARGET_CC"
493CFLAGS="$TARGET_CFLAGS"
494CPPFLAGS="$TARGET_CPPFLAGS"
495LDFLAGS="$TARGET_LDFLAGS"
aa6d7826 496LIBS=""
b977bf01 497
90d1e879 498# debug flags.
4e27343f 499TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
76ed06b9 500TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
6a161fa9 501
c12936c5
VS
502if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then
503TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align"
504fi
505
6a7957f9
VS
506TARGET_CC_VERSION="$(LC_ALL=C $TARGET_CC --version | head -n1)"
507
60d5e9cb
VS
508AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [
509 LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
510
511 grub_cv_target_cc_w_extra_flags=
512 for x in $EXTRA_WARN_FLAGS; do
513 CFLAGS="$TARGET_CFLAGS $x -Werror"
37378f74
VS
514 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
515asm (".globl start; start:");
516void __main (void);
517void __main (void) {}
518int main (void);
519]], [[]])], [flag=1], [flag=0])
60d5e9cb
VS
520 if test x$flag = x1 ; then
521 grub_cv_target_cc_w_extra_flags="$grub_cv_target_cc_w_extra_flags $x"
522 fi
523 done
524])
525
526TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_w_extra_flags"
527
60375a88 528AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang]
b73b70eb
VS
529[
530CFLAGS="$TARGET_CFLAGS"
531AC_COMPILE_IFELSE(
60375a88
VS
532[AC_LANG_PROGRAM([], [[
533#ifdef __clang__
534#error "is clang"
535#endif
536]])],
537[grub_cv_cc_target_clang=no], [grub_cv_cc_target_clang=yes])])
538
2312f06c
VS
539# on x86 clang doesn't support .code16
540# on arm clang doesn't support .arch directive
63a45330
VS
541# on mips clang doesn't support privilegied instructions, doubleword store/load
542# and crashes with hand-written assembly
543if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \
544 || test "x$target_cpu" = xx86_64 || test "x$target_cpu" = xarm \
545 || test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ); then
60375a88
VS
546 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
547fi
548
b73b70eb
VS
549if test "x$grub_cv_cc_target_clang" = xyes && test "x$target_cpu" = xpowerpc; then
550AC_CACHE_CHECK([if clang can handle ame instruction], [grub_cv_cc_target_clang_ame]
551[
552CFLAGS="$TARGET_CFLAGS"
553AC_COMPILE_IFELSE(
554[AC_LANG_PROGRAM([], [[
555 unsigned int a = 0, b = 0;
556 asm volatile ("{ame|addme} %0,%1" : "=r" (a) : "r" (b));
557 if (a)
558 return 1;
559]])],
560[grub_cv_cc_target_clang_ame=yes], [grub_cv_cc_target_clang_ame=no])])
561 # clang <= 3.3 doesn't handle most of ppc assembly, not even inline assembly
562 # used by gcrypt
563 if test x$grub_cv_cc_target_clang_ame = xno ; then
564 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
896f483d 565 TARGET_CFLAGS="$TARGET_CFLAGS -no-integrated-as"
b73b70eb
VS
566 fi
567fi
568
60375a88
VS
569if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
570 TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
571fi
572
573if test "x$target_m32" = x1; then
574 # Force 32-bit mode.
575 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
576 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
577 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
578 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
579 TARGET_MODULE_FORMAT="elf32"
580fi
581
582if test "x$target_m64" = x1; then
583 # Force 64-bit mode.
584 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
585 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
586 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
587 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
588 TARGET_MODULE_FORMAT="elf64"
589fi
590
591if test "x$grub_cv_cc_target_clang" = xno && test "x$target_cpu" = xi386 && test "x$platform" != xemu && test "x$platform" != xefi; then
592 TARGET_CFLAGS="$TARGET_CFLAGS -mrtd -mregparm=3"
593fi
594
f93ddcfd
VS
595# on mips redirect cache flushing function to non-existant one.
596if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then
597 AC_CACHE_CHECK([whether -mflush-func=grub_red_herring works], [grub_cv_cc_mflush_func], [
598 CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring -Werror"
599 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
600 [grub_cv_cc_mflush_func=yes],
601 [grub_cv_cc_mflush_func=no])
602 ])
603
604 if test "x$grub_cv_cc_mflush_func" = xyes; then
605 TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring"
606 fi
607fi
608
609
90d1e879
RM
610# Force no alignment to save space on i386.
611if test "x$target_cpu" = xi386; then
612 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
b35ec299 613 CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror"
eb73121d 614 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
90d1e879
RM
615 [grub_cv_cc_falign_loop=yes],
616 [grub_cv_cc_falign_loop=no])
6a161fa9 617 ])
6a161fa9 618
c966a489 619 AC_CACHE_CHECK([whether -malign-loops works], [grub_cv_cc_malign_loop], [
b35ec299 620 CFLAGS="$TARGET_CFLAGS -malign-loops=1 -Werror"
c966a489
VS
621 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
622 [grub_cv_cc_malign_loop=yes],
623 [grub_cv_cc_malign_loop=no])
624 ])
625
90d1e879
RM
626 if test "x$grub_cv_cc_falign_loop" = xyes; then
627 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
c966a489 628 elif test "x$grub_cv_cc_malign_loop" = xyes; then
90d1e879 629 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
6a161fa9 630 fi
89e0240c 631fi
6a161fa9 632
cdc17f60
VS
633AC_CACHE_CHECK([whether -freg-struct-return works], [grub_cv_cc_freg_struct_return], [
634 CFLAGS="$TARGET_CFLAGS -freg-struct-return -Werror"
635 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
636 [grub_cv_cc_freg_struct_return=yes],
637 [grub_cv_cc_freg_struct_return=no])
638])
639
640if test "x$grub_cv_cc_freg_struct_return" = xyes; then
641 TARGET_CFLAGS="$TARGET_CFLAGS -freg-struct-return"
642fi
643
ee0220bc 644if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
90d1e879
RM
645 # Some toolchains enable these features by default, but they need
646 # registers that aren't set up properly in GRUB.
647 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
648fi
77c55a87 649
90d1e879
RM
650# By default, GCC 4.4 generates .eh_frame sections containing unwind
651# information in some cases where it previously did not. GRUB doesn't need
652# these and they just use up vital space. Restore the old compiler
653# behaviour.
654AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
24f4e57c 655 CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
90d1e879
RM
656 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
657 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
658 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
90d1e879 659])
77c55a87 660
90d1e879
RM
661if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
662 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
b977bf01 663fi
6a161fa9 664
1c1f31e5
VS
665if test x"$target_os" = xcygwin; then
666 AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [
24f4e57c 667 CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
1c1f31e5
VS
668 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
669 [grub_cv_cc_no_reorder_functions=yes],
670 [grub_cv_cc_no_reorder_functions=no])
671 ])
672fi
673
674if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xyes; then
675 TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
676fi
677
e9d3421c
VS
678# By default, GCC 4.6 generates .eh_frame sections containing unwind
679# information in some cases where it previously did not. GRUB doesn't need
680# these and they just use up vital space. Restore the old compiler
681# behaviour.
682AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
24f4e57c 683 CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
e9d3421c
VS
684 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
685 [grub_cv_cc_fno_asynchronous_unwind_tables=yes],
686 [grub_cv_cc_fno_asynchronous_unwind_tables=no])
e9d3421c
VS
687])
688
689if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
690 TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
691fi
692
30c7d3ce
VS
693AC_ARG_ENABLE([efiemu],
694 [AS_HELP_STRING([--enable-efiemu],
695 [build and install the efiemu runtimes (default=guessed)])])
696if test x"$enable_efiemu" = xno ; then
697 efiemu_excuse="explicitly disabled"
698fi
6f1f6a0c 699if test x"$grub_cv_target_cc_link_format" = x-mi386pe || test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
1c1f31e5
VS
700 efiemu_excuse="not available on cygwin"
701fi
30c7d3ce
VS
702if test x"$target_cpu" != xi386 ; then
703 efiemu_excuse="only available on i386"
704fi
705if test x"$platform" = xefi ; then
706 efiemu_excuse="not available on efi"
707fi
708if test x"$efiemu_excuse" = x ; then
709 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
3c2304d5 710 CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
30c7d3ce
VS
711 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
712 [grub_cv_cc_efiemu=yes],
713 [grub_cv_cc_efiemu=no])
714 ])
715 if test x$grub_cv_cc_efiemu = xno; then
716 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
717 fi
718fi
c2b70d09
AB
719if test x"$efiemu_excuse" = x ; then
720 AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [
721 grub_cv_target_cc_efiemu64_link_format=unknown
722 for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -arch,x86_64; do
723 CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
724 LDFLAGS="-m64 -Wl,$format -nostdlib -static"
725 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
726 asm (".globl start; start:");
727 asm (".globl _start; _start:");
728 asm (".globl __start; __start:");
729 void __main (void);
730 void __main (void) {}
731 ]], [[]])], [flag=1], [flag=0])
732 if test x"$flag" = x1; then
733 grub_cv_target_cc_efiemu64_link_format="$format"
734 break;
735 fi
736 done])
737 if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then
738 efiemu_excuse="no suitable link format for efiemu64 found"
739 else
740 EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format"
741 fi
742fi
30c7d3ce 743if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
d642d761 744 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled ($efiemu_excuse)])
30c7d3ce
VS
745fi
746if test x"$efiemu_excuse" = x ; then
747enable_efiemu=yes
748else
749enable_efiemu=no
750fi
751AC_SUBST([enable_efiemu])
c2b70d09 752AC_SUBST([EFIEMU64_LINK_FORMAT])
30c7d3ce 753
a9f25a08
VS
754CFLAGS="$TARGET_CFLAGS"
755
bf082198
VS
756
757if test x"$platform" = xemu ; then
758 TARGET_OBJ2ELF=
759 grub_cv_target_cc_link_format=
760 case "$host_os" in
761 *darwin* | *mac*)
762 grub_cv_target_cc_link_format="-arch,${target_cpu}"
763 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
764 ;;
765 *windows* | *cygwin* | *mingw*)
766 if test x${target_cpu} = xi386 ; then
767 grub_cv_target_cc_link_format=-mi386pe;
768 TARGET_OBJ2ELF='./build-grub-pe2elf';
769 fi
770 if test x${target_cpu} = xx86_64 ; then
771 grub_cv_target_cc_link_format=-mi386pep;
772 TARGET_OBJ2ELF='./build-grub-pep2elf';
773 fi
774 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
775 ;;
776 esac
777elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
c2b70d09 778 AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_format], [
a9f25a08 779 grub_cv_target_cc_link_format=unknown
6f1f6a0c 780 for format in -melf_${target_cpu} -melf_${target_cpu}_fbsd -melf_${target_cpu}_obsd -melf_${target_cpu}_haiku -mi386pe -mi386pep -arch,${target_cpu}; do
bf082198 781 if test x${target_cpu} != xi386 && test x$format = x-mi386pe; then
6f1f6a0c
VS
782 continue
783 fi
bf082198 784 if test x${target_cpu} != xx86_64 && test x$format = x-mi386pep; then
a9f25a08
VS
785 continue
786 fi
246a434f
VS
787 CFLAGS="$TARGET_CFLAGS"
788 LDFLAGS="$TARGET_LDFLAGS -Wl,$format -nostdlib -static"
a9f25a08
VS
789 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
790 asm (".globl start; start:");
791 asm (".globl _start; _start:");
792 asm (".globl __start; __start:");
793 void __main (void);
794 void __main (void) {}
c2b70d09 795 ]], [[]])], [flag=1], [flag=0])
a9f25a08
VS
796 if test x"$flag" = x1; then
797 grub_cv_target_cc_link_format="$format"
798 break;
799 fi
800 done])
801 if test x"$grub_cv_target_cc_link_format" = xunknown; then
802 AC_MSG_ERROR([no suitable link format found])
803 fi
804 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
6f1f6a0c 805 if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then
a9f25a08
VS
806 TARGET_OBJ2ELF='./build-grub-pe2elf';
807 fi
6f1f6a0c
VS
808 if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
809 TARGET_OBJ2ELF='./build-grub-pep2elf';
810 fi
a9f25a08
VS
811fi
812
813if test x$grub_cv_target_cc_link_format = x-arch,i386 || test x$grub_cv_target_cc_link_format = x-arch,x86_64; then
814 TARGET_APPLE_LINKER=1
815 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], [])
816 if test "x$TARGET_OBJCONV" = x ; then
817 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.])
818 fi
819 if test "x$TARGET_OBJCONV" = x ; then
820 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
821 fi
822 TARGET_IMG_LDSCRIPT=
823 TARGET_IMG_CFLAGS="-static"
824 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
825 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
826 TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
827 TARGET_LDFLAGS_OLDMAGIC=""
6f1f6a0c 828elif test x$grub_cv_target_cc_link_format = x-mi386pe || test x$grub_cv_target_cc_link_format = x-mi386pep ; then
a9f25a08
VS
829 TARGET_APPLE_LINKER=0
830 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
60b967be 831 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/i386-cygwin-img-ld.sc"
a9f25a08 832 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
60b967be 833 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/i386-cygwin-img-ld.sc"
a9f25a08
VS
834 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
835 TARGET_IMG_CFLAGS=
836else
837 TARGET_APPLE_LINKER=0
838 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
839 TARGET_IMG_LDSCRIPT=
840 TARGET_IMG_LDFLAGS='-Wl,-N'
841 TARGET_IMG_LDFLAGS_AC='-Wl,-N'
842 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
843 TARGET_IMG_CFLAGS=
844fi
845
846AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
847
848
849LDFLAGS="$TARGET_LDFLAGS"
8f0baaac 850
eaf01c25 851if test "$target_cpu" = x86_64 || test "$target_cpu-$platform" = sparc64-emu ; then
7e9ca17a 852 # Use large model to support 4G memory
6e09b8b7 853 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
24f4e57c 854 CFLAGS="$TARGET_CFLAGS -m64 -mcmodel=large"
6e09b8b7 855 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
856 [grub_cv_cc_mcmodel=yes],
857 [grub_cv_cc_mcmodel=no])
858 ])
a3ba7410 859 if test "x$grub_cv_cc_mcmodel" = xyes; then
c8600122 860 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
eaf01c25
VS
861 elif test "$target_cpu-$platform" = sparc64-emu; then
862 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany"
6e09b8b7 863 fi
46546fc5 864fi
7e9ca17a 865
46546fc5 866if test "$target_cpu"-"$platform" = x86_64-efi; then
7e9ca17a 867 # EFI writes to stack below %rsp, we must not use the red zone
868 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
24f4e57c 869 CFLAGS="$TARGET_CFLAGS -m64 -mno-red-zone"
7e9ca17a 870 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
871 [grub_cv_cc_no_red_zone=yes],
872 [grub_cv_cc_no_red_zone=no])
873 ])
874 if test "x$grub_cv_cc_no_red_zone" = xno; then
875 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
876 fi
877
c8600122 878 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
20011694 879fi
880
41822625
VS
881if test "x$target_cpu" = xarm; then
882 AC_CACHE_CHECK([whether option -mlong-calls works], grub_cv_cc_mlong_calls, [
883 CFLAGS="$TARGET_CFLAGS -mlong-calls -Werror"
884 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
885 [grub_cv_cc_mlong_calls=yes],
886 [grub_cv_cc_mlong_calls=no])
887 ])
888 if test "x$grub_cv_cc_mlong_calls" = xyes; then
889 TARGET_CFLAGS="$TARGET_CFLAGS -mlong-calls"
890 fi
a29f317a
VS
891 AC_CACHE_CHECK([whether option -mthumb-interwork works], grub_cv_cc_mthumb_interwork, [
892 CFLAGS="$TARGET_CFLAGS -mthumb-interwork -Werror"
893 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
894 [grub_cv_cc_mthumb_interwork=yes],
895 [grub_cv_cc_mthumb_interwork=no])
896 ])
897 if test "x$grub_cv_cc_mthumb_interwork" = xyes; then
898 TARGET_CFLAGS="$TARGET_CFLAGS -mthumb-interwork"
899 elif test "x$grub_cv_cc_target_clang" = xno ; then
900 AC_MSG_ERROR([your compiler doesn't support -mthumb-interwork])
901 else
902 CFLAGS="$TARGET_CFLAGS"
903 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
904#if defined (__thumb__) && !defined (__thumb2__)
905#error thumb without interworking
906#endif
907]])],
908 [no_interwork_ok=yes],
909 [no_interwork_ok=no])
910 if test x$no_interwork_ok = xno ; then
911 AC_MSG_ERROR([attempt to compile to thumb with no thumb interwork])
912 fi
913 fi
41822625
VS
914fi
915
57bc5d43
VS
916AC_CACHE_CHECK([whether option -Qn works], grub_cv_target_cc_qn, [
917 CFLAGS="$TARGET_CFLAGS -Qn -Werror"
918 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
919 [grub_cv_target_cc_qn=yes],
920 [grub_cv_target_cc_qn=no])])
921if test "x$grub_cv_target_cc_qn" = xyes; then
922 TARGET_CFLAGS="$TARGET_CFLAGS -Qn"
923fi
924
baa2a121 925#
926# Compiler features.
927#
928
28668d80
VS
929CFLAGS="$TARGET_CFLAGS"
930
93a81088 931# Position independent executable.
932grub_CHECK_PIE
933[# Need that, because some distributions ship compilers that include
934# `-fPIE' in the default specs.
935if [ x"$pie_possible" = xyes ]; then
936 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
937fi]
938
28668d80
VS
939CFLAGS="$TARGET_CFLAGS"
940
7bd8b0c7
VS
941# Position independent executable.
942grub_CHECK_PIC
9cf12b20
VS
943[# On most platforms we don't want PIC as it only makes relocations harder
944# and code less efficient. On mips we want to have one got table per module
945# and reload $gp in every function.
946# GCC implements it using symbol __gnu_local_gp in non-PIC as well.
947# However with clang we need PIC for this reloading to happen.
948# Since default varies across dictributions use either -fPIC or -fno-PIC
949# explicitly.
950if ( test x$target_cpu = xmips || test x$target_cpu = xmipsel ) && test "x$grub_cv_cc_target_clang" = xyes ; then
951 TARGET_CFLAGS="$TARGET_CFLAGS -fPIC"
952elif [ x"$pic_possible" = xyes ]; then
953 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
7bd8b0c7
VS
954fi]
955
28668d80
VS
956CFLAGS="$TARGET_CFLAGS"
957
baa2a121 958# Smashing stack protector.
959grub_CHECK_STACK_PROTECTOR
c3db8364 960# Need that, because some distributions ship compilers that include
baa2a121 961# `-fstack-protector' in the default specs.
c3db8364 962if test "x$ssp_possible" = xyes; then
963 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
964fi
28668d80
VS
965
966CFLAGS="$TARGET_CFLAGS"
967
2a8a80e4 968grub_CHECK_STACK_ARG_PROBE
969# Cygwin's GCC uses alloca() to probe the stackframe on static
970# stack allocations above some threshold.
971if test x"$sap_possible" = xyes; then
972 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
973fi
baa2a121 974
28668d80
VS
975CFLAGS="$TARGET_CFLAGS"
976
d74b9a1d 977# -mno-unaligned-access -mstrict-align
bb9f92b9 978if test "$target_cpu" = arm; then
d74b9a1d 979 AC_CACHE_CHECK([for compile options to get strict alignment], [grub_cv_target_cc_strict_align], [
bdb6090d 980 grub_cv_target_cc_strict_align=
d74b9a1d
VS
981 for arg in -mno-unaligned-access "-Xclang -mstrict-align" -mstrict-align; do
982 CFLAGS="$TARGET_CFLAGS $arg -Werror"
983 LDFLAGS="$TARGET_LDFLAGS"
984 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
985 if test x"$flag" = x1; then
986 grub_cv_target_cc_strict_align="$arg"
987 break;
988 fi
989 done])
990
d74b9a1d
VS
991 TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_strict_align"
992 if test x"$grub_cv_target_cc_strict_align" = x"-Xclang -mstrict-align"; then
993 TARGET_LDFLAGS="$TARGET_LDFLAGS -Qunused-arguments"
bb9f92b9 994 fi
bdb6090d
VS
995 AC_CACHE_CHECK([if compiler generates unaligned accesses], [grub_cv_cc_target_emits_unaligned],
996 [CFLAGS="$TARGET_CFLAGS"
997 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
998#ifdef __ARM_FEATURE_UNALIGNED
999#error "unaligned"
1000#endif
1001 ]])],
1002 [grub_cv_cc_target_emits_unaligned=no], [grub_cv_cc_target_emits_unaligned=yes])])
1003 if test x$grub_cv_cc_target_emits_unaligned = xyes; then
1004 AC_MSG_ERROR([compiler generates unaligned accesses])
1005 fi
bb9f92b9
LL
1006fi
1007
aa6d7826 1008# Set them to their new values for the tests below.
1009CC="$TARGET_CC"
a9f25a08 1010if test "x$TARGET_APPLE_LINKER" = x1 ; then
246a434f 1011CFLAGS="$TARGET_CFLAGS -nostdlib -static -Wno-error"
26de2bcd 1012else
37378f74 1013CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
26de2bcd 1014fi
aa6d7826 1015CPPFLAGS="$TARGET_CPPFLAGS"
d5524ca8
VS
1016if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes ; then
1017TARGET_LIBGCC=
03f80960 1018else
d5524ca8 1019TARGET_LIBGCC=-lgcc
03f80960 1020fi
69be5b74 1021
d5524ca8
VS
1022LIBS="$TARGET_LIBGCC"
1023
01fcf061 1024grub_ASM_USCORE
a9f25a08 1025if test "x$TARGET_APPLE_LINKER" = x0 ; then
01fcf061 1026if test x$grub_cv_asm_uscore = xyes; then
37378f74 1027DEFSYM="-Wl,--defsym,_abort=_main -Wl,--defsym,__main=_main"
01fcf061 1028else
37378f74 1029DEFSYM="-Wl,--defsym,abort=main -Wl,--defsym,_main=main -Wl,--defsym,__main=main"
01fcf061 1030fi
37378f74 1031CFLAGS="$TARGET_CFLAGS -nostdlib $DEFSYM"
a9f25a08 1032fi
01fcf061 1033
69be5b74 1034# Check for libgcc symbols
6fcec439 1035AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x)
69be5b74 1036
a9f25a08 1037if test "x$TARGET_APPLE_LINKER" = x1 ; then
246a434f 1038CFLAGS="$TARGET_CFLAGS -nostdlib -static"
69be5b74 1039else
37378f74 1040CFLAGS="$TARGET_CFLAGS -nostdlib"
69be5b74 1041fi
42e0cba3 1042LIBS=""
aa6d7826 1043
6a161fa9 1044# Defined in aclocal.m4.
f6130a12 1045grub_PROG_TARGET_CC
a9f25a08 1046if test "x$TARGET_APPLE_LINKER" != x1 ; then
b977bf01 1047grub_PROG_OBJCOPY_ABSOLUTE
2b167a72 1048fi
cb71ba20 1049grub_PROG_LD_BUILD_ID_NONE
b977bf01 1050if test "x$target_cpu" = xi386; then
a9f25a08 1051 if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then
2aec1692
CF
1052 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
1053 # Check symbols provided by linker script.
37378f74 1054 CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},0x8000"
2aec1692 1055 fi
2a8a80e4 1056 grub_CHECK_BSS_START_SYMBOL
1057 grub_CHECK_END_SYMBOL
1058 fi
1059 CFLAGS="$TARGET_CFLAGS"
4b13b216 1060 grub_I386_ASM_PREFIX_REQUIREMENT
1061 grub_I386_ASM_ADDR32
6a161fa9 1062fi
1063
20aea949
VS
1064grub_PROG_NM_WORKS
1065grub_PROG_NM_MINUS_P
1066grub_PROG_NM_DEFINED_ONLY
1067AC_SUBST(TARGET_NMFLAGS_MINUS_P)
1068AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
1069
016a671b 1070if test "$platform" != emu; then
8f9a632b
VS
1071AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
1072 SAVED_CPPFLAGS="$CPPFLAGS"
1073 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
1074 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
ce938140 1075#include <stddef.h>
8f9a632b
VS
1076int va_arg_func (int fixed, va_list args);]], [[]])],
1077 [grub_cv_cc_isystem=yes],
1078 [grub_cv_cc_isystem=no])
1079 CPPFLAGS="$SAVED_CPPFLAGS"
1080])
1081
1082if test x"$grub_cv_cc_isystem" = xyes ; then
1083 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
1084fi
dae79b6b 1085fi
5ce5507f 1086
19ce697d 1087AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [
24f4e57c 1088 CFLAGS="$TARGET_CFLAGS -Wtrampolines -Werror"
779dc15b
VS
1089 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
1090int va_arg_func (int fixed, va_list args);]], [[]])],
19ce697d
VS
1091 [grub_cv_cc_wtrampolines=yes],
1092 [grub_cv_cc_wtrampolines=no])
779dc15b
VS
1093])
1094
19ce697d
VS
1095if test x"$grub_cv_cc_wtrampolines" = xyes ; then
1096 TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines"
779dc15b
VS
1097fi
1098
c9a86192 1099# Restore the flags.
9962ed99 1100CC="$tmp_CC"
1101CFLAGS="$tmp_CFLAGS"
1102CPPFLAGS="$tmp_CPPFLAGS"
c9a86192 1103LDFLAGS="$tmp_LDFLAGS"
aa6d7826 1104LIBS="$tmp_LIBS"
6a161fa9 1105
4fe9862e 1106#
2965c7cc 1107# Check for options.
4fe9862e 1108#
1109
1110# Memory manager debugging.
b39f9d20 1111AC_ARG_ENABLE([mm-debug],
2965c7cc 1112 AS_HELP_STRING([--enable-mm-debug],
90ce5d56 1113 [include memory manager debugging]),
2965c7cc 1114 [AC_DEFINE([MM_DEBUG], [1],
1115 [Define to 1 if you enable memory manager debugging.])])
1116
c5dc1690
SJ
1117AC_ARG_ENABLE([cache-stats],
1118 AS_HELP_STRING([--enable-cache-stats],
055e2b8b 1119 [enable disk cache statistics collection]))
c5dc1690
SJ
1120
1121if test x$enable_cache_stats = xyes; then
1122 DISK_CACHE_STATS=1
1123else
1124 DISK_CACHE_STATS=0
1125fi
1126AC_SUBST([DISK_CACHE_STATS])
1127
e744219b
VS
1128AC_ARG_ENABLE([boot-time],
1129 AS_HELP_STRING([--enable-boot-time],
1130 [enable boot time statistics collection]))
1131
1132if test x$enable_boot_time = xyes; then
1133 BOOT_TIME_STATS=1
1134else
1135 BOOT_TIME_STATS=0
1136fi
1137AC_SUBST([BOOT_TIME_STATS])
1138
d64399b5 1139AC_ARG_ENABLE([grub-emu-usb],
1140 [AS_HELP_STRING([--enable-grub-emu-usb],
5ce5507f 1141 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
5ce5507f 1142
927d0134
VS
1143AC_ARG_ENABLE([grub-emu-sdl],
1144 [AS_HELP_STRING([--enable-grub-emu-sdl],
1145 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
1146
3affd0ec 1147AC_ARG_ENABLE([grub-emu-pci],
1148 [AS_HELP_STRING([--enable-grub-emu-pci],
1149 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
1150
f84b481b 1151if test "$platform" = emu; then
f84b481b 1152
62a747cb
VS
1153if test x"$enable_grub_emu_usb" != xyes ; then
1154 grub_emu_usb_excuse="not enabled"
5ce5507f 1155fi
325c8258 1156
0e848909
VS
1157if test x"$enable_grub_emu_pci" = xyes ; then
1158 grub_emu_usb_excuse="conflicts with PCI support"
1159fi
1160
5ce5507f 1161[if [ x"$grub_emu_usb_excuse" = x ]; then
d64399b5 1162 # Check for libusb libraries.]
5ce5507f 1163AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
e98cd0c2 1164 [grub_emu_usb_excuse=["need libusb library"]])
d64399b5 1165 AC_SUBST([LIBUSB])
5ce5507f 1166[fi]
1167[if [ x"$grub_emu_usb_excuse" = x ]; then
1168 # Check for headers.]
d64399b5 1169 AC_CHECK_HEADERS([usb.h], [],
e98cd0c2 1170 [grub_emu_usb_excuse=["need libusb headers"]])
4fe9862e 1171[fi]
c6f3b249 1172if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
d642d761 1173 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled ($grub_emu_usb_excuse)])
5ce5507f 1174fi
1175if test x"$grub_emu_usb_excuse" = x ; then
1176enable_grub_emu_usb=yes
1177else
1178enable_grub_emu_usb=no
1179fi
1180
927d0134 1181if test x"$enable_grub_emu_sdl" = xno ; then
16f7455b 1182 grub_emu_sdl_excuse="explicitly disabled"
927d0134
VS
1183fi
1184[if [ x"$grub_emu_sdl_excuse" = x ]; then
1185 # Check for libSDL libraries.]
1186AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
1187 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
1188 AC_SUBST([LIBSDL])
1189[fi]
9f293ab0 1190
927d0134
VS
1191[if [ x"$grub_emu_sdl_excuse" = x ]; then
1192 # Check for headers.]
1193 AC_CHECK_HEADERS([SDL/SDL.h], [],
1194 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
1195[fi]
9f293ab0 1196
927d0134 1197if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
16f7455b 1198 AC_MSG_ERROR([SDL support for grub-emu was explicitly requested but can't be compiled ($grub_emu_sdl_excuse)])
927d0134
VS
1199fi
1200if test x"$grub_emu_sdl_excuse" = x ; then
1201enable_grub_emu_sdl=yes
1202else
1203enable_grub_emu_sdl=no
1204fi
1205
3affd0ec 1206if test x"$enable_grub_emu_pci" != xyes ; then
325c8258 1207 grub_emu_pci_excuse="not enabled"
1208fi
1209
1210if test x"$enable_grub_emu_usb" = xyes ; then
1211 grub_emu_pci_excuse="conflicts with USB support"
1212fi
1213
1214[if [ x"$grub_emu_pci_excuse" = x ]; then
1215 # Check for libpci libraries.]
459fed4b 1216 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
1217 [grub_emu_pci_excuse=["need libpciaccess library"]])
1218 AC_SUBST([LIBPCIACCESS])
325c8258 1219[fi]
1220[if [ x"$grub_emu_pci_excuse" = x ]; then
1221 # Check for headers.]
1222 AC_CHECK_HEADERS([pci/pci.h], [],
459fed4b 1223 [grub_emu_pci_excuse=["need libpciaccess headers"]])
325c8258 1224[fi]
1225
1226if test x"$grub_emu_pci_excuse" = x ; then
1227enable_grub_emu_pci=yes
1228else
9f293ab0 1229
325c8258 1230enable_grub_emu_pci=no
3affd0ec 1231fi
1232
927d0134 1233AC_SUBST([enable_grub_emu_sdl])
d64399b5 1234AC_SUBST([enable_grub_emu_usb])
3affd0ec 1235AC_SUBST([enable_grub_emu_pci])
e7d09ac4
AB
1236
1237else
1238
1239# Ignore --enable-emu-* if platform is not emu
1240enable_grub_emu_sdl=no
1241enable_grub_emu_usb=no
1242enable_grub_emu_pci=no
f84b481b 1243fi
4fe9862e 1244
e52db1f7 1245AC_ARG_ENABLE([grub-mkfont],
1246 [AS_HELP_STRING([--enable-grub-mkfont],
5ce5507f 1247 [build and install the `grub-mkfont' utility (default=guessed)])])
1248if test x"$enable_grub_mkfont" = xno ; then
ce7a733d 1249 grub_mkfont_excuse="explicitly disabled"
5ce5507f 1250fi
1251
1252if test x"$grub_mkfont_excuse" = x ; then
e52db1f7 1253 # Check for freetype libraries.
a5b55c4b 1254 AC_CHECK_TOOLS([FREETYPE], [freetype-config])
e52db1f7 1255 if test "x$FREETYPE" = x ; then
e98cd0c2 1256 grub_mkfont_excuse=["need freetype2 library"]
e52db1f7 1257 fi
e52db1f7 1258fi
660960d6 1259
7b780018
VS
1260unset ac_cv_header_ft2build_h
1261
660960d6
VS
1262if test x"$grub_mkfont_excuse" = x ; then
1263 # Check for freetype libraries.
a5b55c4b
DM
1264 freetype_cflags=`$FREETYPE --cflags`
1265 freetype_libs=`$FREETYPE --libs`
d1e8a02f 1266 SAVED_CPPFLAGS="$CPPFLAGS"
b75db69a 1267 SAVED_LIBS="$LIBS"
d1e8a02f 1268 CPPFLAGS="$CPPFLAGS $freetype_cflags"
b75db69a 1269 LIBS="$LIBS $freetype_libs"
660960d6
VS
1270 AC_CHECK_HEADERS([ft2build.h], [],
1271 [grub_mkfont_excuse=["need freetype2 headers"]])
b75db69a 1272 AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]])
d1e8a02f 1273 CPPFLAGS="$SAVED_CPPFLAGS"
b75db69a 1274 LIBS="$SAVED_LIBS"
660960d6
VS
1275fi
1276
5ce5507f 1277if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
d642d761 1278 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled ($grub_mkfont_excuse)])
5ce5507f 1279fi
1280if test x"$grub_mkfont_excuse" = x ; then
1281enable_grub_mkfont=yes
1282else
1283enable_grub_mkfont=no
1284fi
e52db1f7 1285AC_SUBST([enable_grub_mkfont])
1286AC_SUBST([freetype_cflags])
1287AC_SUBST([freetype_libs])
1288
7c9d0c39 1289SAVED_CC="$CC"
b224c266 1290SAVED_CPP="$CPP"
7c9d0c39
VS
1291SAVED_CFLAGS="$CFLAGS"
1292SAVED_CPPFLAGS="$CPPFLAGS"
1293CC="$BUILD_CC"
b224c266 1294CPP="$BUILD_CPP"
7c9d0c39 1295CFLAGS="$BUILD_CFLAGS"
7b780018
VS
1296CPPFLAGS="$BUILD_CPPFLAGS"
1297
1298unset ac_cv_c_bigendian
1299unset ac_cv_header_ft2build_h
1300
1301AC_COMPUTE_INT([BUILD_SIZEOF_VOID_P], [sizeof (void *)])
1302AC_COMPUTE_INT([BUILD_SIZEOF_LONG], [sizeof (long)])
1303AC_C_BIGENDIAN([BUILD_WORDS_BIGENDIAN=1], [BUILD_WORDS_BIGENDIAN=0], [BUILD_WORDS_BIGENDIAN=err], [BUILD_WORDS_BIGENDIAN=err])
1304
1305if test x$BUILD_WORDS_BIGENDIAN = xerr ; then
1306 AC_MSG_ERROR([couldnt determine build endianness])
1307fi
1308
1309AC_SUBST([BUILD_SIZEOF_LONG])
1310AC_SUBST([BUILD_SIZEOF_VOID_P])
1311AC_SUBST([BUILD_WORDS_BIGENDIAN])
c5884973 1312
7c9d0c39
VS
1313if test x"$grub_build_mkfont_excuse" = x ; then
1314 # Check for freetype libraries.
7b780018 1315 AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config])
7c9d0c39
VS
1316 if test "x$BUILD_FREETYPE" = x ; then
1317 grub_build_mkfont_excuse=["need freetype2 library"]
1318 fi
1319fi
c5884973 1320
7c9d0c39
VS
1321if test x"$grub_build_mkfont_excuse" = x ; then
1322 # Check for freetype libraries.
1323 build_freetype_cflags=`$BUILD_FREETYPE --cflags`
1324 build_freetype_libs=`$BUILD_FREETYPE --libs`
1325 SAVED_CPPFLAGS_2="$CPPFLAGS"
b75db69a 1326 SAVED_LIBS="$LIBS"
7c9d0c39 1327 CPPFLAGS="$CPPFLAGS $build_freetype_cflags"
b75db69a 1328 LIBS="$LIBS $build_freetype_libs"
7c9d0c39
VS
1329 AC_CHECK_HEADERS([ft2build.h], [],
1330 [grub_build_mkfont_excuse=["need freetype2 headers"]])
b75db69a
VS
1331 AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_build_mkfont_excuse=["freetype2 library unusable"]])
1332 LIBS="$SAVED_LIBS"
7c9d0c39
VS
1333 CPPFLAGS="$SAVED_CPPFLAGS_2"
1334fi
1335
1336if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
d642d761 1337 AC_MSG_ERROR([build-grub-mkfont was explicitly requested but can't be compiled ($grub_build_mkfont_excuse)])
7c9d0c39
VS
1338fi
1339if test x"$grub_build_mkfont_excuse" = x ; then
1340 enable_build_grub_mkfont=yes
1341else
1342 enable_build_grub_mkfont=no
c5884973 1343fi
72c9a507 1344if 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 || test "x$platform" = xcoreboot ); then
d642d761
CW
1345 if test x"$grub_build_mkfont_excuse" = x ; then
1346 AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports needs build-time grub-mkfont])
1347 else
1348 AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports needs build-time grub-mkfont ($grub_build_mkfont_excuse)])
1349 fi
7c9d0c39
VS
1350fi
1351
1352AC_SUBST([build_freetype_cflags])
1353AC_SUBST([build_freetype_libs])
1354
1355CC="$SAVED_CC"
b224c266 1356CPP="$SAVED_CPP"
7c9d0c39
VS
1357CFLAGS="$SAVED_CFLAGS"
1358CPPFLAGS="$SAVED_CPPFLAGS"
1359
1360
1361DJVU_FONT_SOURCE=
1362
1363starfield_excuse=
c5884973 1364
300f48c5
VS
1365AC_ARG_ENABLE([grub-themes],
1366 [AS_HELP_STRING([--enable-grub-themes],
1367 [build and install GRUB themes (default=guessed)])])
1368if test x"$enable_grub_themes" = xno ; then
1369 starfield_excuse="explicitly disabled"
1370fi
1371
1372if test x"$starfield_excuse" = x && test x"$enable_build_grub_mkfont" = xno ; then
7b966834
VS
1373 starfield_excuse="No build-time grub-mkfont"
1374fi
1375
501b9e4b 1376if test x"$starfield_excuse" = x; then
c5884973 1377 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
32745f51 1378 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do
c5884973
DO
1379 if test -f "$dir/DejaVuSans.$ext"; then
1380 DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
1381 break 2
1382 fi
1383 done
1384 done
1385
1386 if test "x$DJVU_FONT_SOURCE" = x; then
1387 starfield_excuse="No DejaVu found"
1388 fi
1389fi
1390
300f48c5 1391if test x"$enable_grub_themes" = xyes && test x"$starfield_excuse" != x; then
d642d761 1392 AC_MSG_ERROR([themes were explicitly requested but requirements are not satisfied ($starfield_excuse)])
300f48c5
VS
1393fi
1394
c5884973
DO
1395AC_SUBST([DJVU_FONT_SOURCE])
1396
7c9d0c39
VS
1397FONT_SOURCE=
1398
1399for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
1400 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
1401 if test -f "$dir/unifont.$ext"; then
0277eab7
VS
1402 md5="$(md5sum "$dir/unifont.$ext"|awk '{ print $1; }')"
1403 # PCF and BDF from version 6.3 isn't hanled properly by libfreetype.
1404 if test "$md5" = 0a54834d2788c83886a3e1785a6a1e61 || test "$md5" = 28f2565c7a41d8d407e2551159385edb || test "$md5" = dae5e588461b3b92b87b6ffee734f936 || test "$md5" = 4a3d687aa5bb329ed05f4263a1016791 ; then
1405 continue;
1406 fi
7c9d0c39
VS
1407 FONT_SOURCE="$dir/unifont.$ext"
1408 break 2
1409 fi
1410 done
1411done
1412
7b966834
VS
1413if test x"$enable_build_grub_mkfont" = xno ; then
1414 FONT_SOURCE=
1415fi
1416
72c9a507 1417if 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 || test "x$platform" = xcoreboot ); then
d642d761
CW
1418 if test x"$grub_build_mkfont_excuse" = x ; then
1419 AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports need unifont])
1420 else
1421 AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports need unifont ($grub_build_mkfont_excuse)])
1422 fi
7c9d0c39
VS
1423fi
1424
1425AC_SUBST([FONT_SOURCE])
1426
7b780018 1427if test x"$FONT_SOURCE" = x && test x"$DJVU_FONT_SOURCE" = x && test x"$grub_build_mkfont_excuse" = x; then
7c9d0c39
VS
1428 grub_build_mkfont_excuse="no fonts"
1429fi
1430
1431
897e6207
CW
1432AC_ARG_ENABLE([grub-mount],
1433 [AS_HELP_STRING([--enable-grub-mount],
1434 [build and install the `grub-mount' utility (default=guessed)])])
1435if test x"$enable_grub_mount" = xno ; then
1436 grub_mount_excuse="explicitly disabled"
92bb0786
VS
1437fi
1438
897e6207 1439if test x"$grub_mount_excuse" = x ; then
92bb0786 1440 AC_CHECK_LIB([fuse], [fuse_main_real], [],
897e6207 1441 [grub_mount_excuse="need FUSE library"])
92bb0786
VS
1442fi
1443
897e6207 1444if test x"$grub_mount_excuse" = x ; then
92bb0786
VS
1445 # Check for fuse headers.
1446 SAVED_CPPFLAGS="$CPPFLAGS"
338c7fab 1447 CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
92bb0786 1448 AC_CHECK_HEADERS([fuse/fuse.h], [],
897e6207 1449 [grub_mount_excuse=["need FUSE headers"]])
92bb0786
VS
1450 CPPFLAGS="$SAVED_CPPFLAGS"
1451fi
1452
897e6207 1453if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
d642d761 1454 AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled ($grub_mount_excuse)])
92bb0786 1455fi
897e6207
CW
1456if test x"$grub_mount_excuse" = x ; then
1457enable_grub_mount=yes
92bb0786 1458else
897e6207 1459enable_grub_mount=no
92bb0786 1460fi
897e6207 1461AC_SUBST([enable_grub_mount])
92bb0786 1462
7181e228
CW
1463AC_ARG_ENABLE([device-mapper],
1464 [AS_HELP_STRING([--enable-device-mapper],
1465 [enable Linux device-mapper support (default=guessed)])])
1466if test x"$enable_device_mapper" = xno ; then
1467 device_mapper_excuse="explicitly disabled"
1468fi
1469
53798c4b
GS
1470if test x"$device_mapper_excuse" = x ; then
1471 # Check for device-mapper header.
1472 AC_CHECK_HEADER([libdevmapper.h], [],
1473 [device_mapper_excuse="need libdevmapper header"])
1474fi
1475
7181e228
CW
1476if test x"$device_mapper_excuse" = x ; then
1477 # Check for device-mapper library.
61d720e5 1478 AC_CHECK_LIB([devmapper], [dm_task_create], [],
7181e228 1479 [device_mapper_excuse="need devmapper library"])
7181e228 1480fi
61d720e5
VS
1481
1482if test x"$device_mapper_excuse" = x ; then
1483 # Check for device-mapper library.
1484 AC_CHECK_LIB([devmapper], [dm_log_with_errno_init],
1485 [],
1486 [device_mapper_excuse="need devmapper library"])
1487fi
1488
1489if test x"$device_mapper_excuse" = x ; then
1490 LIBDEVMAPPER="-ldevmapper";
1491 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
1492 [Define to 1 if you have the devmapper library.])
1493fi
1494
62f7d208 1495AC_SUBST([LIBDEVMAPPER])
76ed06b9 1496
f4727da9
VS
1497LIBGEOM=
1498if test x$host_kernel = xkfreebsd; then
1499 AC_CHECK_LIB([geom], [geom_gettree], [],
1500 [AC_MSG_ERROR([Your platform requires libgeom])])
1501 LIBGEOM="-lgeom"
1502fi
1503
1504AC_SUBST([LIBGEOM])
1505
0d2d30bb
VS
1506AC_ARG_ENABLE([liblzma],
1507 [AS_HELP_STRING([--enable-liblzma],
1508 [enable liblzma integration (default=guessed)])])
1509if test x"$enable_liblzma" = xno ; then
1510 liblzma_excuse="explicitly disabled"
1511fi
1512
1513if test x"$liblzma_excuse" = x ; then
2c44e493 1514AC_CHECK_LIB([lzma], [lzma_code],
0d2d30bb
VS
1515 [],[liblzma_excuse="need lzma library"])
1516fi
1517if test x"$liblzma_excuse" = x ; then
1518AC_CHECK_HEADER([lzma.h], [], [liblzma_excuse="need lzma header"])
1519fi
1520
1521if test x"$enable_liblzma" = xyes && test x"$liblzma_excuse" != x ; then
d642d761 1522 AC_MSG_ERROR([liblzma support was explicitly requested but requirements are not satisfied ($liblzma_excuse)])
0d2d30bb
VS
1523fi
1524
1525
1526if test x"$liblzma_excuse" = x ; then
1527 LIBLZMA="-llzma"
1528 AC_DEFINE([USE_LIBLZMA], [1],
1529 [Define to 1 if you have the LZMA library.])
1530fi
1531
2c44e493
VS
1532AC_SUBST([LIBLZMA])
1533
e4c498a1
MG
1534AC_ARG_ENABLE([libzfs],
1535 [AS_HELP_STRING([--enable-libzfs],
1536 [enable libzfs integration (default=guessed)])])
1537if test x"$enable_libzfs" = xno ; then
1538 libzfs_excuse="explicitly disabled"
1539fi
16c7cb32 1540
e4c498a1
MG
1541if test x"$libzfs_excuse" = x ; then
1542 # Only check for system headers if libzfs support has not been disabled.
1543 AC_CHECK_HEADERS(libzfs.h libnvpair.h)
1544fi
1545
1546if test x"$libzfs_excuse" = x ; then
1547 AC_CHECK_LIB([zfs], [libzfs_init],
1548 [],
1549 [libzfs_excuse="need zfs library"])
1550fi
1551
1552if test x"$libzfs_excuse" = x ; then
27f9d02e 1553 AC_CHECK_LIB([nvpair], [nvlist_lookup_string],
e4c498a1
MG
1554 [],
1555 [libzfs_excuse="need nvpair library"])
1556fi
1557
1558if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
d642d761 1559 AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied ($libzfs_excuse)])
e4c498a1
MG
1560fi
1561
1562if test x"$libzfs_excuse" = x ; then
1563 # We need both libzfs and libnvpair for a successful build.
1564 LIBZFS="-lzfs"
1565 AC_DEFINE([HAVE_LIBZFS], [1],
1566 [Define to 1 if you have the ZFS library.])
1567 LIBNVPAIR="-lnvpair"
1568 AC_DEFINE([HAVE_LIBNVPAIR], [1],
1569 [Define to 1 if you have the NVPAIR library.])
1570fi
1571
1572AC_SUBST([LIBZFS])
16c7cb32
BC
1573AC_SUBST([LIBNVPAIR])
1574
9f915872
VS
1575LIBS=""
1576
76ed06b9 1577AC_SUBST([FONT_SOURCE])
76ed06b9
BC
1578AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
1579 [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
7181e228 1580
742f9232
VS
1581AC_SUBST(HAVE_ASM_USCORE)
1582AC_SUBST(ADDR32)
1583AC_SUBST(DATA32)
1584AC_SUBST(BSS_START_SYMBOL)
1585AC_SUBST(END_SYMBOL)
1586AC_SUBST(PACKAGE)
1587AC_SUBST(VERSION)
742f9232 1588
d5524ca8
VS
1589AC_ARG_ENABLE([werror],
1590 [AS_HELP_STRING([--disable-werror],
1591 [do not use -Werror when building GRUB])])
1592if test x"$enable_werror" != xno ; then
1593 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
1594 HOST_CFLAGS="$HOST_CFLAGS -Werror"
1595fi
1596
1597if test "x$grub_cv_cc_target_clang" = xno; then
1598 TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc"
1599else
1600 TARGET_LDFLAGS_STATIC_LIBGCC=
1601fi
1602
1603TARGET_CPP="$TARGET_CC -E"
1604TARGET_CCAS=$TARGET_CC
1605
1606GRUB_TARGET_CPU="${target_cpu}"
1607GRUB_PLATFORM="${platform}"
1608
1609AC_SUBST(GRUB_TARGET_CPU)
1610AC_SUBST(GRUB_PLATFORM)
1611
1612AC_SUBST(TARGET_OBJCONV)
1613AC_SUBST(TARGET_LIBGCC)
1614AC_SUBST(TARGET_LDFLAGS_STATIC_LIBGCC)
1615AC_SUBST(TARGET_CPP)
1616AC_SUBST(TARGET_CCAS)
1617AC_SUBST(TARGET_OBJ2ELF)
d5524ca8 1618AC_SUBST(TARGET_MODULE_FORMAT)
6a7957f9 1619AC_SUBST(TARGET_CC_VERSION)
d5524ca8
VS
1620
1621AC_SUBST(TARGET_CFLAGS)
1622AC_SUBST(TARGET_LDFLAGS)
1623AC_SUBST(TARGET_CPPFLAGS)
1624AC_SUBST(TARGET_CCASFLAGS)
1625
d5524ca8
VS
1626AC_SUBST(TARGET_IMG_LDFLAGS)
1627AC_SUBST(TARGET_IMG_CFLAGS)
1628AC_SUBST(TARGET_IMG_BASE_LDOPT)
a9f25a08 1629AC_SUBST(TARGET_APPLE_LINKER)
d5524ca8
VS
1630
1631AC_SUBST(HOST_CFLAGS)
1632AC_SUBST(HOST_LDFLAGS)
1633AC_SUBST(HOST_CPPFLAGS)
1634AC_SUBST(HOST_CCASFLAGS)
1635
1636AC_SUBST(BUILD_LIBM)
1637
76ed06b9
BC
1638#
1639# Automake conditionals
1640#
8c411768 1641
76ed06b9 1642AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
d59849b2 1643AM_CONDITIONAL([COND_clang], [test x$grub_cv_cc_target_clang = xyes])
76ed06b9
BC
1644AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
1645AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
6585de4c 1646AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
76ed06b9
BC
1647AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
1648AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
1649AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
1650AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
1651AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
9612ebc0
VS
1652AM_CONDITIONAL([COND_i386_xen], [test x$target_cpu = xi386 -a x$platform = xxen])
1653AM_CONDITIONAL([COND_x86_64_xen], [test x$target_cpu = xx86_64 -a x$platform = xxen])
4959e111
VS
1654AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
1655AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
7f63a64f 1656AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc])
76ed06b9 1657AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
eaf01c25 1658AM_CONDITIONAL([COND_sparc64_emu], [test x$target_cpu = xsparc64 -a x$platform = xemu])
76ed06b9 1659AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
4959e111 1660AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
37ba07eb
VS
1661AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
1662AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
389b31cd
LL
1663AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ])
1664AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot])
1665AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi])
15a463d7
LL
1666AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ])
1667AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi])
f7711f5e 1668
faf4a65e
VS
1669AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
1670AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
1671AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
f7711f5e 1672AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
faf4a65e
VS
1673AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
1674AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
1675AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
2d465fb0 1676
76ed06b9
BC
1677AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
1678AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
1679AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
1680AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
1681AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
897e6207 1682AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
76ed06b9 1683AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
6f07c4e4
VS
1684if test x$FONT_SOURCE != x ; then
1685 HAVE_FONT_SOURCE=1
1686else
1687 HAVE_FONT_SOURCE=0
1688fi
1689AC_SUBST(HAVE_FONT_SOURCE)
a9f25a08 1690AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1])
76ed06b9 1691AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
c5dc1690 1692AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
e744219b 1693AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
fc45fb58 1694
1eed0e6e
VS
1695AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
1696
742f9232 1697AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
c5884973 1698AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
cd46aa6c
VS
1699AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy])
1700
1701test "x$prefix" = xNONE && prefix="$ac_default_prefix"
1702test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
1703datarootdir="$(eval echo "$datarootdir")"
1704grub_libdir="$(eval echo "$libdir")"
1705grub_localedir="$(eval echo "$localedir")"
1706grub_datadir="$(eval echo "$datadir")"
1707grub_sysconfdir="$(eval echo "$sysconfdir")"
1708AC_DEFINE_UNQUOTED(LOCALEDIR, "$grub_localedir", [Locale dir])
1709AC_DEFINE_UNQUOTED(GRUB_LIBDIR, "$grub_libdir", [Library dir])
1710AC_DEFINE_UNQUOTED(GRUB_DATADIR, "$grub_datadir", [Data dir])
1711AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "$grub_sysconfdir", [Configuration dir])
1712
742f9232 1713
6a161fa9 1714# Output files.
4959e111
VS
1715cpudir="${target_cpu}"
1716if test x${cpudir} = xmipsel; then
1717 cpudir=mips;
1718fi
1f4147aa 1719grub_CHECK_LINK_DIR
1720if test x"$link_dir" = xyes ; then
4959e111 1721 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
f84b481b 1722 if test "$platform" != emu ; then
4959e111 1723 AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
f84b481b 1724 fi
1f4147aa 1725else
1726 mkdir -p include/grub 2>/dev/null
1727 rm -rf include/grub/cpu
4959e111 1728 cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
f84b481b
RM
1729 if test "$platform" != emu ; then
1730 rm -rf include/grub/machine
4959e111 1731 cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
f84b481b 1732 fi
1f4147aa 1733fi
6304d292 1734
8c411768 1735AC_CONFIG_FILES([Makefile])
6304d292 1736AC_CONFIG_FILES([grub-core/Makefile])
15c69261 1737AC_CONFIG_FILES([grub-core/gnulib/Makefile])
269004c1 1738AC_CONFIG_FILES([po/Makefile.in])
8c411768 1739AC_CONFIG_FILES([docs/Makefile])
b23ffd70 1740AC_CONFIG_FILES([util/bash-completion.d/Makefile])
6a161fa9 1741AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
742f9232 1742AC_CONFIG_FILES([config.h])
8c411768 1743
6a161fa9 1744AC_OUTPUT
5ce5507f 1745[
1746echo "*******************************************************"
1747echo GRUB2 will be compiled with following components:
1748echo Platform: "$target_cpu"-"$platform"
f84b481b 1749if [ x"$platform" = xemu ]; then
5ce5507f 1750if [ x"$grub_emu_usb_excuse" = x ]; then
1751echo USB support for grub-emu: Yes
1752else
1753echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
1754fi
927d0134
VS
1755if [ x"$grub_emu_sdl_excuse" = x ]; then
1756echo SDL support for grub-emu: Yes
1757else
1758echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
1759fi
325c8258 1760if [ x"$grub_emu_pci_excuse" = x ]; then
1761echo PCI support for grub-emu: Yes
1762else
1763echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
1764fi
f84b481b 1765fi
61d720e5
VS
1766if test x"$device_mapper_excuse" = x ; then
1767echo With devmapper support: Yes
1768else
1769echo With devmapper support: No "($device_mapper_excuse)"
1770fi
5ce5507f 1771if [ x"$enable_mm_debug" = xyes ]; then
1772echo With memory debugging: Yes
1773else
1774echo With memory debugging: No
1775fi
c5dc1690
SJ
1776if [ x"$enable_cache_stats" = xyes ]; then
1777echo With disk cache statistics: Yes
1778else
1779echo With disk cache statistics: No
1780fi
e744219b
VS
1781
1782if [ x"$enable_boot_time" = xyes ]; then
1783echo With boot time statistics: Yes
1784else
1785echo With boot time statistics: No
1786fi
1787
5ce5507f 1788if [ x"$efiemu_excuse" = x ]; then
1789echo efiemu runtime: Yes
1790else
1791echo efiemu runtime: No "($efiemu_excuse)"
1792fi
5ce5507f 1793if [ x"$grub_mkfont_excuse" = x ]; then
1794echo grub-mkfont: Yes
1795else
1796echo grub-mkfont: No "($grub_mkfont_excuse)"
1797fi
897e6207 1798if [ x"$grub_mount_excuse" = x ]; then
89644ef1 1799echo grub-mount: Yes
92bb0786 1800else
897e6207 1801echo grub-mount: No "($grub_mount_excuse)"
92bb0786 1802fi
c5884973
DO
1803if [ x"$starfield_excuse" = x ]; then
1804echo starfield theme: Yes
1805else
1806echo starfield theme: No "($starfield_excuse)"
1807fi
e4c498a1
MG
1808if [ x"$libzfs_excuse" = x ]; then
1809echo With libzfs support: Yes
1810else
1811echo With libzfs support: No "($libzfs_excuse)"
1812fi
7b780018 1813if [ x"$grub_build_mkfont_excuse" = x ]; then
7c9d0c39
VS
1814 echo Build-time grub-mkfont: Yes
1815 if test "x$FONT_SOURCE" = x ; then
1816 echo "Without unifont"
1817 else
1818 echo "With unifont from $FONT_SOURCE"
1819 fi
4b80e43c 1820else
7b780018 1821 echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)"
7c9d0c39 1822 echo "Without unifont (no build-time grub-mkfont)"
4b80e43c 1823fi
0d2d30bb
VS
1824if test x"$liblzma_excuse" != x ; then
1825echo "Without liblzma (no support for XZ-compressed mips images) ($liblzma_excuse)"
64fce2d8
VS
1826else
1827echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
1828fi
5ce5507f 1829echo "*******************************************************"
1830]