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