]> git.proxmox.com Git - grub2.git/blame - configure.ac
* grub-core/kern/ieee1275/cmain.c: Add explicit attribute on asm
[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
5f91f701 35AC_INIT([GRUB],[2.00],[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
8c411768
BC
48AM_INIT_AUTOMAKE()
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])
1d543c3e 72
90d1e879
RM
73# Optimization flag. Allow user to override.
74if test "x$TARGET_CFLAGS" = x; then
75 TARGET_CFLAGS="$TARGET_CFLAGS -Os"
76fi
77
7c9d0c39
VS
78BUILD_CPPFLAGS="$BUILD_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
79
76ed06b9
BC
80# Default HOST_CPPFLAGS
81HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
76ed06b9 82HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
76ed06b9
BC
83HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
84HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_LIBDIR=\\\"\$(pkglibdir)\\\""
85HOST_CPPFLAGS="$HOST_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
86
87TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
88TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
89TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
90
b977bf01 91case "$target_cpu" in
02164e1b 92 i[[3456]]86) target_cpu=i386 ;;
c7ef54aa 93 amd64) target_cpu=x86_64 ;;
02164e1b 94 sparc) target_cpu=sparc64 ;;
ade85305 95 mipsel|mips64el)
4959e111 96 target_cpu=mipsel;
c721825b 97 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
4a1eefb6 98 ;;
ade85305 99 mips|mips64)
76ed06b9 100 target_cpu=mips;
c721825b 101 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1";
4a1eefb6 102 ;;
389b31cd
LL
103 arm*)
104 target_cpu=arm;
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 ;;
58393a2d 127 *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
05568c2e 128 esac
129else
130 platform="$with_platform"
131fi
132
ec1dfd63
VS
133case "$target_cpu"-"$platform" in
134 x86_64-efi) ;;
135 x86_64-emu) ;;
136 x86_64-*) target_cpu=i386 ;;
137 powerpc64-ieee1275) target_cpu=powerpc ;;
138esac
20011694 139
58393a2d 140# Check if the platform is supported, make final adjustments.
b977bf01 141case "$target_cpu"-"$platform" in
05568c2e 142 i386-efi) ;;
3f4ce737 143 x86_64-efi) ;;
05568c2e 144 i386-pc) ;;
7210dca9 145 i386-multiboot) ;;
546f966a 146 i386-coreboot) ;;
58393a2d 147 i386-linuxbios) platform=coreboot ;;
3d04eab8 148 i386-ieee1275) ;;
8231fb77 149 i386-qemu) ;;
05568c2e 150 powerpc-ieee1275) ;;
151 sparc64-ieee1275) ;;
2c40cc78 152 ia64-efi) ;;
f440c33f 153 mips-qemu_mips) ;;
3666d5f6 154 mips-qemu-mips) platform=qemu_mips;;
8906c3dd 155 mips-arc) ;;
7f63a64f 156 mipsel-arc) ;;
4959e111
VS
157 mipsel-qemu_mips) ;;
158 mipsel-qemu-mips) platform=qemu_mips;;
159 mipsel-yeeloong) platform=loongson ;;
160 mipsel-fuloong) platform=loongson ;;
161 mipsel-loongson) ;;
389b31cd
LL
162 arm-uboot) ;;
163 arm-efi) ;;
f84b481b 164 *-emu) ;;
58393a2d 165 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
6a161fa9 166esac
167
48145ea3 168if test x$platform != xemu ; then
dd614590
VS
169 case "$target_cpu" in
170 i386 | powerpc) target_m32=1 ;;
171 x86_64 | sparc64) target_m64=1 ;;
172 esac
173fi
3f4ce737 174
fc97214f 175case "$target_os" in
c3302aa5 176 windows* | mingw32*) target_os=cygwin ;;
fc97214f
VS
177esac
178
9304eef1 179# This normalizes the names, and creates a new variable ("host_kernel")
180# while at it, since the mapping is not always 1:1 (e.g. different OSes
181# using the same kernel type).
182case "$host_os" in
183 gnu*) host_kernel=hurd ;;
184 linux*) host_kernel=linux ;;
67937d4d 185 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
2c7031b1 186 netbsd*) host_kernel=netbsd ;;
958ee221 187 solaris*) host_kernel=illumos ;;
b105df76 188 darwin*) host_kernel=xnu ;;
7e518ca8 189 cygwin | windows* | mingw32*) host_kernel=windows ;;
9304eef1 190esac
191
f84b481b 192case "$platform" in
c721825b
BC
193 coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
194 multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
195 efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
196 ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
389b31cd 197 uboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_UBOOT=1" ;;
c721825b
BC
198 qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
199 pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
200 emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
54da1feb 201 loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
3666d5f6
VS
202 qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
203 arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
f84b481b 204esac
6bea3f89 205case "$target_cpu" in
389b31cd 206 arm) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARM=1" ;;
4959e111 207 mips |mipsel) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
c721825b 208 sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
6bea3f89 209esac
4959e111
VS
210if test x${target_cpu} = xmipsel ; then
211 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
212else
3ec0fc1c 213 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,` -DGRUB_TARGET_CPU_`echo ${target_cpu} | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`=1"
4959e111 214fi
6bea3f89 215
7f63a64f
VS
216case "${target_cpu}-$platform" in
217 mips-arc)
218 TARGET_LINK_ADDR=0x88200000
219 TARGET_DECOMPRESSOR_LINK_ADDR=0x88100000
220 ;;
221 mipsel-arc)
222 TARGET_LINK_ADDR=0x80700000
223 TARGET_DECOMPRESSOR_LINK_ADDR=0x80600000
224 ;;
5fe67f39 225 mips*-qemu_mips | mips*-loongson)
7f63a64f
VS
226 TARGET_DECOMPRESSOR_LINK_ADDR=0x80100000
227 ;;
228esac
229
230AC_SUBST(TARGET_LINK_ADDR)
231AC_SUBST(TARGET_DECOMPRESSOR_LINK_ADDR)
232
c721825b 233TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
f84b481b 234
56978920 235AC_SUBST(host_cpu)
236AC_SUBST(host_os)
9304eef1 237AC_SUBST(host_kernel)
6e5a42fe 238
071114bb
VS
239AC_SUBST(target_cpu)
240AC_SUBST(platform)
241
d87aedff 242# Define default variables
7134247c
VS
243
244have_with_bootdir=n
245AC_ARG_WITH([bootdir],
246 AS_HELP_STRING([--with-bootdir=DIR],
247 [set the name of /boot directory [[guessed]]]),
248 [have_with_bootdir=y],
249 [have_with_bootdir=n])
250if test x$have_with_bootdir = xy; then
251 bootdirname="$with_bootdir"
252else
253 case "$host_os" in
254 netbsd* | openbsd*)
d87aedff 255 # Because /boot is used for the boot block in NetBSD and OpenBSD,
7134247c
VS
256 bootdirname='' ;;
257 *) bootdirname='boot' ;;
258 esac
259fi
260
d87aedff 261AC_SUBST(bootdirname)
a4c1d277
YB
262AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
263 [Default boot directory name]")
d87aedff 264
7134247c
VS
265AC_ARG_WITH([grubdir],
266 AS_HELP_STRING([--with-grubdir=DIR],
267 [set the name of grub directory [[guessed]]]),
268 [grubdirname="$with_grubdir"],
269 [grubdirname="$PACKAGE"])
270
d87aedff 271AC_SUBST(grubdirname)
a4c1d277
YB
272AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
273 [Default grub directory name])
d87aedff 274
b977bf01 275#
276# Checks for build programs.
277#
144f1f98 278
6c826348 279# Although cmp is listed in the GNU Coding Standards as a command which
280# can used directly, OpenBSD lacks cmp in the default installation.
281AC_CHECK_PROGS([CMP], [cmp])
282if test "x$CMP" = x; then
283 AC_MSG_ERROR([cmp is not found])
284fi
285
144f1f98 286AC_CHECK_PROGS([YACC], [bison])
1569ec51 287if test "x$YACC" = x; then
6c826348 288 AC_MSG_ERROR([bison is not found])
1569ec51 289fi
290
76ed06b9 291AC_PROG_RANLIB
b977bf01 292AC_PROG_INSTALL
293AC_PROG_AWK
09220190 294AC_PROG_LEX
76ed06b9 295AC_PROG_YACC
b977bf01 296AC_PROG_MAKE_SET
ff420223 297AC_PROG_MKDIR_P
e1fd1939 298AC_PROG_LN_S
b977bf01 299
c7c75cf4 300if test "x$LEX" = "x:"; then
09220190
BC
301 AC_MSG_ERROR([flex is not found])
302else
2663fb5f 303 version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
b777c18e 304 if test -n "$version" -a "$version" -ge 20535; then
09220190
BC
305 :
306 else
307 AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
308 fi
309fi
310
68807e5f 311# These are not a "must".
51fa856c 312AC_PATH_PROGS(MAKEINFO, makeinfo true)
6a161fa9 313
b977bf01 314#
315# Checks for host programs.
316#
317
318AC_PROG_CC
15c69261 319gl_EARLY
1eed0e6e 320AC_PROG_CXX
76ed06b9
BC
321AM_PROG_CC_C_O
322AM_PROG_AS
323
6a161fa9 324# Must be GCC.
325test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
326
1eed0e6e
VS
327AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
328
4889bdec 329AC_GNU_SOURCE
2f1a3acf 330AM_GNU_GETTEXT([external])
b977bf01 331AC_SYS_LARGEFILE
332
333# Identify characteristics of the host architecture.
7b780018
VS
334unset ac_cv_c_bigendian
335
b977bf01 336AC_C_BIGENDIAN
337AC_CHECK_SIZEOF(void *)
338AC_CHECK_SIZEOF(long)
339
7e518ca8
VS
340case "$host_os" in
341 cygwin | windows* | mingw32*)
342 HOST_CPPFLAGS="$HOST_CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
343 CPPFLAGS="$CPPFLAGS -DUNICODE=1 -D_WIN32_WINNT=0x0500"
344 AC_CHECK_SIZEOF(TCHAR,,[#include <windows.h>])
345 ;;
346esac
347
2b167a72 348grub_apple_cc
c9da87d0 349if test x$grub_cv_apple_cc = xyes ; then
6fd0b143
VS
350 HOST_CPPFLAGS="$HOST_CPPFLAGS -fnested-functions"
351 HOST_LDFLAGS="$HOST_LDFLAGS -Wl,-allow_stack_execute"
2b167a72 352fi
b977bf01 353
aad32b14
VS
354if test x$USE_NLS = xno; then
355 HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
356fi
357
86695375 358if test "x$cross_compiling" = xyes; then
359 AC_MSG_WARN([cannot generate manual pages while cross compiling])
360else
361 AC_PATH_PROG(HELP2MAN, help2man)
362fi
363
3169f4c7 364# Check for functions and headers.
0f7e980b 365AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
e4c498a1 366AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
7c4e16ff 367
fb90b546
RM
368AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
369#include <sys/param.h>
370#include <sys/mount.h>])
371
372AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default
373#include <sys/param.h>
374#include <sys/mount.h>])
375
2c7031b1
GS
376# For opendisk() and getrawpartition() on NetBSD.
377# Used in util/deviceiter.c and in util/hostdisk.c.
378AC_CHECK_HEADER([util.h], [
379 AC_CHECK_LIB([util], [opendisk], [
380 LIBUTIL="-lutil"
381 AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
382 ])
383 AC_CHECK_LIB([util], [getrawpartition], [
384 LIBUTIL="-lutil"
385 AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
386 ])
387])
388AC_SUBST([LIBUTIL])
389
19ce697d 390AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_host_cc_wtrampolines], [
00c05e22 391 SAVED_CFLAGS="$CFLAGS"
b35ec299 392 CFLAGS="$HOST_CFLAGS -Wtrampolines -Werror"
00c05e22
VS
393 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
394int va_arg_func (int fixed, va_list args);]], [[]])],
19ce697d
VS
395 [grub_cv_host_cc_wtrampolines=yes],
396 [grub_cv_host_cc_wtrampolines=no])
00c05e22
VS
397 CFLAGS="$SAVED_CFLAGS"
398])
399
19ce697d
VS
400if test x"$grub_host_cv_cc_wtrampolines" = xyes ; then
401 HOST_CFLAGS="$HOST_CFLAGS -Wtrampolines"
00c05e22
VS
402fi
403
76ed06b9
BC
404#
405# Check for host and build compilers.
406#
407HOST_CC=$CC
816719c8
VS
408AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc])
409test -z "$BUILD_CC" && AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])
b224c266 410BUILD_CPP="$BUILD_CC -E"
76ed06b9 411
29013cba
VS
412case "$build_os" in
413 haiku*) BUILD_LIBM= ;;
414 *) BUILD_LIBM=-lm ;;
415esac
15c69261
YB
416# For gnulib.
417gl_INIT
418
b977bf01 419#
420# Check for target programs.
421#
422
5b5d4aa5 423# Find tools for the target.
424if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
b977bf01 425 tmp_ac_tool_prefix="$ac_tool_prefix"
426 ac_tool_prefix=$target_alias-
427
428 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
429 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
fc97214f
VS
430 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
431 AC_CHECK_TOOL(TARGET_STRIP, strip)
432 AC_CHECK_TOOL(TARGET_NM, nm)
0e8daad0 433 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
b977bf01 434
435 ac_tool_prefix="$tmp_ac_tool_prefix"
436else
437 if test "x$TARGET_CC" = x; then
438 TARGET_CC=$CC
439 fi
fc97214f
VS
440 AC_CHECK_TOOL(TARGET_OBJCOPY, objcopy)
441 AC_CHECK_TOOL(TARGET_STRIP, strip)
442 AC_CHECK_TOOL(TARGET_NM, nm)
0e8daad0 443 AC_CHECK_TOOL(TARGET_RANLIB, ranlib)
b977bf01 444fi
fc97214f 445
76ed06b9
BC
446AC_SUBST(HOST_CC)
447AC_SUBST(BUILD_CC)
7c9d0c39
VS
448AC_SUBST(BUILD_CFLAGS)
449AC_SUBST(BUILD_CPPFLAGS)
b977bf01 450AC_SUBST(TARGET_CC)
fc97214f 451AC_SUBST(TARGET_NM)
1bd73025 452AC_SUBST(TARGET_RANLIB)
fc97214f
VS
453AC_SUBST(TARGET_STRIP)
454AC_SUBST(TARGET_OBJCOPY)
b977bf01 455
b977bf01 456# Test the C compiler for the target environment.
457tmp_CC="$CC"
458tmp_CFLAGS="$CFLAGS"
459tmp_LDFLAGS="$LDFLAGS"
460tmp_CPPFLAGS="$CPPFLAGS"
aa6d7826 461tmp_LIBS="$LIBS"
b977bf01 462CC="$TARGET_CC"
463CFLAGS="$TARGET_CFLAGS"
464CPPFLAGS="$TARGET_CPPFLAGS"
465LDFLAGS="$TARGET_LDFLAGS"
aa6d7826 466LIBS=""
b977bf01 467
fc97214f
VS
468grub_PROG_NM_MINUS_P
469grub_PROG_NM_DEFINED_ONLY
470AC_SUBST(TARGET_NMFLAGS_MINUS_P)
471AC_SUBST(TARGET_NMFLAGS_DEFINED_ONLY)
472
90d1e879 473# debug flags.
c12936c5
VS
474WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Wattributes -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
475HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS -Wcast-align"
4e27343f 476TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
76ed06b9 477TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
6a161fa9 478
c12936c5
VS
479if test "x$target_cpu" != xi386 && test "x$target_cpu" != xx86_64; then
480TARGET_CFLAGS="$TARGET_CFLAGS -Wcast-align"
481fi
482
90d1e879
RM
483# Force no alignment to save space on i386.
484if test "x$target_cpu" = xi386; then
485 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
b35ec299 486 CFLAGS="$TARGET_CFLAGS -falign-loops=1 -Werror"
eb73121d 487 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
90d1e879
RM
488 [grub_cv_cc_falign_loop=yes],
489 [grub_cv_cc_falign_loop=no])
6a161fa9 490 ])
6a161fa9 491
c966a489 492 AC_CACHE_CHECK([whether -malign-loops works], [grub_cv_cc_malign_loop], [
b35ec299 493 CFLAGS="$TARGET_CFLAGS -malign-loops=1 -Werror"
c966a489
VS
494 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
495 [grub_cv_cc_malign_loop=yes],
496 [grub_cv_cc_malign_loop=no])
497 ])
498
90d1e879
RM
499 if test "x$grub_cv_cc_falign_loop" = xyes; then
500 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
c966a489 501 elif test "x$grub_cv_cc_malign_loop" = xyes; then
90d1e879 502 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
6a161fa9 503 fi
89e0240c 504fi
6a161fa9 505
cdc17f60
VS
506AC_CACHE_CHECK([whether -freg-struct-return works], [grub_cv_cc_freg_struct_return], [
507 CFLAGS="$TARGET_CFLAGS -freg-struct-return -Werror"
508 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
509 [grub_cv_cc_freg_struct_return=yes],
510 [grub_cv_cc_freg_struct_return=no])
511])
512
513if test "x$grub_cv_cc_freg_struct_return" = xyes; then
514 TARGET_CFLAGS="$TARGET_CFLAGS -freg-struct-return"
515fi
516
ee0220bc 517if ( test "x$target_cpu" = xi386 || test "x$target_cpu" = xx86_64 ) && test "x$platform" != xemu; then
90d1e879
RM
518 # Some toolchains enable these features by default, but they need
519 # registers that aren't set up properly in GRUB.
520 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
521fi
77c55a87 522
90d1e879
RM
523# By default, GCC 4.4 generates .eh_frame sections containing unwind
524# information in some cases where it previously did not. GRUB doesn't need
525# these and they just use up vital space. Restore the old compiler
526# behaviour.
527AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
24f4e57c 528 CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
90d1e879
RM
529 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
530 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
531 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
90d1e879 532])
77c55a87 533
90d1e879
RM
534if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
535 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
b977bf01 536fi
6a161fa9 537
1c1f31e5
VS
538if test x"$target_os" = xcygwin; then
539 AC_CACHE_CHECK([whether option -fno-reorder-functions works], grub_cv_cc_no_reorder_functions, [
24f4e57c 540 CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
1c1f31e5
VS
541 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
542 [grub_cv_cc_no_reorder_functions=yes],
543 [grub_cv_cc_no_reorder_functions=no])
544 ])
545fi
546
547if test x"$target_os" = xcygwin && test "x$grub_cv_cc_no_reorder_functions" = xyes; then
548 TARGET_CFLAGS="$TARGET_CFLAGS -fno-reorder-functions"
549fi
550
e9d3421c
VS
551# By default, GCC 4.6 generates .eh_frame sections containing unwind
552# information in some cases where it previously did not. GRUB doesn't need
553# these and they just use up vital space. Restore the old compiler
554# behaviour.
555AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
24f4e57c 556 CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
e9d3421c
VS
557 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
558 [grub_cv_cc_fno_asynchronous_unwind_tables=yes],
559 [grub_cv_cc_fno_asynchronous_unwind_tables=no])
e9d3421c
VS
560])
561
562if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
563 TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
564fi
565
2b167a72 566grub_apple_target_cc
c9da87d0 567if test x$grub_cv_apple_target_cc = xyes ; then
2b167a72 568 TARGET_APPLE_CC=1
fc97214f
VS
569 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [objconv], [])
570 if test "x$TARGET_OBJCONV" = x ; then
571 AC_CHECK_PROG([TARGET_OBJCONV], [objconv], [./objconv], [], [.])
cf00df31 572 fi
fc97214f 573 if test "x$TARGET_OBJCONV" = x ; then
cf00df31 574 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
575 fi
2b167a72 576 TARGET_IMG_LDSCRIPT=
577 TARGET_IMG_CFLAGS="-static"
76ed06b9
BC
578 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
579 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
580 TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
46cf439c 581 TARGET_LDFLAGS_OLDMAGIC=""
2b167a72 582else
583 TARGET_APPLE_CC=0
f04a9a21 584 TARGET_LDFLAGS_OLDMAGIC="-Wl,-N"
2b167a72 585# Use linker script if present, otherwise use builtin -N script.
fc97214f
VS
586if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc"; then
587 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc"
76ed06b9 588 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
fc97214f 589 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${target_os}-img-ld.sc"
76ed06b9 590 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
2b167a72 591else
592 TARGET_IMG_LDSCRIPT=
76ed06b9
BC
593 TARGET_IMG_LDFLAGS='-Wl,-N'
594 TARGET_IMG_LDFLAGS_AC='-Wl,-N'
595 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
2b167a72 596fi
597TARGET_IMG_CFLAGS=
598fi
599
46cf439c
VS
600AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
601
2b167a72 602# For platforms where ELF is not the default link format.
603AC_MSG_CHECKING([for command to convert module to ELF format])
fc97214f 604case "${target_os}" in
7b780018 605 cygwin) TARGET_OBJ2ELF='./build-grub-pe2elf';
4b0cd8f8 606# FIXME: put proper test here
742f9232 607 NEED_REGISTER_FRAME_INFO=1
4b0cd8f8 608 ;;
742f9232 609 *) NEED_REGISTER_FRAME_INFO=0 ;;
2b167a72 610esac
2b167a72 611AC_MSG_RESULT([$TARGET_OBJ2ELF])
612
30c7d3ce
VS
613
614AC_ARG_ENABLE([efiemu],
615 [AS_HELP_STRING([--enable-efiemu],
616 [build and install the efiemu runtimes (default=guessed)])])
617if test x"$enable_efiemu" = xno ; then
618 efiemu_excuse="explicitly disabled"
619fi
1c1f31e5
VS
620if test x"$target_os" = xcygwin ; then
621 efiemu_excuse="not available on cygwin"
622fi
30c7d3ce
VS
623if test x"$target_cpu" != xi386 ; then
624 efiemu_excuse="only available on i386"
625fi
626if test x"$platform" = xefi ; then
627 efiemu_excuse="not available on efi"
628fi
629if test x"$efiemu_excuse" = x ; then
630 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
24f4e57c 631 CFLAGS="$TARGET_CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
30c7d3ce
VS
632 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
633 [grub_cv_cc_efiemu=yes],
634 [grub_cv_cc_efiemu=no])
635 ])
636 if test x$grub_cv_cc_efiemu = xno; then
637 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
638 fi
639fi
640if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
641 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
642fi
643if test x"$efiemu_excuse" = x ; then
644enable_efiemu=yes
645else
646enable_efiemu=no
647fi
648AC_SUBST([enable_efiemu])
649
24f4e57c
VS
650if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then
651 TARGET_CFLAGS="$TARGET_CFLAGS -march=i386"
652fi
653
b977bf01 654if test "x$target_m32" = x1; then
655 # Force 32-bit mode.
656 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
76ed06b9 657 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
19e81ba7 658 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
b977bf01 659 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
2b167a72 660 TARGET_MODULE_FORMAT="elf32"
6a161fa9 661fi
b977bf01 662
20011694 663if test "x$target_m64" = x1; then
664 # Force 64-bit mode.
7e9ca17a 665 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
76ed06b9 666 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
19e81ba7 667 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
7e9ca17a 668 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
2b167a72 669 TARGET_MODULE_FORMAT="elf64"
7e9ca17a 670fi
671
15ce95c4
VS
672case "$target_os" in
673 cygwin)
674 ;;
675 freebsd)
676 if test x"$target_cpu" = xi386; then
677 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386_fbsd"
678 fi
679 if test x"$target_cpu" = xx86_64; then
680 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64_fbsd"
681 fi
682 ;;
6d0740e8
IB
683 openbsd*)
684 if test x"$target_cpu" = xi386; then
685 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386_obsd"
686 fi
687 if test x"$target_cpu" = xx86_64; then
688 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64_obsd"
689 fi
690 ;;
e8559d24
VS
691 haiku*)
692 if test x"$target_cpu" = xi386; then
693 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386_haiku"
694 fi
695 if test x"$target_cpu" = xx86_64; then
696 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64_haiku"
697 fi
698 ;;
15ce95c4
VS
699 *)
700 if test x"$target_cpu" = xi386; then
701 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_i386"
702 fi
703 if test x"$target_cpu" = xx86_64; then
704 TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,-melf_x86_64"
705 fi
706 ;;
707esac
8f0baaac 708
46546fc5 709if test "$target_cpu" = x86_64; then
7e9ca17a 710 # Use large model to support 4G memory
6e09b8b7 711 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
24f4e57c 712 CFLAGS="$TARGET_CFLAGS -m64 -mcmodel=large"
6e09b8b7 713 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
714 [grub_cv_cc_mcmodel=yes],
715 [grub_cv_cc_mcmodel=no])
716 ])
c8600122 717 if test "x$grub_cv_cc_mcmodel" = xno; then
4ba8d354 718 AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
c8600122 719 else
720 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
6e09b8b7 721 fi
46546fc5 722fi
7e9ca17a 723
46546fc5 724if test "$target_cpu"-"$platform" = x86_64-efi; then
7e9ca17a 725 # EFI writes to stack below %rsp, we must not use the red zone
726 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
24f4e57c 727 CFLAGS="$TARGET_CFLAGS -m64 -mno-red-zone"
7e9ca17a 728 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
729 [grub_cv_cc_no_red_zone=yes],
730 [grub_cv_cc_no_red_zone=no])
731 ])
732 if test "x$grub_cv_cc_no_red_zone" = xno; then
733 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
734 fi
735
c8600122 736 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
20011694 737fi
738
baa2a121 739#
740# Compiler features.
741#
742
93a81088 743# Position independent executable.
744grub_CHECK_PIE
745[# Need that, because some distributions ship compilers that include
746# `-fPIE' in the default specs.
747if [ x"$pie_possible" = xyes ]; then
748 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
749fi]
750
7bd8b0c7
VS
751# Position independent executable.
752grub_CHECK_PIC
753[# Need that, because some distributions ship compilers that include
754# `-fPIC' in the default specs.
755if [ x"$pic_possible" = xyes ]; then
756 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIC"
757fi]
758
baa2a121 759# Smashing stack protector.
760grub_CHECK_STACK_PROTECTOR
c3db8364 761# Need that, because some distributions ship compilers that include
baa2a121 762# `-fstack-protector' in the default specs.
c3db8364 763if test "x$ssp_possible" = xyes; then
764 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
765fi
2a8a80e4 766grub_CHECK_STACK_ARG_PROBE
767# Cygwin's GCC uses alloca() to probe the stackframe on static
768# stack allocations above some threshold.
769if test x"$sap_possible" = xyes; then
770 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
771fi
baa2a121 772
bb9f92b9
LL
773# -mno-unaligned-access
774if test "$target_cpu" = arm; then
775 grub_CHECK_NO_UNALIGNED_ACCESS
776 if test x"$nua_possible" = xyes; then
777 TARGET_CFLAGS="$TARGET_CFLAGS -mno-unaligned-access"
778 fi
779fi
780
63f745e8 781AC_ARG_ENABLE([werror],
782 [AS_HELP_STRING([--disable-werror],
783 [do not use -Werror when building GRUB])])
784if test x"$enable_werror" != xno ; then
785 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
ebcecdf1 786 HOST_CFLAGS="$HOST_CFLAGS -Werror"
63f745e8 787fi
788
76ed06b9
BC
789TARGET_CPP="$TARGET_CC -E"
790TARGET_CCAS=$TARGET_CC
791
92cd0f6e
VS
792GRUB_TARGET_CPU="${target_cpu}"
793GRUB_PLATFORM="${platform}"
794
795AC_SUBST(GRUB_TARGET_CPU)
796AC_SUBST(GRUB_PLATFORM)
797
fc97214f 798AC_SUBST(TARGET_OBJCONV)
76ed06b9
BC
799AC_SUBST(TARGET_CPP)
800AC_SUBST(TARGET_CCAS)
801AC_SUBST(TARGET_OBJ2ELF)
2b167a72 802AC_SUBST(TARGET_APPLE_CC)
76ed06b9
BC
803AC_SUBST(TARGET_MODULE_FORMAT)
804
805AC_SUBST(TARGET_CFLAGS)
b977bf01 806AC_SUBST(TARGET_LDFLAGS)
76ed06b9
BC
807AC_SUBST(TARGET_CPPFLAGS)
808AC_SUBST(TARGET_CCASFLAGS)
809
810AC_SUBST(TARGET_IMG_LDSCRIPT)
811AC_SUBST(TARGET_IMG_LDFLAGS)
812AC_SUBST(TARGET_IMG_CFLAGS)
813AC_SUBST(TARGET_IMG_BASE_LDOPT)
814
815AC_SUBST(HOST_CFLAGS)
816AC_SUBST(HOST_LDFLAGS)
817AC_SUBST(HOST_CPPFLAGS)
818AC_SUBST(HOST_CCASFLAGS)
6a161fa9 819
29013cba
VS
820AC_SUBST(BUILD_LIBM)
821
aa6d7826 822# Set them to their new values for the tests below.
823CC="$TARGET_CC"
26de2bcd 824if test "x$TARGET_APPLE_CC" = x1 ; then
69be5b74 825CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
26de2bcd 826else
01fcf061 827CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
26de2bcd 828fi
aa6d7826 829CPPFLAGS="$TARGET_CPPFLAGS"
03f80960
VS
830if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 ; then
831LIBS=
832else
69be5b74 833LIBS=-lgcc
03f80960 834fi
69be5b74 835
01fcf061
VS
836grub_ASM_USCORE
837if test x$grub_cv_asm_uscore = xyes; then
24f4e57c 838CFLAGS="$TARGET_CFLAGS -Wl,--defsym,_abort=_main"
01fcf061 839else
24f4e57c 840CFLAGS="$TARGET_CFLAGS -Wl,--defsym,abort=main"
01fcf061
VS
841fi
842
69be5b74 843# Check for libgcc symbols
19ce697d 844AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __ucmpdi2 _restgpr_14_x __udivsi3 __umoddi3 __udivdi3 __divsi3 __modsi3 __umodsi3 __moddi3 __divdi3 __ctzdi2 __ctzsi2)
69be5b74
VS
845
846if test "x$TARGET_APPLE_CC" = x1 ; then
847CFLAGS="$TARGET_CFLAGS -nostdlib"
848else
849CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
850fi
42e0cba3 851LIBS=""
aa6d7826 852
6a161fa9 853# Defined in aclocal.m4.
f6130a12 854grub_PROG_TARGET_CC
2b167a72 855if test "x$TARGET_APPLE_CC" != x1 ; then
b977bf01 856grub_PROG_OBJCOPY_ABSOLUTE
2b167a72 857fi
cb71ba20 858grub_PROG_LD_BUILD_ID_NONE
b977bf01 859if test "x$target_cpu" = xi386; then
2aec1692
CF
860 if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
861 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
862 # Check symbols provided by linker script.
5cf9459c 863 CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},0x8000 -Wl,--defsym,___main=0x8100"
2aec1692 864 fi
2a8a80e4 865 grub_CHECK_BSS_START_SYMBOL
866 grub_CHECK_END_SYMBOL
867 fi
868 CFLAGS="$TARGET_CFLAGS"
4b13b216 869 grub_I386_ASM_PREFIX_REQUIREMENT
870 grub_I386_ASM_ADDR32
6a161fa9 871fi
872
016a671b 873if test "$platform" != emu; then
8f9a632b
VS
874AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
875 SAVED_CPPFLAGS="$CPPFLAGS"
876 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
877 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
ce938140 878#include <stddef.h>
8f9a632b
VS
879int va_arg_func (int fixed, va_list args);]], [[]])],
880 [grub_cv_cc_isystem=yes],
881 [grub_cv_cc_isystem=no])
882 CPPFLAGS="$SAVED_CPPFLAGS"
883])
884
885if test x"$grub_cv_cc_isystem" = xyes ; then
886 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
887fi
dae79b6b 888fi
5ce5507f 889
19ce697d 890AC_CACHE_CHECK([whether -Wtrampolines work], [grub_cv_cc_wtrampolines], [
24f4e57c 891 CFLAGS="$TARGET_CFLAGS -Wtrampolines -Werror"
779dc15b
VS
892 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
893int va_arg_func (int fixed, va_list args);]], [[]])],
19ce697d
VS
894 [grub_cv_cc_wtrampolines=yes],
895 [grub_cv_cc_wtrampolines=no])
779dc15b
VS
896])
897
19ce697d
VS
898if test x"$grub_cv_cc_wtrampolines" = xyes ; then
899 TARGET_CFLAGS="$TARGET_CFLAGS -Wtrampolines"
779dc15b
VS
900fi
901
c9a86192 902# Restore the flags.
9962ed99 903CC="$tmp_CC"
904CFLAGS="$tmp_CFLAGS"
905CPPFLAGS="$tmp_CPPFLAGS"
c9a86192 906LDFLAGS="$tmp_LDFLAGS"
aa6d7826 907LIBS="$tmp_LIBS"
6a161fa9 908
4fe9862e 909#
2965c7cc 910# Check for options.
4fe9862e 911#
912
913# Memory manager debugging.
b39f9d20 914AC_ARG_ENABLE([mm-debug],
2965c7cc 915 AS_HELP_STRING([--enable-mm-debug],
90ce5d56 916 [include memory manager debugging]),
2965c7cc 917 [AC_DEFINE([MM_DEBUG], [1],
918 [Define to 1 if you enable memory manager debugging.])])
919
c5dc1690
SJ
920AC_ARG_ENABLE([cache-stats],
921 AS_HELP_STRING([--enable-cache-stats],
055e2b8b 922 [enable disk cache statistics collection]))
c5dc1690
SJ
923
924if test x$enable_cache_stats = xyes; then
925 DISK_CACHE_STATS=1
926else
927 DISK_CACHE_STATS=0
928fi
929AC_SUBST([DISK_CACHE_STATS])
930
e744219b
VS
931AC_ARG_ENABLE([boot-time],
932 AS_HELP_STRING([--enable-boot-time],
933 [enable boot time statistics collection]))
934
935if test x$enable_boot_time = xyes; then
936 BOOT_TIME_STATS=1
937else
938 BOOT_TIME_STATS=0
939fi
940AC_SUBST([BOOT_TIME_STATS])
941
d64399b5 942AC_ARG_ENABLE([grub-emu-usb],
943 [AS_HELP_STRING([--enable-grub-emu-usb],
5ce5507f 944 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
5ce5507f 945
927d0134
VS
946AC_ARG_ENABLE([grub-emu-sdl],
947 [AS_HELP_STRING([--enable-grub-emu-sdl],
948 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
949
3affd0ec 950AC_ARG_ENABLE([grub-emu-pci],
951 [AS_HELP_STRING([--enable-grub-emu-pci],
952 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
953
f84b481b 954if test "$platform" = emu; then
f84b481b 955
62a747cb
VS
956if test x"$enable_grub_emu_usb" != xyes ; then
957 grub_emu_usb_excuse="not enabled"
5ce5507f 958fi
325c8258 959
0e848909
VS
960if test x"$enable_grub_emu_pci" = xyes ; then
961 grub_emu_usb_excuse="conflicts with PCI support"
962fi
963
5ce5507f 964[if [ x"$grub_emu_usb_excuse" = x ]; then
d64399b5 965 # Check for libusb libraries.]
5ce5507f 966AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
e98cd0c2 967 [grub_emu_usb_excuse=["need libusb library"]])
d64399b5 968 AC_SUBST([LIBUSB])
5ce5507f 969[fi]
970[if [ x"$grub_emu_usb_excuse" = x ]; then
971 # Check for headers.]
d64399b5 972 AC_CHECK_HEADERS([usb.h], [],
e98cd0c2 973 [grub_emu_usb_excuse=["need libusb headers"]])
4fe9862e 974[fi]
c6f3b249 975if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
ce7a733d 976 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
5ce5507f 977fi
978if test x"$grub_emu_usb_excuse" = x ; then
979enable_grub_emu_usb=yes
980else
981enable_grub_emu_usb=no
982fi
983
927d0134
VS
984if test x"$enable_grub_emu_sdl" = xno ; then
985 grub_emu_sdl_excuse="explicitely disabled"
986fi
987[if [ x"$grub_emu_sdl_excuse" = x ]; then
988 # Check for libSDL libraries.]
989AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
990 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
991 AC_SUBST([LIBSDL])
992[fi]
9f293ab0 993
927d0134
VS
994[if [ x"$grub_emu_sdl_excuse" = x ]; then
995 # Check for headers.]
996 AC_CHECK_HEADERS([SDL/SDL.h], [],
997 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
998[fi]
9f293ab0 999
927d0134
VS
1000if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
1001 AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
1002fi
1003if test x"$grub_emu_sdl_excuse" = x ; then
1004enable_grub_emu_sdl=yes
1005else
1006enable_grub_emu_sdl=no
1007fi
1008
3affd0ec 1009if test x"$enable_grub_emu_pci" != xyes ; then
325c8258 1010 grub_emu_pci_excuse="not enabled"
1011fi
1012
1013if test x"$enable_grub_emu_usb" = xyes ; then
1014 grub_emu_pci_excuse="conflicts with USB support"
1015fi
1016
1017[if [ x"$grub_emu_pci_excuse" = x ]; then
1018 # Check for libpci libraries.]
459fed4b 1019 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
1020 [grub_emu_pci_excuse=["need libpciaccess library"]])
1021 AC_SUBST([LIBPCIACCESS])
325c8258 1022[fi]
1023[if [ x"$grub_emu_pci_excuse" = x ]; then
1024 # Check for headers.]
1025 AC_CHECK_HEADERS([pci/pci.h], [],
459fed4b 1026 [grub_emu_pci_excuse=["need libpciaccess headers"]])
325c8258 1027[fi]
1028
1029if test x"$grub_emu_pci_excuse" = x ; then
1030enable_grub_emu_pci=yes
1031else
9f293ab0 1032
325c8258 1033enable_grub_emu_pci=no
3affd0ec 1034fi
1035
927d0134 1036AC_SUBST([enable_grub_emu_sdl])
d64399b5 1037AC_SUBST([enable_grub_emu_usb])
3affd0ec 1038AC_SUBST([enable_grub_emu_pci])
e7d09ac4
AB
1039
1040else
1041
1042# Ignore --enable-emu-* if platform is not emu
1043enable_grub_emu_sdl=no
1044enable_grub_emu_usb=no
1045enable_grub_emu_pci=no
f84b481b 1046fi
4fe9862e 1047
e52db1f7 1048AC_ARG_ENABLE([grub-mkfont],
1049 [AS_HELP_STRING([--enable-grub-mkfont],
5ce5507f 1050 [build and install the `grub-mkfont' utility (default=guessed)])])
1051if test x"$enable_grub_mkfont" = xno ; then
ce7a733d 1052 grub_mkfont_excuse="explicitly disabled"
5ce5507f 1053fi
1054
1055if test x"$grub_mkfont_excuse" = x ; then
e52db1f7 1056 # Check for freetype libraries.
a5b55c4b 1057 AC_CHECK_TOOLS([FREETYPE], [freetype-config])
e52db1f7 1058 if test "x$FREETYPE" = x ; then
e98cd0c2 1059 grub_mkfont_excuse=["need freetype2 library"]
e52db1f7 1060 fi
e52db1f7 1061fi
660960d6 1062
7b780018
VS
1063unset ac_cv_header_ft2build_h
1064
660960d6
VS
1065if test x"$grub_mkfont_excuse" = x ; then
1066 # Check for freetype libraries.
a5b55c4b
DM
1067 freetype_cflags=`$FREETYPE --cflags`
1068 freetype_libs=`$FREETYPE --libs`
d1e8a02f
VS
1069 SAVED_CPPFLAGS="$CPPFLAGS"
1070 CPPFLAGS="$CPPFLAGS $freetype_cflags"
660960d6
VS
1071 AC_CHECK_HEADERS([ft2build.h], [],
1072 [grub_mkfont_excuse=["need freetype2 headers"]])
d1e8a02f 1073 CPPFLAGS="$SAVED_CPPFLAGS"
660960d6
VS
1074fi
1075
5ce5507f 1076if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
ce7a733d 1077 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
5ce5507f 1078fi
1079if test x"$grub_mkfont_excuse" = x ; then
1080enable_grub_mkfont=yes
1081else
1082enable_grub_mkfont=no
1083fi
e52db1f7 1084AC_SUBST([enable_grub_mkfont])
1085AC_SUBST([freetype_cflags])
1086AC_SUBST([freetype_libs])
1087
7c9d0c39 1088SAVED_CC="$CC"
b224c266 1089SAVED_CPP="$CPP"
7c9d0c39
VS
1090SAVED_CFLAGS="$CFLAGS"
1091SAVED_CPPFLAGS="$CPPFLAGS"
1092CC="$BUILD_CC"
b224c266 1093CPP="$BUILD_CPP"
7c9d0c39 1094CFLAGS="$BUILD_CFLAGS"
7b780018
VS
1095CPPFLAGS="$BUILD_CPPFLAGS"
1096
1097unset ac_cv_c_bigendian
1098unset ac_cv_header_ft2build_h
1099
1100AC_COMPUTE_INT([BUILD_SIZEOF_VOID_P], [sizeof (void *)])
1101AC_COMPUTE_INT([BUILD_SIZEOF_LONG], [sizeof (long)])
1102AC_C_BIGENDIAN([BUILD_WORDS_BIGENDIAN=1], [BUILD_WORDS_BIGENDIAN=0], [BUILD_WORDS_BIGENDIAN=err], [BUILD_WORDS_BIGENDIAN=err])
1103
1104if test x$BUILD_WORDS_BIGENDIAN = xerr ; then
1105 AC_MSG_ERROR([couldnt determine build endianness])
1106fi
1107
1108AC_SUBST([BUILD_SIZEOF_LONG])
1109AC_SUBST([BUILD_SIZEOF_VOID_P])
1110AC_SUBST([BUILD_WORDS_BIGENDIAN])
c5884973 1111
7c9d0c39
VS
1112if test x"$grub_build_mkfont_excuse" = x ; then
1113 # Check for freetype libraries.
7b780018 1114 AC_CHECK_PROGS([BUILD_FREETYPE], [freetype-config])
7c9d0c39
VS
1115 if test "x$BUILD_FREETYPE" = x ; then
1116 grub_build_mkfont_excuse=["need freetype2 library"]
1117 fi
1118fi
c5884973 1119
7c9d0c39
VS
1120if test x"$grub_build_mkfont_excuse" = x ; then
1121 # Check for freetype libraries.
1122 build_freetype_cflags=`$BUILD_FREETYPE --cflags`
1123 build_freetype_libs=`$BUILD_FREETYPE --libs`
1124 SAVED_CPPFLAGS_2="$CPPFLAGS"
1125 CPPFLAGS="$CPPFLAGS $build_freetype_cflags"
1126 AC_CHECK_HEADERS([ft2build.h], [],
1127 [grub_build_mkfont_excuse=["need freetype2 headers"]])
1128 CPPFLAGS="$SAVED_CPPFLAGS_2"
1129fi
1130
1131if test x"$enable_build_grub_mkfont" = xyes && test x"$grub_build_mkfont_excuse" != x ; then
1132 AC_MSG_ERROR([build-grub-mkfont was explicitly requested but can't be compiled])
1133fi
1134if test x"$grub_build_mkfont_excuse" = x ; then
1135 enable_build_grub_mkfont=yes
1136else
1137 enable_build_grub_mkfont=no
c5884973 1138fi
b2e9d276
VS
1139if test x"$enable_build_grub_mkfont" = xno && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 ); then
1140 AC_MSG_ERROR([qemu, powerpc-ieee1275 and loongson ports needs build-time grub-mkfont])
7c9d0c39
VS
1141fi
1142
1143AC_SUBST([build_freetype_cflags])
1144AC_SUBST([build_freetype_libs])
1145
1146CC="$SAVED_CC"
b224c266 1147CPP="$SAVED_CPP"
7c9d0c39
VS
1148CFLAGS="$SAVED_CFLAGS"
1149CPPFLAGS="$SAVED_CPPFLAGS"
1150
1151
1152DJVU_FONT_SOURCE=
1153
1154starfield_excuse=
c5884973 1155
7b966834
VS
1156if test x"$enable_build_grub_mkfont" = xno ; then
1157 starfield_excuse="No build-time grub-mkfont"
1158fi
1159
501b9e4b 1160if test x"$starfield_excuse" = x; then
c5884973 1161 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
32745f51 1162 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do
c5884973
DO
1163 if test -f "$dir/DejaVuSans.$ext"; then
1164 DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
1165 break 2
1166 fi
1167 done
1168 done
1169
1170 if test "x$DJVU_FONT_SOURCE" = x; then
1171 starfield_excuse="No DejaVu found"
1172 fi
1173fi
1174
1175AC_SUBST([DJVU_FONT_SOURCE])
1176
7c9d0c39
VS
1177FONT_SOURCE=
1178
1179for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
1180 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
1181 if test -f "$dir/unifont.$ext"; then
1182 FONT_SOURCE="$dir/unifont.$ext"
1183 break 2
1184 fi
1185 done
1186done
1187
7b966834
VS
1188if test x"$enable_build_grub_mkfont" = xno ; then
1189 FONT_SOURCE=
1190fi
1191
b2e9d276
VS
1192if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips || test "x$target_cpu"-"$platform" = xpowerpc-ieee1275 ); then
1193 AC_MSG_ERROR([qemu, powerpc-ieee1275 and loongson ports need unifont])
7c9d0c39
VS
1194fi
1195
1196AC_SUBST([FONT_SOURCE])
1197
7b780018 1198if test x"$FONT_SOURCE" = x && test x"$DJVU_FONT_SOURCE" = x && test x"$grub_build_mkfont_excuse" = x; then
7c9d0c39
VS
1199 grub_build_mkfont_excuse="no fonts"
1200fi
1201
1202
897e6207
CW
1203AC_ARG_ENABLE([grub-mount],
1204 [AS_HELP_STRING([--enable-grub-mount],
1205 [build and install the `grub-mount' utility (default=guessed)])])
1206if test x"$enable_grub_mount" = xno ; then
1207 grub_mount_excuse="explicitly disabled"
92bb0786
VS
1208fi
1209
897e6207 1210if test x"$grub_mount_excuse" = x ; then
92bb0786 1211 AC_CHECK_LIB([fuse], [fuse_main_real], [],
897e6207 1212 [grub_mount_excuse="need FUSE library"])
92bb0786
VS
1213fi
1214
897e6207 1215if test x"$grub_mount_excuse" = x ; then
92bb0786
VS
1216 # Check for fuse headers.
1217 SAVED_CPPFLAGS="$CPPFLAGS"
338c7fab 1218 CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
92bb0786 1219 AC_CHECK_HEADERS([fuse/fuse.h], [],
897e6207 1220 [grub_mount_excuse=["need FUSE headers"]])
92bb0786
VS
1221 CPPFLAGS="$SAVED_CPPFLAGS"
1222fi
1223
897e6207 1224if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
89644ef1 1225 AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled])
92bb0786 1226fi
897e6207
CW
1227if test x"$grub_mount_excuse" = x ; then
1228enable_grub_mount=yes
92bb0786 1229else
897e6207 1230enable_grub_mount=no
92bb0786 1231fi
897e6207 1232AC_SUBST([enable_grub_mount])
92bb0786 1233
7181e228
CW
1234AC_ARG_ENABLE([device-mapper],
1235 [AS_HELP_STRING([--enable-device-mapper],
1236 [enable Linux device-mapper support (default=guessed)])])
1237if test x"$enable_device_mapper" = xno ; then
1238 device_mapper_excuse="explicitly disabled"
1239fi
1240
53798c4b
GS
1241if test x"$device_mapper_excuse" = x ; then
1242 # Check for device-mapper header.
1243 AC_CHECK_HEADER([libdevmapper.h], [],
1244 [device_mapper_excuse="need libdevmapper header"])
1245fi
1246
7181e228
CW
1247if test x"$device_mapper_excuse" = x ; then
1248 # Check for device-mapper library.
61d720e5 1249 AC_CHECK_LIB([devmapper], [dm_task_create], [],
7181e228 1250 [device_mapper_excuse="need devmapper library"])
7181e228 1251fi
61d720e5
VS
1252
1253if test x"$device_mapper_excuse" = x ; then
1254 # Check for device-mapper library.
1255 AC_CHECK_LIB([devmapper], [dm_log_with_errno_init],
1256 [],
1257 [device_mapper_excuse="need devmapper library"])
1258fi
1259
1260if test x"$device_mapper_excuse" = x ; then
1261 LIBDEVMAPPER="-ldevmapper";
1262 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
1263 [Define to 1 if you have the devmapper library.])
1264fi
1265
62f7d208 1266AC_SUBST([LIBDEVMAPPER])
76ed06b9 1267
f4727da9
VS
1268LIBGEOM=
1269if test x$host_kernel = xkfreebsd; then
1270 AC_CHECK_LIB([geom], [geom_gettree], [],
1271 [AC_MSG_ERROR([Your platform requires libgeom])])
1272 LIBGEOM="-lgeom"
1273fi
1274
1275AC_SUBST([LIBGEOM])
1276
2c44e493
VS
1277AC_CHECK_LIB([lzma], [lzma_code],
1278 [LIBLZMA="-llzma"
1279 AC_DEFINE([HAVE_LIBLZMA], [1],
1280 [Define to 1 if you have the LZMA library.])],)
1281AC_SUBST([LIBLZMA])
1282
e4c498a1
MG
1283AC_ARG_ENABLE([libzfs],
1284 [AS_HELP_STRING([--enable-libzfs],
1285 [enable libzfs integration (default=guessed)])])
1286if test x"$enable_libzfs" = xno ; then
1287 libzfs_excuse="explicitly disabled"
1288fi
16c7cb32 1289
e4c498a1
MG
1290if test x"$libzfs_excuse" = x ; then
1291 # Only check for system headers if libzfs support has not been disabled.
1292 AC_CHECK_HEADERS(libzfs.h libnvpair.h)
1293fi
1294
1295if test x"$libzfs_excuse" = x ; then
1296 AC_CHECK_LIB([zfs], [libzfs_init],
1297 [],
1298 [libzfs_excuse="need zfs library"])
1299fi
1300
1301if test x"$libzfs_excuse" = x ; then
27f9d02e 1302 AC_CHECK_LIB([nvpair], [nvlist_lookup_string],
e4c498a1
MG
1303 [],
1304 [libzfs_excuse="need nvpair library"])
1305fi
1306
1307if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
1308 AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied])
1309fi
1310
1311if test x"$libzfs_excuse" = x ; then
1312 # We need both libzfs and libnvpair for a successful build.
1313 LIBZFS="-lzfs"
1314 AC_DEFINE([HAVE_LIBZFS], [1],
1315 [Define to 1 if you have the ZFS library.])
1316 LIBNVPAIR="-lnvpair"
1317 AC_DEFINE([HAVE_LIBNVPAIR], [1],
1318 [Define to 1 if you have the NVPAIR library.])
1319fi
1320
1321AC_SUBST([LIBZFS])
16c7cb32
BC
1322AC_SUBST([LIBNVPAIR])
1323
9f915872
VS
1324LIBS=""
1325
76ed06b9 1326AC_SUBST([FONT_SOURCE])
76ed06b9
BC
1327AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
1328 [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
76ed06b9
BC
1329AS_IF([test x$TARGET_APPLE_CC = x1],
1330 [AC_SUBST([USE_APPLE_CC_FIXES], yes)])
7181e228 1331
742f9232
VS
1332AC_SUBST(HAVE_ASM_USCORE)
1333AC_SUBST(ADDR32)
1334AC_SUBST(DATA32)
1335AC_SUBST(BSS_START_SYMBOL)
1336AC_SUBST(END_SYMBOL)
1337AC_SUBST(PACKAGE)
1338AC_SUBST(VERSION)
742f9232
VS
1339AC_SUBST(NEED_REGISTER_FRAME_INFO)
1340
76ed06b9
BC
1341#
1342# Automake conditionals
1343#
8c411768 1344
76ed06b9
BC
1345AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
1346AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
1347AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
6585de4c 1348AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
76ed06b9
BC
1349AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
1350AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
1351AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
1352AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
1353AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
4959e111
VS
1354AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
1355AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
7f63a64f 1356AM_CONDITIONAL([COND_mips_arc], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xarc])
76ed06b9
BC
1357AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
1358AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
4959e111 1359AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
37ba07eb
VS
1360AM_CONDITIONAL([COND_mipsel], [test x$target_cpu = xmipsel])
1361AM_CONDITIONAL([COND_mipseb], [test x$target_cpu = xmips])
389b31cd
LL
1362AM_CONDITIONAL([COND_arm], [test x$target_cpu = xarm ])
1363AM_CONDITIONAL([COND_arm_uboot], [test x$target_cpu = xarm -a x$platform = xuboot])
1364AM_CONDITIONAL([COND_arm_efi], [test x$target_cpu = xarm -a x$platform = xefi])
f7711f5e
BC
1365
1366AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
1367AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
1368AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
1369AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
1370AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
b105df76 1371AM_CONDITIONAL([COND_HOST_XNU], [test x$host_kernel = xxnu])
958ee221 1372AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
2d465fb0 1373
76ed06b9
BC
1374AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
1375AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
1376AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
1377AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
1378AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
897e6207 1379AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
76ed06b9 1380AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
771111e5 1381AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
76ed06b9 1382AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
c5dc1690 1383AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
e744219b 1384AM_CONDITIONAL([COND_ENABLE_BOOT_TIME_STATS], [test x$BOOT_TIME_STATS = x1])
fc45fb58 1385
1eed0e6e
VS
1386AM_CONDITIONAL([COND_HAVE_CXX], [test x$HAVE_CXX = xyes])
1387
742f9232 1388AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
fc97214f 1389AM_CONDITIONAL([COND_CYGWIN], [test x$target_os = xcygwin])
c5884973 1390AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
742f9232 1391
6a161fa9 1392# Output files.
4959e111
VS
1393cpudir="${target_cpu}"
1394if test x${cpudir} = xmipsel; then
1395 cpudir=mips;
1396fi
1f4147aa 1397grub_CHECK_LINK_DIR
1398if test x"$link_dir" = xyes ; then
4959e111 1399 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
f84b481b 1400 if test "$platform" != emu ; then
4959e111 1401 AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
f84b481b 1402 fi
1f4147aa 1403else
1404 mkdir -p include/grub 2>/dev/null
1405 rm -rf include/grub/cpu
4959e111 1406 cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
f84b481b
RM
1407 if test "$platform" != emu ; then
1408 rm -rf include/grub/machine
4959e111 1409 cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
f84b481b 1410 fi
1f4147aa 1411fi
6304d292 1412
8c411768 1413AC_CONFIG_FILES([Makefile])
6304d292 1414AC_CONFIG_FILES([grub-core/Makefile])
15c69261 1415AC_CONFIG_FILES([grub-core/gnulib/Makefile])
269004c1 1416AC_CONFIG_FILES([po/Makefile.in])
8c411768 1417AC_CONFIG_FILES([docs/Makefile])
b23ffd70 1418AC_CONFIG_FILES([util/bash-completion.d/Makefile])
6a161fa9 1419AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
742f9232 1420AC_CONFIG_FILES([config.h])
8c411768 1421
6a161fa9 1422AC_OUTPUT
5ce5507f 1423[
1424echo "*******************************************************"
1425echo GRUB2 will be compiled with following components:
1426echo Platform: "$target_cpu"-"$platform"
f84b481b 1427if [ x"$platform" = xemu ]; then
5ce5507f 1428if [ x"$grub_emu_usb_excuse" = x ]; then
1429echo USB support for grub-emu: Yes
1430else
1431echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
1432fi
927d0134
VS
1433if [ x"$grub_emu_sdl_excuse" = x ]; then
1434echo SDL support for grub-emu: Yes
1435else
1436echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
1437fi
325c8258 1438if [ x"$grub_emu_pci_excuse" = x ]; then
1439echo PCI support for grub-emu: Yes
1440else
1441echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
1442fi
f84b481b 1443fi
61d720e5
VS
1444if test x"$device_mapper_excuse" = x ; then
1445echo With devmapper support: Yes
1446else
1447echo With devmapper support: No "($device_mapper_excuse)"
1448fi
5ce5507f 1449if [ x"$enable_mm_debug" = xyes ]; then
1450echo With memory debugging: Yes
1451else
1452echo With memory debugging: No
1453fi
c5dc1690
SJ
1454if [ x"$enable_cache_stats" = xyes ]; then
1455echo With disk cache statistics: Yes
1456else
1457echo With disk cache statistics: No
1458fi
e744219b
VS
1459
1460if [ x"$enable_boot_time" = xyes ]; then
1461echo With boot time statistics: Yes
1462else
1463echo With boot time statistics: No
1464fi
1465
5ce5507f 1466if [ x"$efiemu_excuse" = x ]; then
1467echo efiemu runtime: Yes
1468else
1469echo efiemu runtime: No "($efiemu_excuse)"
1470fi
5ce5507f 1471if [ x"$grub_mkfont_excuse" = x ]; then
1472echo grub-mkfont: Yes
1473else
1474echo grub-mkfont: No "($grub_mkfont_excuse)"
1475fi
897e6207 1476if [ x"$grub_mount_excuse" = x ]; then
89644ef1 1477echo grub-mount: Yes
92bb0786 1478else
897e6207 1479echo grub-mount: No "($grub_mount_excuse)"
92bb0786 1480fi
c5884973
DO
1481if [ x"$starfield_excuse" = x ]; then
1482echo starfield theme: Yes
1483else
1484echo starfield theme: No "($starfield_excuse)"
1485fi
e4c498a1
MG
1486if [ x"$libzfs_excuse" = x ]; then
1487echo With libzfs support: Yes
1488else
1489echo With libzfs support: No "($libzfs_excuse)"
1490fi
7b780018 1491if [ x"$grub_build_mkfont_excuse" = x ]; then
7c9d0c39
VS
1492 echo Build-time grub-mkfont: Yes
1493 if test "x$FONT_SOURCE" = x ; then
1494 echo "Without unifont"
1495 else
1496 echo "With unifont from $FONT_SOURCE"
1497 fi
4b80e43c 1498else
7b780018 1499 echo Build-time grub-mkfont: No "($grub_build_mkfont_excuse)"
7c9d0c39 1500 echo "Without unifont (no build-time grub-mkfont)"
4b80e43c 1501fi
64fce2d8
VS
1502if test "x$LIBLZMA" = x ; then
1503echo "Without liblzma (no support for XZ-compressed mips images)"
1504else
1505echo "With liblzma from $LIBLZMA (support for XZ-compressed mips images)"
1506fi
5ce5507f 1507echo "*******************************************************"
1508]