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