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