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