]> git.proxmox.com Git - grub2.git/blame - configure.ac
* grub-core/loader/powerpc/ieee1275/linux.c (grub_linux_load32): Apply
[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
df3367cc 35AC_INIT([GRUB],[1.99~beta0],[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
53
90d1e879
RM
54# Optimization flag. Allow user to override.
55if test "x$TARGET_CFLAGS" = x; then
56 TARGET_CFLAGS="$TARGET_CFLAGS -Os"
57fi
58
76ed06b9
BC
59# Default HOST_CPPFLAGS
60HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
76ed06b9 61HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
76ed06b9
BC
62HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
63HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_LIBDIR=\\\"\$(pkglibdir)\\\""
64HOST_CPPFLAGS="$HOST_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
65
66TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
67TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
68TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
69
b977bf01 70case "$target_cpu" in
02164e1b 71 i[[3456]]86) target_cpu=i386 ;;
c7ef54aa 72 amd64) target_cpu=x86_64 ;;
02164e1b 73 sparc) target_cpu=sparc64 ;;
ade85305 74 mipsel|mips64el)
76ed06b9 75 target_cpu=mips;
c721825b 76 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
4a1eefb6 77 ;;
ade85305 78 mips|mips64)
76ed06b9 79 target_cpu=mips;
c721825b 80 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1";
4a1eefb6 81 ;;
6a161fa9 82esac
83
05568c2e 84# Specify the platform (such as firmware).
85AC_ARG_WITH([platform],
86 AS_HELP_STRING([--with-platform=PLATFORM],
83b984de 87 [select the host platform [[guessed]]]))
05568c2e 88
89# Guess the platform if not specified.
90if test "x$with_platform" = x; then
b977bf01 91 case "$target_cpu"-"$target_vendor" in
05568c2e 92 i386-apple) platform=efi ;;
93 i386-*) platform=pc ;;
58393a2d 94 x86_64-apple) platform=efi ;;
737feb35 95 x86_64-*) platform=pc ;;
05568c2e 96 powerpc-*) platform=ieee1275 ;;
58393a2d 97 powerpc64-*) platform=ieee1275 ;;
05568c2e 98 sparc64-*) platform=ieee1275 ;;
ad17a401 99 mips-*) platform=yeeloong ;;
58393a2d 100 *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
05568c2e 101 esac
102else
103 platform="$with_platform"
104fi
105
ec1dfd63
VS
106case "$target_cpu"-"$platform" in
107 x86_64-efi) ;;
108 x86_64-emu) ;;
109 x86_64-*) target_cpu=i386 ;;
110 powerpc64-ieee1275) target_cpu=powerpc ;;
111esac
20011694 112
58393a2d 113# Check if the platform is supported, make final adjustments.
b977bf01 114case "$target_cpu"-"$platform" in
05568c2e 115 i386-efi) ;;
3f4ce737 116 x86_64-efi) ;;
05568c2e 117 i386-pc) ;;
7210dca9 118 i386-multiboot) ;;
546f966a 119 i386-coreboot) ;;
58393a2d 120 i386-linuxbios) platform=coreboot ;;
3d04eab8 121 i386-ieee1275) ;;
8231fb77 122 i386-qemu) ;;
05568c2e 123 powerpc-ieee1275) ;;
124 sparc64-ieee1275) ;;
7b5f334b 125 mips-qemu-mips) ;;
ad17a401 126 mips-yeeloong) ;;
f84b481b 127 *-emu) ;;
58393a2d 128 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
6a161fa9 129esac
130
3f4ce737 131case "$target_cpu" in
132 i386 | powerpc) target_m32=1 ;;
133 x86_64 | sparc64) target_m64=1 ;;
134esac
135
6e5a42fe 136case "$host_os" in
4825d790 137 mingw32*) host_os=cygwin ;;
6e5a42fe 138esac
139
9304eef1 140# This normalizes the names, and creates a new variable ("host_kernel")
141# while at it, since the mapping is not always 1:1 (e.g. different OSes
142# using the same kernel type).
143case "$host_os" in
144 gnu*) host_kernel=hurd ;;
145 linux*) host_kernel=linux ;;
67937d4d 146 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
2c7031b1 147 netbsd*) host_kernel=netbsd ;;
9304eef1 148 cygwin) host_kernel=windows ;;
149esac
150
f84b481b 151case "$platform" in
c721825b
BC
152 coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
153 multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
154 efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
155 ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
156 qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
157 pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
158 emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
159 yeeloong) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
160 qemu-mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
f84b481b 161esac
6bea3f89 162case "$target_cpu" in
c721825b
BC
163 mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
164 sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
6bea3f89 165esac
742f9232 166machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
6bea3f89 167
c721825b
BC
168HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CPPFLAGS"
169TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
f84b481b 170
56978920 171AC_SUBST(host_cpu)
172AC_SUBST(host_os)
9304eef1 173AC_SUBST(host_kernel)
6e5a42fe 174
b977bf01 175AC_SUBST(target_cpu)
05568c2e 176AC_SUBST(platform)
6a161fa9 177
d87aedff
YB
178# Define default variables
179case "$host_os" in
180 netbsd* | openbsd*)
181 # Because /boot is used for the boot block in NetBSD and OpenBSD,
182 bootdirname='' ;;
183 *) bootdirname='boot' ;;
184esac
185bootdirname=`echo "$bootdirname" | sed "$program_transform_name"`
186AC_SUBST(bootdirname)
a4c1d277
YB
187AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
188 [Default boot directory name]")
d87aedff
YB
189
190grubdirname=`echo "$PACKAGE" | sed "$program_transform_name"`
191AC_SUBST(grubdirname)
a4c1d277
YB
192AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
193 [Default grub directory name])
d87aedff 194
b977bf01 195#
196# Checks for build programs.
197#
144f1f98 198
6c826348 199# Although cmp is listed in the GNU Coding Standards as a command which
200# can used directly, OpenBSD lacks cmp in the default installation.
201AC_CHECK_PROGS([CMP], [cmp])
202if test "x$CMP" = x; then
203 AC_MSG_ERROR([cmp is not found])
204fi
205
144f1f98 206AC_CHECK_PROGS([YACC], [bison])
1569ec51 207if test "x$YACC" = x; then
6c826348 208 AC_MSG_ERROR([bison is not found])
1569ec51 209fi
210
4d88b9ae
VS
211FONT_SOURCE=
212
f4d095d7
GS
213for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
214 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do
215 if test -f "$dir/unifont.$ext"; then
8e50ec9f 216 FONT_SOURCE="$dir/unifont.$ext"
f4d095d7
GS
217 break 2
218 fi
219 done
4931827f 220done
221
76ed06b9 222if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xyeeloong ); then
4d88b9ae
VS
223 AC_MSG_ERROR([qemu and yeeloong ports need unifont])
224fi
225
76ed06b9 226AC_SUBST([FONT_SOURCE])
8e50ec9f 227
76ed06b9 228AC_PROG_RANLIB
b977bf01 229AC_PROG_INSTALL
230AC_PROG_AWK
09220190 231AC_PROG_LEX
76ed06b9 232AC_PROG_YACC
b977bf01 233AC_PROG_MAKE_SET
ff420223 234AC_PROG_MKDIR_P
e1fd1939 235AC_PROG_LN_S
b977bf01 236
c7c75cf4 237if test "x$LEX" = "x:"; then
09220190
BC
238 AC_MSG_ERROR([flex is not found])
239else
2663fb5f 240 version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
b777c18e 241 if test -n "$version" -a "$version" -ge 20535; then
09220190
BC
242 :
243 else
244 AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
245 fi
246fi
247
68807e5f 248# These are not a "must".
c44c90db 249AC_PATH_PROG(MAKEINFO, makeinfo)
6a161fa9 250
b977bf01 251#
252# Checks for host programs.
253#
254
255AC_PROG_CC
15c69261 256gl_EARLY
76ed06b9
BC
257AM_PROG_CC_C_O
258AM_PROG_AS
259
6a161fa9 260# Must be GCC.
261test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
262
4889bdec 263AC_GNU_SOURCE
2f1a3acf 264AM_GNU_GETTEXT([external])
b977bf01 265AC_SYS_LARGEFILE
266
267# Identify characteristics of the host architecture.
268AC_C_BIGENDIAN
269AC_CHECK_SIZEOF(void *)
270AC_CHECK_SIZEOF(long)
271
2b167a72 272grub_apple_cc
c9da87d0 273if test x$grub_cv_apple_cc = xyes ; then
76ed06b9
BC
274 HOST_CPPFLAGS="$HOST_CPPFLAGS -DAPPLE_CC=1"
275 HOST_CFLAGS="$HOST_CFLAGS -fnested-functions"
2b167a72 276fi
b977bf01 277
86695375 278if test "x$cross_compiling" = xyes; then
279 AC_MSG_WARN([cannot generate manual pages while cross compiling])
280else
281 AC_PATH_PROG(HELP2MAN, help2man)
282fi
283
3169f4c7 284# Check for functions and headers.
c38fe9f4
RM
285AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getextmntent)
286AC_CHECK_HEADERS(libzfs.h libnvpair.h sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h)
7c4e16ff 287
fb90b546
RM
288AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
289#include <sys/param.h>
290#include <sys/mount.h>])
291
292AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default
293#include <sys/param.h>
294#include <sys/mount.h>])
295
2c7031b1
GS
296# For opendisk() and getrawpartition() on NetBSD.
297# Used in util/deviceiter.c and in util/hostdisk.c.
298AC_CHECK_HEADER([util.h], [
299 AC_CHECK_LIB([util], [opendisk], [
300 LIBUTIL="-lutil"
301 AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
302 ])
303 AC_CHECK_LIB([util], [getrawpartition], [
304 LIBUTIL="-lutil"
305 AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
306 ])
307])
308AC_SUBST([LIBUTIL])
309
76ed06b9
BC
310#
311# Check for host and build compilers.
312#
313HOST_CC=$CC
314AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc],
315 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])])
316
15c69261
YB
317# For gnulib.
318gl_INIT
319
b977bf01 320#
321# Check for target programs.
322#
323
5b5d4aa5 324# Find tools for the target.
325if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
b977bf01 326 tmp_ac_tool_prefix="$ac_tool_prefix"
327 ac_tool_prefix=$target_alias-
328
329 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
330 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
331 AC_CHECK_TOOL(OBJCOPY, objcopy)
332 AC_CHECK_TOOL(STRIP, strip)
333 AC_CHECK_TOOL(NM, nm)
334
335 ac_tool_prefix="$tmp_ac_tool_prefix"
336else
337 if test "x$TARGET_CC" = x; then
338 TARGET_CC=$CC
339 fi
340 AC_CHECK_TOOL(OBJCOPY, objcopy)
341 AC_CHECK_TOOL(STRIP, strip)
342 AC_CHECK_TOOL(NM, nm)
343fi
76ed06b9
BC
344AC_SUBST(HOST_CC)
345AC_SUBST(BUILD_CC)
b977bf01 346AC_SUBST(TARGET_CC)
347
b977bf01 348# Test the C compiler for the target environment.
349tmp_CC="$CC"
350tmp_CFLAGS="$CFLAGS"
351tmp_LDFLAGS="$LDFLAGS"
352tmp_CPPFLAGS="$CPPFLAGS"
aa6d7826 353tmp_LIBS="$LIBS"
b977bf01 354CC="$TARGET_CC"
355CFLAGS="$TARGET_CFLAGS"
356CPPFLAGS="$TARGET_CPPFLAGS"
357LDFLAGS="$TARGET_LDFLAGS"
aa6d7826 358LIBS=""
b977bf01 359
90d1e879 360# debug flags.
76ed06b9
BC
361TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes -Wundef -Wstrict-prototypes -g"
362TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
6a161fa9 363
90d1e879
RM
364# Force no alignment to save space on i386.
365if test "x$target_cpu" = xi386; then
366 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
367 CFLAGS="$CFLAGS -falign-loops=1"
eb73121d 368 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
90d1e879
RM
369 [grub_cv_cc_falign_loop=yes],
370 [grub_cv_cc_falign_loop=no])
6a161fa9 371 ])
6a161fa9 372
90d1e879
RM
373 if test "x$grub_cv_cc_falign_loop" = xyes; then
374 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
6a161fa9 375 else
90d1e879 376 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
6a161fa9 377 fi
378
90d1e879
RM
379 # Some toolchains enable these features by default, but they need
380 # registers that aren't set up properly in GRUB.
381 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
382fi
77c55a87 383
90d1e879
RM
384# By default, GCC 4.4 generates .eh_frame sections containing unwind
385# information in some cases where it previously did not. GRUB doesn't need
386# these and they just use up vital space. Restore the old compiler
387# behaviour.
388AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
389 SAVE_CFLAGS="$CFLAGS"
390 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
391 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
392 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
393 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
394 CFLAGS="$SAVE_CFLAGS"
395])
77c55a87 396
90d1e879
RM
397if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
398 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
b977bf01 399fi
6a161fa9 400
d2bf06bf
RM
401if test "${target_cpu}-${platform}" = mips-yeeloong; then
402 AC_CACHE_CHECK([whether -march=loongson2f works], [grub_cv_cc_march_loongson2f], [
403 SAVE_CFLAGS="$CFLAGS"
404 CFLAGS="$CFLAGS -march=loongson2f"
405 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
406 [grub_cv_cc_march_loongson2f=yes],
407 [grub_cv_cc_march_loongson2f=no])
408 CFLAGS="$SAVE_CFLAGS"
409 ])
410
411 if test "x$grub_cv_cc_march_loongson2f" = xyes; then
412 TARGET_CFLAGS="$TARGET_CFLAGS -march=loongson2f"
413 else
414 TARGET_CFLAGS="$TARGET_CFLAGS -march=mips3"
415 fi
416fi
417
2b167a72 418grub_apple_target_cc
c9da87d0 419if test x$grub_cv_apple_target_cc = xyes ; then
76ed06b9
BC
420 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1"
421 TARGET_CFLAGS="$TARGET_CFLAGS -fnested-functions"
422
2b167a72 423 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
2b167a72 424 TARGET_APPLE_CC=1
cf00df31 425 AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
426 if test "x$OBJCONV" = x ; then
427 AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
428 fi
429 if test "x$OBJCONV" = x ; then
430 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
431 fi
2b167a72 432 TARGET_IMG_LDSCRIPT=
433 TARGET_IMG_CFLAGS="-static"
76ed06b9
BC
434 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
435 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
436 TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
2b167a72 437else
438 TARGET_APPLE_CC=0
439# Use linker script if present, otherwise use builtin -N script.
76ed06b9
BC
440if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
441 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
442 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
443 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
444 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
2b167a72 445else
446 TARGET_IMG_LDSCRIPT=
76ed06b9
BC
447 TARGET_IMG_LDFLAGS='-Wl,-N'
448 TARGET_IMG_LDFLAGS_AC='-Wl,-N'
449 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
2b167a72 450fi
451TARGET_IMG_CFLAGS=
452fi
453
2b167a72 454# For platforms where ELF is not the default link format.
455AC_MSG_CHECKING([for command to convert module to ELF format])
456case "${host_os}" in
76ed06b9 457 cygwin) TARGET_OBJ2ELF='$(grub_utildir)/grub-pe2elf';
4b0cd8f8 458# FIXME: put proper test here
742f9232 459 NEED_REGISTER_FRAME_INFO=1
4b0cd8f8 460 ;;
742f9232 461 *) NEED_REGISTER_FRAME_INFO=0 ;;
2b167a72 462esac
2b167a72 463AC_MSG_RESULT([$TARGET_OBJ2ELF])
464
b977bf01 465if test "x$target_m32" = x1; then
466 # Force 32-bit mode.
467 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
76ed06b9 468 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
b977bf01 469 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
2b167a72 470 TARGET_MODULE_FORMAT="elf32"
6a161fa9 471fi
b977bf01 472
20011694 473if test "x$target_m64" = x1; then
474 # Force 64-bit mode.
7e9ca17a 475 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
76ed06b9 476 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
7e9ca17a 477 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
2b167a72 478 TARGET_MODULE_FORMAT="elf64"
7e9ca17a 479fi
480
481if test "$target_cpu"-"$platform" = x86_64-efi; then
482 # Use large model to support 4G memory
6e09b8b7 483 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
c8600122 484 SAVED_CFLAGS=$CFLAGS
485 CFLAGS="$CFLAGS -m64 -mcmodel=large"
6e09b8b7 486 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
487 [grub_cv_cc_mcmodel=yes],
488 [grub_cv_cc_mcmodel=no])
489 ])
c8600122 490 if test "x$grub_cv_cc_mcmodel" = xno; then
4ba8d354 491 AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
c8600122 492 else
493 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
6e09b8b7 494 fi
7e9ca17a 495
496 # EFI writes to stack below %rsp, we must not use the red zone
497 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
c8600122 498 CFLAGS="$CFLAGS -m64 -mno-red-zone"
7e9ca17a 499 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
500 [grub_cv_cc_no_red_zone=yes],
501 [grub_cv_cc_no_red_zone=no])
502 ])
503 if test "x$grub_cv_cc_no_red_zone" = xno; then
504 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
505 fi
506
c8600122 507 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
20011694 508fi
509
baa2a121 510#
511# Compiler features.
512#
513
9035dce4 514# Need __enable_execute_stack() for nested function trampolines?
515grub_CHECK_ENABLE_EXECUTE_STACK
516
93a81088 517# Position independent executable.
518grub_CHECK_PIE
519[# Need that, because some distributions ship compilers that include
520# `-fPIE' in the default specs.
521if [ x"$pie_possible" = xyes ]; then
522 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
523fi]
524
baa2a121 525# Smashing stack protector.
526grub_CHECK_STACK_PROTECTOR
c3db8364 527# Need that, because some distributions ship compilers that include
baa2a121 528# `-fstack-protector' in the default specs.
c3db8364 529if test "x$ssp_possible" = xyes; then
530 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
531fi
2a8a80e4 532grub_CHECK_STACK_ARG_PROBE
533# Cygwin's GCC uses alloca() to probe the stackframe on static
534# stack allocations above some threshold.
535if test x"$sap_possible" = xyes; then
536 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
537fi
baa2a121 538
63f745e8 539AC_ARG_ENABLE([werror],
540 [AS_HELP_STRING([--disable-werror],
541 [do not use -Werror when building GRUB])])
542if test x"$enable_werror" != xno ; then
543 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
544fi
545
76ed06b9
BC
546TARGET_CPP="$TARGET_CC -E"
547TARGET_CCAS=$TARGET_CC
548
cf00df31 549AC_SUBST(OBJCONV)
76ed06b9
BC
550AC_SUBST(TARGET_CPP)
551AC_SUBST(TARGET_CCAS)
552AC_SUBST(TARGET_OBJ2ELF)
2b167a72 553AC_SUBST(TARGET_APPLE_CC)
76ed06b9
BC
554AC_SUBST(TARGET_MODULE_FORMAT)
555
556AC_SUBST(TARGET_CFLAGS)
b977bf01 557AC_SUBST(TARGET_LDFLAGS)
76ed06b9
BC
558AC_SUBST(TARGET_CPPFLAGS)
559AC_SUBST(TARGET_CCASFLAGS)
560
561AC_SUBST(TARGET_IMG_LDSCRIPT)
562AC_SUBST(TARGET_IMG_LDFLAGS)
563AC_SUBST(TARGET_IMG_CFLAGS)
564AC_SUBST(TARGET_IMG_BASE_LDOPT)
565
566AC_SUBST(HOST_CFLAGS)
567AC_SUBST(HOST_LDFLAGS)
568AC_SUBST(HOST_CPPFLAGS)
569AC_SUBST(HOST_CCASFLAGS)
6a161fa9 570
aa6d7826 571# Set them to their new values for the tests below.
572CC="$TARGET_CC"
26de2bcd 573if test "x$TARGET_APPLE_CC" = x1 ; then
69be5b74 574CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
26de2bcd 575else
01fcf061 576CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
26de2bcd 577fi
aa6d7826 578CPPFLAGS="$TARGET_CPPFLAGS"
03f80960
VS
579if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 ; then
580LIBS=
581else
69be5b74 582LIBS=-lgcc
03f80960 583fi
69be5b74 584
01fcf061
VS
585grub_ASM_USCORE
586if test x$grub_cv_asm_uscore = xyes; then
587CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main"
588else
589CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
590fi
591
69be5b74
VS
592# Check for libgcc symbols
593AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
594
595if test "x$TARGET_APPLE_CC" = x1 ; then
596CFLAGS="$TARGET_CFLAGS -nostdlib"
597else
598CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
599fi
42e0cba3 600LIBS=""
aa6d7826 601
6a161fa9 602# Defined in aclocal.m4.
f6130a12 603grub_PROG_TARGET_CC
2b167a72 604if test "x$TARGET_APPLE_CC" != x1 ; then
b977bf01 605grub_PROG_OBJCOPY_ABSOLUTE
2b167a72 606fi
cb71ba20 607grub_PROG_LD_BUILD_ID_NONE
b977bf01 608if test "x$target_cpu" = xi386; then
2aec1692
CF
609 if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
610 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
611 # Check symbols provided by linker script.
76ed06b9 612 CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},8000 -Wl,--defsym,___main=0x8100"
2aec1692 613 fi
2a8a80e4 614 grub_CHECK_BSS_START_SYMBOL
615 grub_CHECK_END_SYMBOL
616 fi
617 CFLAGS="$TARGET_CFLAGS"
4b13b216 618 grub_I386_ASM_PREFIX_REQUIREMENT
619 grub_I386_ASM_ADDR32
6a161fa9 620fi
621
5ce5507f 622AC_ARG_ENABLE([efiemu],
623 [AS_HELP_STRING([--enable-efiemu],
624 [build and install the efiemu runtimes (default=guessed)])])
625if test x"$enable_efiemu" = xno ; then
ce7a733d 626 efiemu_excuse="explicitly disabled"
5ce5507f 627fi
05f602fc
VS
628if test x"$target_cpu" != xi386 ; then
629 efiemu_excuse="only available on i386"
630fi
cfdcef12 631if test x"$platform" = xefi ; then
05f602fc
VS
632 efiemu_excuse="not available on efi"
633fi
5ce5507f 634if test x"$efiemu_excuse" = x ; then
43e6200c 635 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
d2838156 636 CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
5ce5507f 637 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
638 [grub_cv_cc_efiemu=yes],
639 [grub_cv_cc_efiemu=no])
640 ])
55c70904 641 if test x$grub_cv_cc_efiemu = xno; then
e98cd0c2 642 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
5ce5507f 643 fi
644fi
645if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
ce7a733d 646 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
5ce5507f 647fi
648if test x"$efiemu_excuse" = x ; then
649enable_efiemu=yes
650else
651enable_efiemu=no
652fi
653AC_SUBST([enable_efiemu])
654
016a671b 655if test "$platform" != emu; then
8f9a632b
VS
656AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
657 SAVED_CPPFLAGS="$CPPFLAGS"
658 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
659 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
660int va_arg_func (int fixed, va_list args);]], [[]])],
661 [grub_cv_cc_isystem=yes],
662 [grub_cv_cc_isystem=no])
663 CPPFLAGS="$SAVED_CPPFLAGS"
664])
665
666if test x"$grub_cv_cc_isystem" = xyes ; then
667 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
668fi
dae79b6b 669fi
5ce5507f 670
779dc15b
VS
671AC_CACHE_CHECK([whether -Wno-trampolines work], [grub_cv_cc_wnotrampolines], [
672 SAVED_CFLAGS="$CFLAGS"
72b7c7aa
CW
673 # Test for -Wtrampolines rather than -Wno-trampolines to reduce confusion
674 # in the event of later failures (since -Wno-* is always accepted, but
675 # produces a diagnostic if something else is wrong).
676 CFLAGS="$TARGET_CFLAGS -Wtrampolines"
779dc15b
VS
677 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
678int va_arg_func (int fixed, va_list args);]], [[]])],
679 [grub_cv_cc_wnotrampolines=yes],
680 [grub_cv_cc_wnotrampolines=no])
681 CFLAGS="$SAVED_CFLAGS"
682])
683
684if test x"$grub_cv_cc_wnotrampolines" = xyes ; then
685 TARGET_CFLAGS="$TARGET_CFLAGS -Wno-trampolines"
686fi
687
c9a86192 688# Restore the flags.
9962ed99 689CC="$tmp_CC"
690CFLAGS="$tmp_CFLAGS"
691CPPFLAGS="$tmp_CPPFLAGS"
c9a86192 692LDFLAGS="$tmp_LDFLAGS"
aa6d7826 693LIBS="$tmp_LIBS"
6a161fa9 694
4fe9862e 695#
2965c7cc 696# Check for options.
4fe9862e 697#
698
699# Memory manager debugging.
b39f9d20 700AC_ARG_ENABLE([mm-debug],
2965c7cc 701 AS_HELP_STRING([--enable-mm-debug],
90ce5d56 702 [include memory manager debugging]),
2965c7cc 703 [AC_DEFINE([MM_DEBUG], [1],
704 [Define to 1 if you enable memory manager debugging.])])
705
d64399b5 706AC_ARG_ENABLE([grub-emu-usb],
707 [AS_HELP_STRING([--enable-grub-emu-usb],
5ce5507f 708 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
5ce5507f 709
927d0134
VS
710AC_ARG_ENABLE([grub-emu-sdl],
711 [AS_HELP_STRING([--enable-grub-emu-sdl],
712 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
713
3affd0ec 714AC_ARG_ENABLE([grub-emu-pci],
715 [AS_HELP_STRING([--enable-grub-emu-pci],
716 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
717
f84b481b
RM
718if test "$platform" = emu; then
719 missing_ncurses=
720[# Check for curses libraries.]
4fe9862e 721 AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
722 [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
f84b481b 723 [missing_ncurses=[true]])])
4fe9862e 724 AC_SUBST([LIBCURSES])
f84b481b 725[if [ x"$missing_ncurses" = x ]; then ]
4fe9862e 726 [# Check for headers.]
727 AC_CHECK_HEADERS([ncurses/curses.h], [],
728 [AC_CHECK_HEADERS([ncurses.h], [],
729 [AC_CHECK_HEADERS([curses.h], [],
f84b481b 730 [missing_ncurses=[true]])])])
5ce5507f 731[fi]
f84b481b
RM
732if test x"$missing_ncurses" = xtrue ; then
733 AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
5ce5507f 734fi
f84b481b 735
62a747cb
VS
736if test x"$enable_grub_emu_usb" != xyes ; then
737 grub_emu_usb_excuse="not enabled"
5ce5507f 738fi
325c8258 739
0e848909
VS
740if test x"$enable_grub_emu_pci" = xyes ; then
741 grub_emu_usb_excuse="conflicts with PCI support"
742fi
743
5ce5507f 744[if [ x"$grub_emu_usb_excuse" = x ]; then
d64399b5 745 # Check for libusb libraries.]
5ce5507f 746AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
e98cd0c2 747 [grub_emu_usb_excuse=["need libusb library"]])
d64399b5 748 AC_SUBST([LIBUSB])
5ce5507f 749[fi]
750[if [ x"$grub_emu_usb_excuse" = x ]; then
751 # Check for headers.]
d64399b5 752 AC_CHECK_HEADERS([usb.h], [],
e98cd0c2 753 [grub_emu_usb_excuse=["need libusb headers"]])
4fe9862e 754[fi]
c6f3b249 755if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
ce7a733d 756 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
5ce5507f 757fi
758if test x"$grub_emu_usb_excuse" = x ; then
759enable_grub_emu_usb=yes
760else
761enable_grub_emu_usb=no
762fi
763
927d0134
VS
764if test x"$enable_grub_emu_sdl" = xno ; then
765 grub_emu_sdl_excuse="explicitely disabled"
766fi
767[if [ x"$grub_emu_sdl_excuse" = x ]; then
768 # Check for libSDL libraries.]
769AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
770 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
771 AC_SUBST([LIBSDL])
772[fi]
9f293ab0 773
927d0134
VS
774[if [ x"$grub_emu_sdl_excuse" = x ]; then
775 # Check for headers.]
776 AC_CHECK_HEADERS([SDL/SDL.h], [],
777 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
778[fi]
9f293ab0 779
927d0134
VS
780if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
781 AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
782fi
783if test x"$grub_emu_sdl_excuse" = x ; then
784enable_grub_emu_sdl=yes
785else
786enable_grub_emu_sdl=no
787fi
788
3affd0ec 789if test x"$enable_grub_emu_pci" != xyes ; then
325c8258 790 grub_emu_pci_excuse="not enabled"
791fi
792
793if test x"$enable_grub_emu_usb" = xyes ; then
794 grub_emu_pci_excuse="conflicts with USB support"
795fi
796
797[if [ x"$grub_emu_pci_excuse" = x ]; then
798 # Check for libpci libraries.]
459fed4b 799 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
800 [grub_emu_pci_excuse=["need libpciaccess library"]])
801 AC_SUBST([LIBPCIACCESS])
325c8258 802[fi]
803[if [ x"$grub_emu_pci_excuse" = x ]; then
804 # Check for headers.]
805 AC_CHECK_HEADERS([pci/pci.h], [],
459fed4b 806 [grub_emu_pci_excuse=["need libpciaccess headers"]])
325c8258 807[fi]
808
809if test x"$grub_emu_pci_excuse" = x ; then
810enable_grub_emu_pci=yes
811else
9f293ab0 812
325c8258 813enable_grub_emu_pci=no
3affd0ec 814fi
815
927d0134 816AC_SUBST([enable_grub_emu_sdl])
d64399b5 817AC_SUBST([enable_grub_emu_usb])
3affd0ec 818AC_SUBST([enable_grub_emu_pci])
f84b481b 819fi
4fe9862e 820
e52db1f7 821AC_ARG_ENABLE([grub-mkfont],
822 [AS_HELP_STRING([--enable-grub-mkfont],
5ce5507f 823 [build and install the `grub-mkfont' utility (default=guessed)])])
824if test x"$enable_grub_mkfont" = xno ; then
ce7a733d 825 grub_mkfont_excuse="explicitly disabled"
5ce5507f 826fi
827
828if test x"$grub_mkfont_excuse" = x ; then
e52db1f7 829 # Check for freetype libraries.
830 AC_CHECK_PROGS([FREETYPE], [freetype-config])
831 if test "x$FREETYPE" = x ; then
e98cd0c2 832 grub_mkfont_excuse=["need freetype2 library"]
e52db1f7 833 fi
e52db1f7 834fi
660960d6
VS
835
836if test x"$grub_mkfont_excuse" = x ; then
837 # Check for freetype libraries.
10854d0d
YB
838 freetype_cflags=`freetype-config --cflags`
839 freetype_libs=`freetype-config --libs`
d1e8a02f
VS
840 SAVED_CPPFLAGS="$CPPFLAGS"
841 CPPFLAGS="$CPPFLAGS $freetype_cflags"
660960d6
VS
842 AC_CHECK_HEADERS([ft2build.h], [],
843 [grub_mkfont_excuse=["need freetype2 headers"]])
d1e8a02f 844 CPPFLAGS="$SAVED_CPPFLAGS"
660960d6
VS
845fi
846
5ce5507f 847if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
ce7a733d 848 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
5ce5507f 849fi
850if test x"$grub_mkfont_excuse" = x ; then
851enable_grub_mkfont=yes
852else
853enable_grub_mkfont=no
854fi
e52db1f7 855AC_SUBST([enable_grub_mkfont])
856AC_SUBST([freetype_cflags])
857AC_SUBST([freetype_libs])
858
7181e228
CW
859AC_ARG_ENABLE([device-mapper],
860 [AS_HELP_STRING([--enable-device-mapper],
861 [enable Linux device-mapper support (default=guessed)])])
862if test x"$enable_device_mapper" = xno ; then
863 device_mapper_excuse="explicitly disabled"
864fi
865
53798c4b
GS
866if test x"$device_mapper_excuse" = x ; then
867 # Check for device-mapper header.
868 AC_CHECK_HEADER([libdevmapper.h], [],
869 [device_mapper_excuse="need libdevmapper header"])
870fi
871
7181e228
CW
872if test x"$device_mapper_excuse" = x ; then
873 # Check for device-mapper library.
61d720e5 874 AC_CHECK_LIB([devmapper], [dm_task_create], [],
7181e228 875 [device_mapper_excuse="need devmapper library"])
7181e228 876fi
61d720e5
VS
877
878if test x"$device_mapper_excuse" = x ; then
879 # Check for device-mapper library.
880 AC_CHECK_LIB([devmapper], [dm_log_with_errno_init],
881 [],
882 [device_mapper_excuse="need devmapper library"])
883fi
884
885if test x"$device_mapper_excuse" = x ; then
886 LIBDEVMAPPER="-ldevmapper";
887 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
888 [Define to 1 if you have the devmapper library.])
889fi
890
62f7d208 891AC_SUBST([LIBDEVMAPPER])
76ed06b9 892
2c44e493
VS
893AC_CHECK_LIB([lzma], [lzma_code],
894 [LIBLZMA="-llzma"
895 AC_DEFINE([HAVE_LIBLZMA], [1],
896 [Define to 1 if you have the LZMA library.])],)
897AC_SUBST([LIBLZMA])
898
a184f9c8 899AC_CHECK_LIB([zfs], [libzfs_init],
16c7cb32 900 [LIBZFS="-lzfs"
a184f9c8
RM
901 AC_DEFINE([HAVE_LIBZFS], [1],
902 [Define to 1 if you have the ZFS library.])],)
16c7cb32
BC
903AC_SUBST([LIBZFS])
904
a184f9c8 905AC_CHECK_LIB([nvpair], [nvlist_print],
16c7cb32 906 [LIBNVPAIR="-lnvpair"
a184f9c8
RM
907 AC_DEFINE([HAVE_LIBNVPAIR], [1],
908 [Define to 1 if you have the NVPAIR library.])],)
16c7cb32
BC
909AC_SUBST([LIBNVPAIR])
910
9f915872
VS
911LIBS=""
912
76ed06b9
BC
913pkglibrootdir='$(libdir)'/`echo $PACKAGE | sed "$program_transform_name"`
914AC_SUBST(pkglibrootdir)
915
916AC_SUBST([FONT_SOURCE])
76ed06b9
BC
917AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
918 [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
76ed06b9
BC
919AS_IF([test x$TARGET_APPLE_CC = x1],
920 [AC_SUBST([USE_APPLE_CC_FIXES], yes)])
7181e228 921
742f9232
VS
922AC_SUBST(HAVE_ASM_USCORE)
923AC_SUBST(ADDR32)
924AC_SUBST(DATA32)
925AC_SUBST(BSS_START_SYMBOL)
926AC_SUBST(END_SYMBOL)
927AC_SUBST(PACKAGE)
928AC_SUBST(VERSION)
929AC_SUBST(NEED_ENABLE_EXECUTE_STACK)
930AC_SUBST(NEED_REGISTER_FRAME_INFO)
931
76ed06b9
BC
932#
933# Automake conditionals
934#
8c411768 935
76ed06b9
BC
936AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
937AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
938AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
939AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
940AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
941AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
942AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
943AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
944AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform = xyeeloong])
945AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips])
946AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
947AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
050abaea 948AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips])
f7711f5e
BC
949
950AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
951AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
952AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
953AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
954AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
2d465fb0 955
76ed06b9
BC
956AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
957AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
958AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
959AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
960AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
961AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
76ed06b9 962AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x])
771111e5 963AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
76ed06b9 964AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
fc45fb58 965
742f9232
VS
966AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
967
6a161fa9 968# Output files.
1f4147aa 969grub_CHECK_LINK_DIR
970if test x"$link_dir" = xyes ; then
f84b481b
RM
971 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
972 if test "$platform" != emu ; then
973 AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
974 fi
1f4147aa 975else
976 mkdir -p include/grub 2>/dev/null
977 rm -rf include/grub/cpu
978 cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
f84b481b
RM
979 if test "$platform" != emu ; then
980 rm -rf include/grub/machine
981 cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
982 fi
1f4147aa 983fi
6304d292 984
8c411768 985AC_CONFIG_FILES([Makefile])
6304d292 986AC_CONFIG_FILES([grub-core/Makefile])
15c69261 987AC_CONFIG_FILES([grub-core/gnulib/Makefile])
269004c1 988AC_CONFIG_FILES([po/Makefile.in])
8c411768 989AC_CONFIG_FILES([docs/Makefile])
b23ffd70 990AC_CONFIG_FILES([util/bash-completion.d/Makefile])
6a161fa9 991AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
742f9232 992AC_CONFIG_FILES([config.h])
8c411768 993
6a161fa9 994AC_OUTPUT
5ce5507f 995[
996echo "*******************************************************"
997echo GRUB2 will be compiled with following components:
998echo Platform: "$target_cpu"-"$platform"
f84b481b 999if [ x"$platform" = xemu ]; then
5ce5507f 1000if [ x"$grub_emu_usb_excuse" = x ]; then
1001echo USB support for grub-emu: Yes
1002else
1003echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
1004fi
927d0134
VS
1005if [ x"$grub_emu_sdl_excuse" = x ]; then
1006echo SDL support for grub-emu: Yes
1007else
1008echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
1009fi
325c8258 1010if [ x"$grub_emu_pci_excuse" = x ]; then
1011echo PCI support for grub-emu: Yes
1012else
1013echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
1014fi
f84b481b 1015fi
61d720e5
VS
1016if test x"$device_mapper_excuse" = x ; then
1017echo With devmapper support: Yes
1018else
1019echo With devmapper support: No "($device_mapper_excuse)"
1020fi
5ce5507f 1021if [ x"$enable_mm_debug" = xyes ]; then
1022echo With memory debugging: Yes
1023else
1024echo With memory debugging: No
1025fi
5ce5507f 1026if [ x"$efiemu_excuse" = x ]; then
1027echo efiemu runtime: Yes
1028else
1029echo efiemu runtime: No "($efiemu_excuse)"
1030fi
5ce5507f 1031if [ x"$grub_mkfont_excuse" = x ]; then
1032echo grub-mkfont: Yes
1033else
1034echo grub-mkfont: No "($grub_mkfont_excuse)"
1035fi
1036echo "*******************************************************"
1037]