]> git.proxmox.com Git - grub2.git/blame - configure.ac
look for DejaVu also in /usr/share/fonts/truetype
[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
dcecae1a
AB
29dnl CC, CFLAGS, etc.) for the host type, variables with prefix "BUILD_"
30dnl (such as BUILD_CC, BUILD_CFLAGS, etc.) for the build type and variables
31dnl with the prefix "TARGET_" (such as TARGET_CC, TARGET_CFLAGS, etc.) are
32dnl used for the target type. See INSTALL for full list of variables.
b977bf01 33
e8f07821 34AC_INIT([GRUB],[2.02~beta2],[bug-grub@gnu.org])
6a161fa9 35
15c69261
YB
36AC_CONFIG_AUX_DIR([build-aux])
37
76ed06b9
BC
38# We don't want -g -O2 by default in CFLAGS
39: ${CFLAGS=""}
6a161fa9 40
1ecf96fc
AB
41# Checks for build, host and target systems.
42AC_CANONICAL_BUILD
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
1ecf96fc
AB
426
427dnl FIXME proper test seems to require too deep dive into Autoconf internals.
428dnl For now just list known platforms that we support.
429
430case "$build_os" in
431 cygwin*|mingw32*|mingw64*) BUILD_EXEEXT=.exe ;;
432 *) BUILD_EXEEXT= ;;
433esac
434AC_SUBST(BUILD_EXEEXT)
435
15c69261
YB
436# For gnulib.
437gl_INIT
438
93bf55e6 439WARN_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 440EXTRA_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
441
442HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"
443
444AC_CACHE_CHECK([which extra warnings work], [grub_cv_cc_w_extra_flags], [
445 SAVED_CFLAGS="$CFLAGS"
446 grub_cv_cc_w_extra_flags=
447 for x in $EXTRA_WARN_FLAGS; do
448 CFLAGS="$HOST_CFLAGS $x -Werror"
449 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
450 if test x$flag = x1 ; then
451 grub_cv_cc_w_extra_flags="$grub_cv_cc_w_extra_flags $x"
452 fi
453 done
454 CFLAGS="$SAVED_CFLAGS"
455])
456
457HOST_CFLAGS="$HOST_CFLAGS $grub_cv_cc_w_extra_flags"
458
b977bf01 459#
460# Check for target programs.
461#
462
5b5d4aa5 463# Find tools for the target.
464if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
b977bf01 465 tmp_ac_tool_prefix="$ac_tool_prefix"
466 ac_tool_prefix=$target_alias-
467
468 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
469 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
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 474
475 ac_tool_prefix="$tmp_ac_tool_prefix"
476else
477 if test "x$TARGET_CC" = x; then
478 TARGET_CC=$CC
479 fi
fc97214f
VS
480 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
481 AC_CHECK_TOOL(TARGET_STRIP, strip)
482 AC_CHECK_TOOL(TARGET_NM, nm)
0e8daad0 483 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
b977bf01 484fi
fc97214f 485
76ed06b9
BC
486AC_SUBST(HOST_CC)
487AC_SUBST(BUILD_CC)
7c9d0c39
VS
488AC_SUBST(BUILD_CFLAGS)
489AC_SUBST(BUILD_CPPFLAGS)
dcecae1a 490AC_SUBST(BUILD_LDFLAGS)
b977bf01 491AC_SUBST(TARGET_CC)
fc97214f 492AC_SUBST(TARGET_NM)
1bd73025 493AC_SUBST(TARGET_RANLIB)
fc97214f
VS
494AC_SUBST(TARGET_STRIP)
495AC_SUBST(TARGET_OBJCOPY)
b977bf01 496
b977bf01 497# Test the C compiler for the target environment.
498tmp_CC="$CC"
499tmp_CFLAGS="$CFLAGS"
500tmp_LDFLAGS="$LDFLAGS"
501tmp_CPPFLAGS="$CPPFLAGS"
aa6d7826 502tmp_LIBS="$LIBS"
b977bf01 503CC="$TARGET_CC"
504CFLAGS="$TARGET_CFLAGS"
505CPPFLAGS="$TARGET_CPPFLAGS"
506LDFLAGS="$TARGET_LDFLAGS"
aa6d7826 507LIBS=""
b977bf01 508
90d1e879 509# debug flags.
4e27343f 510TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
76ed06b9 511TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
6a161fa9 512
c12936c5
VS
513if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then
514TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align"
515fi
516
6a7957f9
VS
517TARGET_CC_VERSION="$(LC_ALL=C $TARGET_CC --version | head -n1)"
518
60d5e9cb
VS
519AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [
520 LDFLAGS="$TARGET_LDFLAGS -nostdlib -static"
521
522 grub_cv_target_cc_w_extra_flags=
523 for x in $EXTRA_WARN_FLAGS; do
524 CFLAGS="$TARGET_CFLAGS $x -Werror"
37378f74
VS
525 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
526asm (".globl start; start:");
527void __main (void);
528void __main (void) {}
529int main (void);
530]], [[]])], [flag=1], [flag=0])
60d5e9cb
VS
531 if test x$flag = x1 ; then
532 grub_cv_target_cc_w_extra_flags="$grub_cv_target_cc_w_extra_flags $x"
533 fi
534 done
535])
536
537TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_w_extra_flags"
538
60375a88 539AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang]
b73b70eb
VS
540[
541CFLAGS="$TARGET_CFLAGS"
542AC_COMPILE_IFELSE(
60375a88
VS
543[AC_LANG_PROGRAM([], [[
544#ifdef __clang__
545#error "is clang"
546#endif
547]])],
548[grub_cv_cc_target_clang=no], [grub_cv_cc_target_clang=yes])])
549
2312f06c
VS
550# on x86 clang doesn't support .code16
551# on arm clang doesn't support .arch directive
63a45330
VS
552# on mips clang doesn't support privilegied instructions, doubleword store/load
553# and crashes with hand-written assembly
554if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \
555 || test "x$target_cpu" = xx86_64 || test "x$target_cpu" = xarm \
556 || test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ); then
60375a88
VS
557 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
558fi
559
b73b70eb
VS
560if test "x$grub_cv_cc_target_clang" = xyes && test "x$target_cpu" = xpowerpc; then
561AC_CACHE_CHECK([if clang can handle ame instruction], [grub_cv_cc_target_clang_ame]
562[
563CFLAGS="$TARGET_CFLAGS"
564AC_COMPILE_IFELSE(
565[AC_LANG_PROGRAM([], [[
566 unsigned int a = 0, b = 0;
567 asm volatile ("{ame|addme} %0,%1" : "=r" (a) : "r" (b));
568 if (a)
569 return 1;
570]])],
571[grub_cv_cc_target_clang_ame=yes], [grub_cv_cc_target_clang_ame=no])])
572 # clang <= 3.3 doesn't handle most of ppc assembly, not even inline assembly
573 # used by gcrypt
574 if test x$grub_cv_cc_target_clang_ame = xno ; then
575 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
896f483d 576 TARGET_CFLAGS="$TARGET_CFLAGS -no-integrated-as"
b73b70eb
VS
577 fi
578fi
579
60375a88
VS
580if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
581 TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
582fi
583
584if test "x$target_m32" = x1; then
585 # Force 32-bit mode.
586 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
587 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
588 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
589 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
590 TARGET_MODULE_FORMAT="elf32"
591fi
592
593if test "x$target_m64" = x1; then
594 # Force 64-bit mode.
595 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
596 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
597 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
598 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
599 TARGET_MODULE_FORMAT="elf64"
600fi
601
602if test "x$grub_cv_cc_target_clang" = xno && test "x$target_cpu" = xi386 && test "x$platform" != xemu && test "x$platform" != xefi; then
603 TARGET_CFLAGS="$TARGET_CFLAGS -mrtd -mregparm=3"
604fi
605
f93ddcfd
VS
606# on mips redirect cache flushing function to non-existant one.
607if test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ; then
608 AC_CACHE_CHECK([whether -mflush-func=grub_red_herring works], [grub_cv_cc_mflush_func], [
609 CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring -Werror"
610 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
611 [grub_cv_cc_mflush_func=yes],
612 [grub_cv_cc_mflush_func=no])
613 ])
614
615 if test "x$grub_cv_cc_mflush_func" = xyes; then
616 TARGET_CFLAGS="$TARGET_CFLAGS -mflush-func=grub_red_herring"
617 fi
618fi
619
620
90d1e879
RM
621# Force no alignment to save space on i386.
622if test "x$target_cpu" = xi386; then
623 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
b35ec299 624 CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror"
eb73121d 625 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
90d1e879
RM
626 [grub_cv_cc_falign_loop=yes],
627 [grub_cv_cc_falign_loop=no])
6a161fa9 628 ])
6a161fa9 629
c966a489 630 AC_CACHE_CHECK([whether -malign-loops works], [grub_cv_cc_malign_loop], [
b35ec299 631 CFLAGS="$TARGET_CFLAGS -malign-loops=1 -Werror"
c966a489
VS
632 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
633 [grub_cv_cc_malign_loop=yes],
634 [grub_cv_cc_malign_loop=no])
635 ])
636
90d1e879
RM
637 if test "x$grub_cv_cc_falign_loop" = xyes; then
638 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
c966a489 639 elif test "x$grub_cv_cc_malign_loop" = xyes; then
90d1e879 640 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
6a161fa9 641 fi
89e0240c 642fi
6a161fa9 643
cdc17f60
VS
644AC_CACHE_CHECK([whether -freg-struct-return works], [grub_cv_cc_freg_struct_return], [
645 CFLAGS="$TARGET_CFLAGS -freg-struct-return -Werror"
646 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
647 [grub_cv_cc_freg_struct_return=yes],
648 [grub_cv_cc_freg_struct_return=no])
649])
650
651if test "x$grub_cv_cc_freg_struct_return" = xyes; then
652 TARGET_CFLAGS="$TARGET_CFLAGS -freg-struct-return"
653fi
654
ee0220bc 655if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
90d1e879
RM
656 # Some toolchains enable these features by default, but they need
657 # registers that aren't set up properly in GRUB.
658 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
659fi
77c55a87 660
90d1e879
RM
661# By default, GCC 4.4 generates .eh_frame sections containing unwind
662# information in some cases where it previously did not. GRUB doesn't need
663# these and they just use up vital space. Restore the old compiler
664# behaviour.
665AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
24f4e57c 666 CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
90d1e879
RM
667 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
668 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
669 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
90d1e879 670])
77c55a87 671
90d1e879
RM
672if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
673 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
b977bf01 674fi
6a161fa9 675
1c1f31e5
VS
676if test x"$target_os" = xcygwin; then
677 AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [
24f4e57c 678 CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
1c1f31e5
VS
679 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
680 [grub_cv_cc_no_reorder_functions=yes],
681 [grub_cv_cc_no_reorder_functions=no])
682 ])
683fi
684
685if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xyes; then
686 TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
687fi
688
e9d3421c
VS
689# By default, GCC 4.6 generates .eh_frame sections containing unwind
690# information in some cases where it previously did not. GRUB doesn't need
691# these and they just use up vital space. Restore the old compiler
692# behaviour.
693AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
24f4e57c 694 CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
e9d3421c
VS
695 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
696 [grub_cv_cc_fno_asynchronous_unwind_tables=yes],
697 [grub_cv_cc_fno_asynchronous_unwind_tables=no])
e9d3421c
VS
698])
699
700if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
701 TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
702fi
703
30c7d3ce
VS
704AC_ARG_ENABLE([efiemu],
705 [AS_HELP_STRING([--enable-efiemu],
706 [build and install the efiemu runtimes (default=guessed)])])
707if test x"$enable_efiemu" = xno ; then
708 efiemu_excuse="explicitly disabled"
709fi
6f1f6a0c 710if test x"$grub_cv_target_cc_link_format" = x-mi386pe || test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
1c1f31e5
VS
711 efiemu_excuse="not available on cygwin"
712fi
30c7d3ce
VS
713if test x"$target_cpu" != xi386 ; then
714 efiemu_excuse="only available on i386"
715fi
716if test x"$platform" = xefi ; then
717 efiemu_excuse="not available on efi"
718fi
719if test x"$efiemu_excuse" = x ; then
720 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
3c2304d5 721 CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
30c7d3ce
VS
722 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
723 [grub_cv_cc_efiemu=yes],
724 [grub_cv_cc_efiemu=no])
725 ])
726 if test x$grub_cv_cc_efiemu = xno; then
727 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
728 fi
729fi
c2b70d09
AB
730if test x"$efiemu_excuse" = x ; then
731 AC_CACHE_CHECK([for efiemu64 linking format], [grub_cv_target_cc_efiemu64_link_format], [
732 grub_cv_target_cc_efiemu64_link_format=unknown
733 for format in -melf_x86_64 -melf_x86_64_fbsd -melf_x86_64_obsd -melf_x86_64_haiku -arch,x86_64; do
734 CFLAGS="-m64 -nostdlib -O2 -mcmodel=large -mno-red-zone"
735 LDFLAGS="-m64 -Wl,$format -nostdlib -static"
736 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
737 asm (".globl start; start:");
738 asm (".globl _start; _start:");
739 asm (".globl __start; __start:");
740 void __main (void);
741 void __main (void) {}
742 ]], [[]])], [flag=1], [flag=0])
743 if test x"$flag" = x1; then
744 grub_cv_target_cc_efiemu64_link_format="$format"
745 break;
746 fi
747 done])
748 if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then
749 efiemu_excuse="no suitable link format for efiemu64 found"
750 else
751 EFIEMU64_LINK_FORMAT="-Wl,$grub_cv_target_cc_efiemu64_link_format"
752 fi
753fi
30c7d3ce 754if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
d642d761 755 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled ($efiemu_excuse)])
30c7d3ce
VS
756fi
757if test x"$efiemu_excuse" = x ; then
758enable_efiemu=yes
759else
760enable_efiemu=no
761fi
762AC_SUBST([enable_efiemu])
c2b70d09 763AC_SUBST([EFIEMU64_LINK_FORMAT])
30c7d3ce 764
a9f25a08
VS
765CFLAGS="$TARGET_CFLAGS"
766
bf082198
VS
767
768if test x"$platform" = xemu ; then
769 TARGET_OBJ2ELF=
770 grub_cv_target_cc_link_format=
771 case "$host_os" in
772 *darwin* | *mac*)
773 grub_cv_target_cc_link_format="-arch,${target_cpu}"
774 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
775 ;;
776 *windows* | *cygwin* | *mingw*)
777 if test x${target_cpu} = xi386 ; then
778 grub_cv_target_cc_link_format=-mi386pe;
1ecf96fc 779 TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)';
bf082198
VS
780 fi
781 if test x${target_cpu} = xx86_64 ; then
782 grub_cv_target_cc_link_format=-mi386pep;
1ecf96fc 783 TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)';
bf082198
VS
784 fi
785 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
786 ;;
787 esac
788elif test x"$target_cpu" = xi386 || test x"$target_cpu" = xx86_64; then
c2b70d09 789 AC_CACHE_CHECK([for target linking format], [grub_cv_target_cc_link_format], [
a9f25a08 790 grub_cv_target_cc_link_format=unknown
6f1f6a0c 791 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 792 if test x${target_cpu} != xi386 && test x$format = x-mi386pe; then
6f1f6a0c
VS
793 continue
794 fi
bf082198 795 if test x${target_cpu} != xx86_64 && test x$format = x-mi386pep; then
a9f25a08
VS
796 continue
797 fi
246a434f
VS
798 CFLAGS="$TARGET_CFLAGS"
799 LDFLAGS="$TARGET_LDFLAGS -Wl,$format -nostdlib -static"
a9f25a08
VS
800 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
801 asm (".globl start; start:");
802 asm (".globl _start; _start:");
803 asm (".globl __start; __start:");
804 void __main (void);
805 void __main (void) {}
c2b70d09 806 ]], [[]])], [flag=1], [flag=0])
a9f25a08
VS
807 if test x"$flag" = x1; then
808 grub_cv_target_cc_link_format="$format"
809 break;
810 fi
811 done])
812 if test x"$grub_cv_target_cc_link_format" = xunknown; then
813 AC_MSG_ERROR([no suitable link format found])
814 fi
815 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,$grub_cv_target_cc_link_format"
6f1f6a0c 816 if test x"$grub_cv_target_cc_link_format" = x-mi386pe ; then
1ecf96fc 817 TARGET_OBJ2ELF='./build-grub-pe2elf$(BUILD_EXEEXT)';
a9f25a08 818 fi
6f1f6a0c 819 if test x"$grub_cv_target_cc_link_format" = x-mi386pep ; then
1ecf96fc 820 TARGET_OBJ2ELF='./build-grub-pep2elf$(BUILD_EXEEXT)';
6f1f6a0c 821 fi
a9f25a08
VS
822fi
823
824if test x$grub_cv_target_cc_link_format = x-arch,i386 || test x$grub_cv_target_cc_link_format = x-arch,x86_64; then
825 TARGET_APPLE_LINKER=1
826 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], [])
827 if test "x$TARGET_OBJCONV" = x ; then
828 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.])
829 fi
830 if test "x$TARGET_OBJCONV" = x ; then
831 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
832 fi
833 TARGET_IMG_LDSCRIPT=
834 TARGET_IMG_CFLAGS="-static"
835 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
836 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
837 TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
838 TARGET_LDFLAGS_OLDMAGIC=""
6f1f6a0c 839elif test x$grub_cv_target_cc_link_format = x-mi386pe || test x$grub_cv_target_cc_link_format = x-mi386pep ; then
a9f25a08
VS
840 TARGET_APPLE_LINKER=0
841 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
60b967be 842 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/i386-cygwin-img-ld.sc"
a9f25a08 843 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
60b967be 844 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/i386-cygwin-img-ld.sc"
a9f25a08
VS
845 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
846 TARGET_IMG_CFLAGS=
847else
848 TARGET_APPLE_LINKER=0
849 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
850 TARGET_IMG_LDSCRIPT=
851 TARGET_IMG_LDFLAGS='-Wl,-N'
852 TARGET_IMG_LDFLAGS_AC='-Wl,-N'
853 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
854 TARGET_IMG_CFLAGS=
855fi
856
857AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
858
859
860LDFLAGS="$TARGET_LDFLAGS"
8f0baaac 861
eaf01c25 862if test "$target_cpu" = x86_64 || test "$target_cpu-$platform" = sparc64-emu ; then
7e9ca17a 863 # Use large model to support 4G memory
6e09b8b7 864 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
24f4e57c 865 CFLAGS="$TARGET_CFLAGS -m64 -mcmodel=large"
6e09b8b7 866 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
867 [grub_cv_cc_mcmodel=yes],
868 [grub_cv_cc_mcmodel=no])
869 ])
a3ba7410 870 if test "x$grub_cv_cc_mcmodel" = xyes; then
c8600122 871 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
eaf01c25
VS
872 elif test "$target_cpu-$platform" = sparc64-emu; then
873 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany"
6e09b8b7 874 fi
46546fc5 875fi
7e9ca17a 876
46546fc5 877if test "$target_cpu"-"$platform" = x86_64-efi; then
7e9ca17a 878 # EFI writes to stack below %rsp, we must not use the red zone
879 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
24f4e57c 880 CFLAGS="$TARGET_CFLAGS -m64 -mno-red-zone"
7e9ca17a 881 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
882 [grub_cv_cc_no_red_zone=yes],
883 [grub_cv_cc_no_red_zone=no])
884 ])
885 if test "x$grub_cv_cc_no_red_zone" = xno; then
886 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
887 fi
888
c8600122 889 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
20011694 890fi
891
41822625
VS
892if test "x$target_cpu" = xarm; then
893 AC_CACHE_CHECK([whether option -mlong-calls works], grub_cv_cc_mlong_calls, [
894 CFLAGS="$TARGET_CFLAGS -mlong-calls -Werror"
895 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
896 [grub_cv_cc_mlong_calls=yes],
897 [grub_cv_cc_mlong_calls=no])
898 ])
899 if test "x$grub_cv_cc_mlong_calls" = xyes; then
900 TARGET_CFLAGS="$TARGET_CFLAGS -mlong-calls"
901 fi
a29f317a
VS
902 AC_CACHE_CHECK([whether option -mthumb-interwork works], grub_cv_cc_mthumb_interwork, [
903 CFLAGS="$TARGET_CFLAGS -mthumb-interwork -Werror"
904 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
905 [grub_cv_cc_mthumb_interwork=yes],
906 [grub_cv_cc_mthumb_interwork=no])
907 ])
908 if test "x$grub_cv_cc_mthumb_interwork" = xyes; then
909 TARGET_CFLAGS="$TARGET_CFLAGS -mthumb-interwork"
910 elif test "x$grub_cv_cc_target_clang" = xno ; then
911 AC_MSG_ERROR([your compiler doesn't support -mthumb-interwork])
912 else
913 CFLAGS="$TARGET_CFLAGS"
914 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
915#if defined (__thumb__) && !defined (__thumb2__)
916#error thumb without interworking
917#endif
918]])],
919 [no_interwork_ok=yes],
920 [no_interwork_ok=no])
921 if test x$no_interwork_ok = xno ; then
922 AC_MSG_ERROR([attempt to compile to thumb with no thumb interwork])
923 fi
924 fi
41822625
VS
925fi
926
57bc5d43
VS
927AC_CACHE_CHECK([whether option -Qn works], grub_cv_target_cc_qn, [
928 CFLAGS="$TARGET_CFLAGS -Qn -Werror"
929 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
930 [grub_cv_target_cc_qn=yes],
931 [grub_cv_target_cc_qn=no])])
932if test "x$grub_cv_target_cc_qn" = xyes; then
933 TARGET_CFLAGS="$TARGET_CFLAGS -Qn"
934fi
935
baa2a121 936#
937# Compiler features.
938#
939
28668d80
VS
940CFLAGS="$TARGET_CFLAGS"
941
93a81088 942# Position independent executable.
943grub_CHECK_PIE
944[# Need that, because some distributions ship compilers that include
945# `-fPIE' in the default specs.
946if [ x"$pie_possible" = xyes ]; then
947 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
948fi]
949
28668d80
VS
950CFLAGS="$TARGET_CFLAGS"
951
7bd8b0c7
VS
952# Position independent executable.
953grub_CHECK_PIC
9cf12b20
VS
954[# On most platforms we don't want PIC as it only makes relocations harder
955# and code less efficient. On mips we want to have one got table per module
956# and reload $gp in every function.
957# GCC implements it using symbol __gnu_local_gp in non-PIC as well.
958# However with clang we need PIC for this reloading to happen.
959# Since default varies across dictributions use either -fPIC or -fno-PIC
960# explicitly.
961if ( test x$target_cpu = xmips || test x$target_cpu = xmipsel ) && test "x$grub_cv_cc_target_clang" = xyes ; then
962 TARGET_CFLAGS="$TARGET_CFLAGS -fPIC"
963elif [ x"$pic_possible" = xyes ]; then
964 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
7bd8b0c7
VS
965fi]
966
28668d80
VS
967CFLAGS="$TARGET_CFLAGS"
968
baa2a121 969# Smashing stack protector.
970grub_CHECK_STACK_PROTECTOR
c3db8364 971# Need that, because some distributions ship compilers that include
baa2a121 972# `-fstack-protector' in the default specs.
c3db8364 973if test "x$ssp_possible" = xyes; then
974 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
975fi
28668d80
VS
976
977CFLAGS="$TARGET_CFLAGS"
978
2a8a80e4 979grub_CHECK_STACK_ARG_PROBE
980# Cygwin's GCC uses alloca() to probe the stackframe on static
981# stack allocations above some threshold.
982if test x"$sap_possible" = xyes; then
983 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
984fi
baa2a121 985
28668d80
VS
986CFLAGS="$TARGET_CFLAGS"
987
d74b9a1d 988# -mno-unaligned-access -mstrict-align
bb9f92b9 989if test "$target_cpu" = arm; then
d74b9a1d 990 AC_CACHE_CHECK([for compile options to get strict alignment], [grub_cv_target_cc_strict_align], [
bdb6090d 991 grub_cv_target_cc_strict_align=
d74b9a1d
VS
992 for arg in -mno-unaligned-access "-Xclang -mstrict-align" -mstrict-align; do
993 CFLAGS="$TARGET_CFLAGS $arg -Werror"
994 LDFLAGS="$TARGET_LDFLAGS"
995 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [flag=1], [flag=0])
996 if test x"$flag" = x1; then
997 grub_cv_target_cc_strict_align="$arg"
998 break;
999 fi
1000 done])
1001
d74b9a1d
VS
1002 TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_strict_align"
1003 if test x"$grub_cv_target_cc_strict_align" = x"-Xclang -mstrict-align"; then
1004 TARGET_LDFLAGS="$TARGET_LDFLAGS -Qunused-arguments"
bb9f92b9 1005 fi
bdb6090d
VS
1006 AC_CACHE_CHECK([if compiler generates unaligned accesses], [grub_cv_cc_target_emits_unaligned],
1007 [CFLAGS="$TARGET_CFLAGS"
1008 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
1009#ifdef __ARM_FEATURE_UNALIGNED
1010#error "unaligned"
1011#endif
1012 ]])],
1013 [grub_cv_cc_target_emits_unaligned=no], [grub_cv_cc_target_emits_unaligned=yes])])
1014 if test x$grub_cv_cc_target_emits_unaligned = xyes; then
1015 AC_MSG_ERROR([compiler generates unaligned accesses])
1016 fi
bb9f92b9
LL
1017fi
1018
aa6d7826 1019# Set them to their new values for the tests below.
1020CC="$TARGET_CC"
a9f25a08 1021if test "x$TARGET_APPLE_LINKER" = x1 ; then
246a434f 1022CFLAGS="$TARGET_CFLAGS -nostdlib -static -Wno-error"
26de2bcd 1023else
37378f74 1024CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
26de2bcd 1025fi
aa6d7826 1026CPPFLAGS="$TARGET_CPPFLAGS"
d5524ca8
VS
1027if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 || test "x$grub_cv_cc_target_clang" = xyes ; then
1028TARGET_LIBGCC=
03f80960 1029else
d5524ca8 1030TARGET_LIBGCC=-lgcc
03f80960 1031fi
69be5b74 1032
d5524ca8
VS
1033LIBS="$TARGET_LIBGCC"
1034
01fcf061 1035grub_ASM_USCORE
a9f25a08 1036if test "x$TARGET_APPLE_LINKER" = x0 ; then
01fcf061 1037if test x$grub_cv_asm_uscore = xyes; then
37378f74 1038DEFSYM="-Wl,--defsym,_abort=_main -Wl,--defsym,__main=_main"
01fcf061 1039else
37378f74 1040DEFSYM="-Wl,--defsym,abort=main -Wl,--defsym,_main=main -Wl,--defsym,__main=main"
01fcf061 1041fi
37378f74 1042CFLAGS="$TARGET_CFLAGS -nostdlib $DEFSYM"
a9f25a08 1043fi
01fcf061 1044
69be5b74 1045# Check for libgcc symbols
6fcec439 1046AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x)
69be5b74 1047
a9f25a08 1048if test "x$TARGET_APPLE_LINKER" = x1 ; then
246a434f 1049CFLAGS="$TARGET_CFLAGS -nostdlib -static"
69be5b74 1050else
37378f74 1051CFLAGS="$TARGET_CFLAGS -nostdlib"
69be5b74 1052fi
42e0cba3 1053LIBS=""
aa6d7826 1054
6a161fa9 1055# Defined in aclocal.m4.
f6130a12 1056grub_PROG_TARGET_CC
a9f25a08 1057if test "x$TARGET_APPLE_LINKER" != x1 ; then
b977bf01 1058grub_PROG_OBJCOPY_ABSOLUTE
2b167a72 1059fi
cb71ba20 1060grub_PROG_LD_BUILD_ID_NONE
b977bf01 1061if test "x$target_cpu" = xi386; then
a9f25a08 1062 if test "$platform" != emu && test "x$TARGET_APPLE_LINKER" != x1 ; then
2aec1692
CF
1063 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
1064 # Check symbols provided by linker script.
37378f74 1065 CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},0x8000"
2aec1692 1066 fi
2a8a80e4 1067 grub_CHECK_BSS_START_SYMBOL
1068 grub_CHECK_END_SYMBOL
1069 fi
1070 CFLAGS="$TARGET_CFLAGS"
4b13b216 1071 grub_I386_ASM_PREFIX_REQUIREMENT
1072 grub_I386_ASM_ADDR32
6a161fa9 1073fi
1074
20aea949
VS
1075grub_PROG_NM_WORKS
1076grub_PROG_NM_MINUS_P
1077grub_PROG_NM_DEFINED_ONLY
1078AC_SUBST(TARGET_NMFLAGS_MINUS_P)
1079AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
1080
016a671b 1081if test "$platform" != emu; then
8f9a632b
VS
1082AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
1083 SAVED_CPPFLAGS="$CPPFLAGS"
1084 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
1085 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
ce938140 1086#include <stddef.h>
8f9a632b
VS
1087int va_arg_func (int fixed, va_list args);]], [[]])],
1088 [grub_cv_cc_isystem=yes],
1089 [grub_cv_cc_isystem=no])
1090 CPPFLAGS="$SAVED_CPPFLAGS"
1091])
1092
1093if test x"$grub_cv_cc_isystem" = xyes ; then
1094 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
1095fi
dae79b6b 1096fi
5ce5507f 1097
19ce697d 1098AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [
24f4e57c 1099 CFLAGS="$TARGET_CFLAGS -Wtrampolines -Werror"
779dc15b
VS
1100 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
1101int va_arg_func (int fixed, va_list args);]], [[]])],
19ce697d
VS
1102 [grub_cv_cc_wtrampolines=yes],
1103 [grub_cv_cc_wtrampolines=no])
779dc15b
VS
1104])
1105
19ce697d
VS
1106if test x"$grub_cv_cc_wtrampolines" = xyes ; then
1107 TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines"
779dc15b
VS
1108fi
1109
c9a86192 1110# Restore the flags.
9962ed99 1111CC="$tmp_CC"
1112CFLAGS="$tmp_CFLAGS"
1113CPPFLAGS="$tmp_CPPFLAGS"
c9a86192 1114LDFLAGS="$tmp_LDFLAGS"
aa6d7826 1115LIBS="$tmp_LIBS"
6a161fa9 1116
4fe9862e 1117#
2965c7cc 1118# Check for options.
4fe9862e 1119#
1120
1121# Memory manager debugging.
b39f9d20 1122AC_ARG_ENABLE([mm-debug],
2965c7cc 1123 AS_HELP_STRING([--enable-mm-debug],
90ce5d56 1124 [include memory manager debugging]),
2965c7cc 1125 [AC_DEFINE([MM_DEBUG], [1],
1126 [Define to 1 if you enable memory manager debugging.])])
1127
c5dc1690
SJ
1128AC_ARG_ENABLE([cache-stats],
1129 AS_HELP_STRING([--enable-cache-stats],
055e2b8b 1130 [enable disk cache statistics collection]))
c5dc1690
SJ
1131
1132if test x$enable_cache_stats = xyes; then
1133 DISK_CACHE_STATS=1
1134else
1135 DISK_CACHE_STATS=0
1136fi
1137AC_SUBST([DISK_CACHE_STATS])
1138
e744219b
VS
1139AC_ARG_ENABLE([boot-time],
1140 AS_HELP_STRING([--enable-boot-time],
1141 [enable boot time statistics collection]))
1142
1143if test x$enable_boot_time = xyes; then
1144 BOOT_TIME_STATS=1
1145else
1146 BOOT_TIME_STATS=0
1147fi
1148AC_SUBST([BOOT_TIME_STATS])
1149
d64399b5 1150AC_ARG_ENABLE([grub-emu-usb],
1151 [AS_HELP_STRING([--enable-grub-emu-usb],
5ce5507f 1152 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
5ce5507f 1153
927d0134
VS
1154AC_ARG_ENABLE([grub-emu-sdl],
1155 [AS_HELP_STRING([--enable-grub-emu-sdl],
1156 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
1157
3affd0ec 1158AC_ARG_ENABLE([grub-emu-pci],
1159 [AS_HELP_STRING([--enable-grub-emu-pci],
1160 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
1161
f84b481b 1162if test "$platform" = emu; then
f84b481b 1163
62a747cb
VS
1164if test x"$enable_grub_emu_usb" != xyes ; then
1165 grub_emu_usb_excuse="not enabled"
5ce5507f 1166fi
325c8258 1167
0e848909
VS
1168if test x"$enable_grub_emu_pci" = xyes ; then
1169 grub_emu_usb_excuse="conflicts with PCI support"
1170fi
1171
5ce5507f 1172[if [ x"$grub_emu_usb_excuse" = x ]; then
d64399b5 1173 # Check for libusb libraries.]
5ce5507f 1174AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
e98cd0c2 1175 [grub_emu_usb_excuse=["need libusb library"]])
d64399b5 1176 AC_SUBST([LIBUSB])
5ce5507f 1177[fi]
1178[if [ x"$grub_emu_usb_excuse" = x ]; then
1179 # Check for headers.]
d64399b5 1180 AC_CHECK_HEADERS([usb.h], [],
e98cd0c2 1181 [grub_emu_usb_excuse=["need libusb headers"]])
4fe9862e 1182[fi]
c6f3b249 1183if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
d642d761 1184 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled ($grub_emu_usb_excuse)])
5ce5507f 1185fi
1186if test x"$grub_emu_usb_excuse" = x ; then
1187enable_grub_emu_usb=yes
1188else
1189enable_grub_emu_usb=no
1190fi
1191
927d0134 1192if test x"$enable_grub_emu_sdl" = xno ; then
16f7455b 1193 grub_emu_sdl_excuse="explicitly disabled"
927d0134
VS
1194fi
1195[if [ x"$grub_emu_sdl_excuse" = x ]; then
1196 # Check for libSDL libraries.]
1197AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
1198 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
1199 AC_SUBST([LIBSDL])
1200[fi]
9f293ab0 1201
927d0134
VS
1202[if [ x"$grub_emu_sdl_excuse" = x ]; then
1203 # Check for headers.]
1204 AC_CHECK_HEADERS([SDL/SDL.h], [],
1205 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
1206[fi]
9f293ab0 1207
927d0134 1208if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
16f7455b 1209 AC_MSG_ERROR([SDL support for grub-emu was explicitly requested but can't be compiled ($grub_emu_sdl_excuse)])
927d0134
VS
1210fi
1211if test x"$grub_emu_sdl_excuse" = x ; then
1212enable_grub_emu_sdl=yes
1213else
1214enable_grub_emu_sdl=no
1215fi
1216
3affd0ec 1217if test x"$enable_grub_emu_pci" != xyes ; then
325c8258 1218 grub_emu_pci_excuse="not enabled"
1219fi
1220
1221if test x"$enable_grub_emu_usb" = xyes ; then
1222 grub_emu_pci_excuse="conflicts with USB support"
1223fi
1224
1225[if [ x"$grub_emu_pci_excuse" = x ]; then
1226 # Check for libpci libraries.]
459fed4b 1227 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
1228 [grub_emu_pci_excuse=["need libpciaccess library"]])
1229 AC_SUBST([LIBPCIACCESS])
325c8258 1230[fi]
1231[if [ x"$grub_emu_pci_excuse" = x ]; then
1232 # Check for headers.]
1233 AC_CHECK_HEADERS([pci/pci.h], [],
459fed4b 1234 [grub_emu_pci_excuse=["need libpciaccess headers"]])
325c8258 1235[fi]
1236
1237if test x"$grub_emu_pci_excuse" = x ; then
1238enable_grub_emu_pci=yes
1239else
9f293ab0 1240
325c8258 1241enable_grub_emu_pci=no
3affd0ec 1242fi
1243
927d0134 1244AC_SUBST([enable_grub_emu_sdl])
d64399b5 1245AC_SUBST([enable_grub_emu_usb])
3affd0ec 1246AC_SUBST([enable_grub_emu_pci])
e7d09ac4
AB
1247
1248else
1249
1250# Ignore --enable-emu-* if platform is not emu
1251enable_grub_emu_sdl=no
1252enable_grub_emu_usb=no
1253enable_grub_emu_pci=no
f84b481b 1254fi
4fe9862e 1255
e52db1f7 1256AC_ARG_ENABLE([grub-mkfont],
1257 [AS_HELP_STRING([--enable-grub-mkfont],
5ce5507f 1258 [build and install the `grub-mkfont' utility (default=guessed)])])
1259if test x"$enable_grub_mkfont" = xno ; then
ce7a733d 1260 grub_mkfont_excuse="explicitly disabled"
5ce5507f 1261fi
1262
1263if test x"$grub_mkfont_excuse" = x ; then
e52db1f7 1264 # Check for freetype libraries.
a5b55c4b 1265 AC_CHECK_TOOLS([FREETYPE], [freetype-config])
e52db1f7 1266 if test "x$FREETYPE" = x ; then
e98cd0c2 1267 grub_mkfont_excuse=["need freetype2 library"]
e52db1f7 1268 fi
e52db1f7 1269fi
660960d6 1270
7b780018
VS
1271unset ac_cv_header_ft2build_h
1272
660960d6
VS
1273if test x"$grub_mkfont_excuse" = x ; then
1274 # Check for freetype libraries.
a5b55c4b
DM
1275 freetype_cflags=`$FREETYPE --cflags`
1276 freetype_libs=`$FREETYPE --libs`
d1e8a02f 1277 SAVED_CPPFLAGS="$CPPFLAGS"
b75db69a 1278 SAVED_LIBS="$LIBS"
d1e8a02f 1279 CPPFLAGS="$CPPFLAGS $freetype_cflags"
b75db69a 1280 LIBS="$LIBS $freetype_libs"
660960d6
VS
1281 AC_CHECK_HEADERS([ft2build.h], [],
1282 [grub_mkfont_excuse=["need freetype2 headers"]])
b75db69a 1283 AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_mkfont_excuse=["freetype2 library unusable"]])
d1e8a02f 1284 CPPFLAGS="$SAVED_CPPFLAGS"
b75db69a 1285 LIBS="$SAVED_LIBS"
660960d6
VS
1286fi
1287
5ce5507f 1288if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
d642d761 1289 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled ($grub_mkfont_excuse)])
5ce5507f 1290fi
1291if test x"$grub_mkfont_excuse" = x ; then
1292enable_grub_mkfont=yes
1293else
1294enable_grub_mkfont=no
1295fi
e52db1f7 1296AC_SUBST([enable_grub_mkfont])
1297AC_SUBST([freetype_cflags])
1298AC_SUBST([freetype_libs])
1299
7c9d0c39 1300SAVED_CC="$CC"
b224c266 1301SAVED_CPP="$CPP"
7c9d0c39
VS
1302SAVED_CFLAGS="$CFLAGS"
1303SAVED_CPPFLAGS="$CPPFLAGS"
dcecae1a 1304SAVED_LDFLAGS="$LDFLAGS"
7c9d0c39 1305CC="$BUILD_CC"
b224c266 1306CPP="$BUILD_CPP"
7c9d0c39 1307CFLAGS="$BUILD_CFLAGS"
7b780018 1308CPPFLAGS="$BUILD_CPPFLAGS"
dcecae1a 1309LDFLAGS="$BUILD_LDFAGS"
7b780018
VS
1310
1311unset ac_cv_c_bigendian
1312unset ac_cv_header_ft2build_h
1313
1314AC_COMPUTE_INT([BUILD_SIZEOF_VOID_P], [sizeof (void *)])
1315AC_COMPUTE_INT([BUILD_SIZEOF_LONG], [sizeof (long)])
1316AC_C_BIGENDIAN([BUILD_WORDS_BIGENDIAN=1], [BUILD_WORDS_BIGENDIAN=0], [BUILD_WORDS_BIGENDIAN=err], [BUILD_WORDS_BIGENDIAN=err])
1317
1318if test x$BUILD_WORDS_BIGENDIAN = xerr ; then
1319 AC_MSG_ERROR([couldnt determine build endianness])
1320fi
1321
1322AC_SUBST([BUILD_SIZEOF_LONG])
1323AC_SUBST([BUILD_SIZEOF_VOID_P])
1324AC_SUBST([BUILD_WORDS_BIGENDIAN])
c5884973 1325
7c9d0c39
VS
1326if test x"$grub_build_mkfont_excuse" = x ; then
1327 # Check for freetype libraries.
7b780018 1328 AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config])
7c9d0c39
VS
1329 if test "x$BUILD_FREETYPE" = x ; then
1330 grub_build_mkfont_excuse=["need freetype2 library"]
1331 fi
1332fi
c5884973 1333
7c9d0c39
VS
1334if test x"$grub_build_mkfont_excuse" = x ; then
1335 # Check for freetype libraries.
1336 build_freetype_cflags=`$BUILD_FREETYPE --cflags`
1337 build_freetype_libs=`$BUILD_FREETYPE --libs`
1338 SAVED_CPPFLAGS_2="$CPPFLAGS"
b75db69a 1339 SAVED_LIBS="$LIBS"
7c9d0c39 1340 CPPFLAGS="$CPPFLAGS $build_freetype_cflags"
b75db69a 1341 LIBS="$LIBS $build_freetype_libs"
7c9d0c39
VS
1342 AC_CHECK_HEADERS([ft2build.h], [],
1343 [grub_build_mkfont_excuse=["need freetype2 headers"]])
b75db69a
VS
1344 AC_LINK_IFELSE([AC_LANG_CALL([], [FT_Load_Glyph])], [], [grub_build_mkfont_excuse=["freetype2 library unusable"]])
1345 LIBS="$SAVED_LIBS"
7c9d0c39
VS
1346 CPPFLAGS="$SAVED_CPPFLAGS_2"
1347fi
1348
1349if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
d642d761 1350 AC_MSG_ERROR([build-grub-mkfont was explicitly requested but can't be compiled ($grub_build_mkfont_excuse)])
7c9d0c39
VS
1351fi
1352if test x"$grub_build_mkfont_excuse" = x ; then
1353 enable_build_grub_mkfont=yes
1354else
1355 enable_build_grub_mkfont=no
c5884973 1356fi
72c9a507 1357if 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
1358 if test x"$grub_build_mkfont_excuse" = x ; then
1359 AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports needs build-time grub-mkfont])
1360 else
1361 AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports needs build-time grub-mkfont ($grub_build_mkfont_excuse)])
1362 fi
7c9d0c39
VS
1363fi
1364
1365AC_SUBST([build_freetype_cflags])
1366AC_SUBST([build_freetype_libs])
1367
1368CC="$SAVED_CC"
b224c266 1369CPP="$SAVED_CPP"
7c9d0c39
VS
1370CFLAGS="$SAVED_CFLAGS"
1371CPPFLAGS="$SAVED_CPPFLAGS"
dcecae1a 1372LDFLAGS="$SAVED_LDFLAGS"
7c9d0c39
VS
1373
1374
1375DJVU_FONT_SOURCE=
1376
1377starfield_excuse=
c5884973 1378
300f48c5
VS
1379AC_ARG_ENABLE([grub-themes],
1380 [AS_HELP_STRING([--enable-grub-themes],
1381 [build and install GRUB themes (default=guessed)])])
1382if test x"$enable_grub_themes" = xno ; then
1383 starfield_excuse="explicitly disabled"
1384fi
1385
1386if test x"$starfield_excuse" = x && test x"$enable_build_grub_mkfont" = xno ; then
7b966834
VS
1387 starfield_excuse="No build-time grub-mkfont"
1388fi
1389
501b9e4b 1390if test x"$starfield_excuse" = x; then
c5884973 1391 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
36387ece 1392 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype; do
c5884973
DO
1393 if test -f "$dir/DejaVuSans.$ext"; then
1394 DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
1395 break 2
1396 fi
1397 done
1398 done
1399
1400 if test "x$DJVU_FONT_SOURCE" = x; then
1401 starfield_excuse="No DejaVu found"
1402 fi
1403fi
1404
300f48c5 1405if test x"$enable_grub_themes" = xyes && test x"$starfield_excuse" != x; then
d642d761 1406 AC_MSG_ERROR([themes were explicitly requested but requirements are not satisfied ($starfield_excuse)])
300f48c5
VS
1407fi
1408
c5884973
DO
1409AC_SUBST([DJVU_FONT_SOURCE])
1410
7c9d0c39
VS
1411FONT_SOURCE=
1412
1413for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
1414 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
1415 if test -f "$dir/unifont.$ext"; then
0277eab7
VS
1416 md5="$(md5sum "$dir/unifont.$ext"|awk '{ print $1; }')"
1417 # PCF and BDF from version 6.3 isn't hanled properly by libfreetype.
1418 if test "$md5" = 0a54834d2788c83886a3e1785a6a1e61 || test "$md5" = 28f2565c7a41d8d407e2551159385edb || test "$md5" = dae5e588461b3b92b87b6ffee734f936 || test "$md5" = 4a3d687aa5bb329ed05f4263a1016791 ; then
1419 continue;
1420 fi
7c9d0c39
VS
1421 FONT_SOURCE="$dir/unifont.$ext"
1422 break 2
1423 fi
1424 done
1425done
1426
7b966834
VS
1427if test x"$enable_build_grub_mkfont" = xno ; then
1428 FONT_SOURCE=
1429fi
1430
72c9a507 1431if 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
1432 if test x"$grub_build_mkfont_excuse" = x ; then
1433 AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports need unifont])
1434 else
1435 AC_MSG_ERROR([qemu, powerpc-ieee1275, coreboot and loongson ports need unifont ($grub_build_mkfont_excuse)])
1436 fi
7c9d0c39
VS
1437fi
1438
1439AC_SUBST([FONT_SOURCE])
1440
7b780018 1441if test x"$FONT_SOURCE" = x && test x"$DJVU_FONT_SOURCE" = x && test x"$grub_build_mkfont_excuse" = x; then
7c9d0c39
VS
1442 grub_build_mkfont_excuse="no fonts"
1443fi
1444
1445
897e6207
CW
1446AC_ARG_ENABLE([grub-mount],
1447 [AS_HELP_STRING([--enable-grub-mount],
1448 [build and install the `grub-mount' utility (default=guessed)])])
1449if test x"$enable_grub_mount" = xno ; then
1450 grub_mount_excuse="explicitly disabled"
92bb0786
VS
1451fi
1452
897e6207 1453if test x"$grub_mount_excuse" = x ; then
92bb0786 1454 AC_CHECK_LIB([fuse], [fuse_main_real], [],
897e6207 1455 [grub_mount_excuse="need FUSE library"])
92bb0786
VS
1456fi
1457
897e6207 1458if test x"$grub_mount_excuse" = x ; then
92bb0786
VS
1459 # Check for fuse headers.
1460 SAVED_CPPFLAGS="$CPPFLAGS"
338c7fab 1461 CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
92bb0786 1462 AC_CHECK_HEADERS([fuse/fuse.h], [],
897e6207 1463 [grub_mount_excuse=["need FUSE headers"]])
92bb0786
VS
1464 CPPFLAGS="$SAVED_CPPFLAGS"
1465fi
1466
897e6207 1467if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
d642d761 1468 AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled ($grub_mount_excuse)])
92bb0786 1469fi
897e6207
CW
1470if test x"$grub_mount_excuse" = x ; then
1471enable_grub_mount=yes
92bb0786 1472else
897e6207 1473enable_grub_mount=no
92bb0786 1474fi
897e6207 1475AC_SUBST([enable_grub_mount])
92bb0786 1476
7181e228
CW
1477AC_ARG_ENABLE([device-mapper],
1478 [AS_HELP_STRING([--enable-device-mapper],
1479 [enable Linux device-mapper support (default=guessed)])])
1480if test x"$enable_device_mapper" = xno ; then
1481 device_mapper_excuse="explicitly disabled"
1482fi
1483
53798c4b
GS
1484if test x"$device_mapper_excuse" = x ; then
1485 # Check for device-mapper header.
1486 AC_CHECK_HEADER([libdevmapper.h], [],
1487 [device_mapper_excuse="need libdevmapper header"])
1488fi
1489
7181e228
CW
1490if test x"$device_mapper_excuse" = x ; then
1491 # Check for device-mapper library.
61d720e5 1492 AC_CHECK_LIB([devmapper], [dm_task_create], [],
7181e228 1493 [device_mapper_excuse="need devmapper library"])
7181e228 1494fi
61d720e5
VS
1495
1496if test x"$device_mapper_excuse" = x ; then
1497 # Check for device-mapper library.
1498 AC_CHECK_LIB([devmapper], [dm_log_with_errno_init],
1499 [],
1500 [device_mapper_excuse="need devmapper library"])
1501fi
1502
1503if test x"$device_mapper_excuse" = x ; then
1504 LIBDEVMAPPER="-ldevmapper";
1505 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
1506 [Define to 1 if you have the devmapper library.])
1507fi
1508
62f7d208 1509AC_SUBST([LIBDEVMAPPER])
76ed06b9 1510
f4727da9
VS
1511LIBGEOM=
1512if test x$host_kernel = xkfreebsd; then
1513 AC_CHECK_LIB([geom], [geom_gettree], [],
1514 [AC_MSG_ERROR([Your platform requires libgeom])])
1515 LIBGEOM="-lgeom"
1516fi
1517
1518AC_SUBST([LIBGEOM])
1519
0d2d30bb
VS
1520AC_ARG_ENABLE([liblzma],
1521 [AS_HELP_STRING([--enable-liblzma],
1522 [enable liblzma integration (default=guessed)])])
1523if test x"$enable_liblzma" = xno ; then
1524 liblzma_excuse="explicitly disabled"
1525fi
1526
1527if test x"$liblzma_excuse" = x ; then
2c44e493 1528AC_CHECK_LIB([lzma], [lzma_code],
0d2d30bb
VS
1529 [],[liblzma_excuse="need lzma library"])
1530fi
1531if test x"$liblzma_excuse" = x ; then
1532AC_CHECK_HEADER([lzma.h], [], [liblzma_excuse="need lzma header"])
1533fi
1534
1535if test x"$enable_liblzma" = xyes && test x"$liblzma_excuse" != x ; then
d642d761 1536 AC_MSG_ERROR([liblzma support was explicitly requested but requirements are not satisfied ($liblzma_excuse)])
0d2d30bb
VS
1537fi
1538
1539
1540if test x"$liblzma_excuse" = x ; then
1541 LIBLZMA="-llzma"
1542 AC_DEFINE([USE_LIBLZMA], [1],
1543 [Define to 1 if you have the LZMA library.])
1544fi
1545
2c44e493
VS
1546AC_SUBST([LIBLZMA])
1547
e4c498a1
MG
1548AC_ARG_ENABLE([libzfs],
1549 [AS_HELP_STRING([--enable-libzfs],
1550 [enable libzfs integration (default=guessed)])])
1551if test x"$enable_libzfs" = xno ; then
1552 libzfs_excuse="explicitly disabled"
1553fi
16c7cb32 1554
e4c498a1
MG
1555if test x"$libzfs_excuse" = x ; then
1556 # Only check for system headers if libzfs support has not been disabled.
1557 AC_CHECK_HEADERS(libzfs.h libnvpair.h)
1558fi
1559
1560if test x"$libzfs_excuse" = x ; then
1561 AC_CHECK_LIB([zfs], [libzfs_init],
1562 [],
1563 [libzfs_excuse="need zfs library"])
1564fi
1565
1566if test x"$libzfs_excuse" = x ; then
27f9d02e 1567 AC_CHECK_LIB([nvpair], [nvlist_lookup_string],
e4c498a1
MG
1568 [],
1569 [libzfs_excuse="need nvpair library"])
1570fi
1571
1572if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
d642d761 1573 AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied ($libzfs_excuse)])
e4c498a1
MG
1574fi
1575
1576if test x"$libzfs_excuse" = x ; then
1577 # We need both libzfs and libnvpair for a successful build.
1578 LIBZFS="-lzfs"
1579 AC_DEFINE([HAVE_LIBZFS], [1],
1580 [Define to 1 if you have the ZFS library.])
1581 LIBNVPAIR="-lnvpair"
1582 AC_DEFINE([HAVE_LIBNVPAIR], [1],
1583 [Define to 1 if you have the NVPAIR library.])
1584fi
1585
1586AC_SUBST([LIBZFS])
16c7cb32
BC
1587AC_SUBST([LIBNVPAIR])
1588
9f915872
VS
1589LIBS=""
1590
76ed06b9 1591AC_SUBST([FONT_SOURCE])
76ed06b9
BC
1592AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
1593 [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
7181e228 1594
742f9232
VS
1595AC_SUBST(HAVE_ASM_USCORE)
1596AC_SUBST(ADDR32)
1597AC_SUBST(DATA32)
1598AC_SUBST(BSS_START_SYMBOL)
1599AC_SUBST(END_SYMBOL)
1600AC_SUBST(PACKAGE)
1601AC_SUBST(VERSION)
742f9232 1602
d5524ca8
VS
1603AC_ARG_ENABLE([werror],
1604 [AS_HELP_STRING([--disable-werror],
1605 [do not use -Werror when building GRUB])])
1606if test x"$enable_werror" != xno ; then
1607 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
1608 HOST_CFLAGS="$HOST_CFLAGS -Werror"
1609fi
1610
1611if test "x$grub_cv_cc_target_clang" = xno; then
1612 TARGET_LDFLAGS_STATIC_LIBGCC="-static-libgcc"
1613else
1614 TARGET_LDFLAGS_STATIC_LIBGCC=
1615fi
1616
1617TARGET_CPP="$TARGET_CC -E"
1618TARGET_CCAS=$TARGET_CC
1619
1620GRUB_TARGET_CPU="${target_cpu}"
1621GRUB_PLATFORM="${platform}"
1622
1623AC_SUBST(GRUB_TARGET_CPU)
1624AC_SUBST(GRUB_PLATFORM)
1625
1626AC_SUBST(TARGET_OBJCONV)
1627AC_SUBST(TARGET_LIBGCC)
1628AC_SUBST(TARGET_LDFLAGS_STATIC_LIBGCC)
1629AC_SUBST(TARGET_CPP)
1630AC_SUBST(TARGET_CCAS)
1631AC_SUBST(TARGET_OBJ2ELF)
d5524ca8 1632AC_SUBST(TARGET_MODULE_FORMAT)
6a7957f9 1633AC_SUBST(TARGET_CC_VERSION)
d5524ca8
VS
1634
1635AC_SUBST(TARGET_CFLAGS)
1636AC_SUBST(TARGET_LDFLAGS)
1637AC_SUBST(TARGET_CPPFLAGS)
1638AC_SUBST(TARGET_CCASFLAGS)
1639
d5524ca8
VS
1640AC_SUBST(TARGET_IMG_LDFLAGS)
1641AC_SUBST(TARGET_IMG_CFLAGS)
1642AC_SUBST(TARGET_IMG_BASE_LDOPT)
a9f25a08 1643AC_SUBST(TARGET_APPLE_LINKER)
d5524ca8
VS
1644
1645AC_SUBST(HOST_CFLAGS)
1646AC_SUBST(HOST_LDFLAGS)
1647AC_SUBST(HOST_CPPFLAGS)
1648AC_SUBST(HOST_CCASFLAGS)
1649
1650AC_SUBST(BUILD_LIBM)
1651
76ed06b9
BC
1652#
1653# Automake conditionals
1654#
8c411768 1655
76ed06b9 1656AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
d59849b2 1657AM_CONDITIONAL([COND_clang], [test x$grub_cv_cc_target_clang = xyes])
76ed06b9
BC
1658AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
1659AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
6585de4c 1660AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
76ed06b9
BC
1661AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
1662AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
1663AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
1664AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
1665AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
9612ebc0
VS
1666AM_CONDITIONAL([COND_i386_xen], [test x$target_cpu = xi386 -a x$platform = xxen])
1667AM_CONDITIONAL([COND_x86_64_xen], [test x$target_cpu = xx86_64 -a x$platform = xxen])
4959e111
VS
1668AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
1669AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
7f63a64f 1670AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc])
76ed06b9 1671AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
eaf01c25 1672AM_CONDITIONAL([COND_sparc64_emu], [test x$target_cpu = xsparc64 -a x$platform = xemu])
76ed06b9 1673AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
4959e111 1674AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
37ba07eb
VS
1675AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
1676AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
389b31cd
LL
1677AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ])
1678AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot])
1679AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi])
15a463d7
LL
1680AM_CONDITIONAL([COND_arm64], [test x$target_cpu = xarm64 ])
1681AM_CONDITIONAL([COND_arm64_efi], [test x$target_cpu = xarm64 -a x$platform = xefi])
f7711f5e 1682
faf4a65e
VS
1683AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
1684AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
1685AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
f7711f5e 1686AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
faf4a65e
VS
1687AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
1688AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
1689AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
2d465fb0 1690
76ed06b9
BC
1691AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
1692AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
1693AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
1694AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
1695AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
897e6207 1696AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
76ed06b9 1697AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
6f07c4e4
VS
1698if test x$FONT_SOURCE != x ; then
1699 HAVE_FONT_SOURCE=1
1700else
1701 HAVE_FONT_SOURCE=0
1702fi
1703AC_SUBST(HAVE_FONT_SOURCE)
a9f25a08 1704AM_CONDITIONAL([COND_APPLE_LINKER], [test x$TARGET_APPLE_LINKER = x1])
76ed06b9 1705AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
c5dc1690 1706AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
e744219b 1707AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
fc45fb58 1708
1eed0e6e
VS
1709AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
1710
742f9232 1711AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
c5884973 1712AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
cd46aa6c
VS
1713AM_CONDITIONAL([COND_HAVE_EXEC], [test "x$have_exec" = xy])
1714
1715test "x$prefix" = xNONE && prefix="$ac_default_prefix"
1716test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
1717datarootdir="$(eval echo "$datarootdir")"
1718grub_libdir="$(eval echo "$libdir")"
1719grub_localedir="$(eval echo "$localedir")"
1720grub_datadir="$(eval echo "$datadir")"
1721grub_sysconfdir="$(eval echo "$sysconfdir")"
1722AC_DEFINE_UNQUOTED(LOCALEDIR, "$grub_localedir", [Locale dir])
1723AC_DEFINE_UNQUOTED(GRUB_LIBDIR, "$grub_libdir", [Library dir])
1724AC_DEFINE_UNQUOTED(GRUB_DATADIR, "$grub_datadir", [Data dir])
1725AC_DEFINE_UNQUOTED(GRUB_SYSCONFDIR, "$grub_sysconfdir", [Configuration dir])
1726
742f9232 1727
6a161fa9 1728# Output files.
4959e111
VS
1729cpudir="${target_cpu}"
1730if test x${cpudir} = xmipsel; then
1731 cpudir=mips;
1732fi
1f4147aa 1733grub_CHECK_LINK_DIR
1734if test x"$link_dir" = xyes ; then
4959e111 1735 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
f84b481b 1736 if test "$platform" != emu ; then
4959e111 1737 AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
f84b481b 1738 fi
1f4147aa 1739else
1740 mkdir -p include/grub 2>/dev/null
1741 rm -rf include/grub/cpu
4959e111 1742 cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
f84b481b
RM
1743 if test "$platform" != emu ; then
1744 rm -rf include/grub/machine
4959e111 1745 cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
f84b481b 1746 fi
1f4147aa 1747fi
6304d292 1748
8c411768 1749AC_CONFIG_FILES([Makefile])
6304d292 1750AC_CONFIG_FILES([grub-core/Makefile])
15c69261 1751AC_CONFIG_FILES([grub-core/gnulib/Makefile])
269004c1 1752AC_CONFIG_FILES([po/Makefile.in])
8c411768 1753AC_CONFIG_FILES([docs/Makefile])
b23ffd70 1754AC_CONFIG_FILES([util/bash-completion.d/Makefile])
6a161fa9 1755AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
742f9232 1756AC_CONFIG_FILES([config.h])
8c411768 1757
6a161fa9 1758AC_OUTPUT
5ce5507f 1759[
1760echo "*******************************************************"
1761echo GRUB2 will be compiled with following components:
1762echo Platform: "$target_cpu"-"$platform"
f84b481b 1763if [ x"$platform" = xemu ]; then
5ce5507f 1764if [ x"$grub_emu_usb_excuse" = x ]; then
1765echo USB support for grub-emu: Yes
1766else
1767echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
1768fi
927d0134
VS
1769if [ x"$grub_emu_sdl_excuse" = x ]; then
1770echo SDL support for grub-emu: Yes
1771else
1772echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
1773fi
325c8258 1774if [ x"$grub_emu_pci_excuse" = x ]; then
1775echo PCI support for grub-emu: Yes
1776else
1777echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
1778fi
f84b481b 1779fi
61d720e5
VS
1780if test x"$device_mapper_excuse" = x ; then
1781echo With devmapper support: Yes
1782else
1783echo With devmapper support: No "($device_mapper_excuse)"
1784fi
5ce5507f 1785if [ x"$enable_mm_debug" = xyes ]; then
1786echo With memory debugging: Yes
1787else
1788echo With memory debugging: No
1789fi
c5dc1690
SJ
1790if [ x"$enable_cache_stats" = xyes ]; then
1791echo With disk cache statistics: Yes
1792else
1793echo With disk cache statistics: No
1794fi
e744219b
VS
1795
1796if [ x"$enable_boot_time" = xyes ]; then
1797echo With boot time statistics: Yes
1798else
1799echo With boot time statistics: No
1800fi
1801
5ce5507f 1802if [ x"$efiemu_excuse" = x ]; then
1803echo efiemu runtime: Yes
1804else
1805echo efiemu runtime: No "($efiemu_excuse)"
1806fi
5ce5507f 1807if [ x"$grub_mkfont_excuse" = x ]; then
1808echo grub-mkfont: Yes
1809else
1810echo grub-mkfont: No "($grub_mkfont_excuse)"
1811fi
897e6207 1812if [ x"$grub_mount_excuse" = x ]; then
89644ef1 1813echo grub-mount: Yes
92bb0786 1814else
897e6207 1815echo grub-mount: No "($grub_mount_excuse)"
92bb0786 1816fi
c5884973
DO
1817if [ x"$starfield_excuse" = x ]; then
1818echo starfield theme: Yes
1819else
1820echo starfield theme: No "($starfield_excuse)"
1821fi
e4c498a1
MG
1822if [ x"$libzfs_excuse" = x ]; then
1823echo With libzfs support: Yes
1824else
1825echo With libzfs support: No "($libzfs_excuse)"
1826fi
7b780018 1827if [ x"$grub_build_mkfont_excuse" = x ]; then
7c9d0c39
VS
1828 echo Build-time grub-mkfont: Yes
1829 if test "x$FONT_SOURCE" = x ; then
1830 echo "Without unifont"
1831 else
1832 echo "With unifont from $FONT_SOURCE"
1833 fi
4b80e43c 1834else
7b780018 1835 echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)"
7c9d0c39 1836 echo "Without unifont (no build-time grub-mkfont)"
4b80e43c 1837fi
0d2d30bb
VS
1838if test x"$liblzma_excuse" != x ; then
1839echo "Without liblzma (no support for XZ-compressed mips images) ($liblzma_excuse)"
64fce2d8
VS
1840else
1841echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
1842fi
5ce5507f 1843echo "*******************************************************"
1844]