]> git.proxmox.com Git - grub2.git/blob - configure.ac
Remove prio_list.
[grub2.git] / configure.ac
1 # -*- autoconf -*-
2
3 # Process this file with autoconf to produce a configure script.
4
5 # Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
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
16 dnl This configure script is complicated, because GRUB needs to deal
17 dnl with three potentially different types:
18 dnl
19 dnl build -- the environment for building GRUB
20 dnl host -- the environment for running utilities
21 dnl target -- the environment for running GRUB
22 dnl
23 dnl In addition, GRUB needs to deal with a platform specification
24 dnl which specifies the system running GRUB, such as firmware.
25 dnl This is necessary because the target type in autoconf does not
26 dnl describe such a system very well.
27 dnl
28 dnl The current strategy is to use variables with no prefix (such as
29 dnl CC, CFLAGS, etc.) for the host type as well as the build type,
30 dnl because GRUB does not need to use those variables for the build
31 dnl type, so there is no conflict. Variables with the prefix "TARGET_"
32 dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
33 dnl type.
34
35 AC_INIT([GRUB],[1.99],[bug-grub@gnu.org])
36
37 AC_CONFIG_AUX_DIR([build-aux])
38
39 # We don't want -g -O2 by default in CFLAGS
40 : ${CFLAGS=""}
41
42 # Checks for host and target systems.
43 AC_CANONICAL_HOST
44 AC_CANONICAL_TARGET
45
46 AM_INIT_AUTOMAKE()
47 AC_PREREQ(2.60)
48 AC_CONFIG_SRCDIR([include/grub/dl.h])
49 AC_CONFIG_HEADER([config-util.h])
50
51 # Program name transformations
52 AC_ARG_PROGRAM
53
54 # Optimization flag. Allow user to override.
55 if test "x$TARGET_CFLAGS" = x; then
56 TARGET_CFLAGS="$TARGET_CFLAGS -Os"
57 fi
58
59 # Default HOST_CPPFLAGS
60 HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
61 HOST_CPPFLAGS="$HOST_CPPFLAGS -I\$(top_builddir)/include"
62 HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
63 HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_LIBDIR=\\\"\$(pkglibdir)\\\""
64 HOST_CPPFLAGS="$HOST_CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
65
66 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -Wall -W"
67 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_srcdir)/include"
68 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -I\$(top_builddir)/include"
69
70 case "$target_cpu" in
71 i[[3456]]86) target_cpu=i386 ;;
72 amd64) target_cpu=x86_64 ;;
73 sparc) target_cpu=sparc64 ;;
74 mipsel|mips64el)
75 target_cpu=mipsel;
76 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
77 ;;
78 mips|mips64)
79 target_cpu=mips;
80 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPS=1";
81 ;;
82 esac
83
84 # Specify the platform (such as firmware).
85 AC_ARG_WITH([platform],
86 AS_HELP_STRING([--with-platform=PLATFORM],
87 [select the host platform [[guessed]]]))
88
89 # Guess the platform if not specified.
90 if test "x$with_platform" = x; then
91 case "$target_cpu"-"$target_vendor" in
92 i386-apple) platform=efi ;;
93 i386-*) platform=pc ;;
94 x86_64-apple) platform=efi ;;
95 x86_64-*) platform=pc ;;
96 powerpc-*) platform=ieee1275 ;;
97 powerpc64-*) platform=ieee1275 ;;
98 sparc64-*) platform=ieee1275 ;;
99 mipsel-*) platform=loongson ;;
100 mips-*) platform=arc ;;
101 ia64-*) platform=efi ;;
102 *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
103 esac
104 else
105 platform="$with_platform"
106 fi
107
108 case "$target_cpu"-"$platform" in
109 x86_64-efi) ;;
110 x86_64-emu) ;;
111 x86_64-*) target_cpu=i386 ;;
112 powerpc64-ieee1275) target_cpu=powerpc ;;
113 esac
114
115 # Check if the platform is supported, make final adjustments.
116 case "$target_cpu"-"$platform" in
117 i386-efi) ;;
118 x86_64-efi) ;;
119 i386-pc) ;;
120 i386-multiboot) ;;
121 i386-coreboot) ;;
122 i386-linuxbios) platform=coreboot ;;
123 i386-ieee1275) ;;
124 i386-qemu) ;;
125 powerpc-ieee1275) ;;
126 sparc64-ieee1275) ;;
127 ia64-efi) ;;
128 mips-qemu_mips) ;;
129 mips-qemu-mips) platform=qemu_mips;;
130 mips-arc) ;;
131 mipsel-qemu_mips) ;;
132 mipsel-qemu-mips) platform=qemu_mips;;
133 mipsel-yeeloong) platform=loongson ;;
134 mipsel-fuloong) platform=loongson ;;
135 mipsel-loongson) ;;
136 *-emu) ;;
137 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
138 esac
139
140 case "$target_cpu" in
141 i386 | powerpc) target_m32=1 ;;
142 x86_64 | sparc64) target_m64=1 ;;
143 esac
144
145 case "$host_os" in
146 mingw32*) host_os=cygwin ;;
147 esac
148
149 # This normalizes the names, and creates a new variable ("host_kernel")
150 # while at it, since the mapping is not always 1:1 (e.g. different OSes
151 # using the same kernel type).
152 case "$host_os" in
153 gnu*) host_kernel=hurd ;;
154 linux*) host_kernel=linux ;;
155 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
156 netbsd*) host_kernel=netbsd ;;
157 solaris*) host_kernel=illumos ;;
158 cygwin) host_kernel=windows ;;
159 esac
160
161 case "$platform" in
162 coreboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_COREBOOT=1" ;;
163 multiboot) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MULTIBOOT=1" ;;
164 efi) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EFI=1" ;;
165 ieee1275) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_IEEE1275=1" ;;
166 qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
167 pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
168 emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
169 loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
170 qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
171 arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
172 esac
173 case "$target_cpu" in
174 mips |mipsel) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
175 sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
176 esac
177 if test x${target_cpu} = xmipsel ; then
178 machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
179 else
180 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"
181 fi
182
183 HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CPPFLAGS"
184 TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
185
186 AC_SUBST(host_cpu)
187 AC_SUBST(host_os)
188 AC_SUBST(host_kernel)
189
190 AC_SUBST(target_cpu)
191 AC_SUBST(platform)
192
193 # Define default variables
194 case "$host_os" in
195 netbsd* | openbsd*)
196 # Because /boot is used for the boot block in NetBSD and OpenBSD,
197 bootdirname='' ;;
198 *) bootdirname='boot' ;;
199 esac
200 bootdirname=`echo "$bootdirname" | sed "$program_transform_name"`
201 AC_SUBST(bootdirname)
202 AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
203 [Default boot directory name]")
204
205 grubdirname=`echo "$PACKAGE" | sed "$program_transform_name"`
206 AC_SUBST(grubdirname)
207 AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
208 [Default grub directory name])
209
210 #
211 # Checks for build programs.
212 #
213
214 # Although cmp is listed in the GNU Coding Standards as a command which
215 # can used directly, OpenBSD lacks cmp in the default installation.
216 AC_CHECK_PROGS([CMP], [cmp])
217 if test "x$CMP" = x; then
218 AC_MSG_ERROR([cmp is not found])
219 fi
220
221 AC_CHECK_PROGS([YACC], [bison])
222 if test "x$YACC" = x; then
223 AC_MSG_ERROR([bison is not found])
224 fi
225
226 FONT_SOURCE=
227
228 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
229 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do
230 if test -f "$dir/unifont.$ext"; then
231 FONT_SOURCE="$dir/unifont.$ext"
232 break 2
233 fi
234 done
235 done
236
237 if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson || test "x$platform" = xqemu_mips); then
238 AC_MSG_ERROR([qemu and loongson ports need unifont])
239 fi
240
241 AC_SUBST([FONT_SOURCE])
242
243 AC_PROG_RANLIB
244 AC_PROG_INSTALL
245 AC_PROG_AWK
246 AC_PROG_LEX
247 AC_PROG_YACC
248 AC_PROG_MAKE_SET
249 AC_PROG_MKDIR_P
250 AC_PROG_LN_S
251
252 if test "x$LEX" = "x:"; then
253 AC_MSG_ERROR([flex is not found])
254 else
255 version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
256 if test -n "$version" -a "$version" -ge 20535; then
257 :
258 else
259 AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above])
260 fi
261 fi
262
263 # These are not a "must".
264 AC_PATH_PROGS(MAKEINFO, makeinfo true)
265
266 #
267 # Checks for host programs.
268 #
269
270 AC_PROG_CC
271 gl_EARLY
272 AM_PROG_CC_C_O
273 AM_PROG_AS
274
275 # Must be GCC.
276 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
277
278 AC_GNU_SOURCE
279 AM_GNU_GETTEXT([external])
280 AC_SYS_LARGEFILE
281
282 # Identify characteristics of the host architecture.
283 AC_C_BIGENDIAN
284 AC_CHECK_SIZEOF(void *)
285 AC_CHECK_SIZEOF(long)
286
287 grub_apple_cc
288 if test x$grub_cv_apple_cc = xyes ; then
289 HOST_CPPFLAGS="$HOST_CPPFLAGS -DAPPLE_CC=1"
290 HOST_CFLAGS="$HOST_CFLAGS -fnested-functions"
291 fi
292
293 if test x$USE_NLS = xno; then
294 HOST_CFLAGS="$HOST_CFLAGS -fno-builtin-gettext"
295 fi
296
297 if test "x$cross_compiling" = xyes; then
298 AC_MSG_WARN([cannot generate manual pages while cross compiling])
299 else
300 AC_PATH_PROG(HELP2MAN, help2man)
301 fi
302
303 # Check for functions and headers.
304 AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getextmntent)
305 AC_CHECK_HEADERS(libzfs.h libnvpair.h sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
306
307 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
308 #include <sys/param.h>
309 #include <sys/mount.h>])
310
311 AC_CHECK_MEMBERS([struct statfs.f_mntfromname],,,[$ac_includes_default
312 #include <sys/param.h>
313 #include <sys/mount.h>])
314
315 # For opendisk() and getrawpartition() on NetBSD.
316 # Used in util/deviceiter.c and in util/hostdisk.c.
317 AC_CHECK_HEADER([util.h], [
318 AC_CHECK_LIB([util], [opendisk], [
319 LIBUTIL="-lutil"
320 AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])
321 ])
322 AC_CHECK_LIB([util], [getrawpartition], [
323 LIBUTIL="-lutil"
324 AC_DEFINE(HAVE_GETRAWPARTITION, 1, [Define if getrawpartition() in -lutil can be used])
325 ])
326 ])
327 AC_SUBST([LIBUTIL])
328
329 #
330 # Check for host and build compilers.
331 #
332 HOST_CC=$CC
333 AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc],
334 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])])
335
336 # For gnulib.
337 gl_INIT
338
339 #
340 # Check for target programs.
341 #
342
343 # Find tools for the target.
344 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
345 tmp_ac_tool_prefix="$ac_tool_prefix"
346 ac_tool_prefix=$target_alias-
347
348 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
349 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
350 AC_CHECK_TOOL(OBJCOPY, objcopy)
351 AC_CHECK_TOOL(STRIP, strip)
352 AC_CHECK_TOOL(NM, nm)
353
354 ac_tool_prefix="$tmp_ac_tool_prefix"
355 else
356 if test "x$TARGET_CC" = x; then
357 TARGET_CC=$CC
358 fi
359 AC_CHECK_TOOL(OBJCOPY, objcopy)
360 AC_CHECK_TOOL(STRIP, strip)
361 AC_CHECK_TOOL(NM, nm)
362 fi
363 AC_SUBST(HOST_CC)
364 AC_SUBST(BUILD_CC)
365 AC_SUBST(TARGET_CC)
366
367 # Test the C compiler for the target environment.
368 tmp_CC="$CC"
369 tmp_CFLAGS="$CFLAGS"
370 tmp_LDFLAGS="$LDFLAGS"
371 tmp_CPPFLAGS="$CPPFLAGS"
372 tmp_LIBS="$LIBS"
373 CC="$TARGET_CC"
374 CFLAGS="$TARGET_CFLAGS"
375 CPPFLAGS="$TARGET_CPPFLAGS"
376 LDFLAGS="$TARGET_LDFLAGS"
377 LIBS=""
378
379 # debug flags.
380 WARN_FLAGS="-Wall -W -Wshadow -Wold-style-declaration -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Waddress -Warray-bounds -Wattributes -Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wclobbered -Wcomment -Wcoverage-mismatch -Wdeprecated -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal -Wformat-contains-nul -Wformat-extra-args -Wformat-security -Wformat-y2k -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wunsafe-loop-optimizations -Wlogical-op -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wmudflap -Wmultichar -Wnonnull -Woverflow -Wpacked-bitfield-compat -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wsync-nand -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wmissing-parameter-type -Wnested-externs -Wstrict-prototypes -Wpointer-sign"
381 HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS"
382 TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations"
383 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g"
384
385 # Force no alignment to save space on i386.
386 if test "x$target_cpu" = xi386; then
387 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
388 CFLAGS="$CFLAGS -falign-loops=1"
389 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
390 [grub_cv_cc_falign_loop=yes],
391 [grub_cv_cc_falign_loop=no])
392 ])
393
394 if test "x$grub_cv_cc_falign_loop" = xyes; then
395 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
396 else
397 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
398 fi
399
400 # Some toolchains enable these features by default, but they need
401 # registers that aren't set up properly in GRUB.
402 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
403 fi
404
405 # By default, GCC 4.4 generates .eh_frame sections containing unwind
406 # information in some cases where it previously did not. GRUB doesn't need
407 # these and they just use up vital space. Restore the old compiler
408 # behaviour.
409 AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
410 SAVE_CFLAGS="$CFLAGS"
411 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
412 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
413 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
414 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
415 CFLAGS="$SAVE_CFLAGS"
416 ])
417
418 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
419 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
420 fi
421
422 # By default, GCC 4.6 generates .eh_frame sections containing unwind
423 # information in some cases where it previously did not. GRUB doesn't need
424 # these and they just use up vital space. Restore the old compiler
425 # behaviour.
426 AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
427 SAVE_CFLAGS="$CFLAGS"
428 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
429 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
430 [grub_cv_cc_fno_asynchronous_unwind_tables=yes],
431 [grub_cv_cc_fno_asynchronous_unwind_tables=no])
432 CFLAGS="$SAVE_CFLAGS"
433 ])
434
435 if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
436 TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
437 fi
438
439 grub_apple_target_cc
440 if test x$grub_cv_apple_target_cc = xyes ; then
441 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1"
442 TARGET_CFLAGS="$TARGET_CFLAGS -fnested-functions"
443
444 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
445 TARGET_APPLE_CC=1
446 AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
447 if test "x$OBJCONV" = x ; then
448 AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
449 fi
450 if test "x$OBJCONV" = x ; then
451 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
452 fi
453 TARGET_IMG_LDSCRIPT=
454 TARGET_IMG_CFLAGS="-static"
455 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
456 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20'
457 TARGET_IMG_BASE_LDOPT="-Wl,-image_base"
458 else
459 TARGET_APPLE_CC=0
460 # Use linker script if present, otherwise use builtin -N script.
461 if test -f "${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
462 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
463 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
464 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/${grub_coredir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
465 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
466 else
467 TARGET_IMG_LDSCRIPT=
468 TARGET_IMG_LDFLAGS='-Wl,-N'
469 TARGET_IMG_LDFLAGS_AC='-Wl,-N'
470 TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
471 fi
472 TARGET_IMG_CFLAGS=
473 fi
474
475 # For platforms where ELF is not the default link format.
476 AC_MSG_CHECKING([for command to convert module to ELF format])
477 case "${host_os}" in
478 cygwin) TARGET_OBJ2ELF='$(top_builddir)/grub-pe2elf';
479 # FIXME: put proper test here
480 NEED_REGISTER_FRAME_INFO=1
481 ;;
482 *) NEED_REGISTER_FRAME_INFO=0 ;;
483 esac
484 AC_MSG_RESULT([$TARGET_OBJ2ELF])
485
486
487 AC_ARG_ENABLE([efiemu],
488 [AS_HELP_STRING([--enable-efiemu],
489 [build and install the efiemu runtimes (default=guessed)])])
490 if test x"$enable_efiemu" = xno ; then
491 efiemu_excuse="explicitly disabled"
492 fi
493 if test x"$target_cpu" != xi386 ; then
494 efiemu_excuse="only available on i386"
495 fi
496 if test x"$platform" = xefi ; then
497 efiemu_excuse="not available on efi"
498 fi
499 if test x"$efiemu_excuse" = x ; then
500 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
501 CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
502 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
503 [grub_cv_cc_efiemu=yes],
504 [grub_cv_cc_efiemu=no])
505 ])
506 if test x$grub_cv_cc_efiemu = xno; then
507 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
508 fi
509 fi
510 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
511 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
512 fi
513 if test x"$efiemu_excuse" = x ; then
514 enable_efiemu=yes
515 else
516 enable_efiemu=no
517 fi
518 AC_SUBST([enable_efiemu])
519
520 if test "x$target_m32" = x1; then
521 # Force 32-bit mode.
522 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
523 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
524 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
525 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
526 TARGET_MODULE_FORMAT="elf32"
527 fi
528
529 if test "x$target_m64" = x1; then
530 # Force 64-bit mode.
531 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
532 TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
533 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
534 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
535 TARGET_MODULE_FORMAT="elf64"
536 fi
537
538 if test "$target_cpu"-"$platform" = x86_64-efi; then
539 # Use large model to support 4G memory
540 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
541 SAVED_CFLAGS=$CFLAGS
542 CFLAGS="$CFLAGS -m64 -mcmodel=large"
543 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
544 [grub_cv_cc_mcmodel=yes],
545 [grub_cv_cc_mcmodel=no])
546 ])
547 if test "x$grub_cv_cc_mcmodel" = xno; then
548 AC_MSG_ERROR([-mcmodel=large not supported. Upgrade your gcc.])
549 else
550 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
551 fi
552
553 # EFI writes to stack below %rsp, we must not use the red zone
554 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
555 CFLAGS="$CFLAGS -m64 -mno-red-zone"
556 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
557 [grub_cv_cc_no_red_zone=yes],
558 [grub_cv_cc_no_red_zone=no])
559 ])
560 if test "x$grub_cv_cc_no_red_zone" = xno; then
561 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
562 fi
563
564 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
565 fi
566
567 #
568 # Compiler features.
569 #
570
571 # Need __enable_execute_stack() for nested function trampolines?
572 grub_CHECK_ENABLE_EXECUTE_STACK
573
574 # Position independent executable.
575 grub_CHECK_PIE
576 [# Need that, because some distributions ship compilers that include
577 # `-fPIE' in the default specs.
578 if [ x"$pie_possible" = xyes ]; then
579 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
580 fi]
581
582 # Smashing stack protector.
583 grub_CHECK_STACK_PROTECTOR
584 # Need that, because some distributions ship compilers that include
585 # `-fstack-protector' in the default specs.
586 if test "x$ssp_possible" = xyes; then
587 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
588 fi
589 grub_CHECK_STACK_ARG_PROBE
590 # Cygwin's GCC uses alloca() to probe the stackframe on static
591 # stack allocations above some threshold.
592 if test x"$sap_possible" = xyes; then
593 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
594 fi
595
596 AC_ARG_ENABLE([werror],
597 [AS_HELP_STRING([--disable-werror],
598 [do not use -Werror when building GRUB])])
599 if test x"$enable_werror" != xno ; then
600 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
601 HOST_CFLAGS="$HOST_CFLAGS -Werror"
602 fi
603
604 TARGET_CPP="$TARGET_CC -E"
605 TARGET_CCAS=$TARGET_CC
606
607 GRUB_TARGET_CPU="${target_cpu}"
608 GRUB_PLATFORM="${platform}"
609
610 AC_SUBST(GRUB_TARGET_CPU)
611 AC_SUBST(GRUB_PLATFORM)
612
613 AC_SUBST(OBJCONV)
614 AC_SUBST(TARGET_CPP)
615 AC_SUBST(TARGET_CCAS)
616 AC_SUBST(TARGET_OBJ2ELF)
617 AC_SUBST(TARGET_APPLE_CC)
618 AC_SUBST(TARGET_MODULE_FORMAT)
619
620 AC_SUBST(TARGET_CFLAGS)
621 AC_SUBST(TARGET_LDFLAGS)
622 AC_SUBST(TARGET_CPPFLAGS)
623 AC_SUBST(TARGET_CCASFLAGS)
624
625 AC_SUBST(TARGET_IMG_LDSCRIPT)
626 AC_SUBST(TARGET_IMG_LDFLAGS)
627 AC_SUBST(TARGET_IMG_CFLAGS)
628 AC_SUBST(TARGET_IMG_BASE_LDOPT)
629
630 AC_SUBST(HOST_CFLAGS)
631 AC_SUBST(HOST_LDFLAGS)
632 AC_SUBST(HOST_CPPFLAGS)
633 AC_SUBST(HOST_CCASFLAGS)
634
635 # Set them to their new values for the tests below.
636 CC="$TARGET_CC"
637 if test "x$TARGET_APPLE_CC" = x1 ; then
638 CFLAGS="$TARGET_CFLAGS -nostdlib -Wno-error"
639 else
640 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
641 fi
642 CPPFLAGS="$TARGET_CPPFLAGS"
643 if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 ; then
644 LIBS=
645 else
646 LIBS=-lgcc
647 fi
648
649 grub_ASM_USCORE
650 if test x$grub_cv_asm_uscore = xyes; then
651 CFLAGS="$CFLAGS -Wl,--defsym,_abort=_main"
652 else
653 CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
654 fi
655
656 # Check for libgcc symbols
657 AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x __ia64_trampoline __udivsi3 __umoddi3 __udivdi3 __divsi3 __modsi3 __umodsi3 __moddi3 __divdi3 __ctzdi2 __ctzsi2)
658
659 if test "x$TARGET_APPLE_CC" = x1 ; then
660 CFLAGS="$TARGET_CFLAGS -nostdlib"
661 else
662 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
663 fi
664 LIBS=""
665
666 # Defined in aclocal.m4.
667 grub_PROG_TARGET_CC
668 if test "x$TARGET_APPLE_CC" != x1 ; then
669 grub_PROG_OBJCOPY_ABSOLUTE
670 fi
671 grub_PROG_LD_BUILD_ID_NONE
672 if test "x$target_cpu" = xi386; then
673 if test "$platform" != emu && test "x$TARGET_APPLE_CC" != x1 ; then
674 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
675 # Check symbols provided by linker script.
676 CFLAGS="$TARGET_CFLAGS -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},8000 -Wl,--defsym,___main=0x8100"
677 fi
678 grub_CHECK_BSS_START_SYMBOL
679 grub_CHECK_END_SYMBOL
680 fi
681 CFLAGS="$TARGET_CFLAGS"
682 grub_I386_ASM_PREFIX_REQUIREMENT
683 grub_I386_ASM_ADDR32
684 fi
685
686 if test "$platform" != emu; then
687 AC_CACHE_CHECK([whether -nostdinc -isystem works], [grub_cv_cc_isystem], [
688 SAVED_CPPFLAGS="$CPPFLAGS"
689 CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
690 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
691 int va_arg_func (int fixed, va_list args);]], [[]])],
692 [grub_cv_cc_isystem=yes],
693 [grub_cv_cc_isystem=no])
694 CPPFLAGS="$SAVED_CPPFLAGS"
695 ])
696
697 if test x"$grub_cv_cc_isystem" = xyes ; then
698 TARGET_CPPFLAGS="$TARGET_CPPFLAGS -nostdinc -isystem `$TARGET_CC -print-file-name=include`"
699 fi
700 fi
701
702 AC_CACHE_CHECK([whether -Wno-trampolines work], [grub_cv_cc_wnotrampolines], [
703 SAVED_CFLAGS="$CFLAGS"
704 # Test for -Wtrampolines rather than -Wno-trampolines to reduce confusion
705 # in the event of later failures (since -Wno-* is always accepted, but
706 # produces a diagnostic if something else is wrong).
707 CFLAGS="$TARGET_CFLAGS -Wtrampolines"
708 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
709 int va_arg_func (int fixed, va_list args);]], [[]])],
710 [grub_cv_cc_wnotrampolines=yes],
711 [grub_cv_cc_wnotrampolines=no])
712 CFLAGS="$SAVED_CFLAGS"
713 ])
714
715 if test x"$grub_cv_cc_wnotrampolines" = xyes ; then
716 TARGET_CFLAGS="$TARGET_CFLAGS -Wno-trampolines"
717 fi
718
719 # Restore the flags.
720 CC="$tmp_CC"
721 CFLAGS="$tmp_CFLAGS"
722 CPPFLAGS="$tmp_CPPFLAGS"
723 LDFLAGS="$tmp_LDFLAGS"
724 LIBS="$tmp_LIBS"
725
726 #
727 # Check for options.
728 #
729
730 # Memory manager debugging.
731 AC_ARG_ENABLE([mm-debug],
732 AS_HELP_STRING([--enable-mm-debug],
733 [include memory manager debugging]),
734 [AC_DEFINE([MM_DEBUG], [1],
735 [Define to 1 if you enable memory manager debugging.])])
736
737 AC_ARG_ENABLE([cache-stats],
738 AS_HELP_STRING([--enable-cache-stats],
739 [enable disk cache statistics collection]))
740
741 if test x$enable_cache_stats = xyes; then
742 DISK_CACHE_STATS=1
743 else
744 DISK_CACHE_STATS=0
745 fi
746 AC_SUBST([DISK_CACHE_STATS])
747
748 AC_ARG_ENABLE([grub-emu-usb],
749 [AS_HELP_STRING([--enable-grub-emu-usb],
750 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
751
752 AC_ARG_ENABLE([grub-emu-sdl],
753 [AS_HELP_STRING([--enable-grub-emu-sdl],
754 [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
755
756 AC_ARG_ENABLE([grub-emu-pci],
757 [AS_HELP_STRING([--enable-grub-emu-pci],
758 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
759
760 if test "$platform" = emu; then
761 missing_ncurses=
762 [# Check for curses libraries.]
763 AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
764 [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
765 [missing_ncurses=[true]])])
766 AC_SUBST([LIBCURSES])
767 [if [ x"$missing_ncurses" = x ]; then ]
768 [# Check for headers.]
769 AC_CHECK_HEADERS([ncurses/curses.h], [],
770 [AC_CHECK_HEADERS([ncurses.h], [],
771 [AC_CHECK_HEADERS([curses.h], [],
772 [missing_ncurses=[true]])])])
773 [fi]
774 if test x"$missing_ncurses" = xtrue ; then
775 AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
776 fi
777
778 if test x"$enable_grub_emu_usb" != xyes ; then
779 grub_emu_usb_excuse="not enabled"
780 fi
781
782 if test x"$enable_grub_emu_pci" = xyes ; then
783 grub_emu_usb_excuse="conflicts with PCI support"
784 fi
785
786 [if [ x"$grub_emu_usb_excuse" = x ]; then
787 # Check for libusb libraries.]
788 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
789 [grub_emu_usb_excuse=["need libusb library"]])
790 AC_SUBST([LIBUSB])
791 [fi]
792 [if [ x"$grub_emu_usb_excuse" = x ]; then
793 # Check for headers.]
794 AC_CHECK_HEADERS([usb.h], [],
795 [grub_emu_usb_excuse=["need libusb headers"]])
796 [fi]
797 if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
798 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
799 fi
800 if test x"$grub_emu_usb_excuse" = x ; then
801 enable_grub_emu_usb=yes
802 else
803 enable_grub_emu_usb=no
804 fi
805
806 if test x"$enable_grub_emu_sdl" = xno ; then
807 grub_emu_sdl_excuse="explicitely disabled"
808 fi
809 [if [ x"$grub_emu_sdl_excuse" = x ]; then
810 # Check for libSDL libraries.]
811 AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
812 [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
813 AC_SUBST([LIBSDL])
814 [fi]
815
816 [if [ x"$grub_emu_sdl_excuse" = x ]; then
817 # Check for headers.]
818 AC_CHECK_HEADERS([SDL/SDL.h], [],
819 [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
820 [fi]
821
822 if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
823 AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
824 fi
825 if test x"$grub_emu_sdl_excuse" = x ; then
826 enable_grub_emu_sdl=yes
827 else
828 enable_grub_emu_sdl=no
829 fi
830
831 if test x"$enable_grub_emu_pci" != xyes ; then
832 grub_emu_pci_excuse="not enabled"
833 fi
834
835 if test x"$enable_grub_emu_usb" = xyes ; then
836 grub_emu_pci_excuse="conflicts with USB support"
837 fi
838
839 [if [ x"$grub_emu_pci_excuse" = x ]; then
840 # Check for libpci libraries.]
841 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
842 [grub_emu_pci_excuse=["need libpciaccess library"]])
843 AC_SUBST([LIBPCIACCESS])
844 [fi]
845 [if [ x"$grub_emu_pci_excuse" = x ]; then
846 # Check for headers.]
847 AC_CHECK_HEADERS([pci/pci.h], [],
848 [grub_emu_pci_excuse=["need libpciaccess headers"]])
849 [fi]
850
851 if test x"$grub_emu_pci_excuse" = x ; then
852 enable_grub_emu_pci=yes
853 else
854
855 enable_grub_emu_pci=no
856 fi
857
858 AC_SUBST([enable_grub_emu_sdl])
859 AC_SUBST([enable_grub_emu_usb])
860 AC_SUBST([enable_grub_emu_pci])
861 fi
862
863 AC_ARG_ENABLE([grub-mkfont],
864 [AS_HELP_STRING([--enable-grub-mkfont],
865 [build and install the `grub-mkfont' utility (default=guessed)])])
866 if test x"$enable_grub_mkfont" = xno ; then
867 grub_mkfont_excuse="explicitly disabled"
868 fi
869
870 if test x"$grub_mkfont_excuse" = x ; then
871 # Check for freetype libraries.
872 AC_CHECK_PROGS([FREETYPE], [freetype-config])
873 if test "x$FREETYPE" = x ; then
874 grub_mkfont_excuse=["need freetype2 library"]
875 fi
876 fi
877
878 if test x"$grub_mkfont_excuse" = x ; then
879 # Check for freetype libraries.
880 freetype_cflags=`freetype-config --cflags`
881 freetype_libs=`freetype-config --libs`
882 SAVED_CPPFLAGS="$CPPFLAGS"
883 CPPFLAGS="$CPPFLAGS $freetype_cflags"
884 AC_CHECK_HEADERS([ft2build.h], [],
885 [grub_mkfont_excuse=["need freetype2 headers"]])
886 CPPFLAGS="$SAVED_CPPFLAGS"
887 fi
888
889 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
890 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
891 fi
892 if test x"$grub_mkfont_excuse" = x ; then
893 enable_grub_mkfont=yes
894 else
895 enable_grub_mkfont=no
896 fi
897 if test x"$enable_grub_mkfont" = xno && test "x$platform" = xloongson; then
898 AC_MSG_ERROR([loongson port needs grub-mkfont])
899 fi
900 AC_SUBST([enable_grub_mkfont])
901 AC_SUBST([freetype_cflags])
902 AC_SUBST([freetype_libs])
903
904 DJVU_FONT_SOURCE=
905
906 starfield_excuse=
907
908 if test x$enable_grub_mkfont = xno; then
909 starfield_excuse="No grub-mkfont"
910 fi
911
912 if test x"$starfield_excuse" != x; then
913 for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
914 for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu; do
915 if test -f "$dir/DejaVuSans.$ext"; then
916 DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
917 break 2
918 fi
919 done
920 done
921
922 if test "x$DJVU_FONT_SOURCE" = x; then
923 starfield_excuse="No DejaVu found"
924 fi
925 fi
926
927 AC_SUBST([DJVU_FONT_SOURCE])
928
929 AC_ARG_ENABLE([grub-mount],
930 [AS_HELP_STRING([--enable-grub-mount],
931 [build and install the `grub-mount' utility (default=guessed)])])
932 if test x"$enable_grub_mount" = xno ; then
933 grub_mount_excuse="explicitly disabled"
934 fi
935
936 if test x"$grub_mount_excuse" = x ; then
937 AC_CHECK_LIB([fuse], [fuse_main_real], [],
938 [grub_mount_excuse="need FUSE library"])
939 fi
940
941 if test x"$grub_mount_excuse" = x ; then
942 # Check for fuse headers.
943 SAVED_CPPFLAGS="$CPPFLAGS"
944 CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
945 AC_CHECK_HEADERS([fuse/fuse.h], [],
946 [grub_mount_excuse=["need FUSE headers"]])
947 CPPFLAGS="$SAVED_CPPFLAGS"
948 fi
949
950 if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
951 AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled])
952 fi
953 if test x"$grub_mount_excuse" = x ; then
954 enable_grub_mount=yes
955 else
956 enable_grub_mount=no
957 fi
958 AC_SUBST([enable_grub_mount])
959
960 AC_ARG_ENABLE([device-mapper],
961 [AS_HELP_STRING([--enable-device-mapper],
962 [enable Linux device-mapper support (default=guessed)])])
963 if test x"$enable_device_mapper" = xno ; then
964 device_mapper_excuse="explicitly disabled"
965 fi
966
967 if test x"$device_mapper_excuse" = x ; then
968 # Check for device-mapper header.
969 AC_CHECK_HEADER([libdevmapper.h], [],
970 [device_mapper_excuse="need libdevmapper header"])
971 fi
972
973 if test x"$device_mapper_excuse" = x ; then
974 # Check for device-mapper library.
975 AC_CHECK_LIB([devmapper], [dm_task_create], [],
976 [device_mapper_excuse="need devmapper library"])
977 fi
978
979 if test x"$device_mapper_excuse" = x ; then
980 # Check for device-mapper library.
981 AC_CHECK_LIB([devmapper], [dm_log_with_errno_init],
982 [],
983 [device_mapper_excuse="need devmapper library"])
984 fi
985
986 if test x"$device_mapper_excuse" = x ; then
987 LIBDEVMAPPER="-ldevmapper";
988 AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
989 [Define to 1 if you have the devmapper library.])
990 fi
991
992 AC_SUBST([LIBDEVMAPPER])
993
994 LIBGEOM=
995 if test x$host_kernel = xkfreebsd; then
996 AC_CHECK_LIB([geom], [geom_gettree], [],
997 [AC_MSG_ERROR([Your platform requires libgeom])])
998 LIBGEOM="-lgeom"
999 fi
1000
1001 AC_SUBST([LIBGEOM])
1002
1003 AC_CHECK_LIB([lzma], [lzma_code],
1004 [LIBLZMA="-llzma"
1005 AC_DEFINE([HAVE_LIBLZMA], [1],
1006 [Define to 1 if you have the LZMA library.])],)
1007 AC_SUBST([LIBLZMA])
1008
1009 AC_CHECK_LIB([zfs], [libzfs_init],
1010 [LIBZFS="-lzfs"
1011 AC_DEFINE([HAVE_LIBZFS], [1],
1012 [Define to 1 if you have the ZFS library.])],)
1013 AC_SUBST([LIBZFS])
1014
1015 AC_CHECK_LIB([nvpair], [nvlist_print],
1016 [LIBNVPAIR="-lnvpair"
1017 AC_DEFINE([HAVE_LIBNVPAIR], [1],
1018 [Define to 1 if you have the NVPAIR library.])],)
1019 AC_SUBST([LIBNVPAIR])
1020
1021 LIBS=""
1022
1023 pkglibrootdir='$(libdir)'/`echo $PACKAGE | sed "$program_transform_name"`
1024 AC_SUBST(pkglibrootdir)
1025
1026 AC_SUBST([FONT_SOURCE])
1027 AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
1028 [AC_SUBST([GRUB_BOOT_MACHINE_LINK_ADDR], 0xffe00)])
1029 AS_IF([test x$TARGET_APPLE_CC = x1],
1030 [AC_SUBST([USE_APPLE_CC_FIXES], yes)])
1031
1032 AC_SUBST(HAVE_ASM_USCORE)
1033 AC_SUBST(ADDR32)
1034 AC_SUBST(DATA32)
1035 AC_SUBST(BSS_START_SYMBOL)
1036 AC_SUBST(END_SYMBOL)
1037 AC_SUBST(PACKAGE)
1038 AC_SUBST(VERSION)
1039 AC_SUBST(NEED_ENABLE_EXECUTE_STACK)
1040 AC_SUBST(NEED_REGISTER_FRAME_INFO)
1041
1042 #
1043 # Automake conditionals
1044 #
1045
1046 AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
1047 AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
1048 AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
1049 AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
1050 AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
1051 AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
1052 AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
1053 AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
1054 AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
1055 AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
1056 AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
1057 AM_CONDITIONAL([COND_mips_arc], [test x$target_cpu = xmips -a x$platform = xarc])
1058 AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
1059 AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
1060 AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
1061
1062 AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
1063 AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
1064 AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
1065 AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
1066 AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
1067 AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
1068
1069 AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
1070 AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
1071 AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
1072 AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
1073 AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
1074 AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
1075 AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
1076 AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x])
1077 AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
1078 AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
1079 AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
1080
1081 AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
1082 AM_CONDITIONAL([COND_CYGWIN], [test x$host_os = xcygwin])
1083 AM_CONDITIONAL([COND_STARFIELD], [test "x$starfield_excuse" = x])
1084
1085 # Output files.
1086 cpudir="${target_cpu}"
1087 if test x${cpudir} = xmipsel; then
1088 cpudir=mips;
1089 fi
1090 grub_CHECK_LINK_DIR
1091 if test x"$link_dir" = xyes ; then
1092 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
1093 if test "$platform" != emu ; then
1094 AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
1095 fi
1096 else
1097 mkdir -p include/grub 2>/dev/null
1098 rm -rf include/grub/cpu
1099 cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
1100 if test "$platform" != emu ; then
1101 rm -rf include/grub/machine
1102 cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
1103 fi
1104 fi
1105
1106 AC_CONFIG_FILES([Makefile])
1107 AC_CONFIG_FILES([grub-core/Makefile])
1108 AC_CONFIG_FILES([grub-core/gnulib/Makefile])
1109 AC_CONFIG_FILES([po/Makefile.in])
1110 AC_CONFIG_FILES([docs/Makefile])
1111 AC_CONFIG_FILES([util/bash-completion.d/Makefile])
1112 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
1113 AC_CONFIG_FILES([config.h])
1114
1115 AC_OUTPUT
1116 [
1117 echo "*******************************************************"
1118 echo GRUB2 will be compiled with following components:
1119 echo Platform: "$target_cpu"-"$platform"
1120 if [ x"$platform" = xemu ]; then
1121 if [ x"$grub_emu_usb_excuse" = x ]; then
1122 echo USB support for grub-emu: Yes
1123 else
1124 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
1125 fi
1126 if [ x"$grub_emu_sdl_excuse" = x ]; then
1127 echo SDL support for grub-emu: Yes
1128 else
1129 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
1130 fi
1131 if [ x"$grub_emu_pci_excuse" = x ]; then
1132 echo PCI support for grub-emu: Yes
1133 else
1134 echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
1135 fi
1136 fi
1137 if test x"$device_mapper_excuse" = x ; then
1138 echo With devmapper support: Yes
1139 else
1140 echo With devmapper support: No "($device_mapper_excuse)"
1141 fi
1142 if [ x"$enable_mm_debug" = xyes ]; then
1143 echo With memory debugging: Yes
1144 else
1145 echo With memory debugging: No
1146 fi
1147 if [ x"$enable_cache_stats" = xyes ]; then
1148 echo With disk cache statistics: Yes
1149 else
1150 echo With disk cache statistics: No
1151 fi
1152 if [ x"$efiemu_excuse" = x ]; then
1153 echo efiemu runtime: Yes
1154 else
1155 echo efiemu runtime: No "($efiemu_excuse)"
1156 fi
1157 if [ x"$grub_mkfont_excuse" = x ]; then
1158 echo grub-mkfont: Yes
1159 else
1160 echo grub-mkfont: No "($grub_mkfont_excuse)"
1161 fi
1162 if [ x"$grub_mount_excuse" = x ]; then
1163 echo grub-mount: Yes
1164 else
1165 echo grub-mount: No "($grub_mount_excuse)"
1166 fi
1167 if [ x"$starfield_excuse" = x ]; then
1168 echo starfield theme: Yes
1169 else
1170 echo starfield theme: No "($starfield_excuse)"
1171 fi
1172 echo "*******************************************************"
1173 ]