]> git.proxmox.com Git - grub2.git/blob - configure.ac
merge mainline into mips
[grub2.git] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2
3 # Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
4 #
5 # This configure.ac is free software; the author
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 dnl This configure script is complicated, because GRUB needs to deal
15 dnl with three potentially different types:
16 dnl
17 dnl build -- the environment for building GRUB
18 dnl host -- the environment for running utilities
19 dnl target -- the environment for running GRUB
20 dnl
21 dnl In addition, GRUB needs to deal with a platform specification
22 dnl which specifies the system running GRUB, such as firmware.
23 dnl This is necessary because the target type in autoconf does not
24 dnl describe such a system very well.
25 dnl
26 dnl The current strategy is to use variables with no prefix (such as
27 dnl CC, CFLAGS, etc.) for the host type as well as the build type,
28 dnl because GRUB does not need to use those variables for the build
29 dnl type, so there is no conflict. Variables with the prefix "TARGET_"
30 dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
31 dnl type.
32
33
34 AC_INIT([GRUB],[1.97],[bug-grub@gnu.org])
35 AM_INIT_AUTOMAKE()
36 AC_PREREQ(2.60)
37 AC_CONFIG_SRCDIR([include/grub/dl.h])
38 AC_CONFIG_HEADER([config.h])
39
40 # Checks for host and target systems.
41 AC_CANONICAL_HOST
42 AC_CANONICAL_TARGET
43
44 # Program name transformations
45 AC_ARG_PROGRAM
46
47 # Optimization flag. Allow user to override.
48 if test "x$TARGET_CFLAGS" = x; then
49 TARGET_CFLAGS="$TARGET_CFLAGS -Os"
50 fi
51
52 case "$target_cpu" in
53 i[[3456]]86) target_cpu=i386 ;;
54 sparc) target_cpu=sparc64 ;;
55 mipsel|mips64el)
56 target_cpu=mips;
57 TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPSEL=1";
58 CFLAGS="$CFLAGS -DGRUB_CPU_MIPSEL=1";
59 ;;
60 mips|mips64)
61 target_cpu=mips;
62 TARGET_CFLAGS="$TARGET_CFLAGS -DGRUB_CPU_MIPS=1";
63 CFLAGS="$CFLAGS -DGRUB_CPU_MIPS=1";
64 ;;
65 esac
66
67 # Specify the platform (such as firmware).
68 AC_ARG_WITH([platform],
69 AS_HELP_STRING([--with-platform=PLATFORM],
70 [select the host platform [[guessed]]]))
71
72 # Guess the platform if not specified.
73 if test "x$with_platform" = x; then
74 case "$target_cpu"-"$target_vendor" in
75 i386-apple) platform=efi ;;
76 i386-*) platform=pc ;;
77 x86_64-apple) platform=efi ;;
78 x86_64-*) platform=pc ;;
79 powerpc-*) platform=ieee1275 ;;
80 powerpc64-*) platform=ieee1275 ;;
81 sparc64-*) platform=ieee1275 ;;
82 mips-*) platform=yeeloong ;;
83 *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
84 esac
85 else
86 platform="$with_platform"
87 fi
88
89 # Adjust CPU unless target was explicitly specified.
90 if test -z "$target_alias"; then
91 case "$target_cpu"-"$platform" in
92 x86_64-efi) ;;
93 x86_64-*) target_cpu=i386 ;;
94 powerpc64-ieee1275) target_cpu=powerpc ;;
95 esac
96 fi
97
98 # Check if the platform is supported, make final adjustments.
99 case "$target_cpu"-"$platform" in
100 i386-efi) ;;
101 x86_64-efi) ;;
102 i386-pc) ;;
103 i386-coreboot) ;;
104 i386-linuxbios) platform=coreboot ;;
105 i386-ieee1275) ;;
106 i386-qemu) ;;
107 powerpc-ieee1275) ;;
108 sparc64-ieee1275) ;;
109 mips-qemu-mips) ;;
110 mips-yeeloong) ;;
111 *-emu) ;;
112 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
113 esac
114
115 case "$target_cpu" in
116 i386 | powerpc) target_m32=1 ;;
117 x86_64 | sparc64) target_m64=1 ;;
118 esac
119
120 case "$host_os" in
121 mingw32*) host_os=cygwin ;;
122 esac
123
124 # This normalizes the names, and creates a new variable ("host_kernel")
125 # while at it, since the mapping is not always 1:1 (e.g. different OSes
126 # using the same kernel type).
127 case "$host_os" in
128 gnu*) host_kernel=hurd ;;
129 linux*) host_kernel=linux ;;
130 freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
131 cygwin) host_kernel=windows ;;
132 esac
133
134 case "$platform" in
135 coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
136 efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
137 ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
138 qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
139 pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
140 emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
141 yeeloong) machine_CFLAGS="-DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
142 qemu-mips) machine_CFLAGS="-DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
143 esac
144 CFLAGS="$CFLAGS $machine_CFLAGS"
145 TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
146 TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
147
148 AC_SUBST(host_cpu)
149 AC_SUBST(host_os)
150 AC_SUBST(host_kernel)
151
152 AC_SUBST(target_cpu)
153 AC_SUBST(platform)
154
155 #
156 # Checks for build programs.
157 #
158
159 # Although cmp is listed in the GNU Coding Standards as a command which
160 # can used directly, OpenBSD lacks cmp in the default installation.
161 AC_CHECK_PROGS([CMP], [cmp])
162 if test "x$CMP" = x; then
163 AC_MSG_ERROR([cmp is not found])
164 fi
165
166 AC_CHECK_PROGS([YACC], [bison])
167 if test "x$YACC" = x; then
168 AC_MSG_ERROR([bison is not found])
169 fi
170
171 for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz ; do
172 if test -e $file ; then
173 AC_SUBST([FONT_SOURCE], [$file])
174 break
175 fi
176 done
177
178 AC_PROG_INSTALL
179 AC_PROG_AWK
180 AC_PROG_MAKE_SET
181 AC_PROG_MKDIR_P
182
183 # These are not a "must".
184 AC_PATH_PROG(RUBY, ruby)
185 AC_PATH_PROG(MAKEINFO, makeinfo)
186
187 #
188 # Checks for host programs.
189 #
190
191 AC_PROG_CC
192 # Must be GCC.
193 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
194
195 AC_GNU_SOURCE
196 AM_GNU_GETTEXT([external])
197 AC_SYS_LARGEFILE
198
199 # Identify characteristics of the host architecture.
200 AC_C_BIGENDIAN
201 AC_CHECK_SIZEOF(void *)
202 AC_CHECK_SIZEOF(long)
203
204 grub_apple_cc
205 if test x$grub_cv_apple_cc = xyes ; then
206 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
207 ASFLAGS="$ASFLAGS -DAPPLE_CC=1"
208 fi
209
210 if test "x$cross_compiling" = xyes; then
211 AC_MSG_WARN([cannot generate manual pages while cross compiling])
212 else
213 AC_PATH_PROG(HELP2MAN, help2man)
214 fi
215
216 # Check for functions.
217 AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
218
219 # For grub-mkisofs
220 AC_HEADER_MAJOR
221 AC_HEADER_DIRENT
222 AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid)
223 AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h)
224 AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h)
225
226 #
227 # Check for target programs.
228 #
229
230 # Find tools for the target.
231 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
232 tmp_ac_tool_prefix="$ac_tool_prefix"
233 ac_tool_prefix=$target_alias-
234
235 AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
236 [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
237 AC_CHECK_TOOL(OBJCOPY, objcopy)
238 AC_CHECK_TOOL(STRIP, strip)
239 AC_CHECK_TOOL(NM, nm)
240
241 ac_tool_prefix="$tmp_ac_tool_prefix"
242 else
243 if test "x$TARGET_CC" = x; then
244 TARGET_CC=$CC
245 fi
246 AC_CHECK_TOOL(OBJCOPY, objcopy)
247 AC_CHECK_TOOL(STRIP, strip)
248 AC_CHECK_TOOL(NM, nm)
249 fi
250 AC_SUBST(TARGET_CC)
251
252
253 # Test the C compiler for the target environment.
254 tmp_CC="$CC"
255 tmp_CFLAGS="$CFLAGS"
256 tmp_LDFLAGS="$LDFLAGS"
257 tmp_CPPFLAGS="$CPPFLAGS"
258 tmp_LIBS="$LIBS"
259 CC="$TARGET_CC"
260 CFLAGS="$TARGET_CFLAGS"
261 CPPFLAGS="$TARGET_CPPFLAGS"
262 LDFLAGS="$TARGET_LDFLAGS"
263 LIBS=""
264
265 # debug flags.
266 TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
267 -Wundef -Wstrict-prototypes -g"
268
269 # Force no alignment to save space on i386.
270 if test "x$target_cpu" = xi386; then
271 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
272 CFLAGS="$CFLAGS -falign-loops=1"
273 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
274 [grub_cv_cc_falign_loop=yes],
275 [grub_cv_cc_falign_loop=no])
276 ])
277
278 if test "x$grub_cv_cc_falign_loop" = xyes; then
279 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
280 else
281 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
282 fi
283
284 # Some toolchains enable these features by default, but they need
285 # registers that aren't set up properly in GRUB.
286 TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
287 fi
288
289 # By default, GCC 4.4 generates .eh_frame sections containing unwind
290 # information in some cases where it previously did not. GRUB doesn't need
291 # these and they just use up vital space. Restore the old compiler
292 # behaviour.
293 AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
294 SAVE_CFLAGS="$CFLAGS"
295 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
296 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
297 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
298 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
299 CFLAGS="$SAVE_CFLAGS"
300 ])
301
302 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
303 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
304 fi
305
306 grub_apple_target_cc
307 if test x$grub_cv_apple_target_cc = xyes ; then
308 TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions"
309 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
310 TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
311 TARGET_APPLE_CC=1
312 AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
313 if test "x$OBJCONV" = x ; then
314 AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
315 fi
316 if test "x$OBJCONV" = x ; then
317 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
318 fi
319 TARGET_IMG_LDSCRIPT=
320 TARGET_IMG_CFLAGS="-static"
321 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
322 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
323 else
324 TARGET_APPLE_CC=0
325 # Use linker script if present, otherwise use builtin -N script.
326 if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
327 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
328 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext,"
329 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
330 else
331 TARGET_IMG_LDSCRIPT=
332 TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
333 TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,'
334 fi
335 TARGET_IMG_CFLAGS=
336 fi
337
338 AC_SUBST(TARGET_IMG_LDSCRIPT)
339 AC_SUBST(TARGET_IMG_LDFLAGS)
340 AC_SUBST(TARGET_IMG_CFLAGS)
341
342 # For platforms where ELF is not the default link format.
343 AC_MSG_CHECKING([for command to convert module to ELF format])
344 case "${host_os}" in
345 cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
346 *) ;;
347 esac
348 AC_SUBST(TARGET_OBJ2ELF)
349 AC_MSG_RESULT([$TARGET_OBJ2ELF])
350
351
352 if test "x$target_m32" = x1; then
353 # Force 32-bit mode.
354 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
355 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
356 TARGET_MODULE_FORMAT="elf32"
357 fi
358
359 if test "x$target_m64" = x1; then
360 # Force 64-bit mode.
361 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
362 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
363 TARGET_MODULE_FORMAT="elf64"
364 fi
365
366 if test "$target_cpu"-"$platform" = x86_64-efi; then
367 # Use large model to support 4G memory
368 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
369 SAVED_CFLAGS=$CFLAGS
370 CFLAGS="$CFLAGS -m64 -mcmodel=large"
371 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
372 [grub_cv_cc_mcmodel=yes],
373 [grub_cv_cc_mcmodel=no])
374 ])
375 if test "x$grub_cv_cc_mcmodel" = xno; then
376 CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1"
377 TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1"
378 AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc])
379 else
380 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
381 fi
382
383 # EFI writes to stack below %rsp, we must not use the red zone
384 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
385 CFLAGS="$CFLAGS -m64 -mno-red-zone"
386 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
387 [grub_cv_cc_no_red_zone=yes],
388 [grub_cv_cc_no_red_zone=no])
389 ])
390 if test "x$grub_cv_cc_no_red_zone" = xno; then
391 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
392 fi
393
394 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
395 fi
396
397 #
398 # Compiler features.
399 #
400
401 # Need __enable_execute_stack() for nested function trampolines?
402 grub_CHECK_ENABLE_EXECUTE_STACK
403
404 # Position independent executable.
405 grub_CHECK_PIE
406 [# Need that, because some distributions ship compilers that include
407 # `-fPIE' in the default specs.
408 if [ x"$pie_possible" = xyes ]; then
409 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
410 fi]
411
412 # Smashing stack protector.
413 grub_CHECK_STACK_PROTECTOR
414 # Need that, because some distributions ship compilers that include
415 # `-fstack-protector' in the default specs.
416 if test "x$ssp_possible" = xyes; then
417 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
418 fi
419 grub_CHECK_STACK_ARG_PROBE
420 # Cygwin's GCC uses alloca() to probe the stackframe on static
421 # stack allocations above some threshold.
422 if test x"$sap_possible" = xyes; then
423 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
424 fi
425
426 AC_ARG_ENABLE([werror],
427 [AS_HELP_STRING([--disable-werror],
428 [do not use -Werror when building GRUB])])
429 if test x"$enable_werror" != xno ; then
430 TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
431 fi
432
433 AC_SUBST(TARGET_CFLAGS)
434 AC_SUBST(TARGET_MODULE_FORMAT)
435 AC_SUBST(OBJCONV)
436 AC_SUBST(TARGET_APPLE_CC)
437 AC_SUBST(TARGET_ASFLAGS)
438 AC_SUBST(TARGET_CPPFLAGS)
439 AC_SUBST(TARGET_LDFLAGS)
440
441 # Check for libgcc symbols (must be performed before we add -nostdlib to LDFLAGS)
442 AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2)
443
444 # Set them to their new values for the tests below.
445 CC="$TARGET_CC"
446 if test "x$TARGET_APPLE_CC" = x1 ; then
447 CFLAGS="$TARGET_CFLAGS -nostdlib"
448 else
449 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
450 fi
451 CPPFLAGS="$TARGET_CPPFLAGS"
452 LDFLAGS="$TARGET_LDFLAGS"
453
454 # Defined in aclocal.m4.
455 grub_PROG_TARGET_CC
456 if test "x$TARGET_APPLE_CC" != x1 ; then
457 grub_PROG_OBJCOPY_ABSOLUTE
458 fi
459 grub_PROG_LD_BUILD_ID_NONE
460 grub_ASM_USCORE
461 if test "x$target_cpu" = xi386; then
462 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
463 # Check symbols provided by linker script.
464 CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100"
465 fi
466 if test "x$TARGET_APPLE_CC" != x1 ; then
467 grub_CHECK_BSS_START_SYMBOL
468 grub_CHECK_END_SYMBOL
469 fi
470 CFLAGS="$TARGET_CFLAGS"
471 grub_I386_ASM_PREFIX_REQUIREMENT
472 grub_I386_ASM_ADDR32
473 grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
474 else
475 AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
476 fi
477
478 AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
479 #define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
480 #else
481 #define NESTED_FUNC_ATTR
482 #endif])
483
484 AC_ARG_ENABLE([efiemu],
485 [AS_HELP_STRING([--enable-efiemu],
486 [build and install the efiemu runtimes (default=guessed)])])
487 if test x"$enable_efiemu" = xno ; then
488 efiemu_excuse="explicitly disabled"
489 fi
490 if test x"$efiemu_excuse" = x ; then
491 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
492 CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
493 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
494 [grub_cv_cc_efiemu=yes],
495 [grub_cv_cc_efiemu=no])
496 ])
497 if test x$grub_cv_cc_efiemu = xno; then
498 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
499 fi
500 fi
501 if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
502 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
503 fi
504 if test x"$efiemu_excuse" = x ; then
505 enable_efiemu=yes
506 else
507 enable_efiemu=no
508 fi
509 AC_SUBST([enable_efiemu])
510
511
512 # Restore the flags.
513 CC="$tmp_CC"
514 CFLAGS="$tmp_CFLAGS"
515 CPPFLAGS="$tmp_CPPFLAGS"
516 LDFLAGS="$tmp_LDFLAGS"
517 LIBS="$tmp_LIBS"
518
519 #
520 # Check for options.
521 #
522
523 # Memory manager debugging.
524 AC_ARG_ENABLE([mm-debug],
525 AS_HELP_STRING([--enable-mm-debug],
526 [include memory manager debugging]),
527 [AC_DEFINE([MM_DEBUG], [1],
528 [Define to 1 if you enable memory manager debugging.])])
529
530 AC_ARG_ENABLE([grub-emu-usb],
531 [AS_HELP_STRING([--enable-grub-emu-usb],
532 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
533
534 AC_ARG_ENABLE([grub-emu-pci],
535 [AS_HELP_STRING([--enable-grub-emu-pci],
536 [build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
537
538 if test "$platform" = emu; then
539 missing_ncurses=
540 [# Check for curses libraries.]
541 AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
542 [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
543 [missing_ncurses=[true]])])
544 AC_SUBST([LIBCURSES])
545 [if [ x"$missing_ncurses" = x ]; then ]
546 [# Check for headers.]
547 AC_CHECK_HEADERS([ncurses/curses.h], [],
548 [AC_CHECK_HEADERS([ncurses.h], [],
549 [AC_CHECK_HEADERS([curses.h], [],
550 [missing_ncurses=[true]])])])
551 [fi]
552 if test x"$missing_ncurses" = xtrue ; then
553 AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
554 fi
555
556 if test x"$enable_grub_emu_usb" = xno ; then
557 grub_emu_usb_excuse="explicitly disabled"
558 fi
559
560 if test x"$enable_grub_emu_pci" = xyes ; then
561 grub_emu_usb_excuse="conflicts with PCI support"
562 fi
563
564 [if [ x"$grub_emu_usb_excuse" = x ]; then
565 # Check for libusb libraries.]
566 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
567 [grub_emu_usb_excuse=["need libusb library"]])
568 AC_SUBST([LIBUSB])
569 [fi]
570 [if [ x"$grub_emu_usb_excuse" = x ]; then
571 # Check for headers.]
572 AC_CHECK_HEADERS([usb.h], [],
573 [grub_emu_usb_excuse=["need libusb headers"]])
574 [fi]
575 if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
576 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
577 fi
578 if test x"$grub_emu_usb_excuse" = x ; then
579 enable_grub_emu_usb=yes
580 else
581 enable_grub_emu_usb=no
582 fi
583
584 if test x"$enable_grub_emu_pci" != xyes ; then
585 grub_emu_pci_excuse="not enabled"
586 fi
587
588 if test x"$enable_grub_emu_usb" = xyes ; then
589 grub_emu_pci_excuse="conflicts with USB support"
590 fi
591
592 [if [ x"$grub_emu_pci_excuse" = x ]; then
593 # Check for libpci libraries.]
594 AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
595 [grub_emu_pci_excuse=["need libpciaccess library"]])
596 AC_SUBST([LIBPCIACCESS])
597 [fi]
598 [if [ x"$grub_emu_pci_excuse" = x ]; then
599 # Check for headers.]
600 AC_CHECK_HEADERS([pci/pci.h], [],
601 [grub_emu_pci_excuse=["need libpciaccess headers"]])
602 [fi]
603
604 if test x"$grub_emu_pci_excuse" = x ; then
605 enable_grub_emu_pci=yes
606 else
607 enable_grub_emu_pci=no
608 fi
609
610 AC_SUBST([enable_grub_emu_usb])
611 AC_SUBST([enable_grub_emu_pci])
612 fi
613
614 AC_ARG_ENABLE([grub-fstest],
615 [AS_HELP_STRING([--enable-grub-fstest],
616 [build and install the `grub-fstest' debugging utility (default=guessed)])])
617 if test x"$enable_grub_fstest" = xno ; then
618 grub_fstest_excuse="explicitly disabled"
619 fi
620 if test x"$grub_fstest_excuse" = x ; then
621 enable_grub_fstest=yes
622 else
623 enable_grub_fstest=no
624 fi
625 AC_SUBST([enable_grub_fstest])
626
627 AC_ARG_ENABLE([grub-mkfont],
628 [AS_HELP_STRING([--enable-grub-mkfont],
629 [build and install the `grub-mkfont' utility (default=guessed)])])
630 if test x"$enable_grub_mkfont" = xno ; then
631 grub_mkfont_excuse="explicitly disabled"
632 fi
633
634 if test x"$grub_mkfont_excuse" = x ; then
635 # Check for freetype libraries.
636 AC_CHECK_PROGS([FREETYPE], [freetype-config])
637 if test "x$FREETYPE" = x ; then
638 grub_mkfont_excuse=["need freetype2 library"]
639 fi
640 freetype_cflags=`freetype-config --cflags`
641 freetype_libs=`freetype-config --libs`
642 fi
643 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
644 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
645 fi
646 if test x"$grub_mkfont_excuse" = x ; then
647 enable_grub_mkfont=yes
648 else
649 enable_grub_mkfont=no
650 fi
651 AC_SUBST([enable_grub_mkfont])
652 AC_SUBST([freetype_cflags])
653 AC_SUBST([freetype_libs])
654
655 AC_SUBST(ASFLAGS)
656
657 # Output files.
658 grub_CHECK_LINK_DIR
659 if test x"$link_dir" = xyes ; then
660 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
661 if test "$platform" != emu ; then
662 AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
663 fi
664 else
665 mkdir -p include/grub 2>/dev/null
666 rm -rf include/grub/cpu
667 cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
668 if test "$platform" != emu ; then
669 rm -rf include/grub/machine
670 cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
671 fi
672 fi
673 AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
674 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
675 AC_OUTPUT
676 [
677 echo "*******************************************************"
678 echo GRUB2 will be compiled with following components:
679 echo Platform: "$target_cpu"-"$platform"
680 if [ x"$platform" = xemu ]; then
681 if [ x"$grub_emu_usb_excuse" = x ]; then
682 echo USB support for grub-emu: Yes
683 else
684 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
685 fi
686 if [ x"$grub_emu_pci_excuse" = x ]; then
687 echo PCI support for grub-emu: Yes
688 else
689 echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
690 fi
691 fi
692 if [ x"$enable_mm_debug" = xyes ]; then
693 echo With memory debugging: Yes
694 else
695 echo With memory debugging: No
696 fi
697 if [ x"$efiemu_excuse" = x ]; then
698 echo efiemu runtime: Yes
699 else
700 echo efiemu runtime: No "($efiemu_excuse)"
701 fi
702 if [ x"$grub_fstest_excuse" = x ]; then
703 echo grub-fstest: Yes
704 else
705 echo grub-fstest: No "($grub_fstest_excuse)"
706 fi
707 if [ x"$grub_mkfont_excuse" = x ]; then
708 echo grub-mkfont: Yes
709 else
710 echo grub-mkfont: No "($grub_mkfont_excuse)"
711 fi
712 echo "*******************************************************"
713 ]