malloc->zalloc
[grub2/phcoder.git] / configure.ac
blob1016edb06db395bdab9c7b65932cbded84a5d4f3
1 # Process this file with autoconf to produce a configure script.
3 # Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009  Free Software Foundation, Inc.
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.
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.
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.
34 AC_INIT([GRUB],[1.96],[bug-grub@gnu.org])
35 AC_PREREQ(2.59)
36 AC_CONFIG_SRCDIR([include/grub/dl.h])
37 AC_CONFIG_HEADER([config.h])
39 # Checks for host and target systems.
40 AC_CANONICAL_HOST
41 AC_CANONICAL_TARGET
43 # Program name transformations
44 AC_ARG_PROGRAM
46 case "$target_cpu" in
47   i[[3456]]86)  target_cpu=i386 ;;
48   sparc)        target_cpu=sparc64 ;;
49 esac
51 # Specify the platform (such as firmware).
52 AC_ARG_WITH([platform],
53             AS_HELP_STRING([--with-platform=PLATFORM],
54                            [select the host platform [[guessed]]]))
56 # Guess the platform if not specified.
57 if test "x$with_platform" = x; then
58   case "$target_cpu"-"$target_vendor" in
59     i386-apple) platform=efi ;;
60     i386-*) platform=pc ;;
61     x86_64-apple) platform=efi ;;
62     x86_64-*) platform=pc ;;
63     powerpc-*) platform=ieee1275 ;;
64     powerpc64-*) platform=ieee1275 ;;
65     sparc64-*) platform=ieee1275 ;;
66     *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
67   esac
68 else
69   platform="$with_platform"
72 # Adjust CPU unless target was explicitly specified.
73 if test -z "$target_alias"; then
74   case "$target_cpu"-"$platform" in
75     x86_64-efi) ;;
76     x86_64-*) target_cpu=i386 ;;
77     powerpc64-ieee1275) target_cpu=powerpc ;;
78   esac
81 # Check if the platform is supported, make final adjustments.
82 case "$target_cpu"-"$platform" in
83   i386-efi) ;;
84   x86_64-efi) ;;
85   i386-pc) ;;
86   i386-coreboot) ;;
87   i386-linuxbios) platform=coreboot ;;
88   i386-ieee1275) ;;
89   i386-qemu) ;;
90   powerpc-ieee1275) ;;
91   sparc64-ieee1275) ;;
92   *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
93 esac
95 case "$target_cpu" in
96   i386 | powerpc) target_m32=1 ;;
97   x86_64 | sparc64) target_m64=1 ;;
98 esac
100 case "$host_os" in
101   mingw32) host_os=cygwin ;;
102 esac
104 # This normalizes the names, and creates a new variable ("host_kernel")
105 # while at it, since the mapping is not always 1:1 (e.g. different OSes
106 # using the same kernel type).
107 case "$host_os" in
108   gnu*)                         host_kernel=hurd ;;
109   linux*)                       host_kernel=linux ;;
110   freebsd* | kfreebsd*-gnu)     host_kernel=freebsd ;;
111   cygwin)                       host_kernel=windows ;;
112 esac
114 AC_SUBST(host_cpu)
115 AC_SUBST(host_os)
116 AC_SUBST(host_kernel)
118 AC_SUBST(target_cpu)
119 AC_SUBST(platform)
122 # Checks for build programs.
125 # Although cmp is listed in the GNU Coding Standards as a command which
126 # can used directly, OpenBSD lacks cmp in the default installation.
127 AC_CHECK_PROGS([CMP], [cmp])
128 if test "x$CMP" = x; then
129   AC_MSG_ERROR([cmp is not found])
132 AC_CHECK_PROGS([YACC], [bison])
133 if test "x$YACC" = x; then
134   AC_MSG_ERROR([bison is not found])
137 for file in /usr/src/unifont.bdf ; do
138   if test -e $file ; then
139     AC_SUBST([UNIFONT_BDF], [$file])
140     break
141   fi
142 done
144 AC_PROG_INSTALL
145 AC_PROG_AWK
146 AC_PROG_MAKE_SET
148 # These are not a "must".
149 AC_PATH_PROG(RUBY, ruby)
150 AC_PATH_PROG(HELP2MAN, help2man)
153 # Checks for host programs.
156 AC_PROG_CC
157 # Must be GCC.
158 test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
160 AC_GNU_SOURCE
161 AC_SYS_LARGEFILE
163 # Identify characteristics of the host architecture.
164 AC_C_BIGENDIAN
165 AC_CHECK_SIZEOF(void *)
166 AC_CHECK_SIZEOF(long)
168 grub_apple_cc
169 if test x$grub_cv_apple_cc = xyes ; then
170   CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
171   ASFLAGS="$ASFLAGS -DAPPLE_CC=1"
174 # Check LZO when compiling for the i386-pc.
175 if test "$target_cpu"-"$platform" = i386-pc; then
176   AC_ARG_ENABLE([lzo],
177               [AS_HELP_STRING([--enable-lzo],
178                              [use lzo to compress kernel (default is lzma)])])
179   [if [ x"$enable_lzo" = xyes ]; then
180     # There are three possibilities. LZO version 2 installed with the name
181     # liblzo2, with the name liblzo, and LZO version 1.]
182     AC_DEFINE([ENABLE_LZO], [1], [Use lzo compression])
183     AC_CHECK_LIB([lzo2], [__lzo_init_v2], [LIBLZO="-llzo2"],
184       [AC_CHECK_LIB([lzo], [__lzo_init_v2], [LIBLZO="-llzo"],
185         [AC_CHECK_LIB([lzo], [__lzo_init2], [LIBLZO="-llzo"],
186                [AC_MSG_ERROR([LZO library version 1.02 or later is required])])])])
187     AC_SUBST([LIBLZO])
188     [LIBS="$LIBS $LIBLZO"]
189     AC_CHECK_FUNC([lzo1x_999_compress], ,
190                 [AC_MSG_ERROR([LZO1X-999 must be enabled])])
192     [# LZO version 2 uses lzo/lzo1x.h, while LZO version 1 uses lzo1x.h.]
193     AC_CHECK_HEADERS([lzo/lzo1x.h lzo1x.h])
194   [else]
195     AC_DEFINE([ENABLE_LZMA], [1], [Use lzma compression])
196   [fi]
197   AC_SUBST([enable_lzo])
200 # Check for functions.
201 AC_CHECK_FUNCS(posix_memalign memalign asprintf)
204 # Check for target programs.
207 # Find tools for the target.
208 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
209   tmp_ac_tool_prefix="$ac_tool_prefix"
210   ac_tool_prefix=$target_alias-
212   AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
213                  [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
214   AC_CHECK_TOOL(OBJCOPY, objcopy)
215   AC_CHECK_TOOL(STRIP, strip)
216   AC_CHECK_TOOL(NM, nm)
218   ac_tool_prefix="$tmp_ac_tool_prefix"
219 else
220   if test "x$TARGET_CC" = x; then
221     TARGET_CC=$CC
222   fi
223   AC_CHECK_TOOL(OBJCOPY, objcopy)
224   AC_CHECK_TOOL(STRIP, strip)
225   AC_CHECK_TOOL(NM, nm)
227 AC_SUBST(TARGET_CC)
230 # Test the C compiler for the target environment.
231 tmp_CC="$CC"
232 tmp_CFLAGS="$CFLAGS"
233 tmp_LDFLAGS="$LDFLAGS"
234 tmp_CPPFLAGS="$CPPFLAGS"
235 tmp_LIBS="$LIBS"
236 CC="$TARGET_CC"
237 CFLAGS="$TARGET_CFLAGS"
238 CPPFLAGS="$TARGET_CPPFLAGS"
239 LDFLAGS="$TARGET_LDFLAGS"
240 LIBS=""
242 if test "x$TARGET_CFLAGS" = x; then
243   # debug flags.
244   TARGET_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
245                  -Wundef -Wstrict-prototypes -g"
247   # optimization flags.
248   AC_CACHE_CHECK([whether optimization for size works], grub_cv_cc_Os, [
249     CFLAGS=-Os
250     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
251                       [grub_cv_cc_Os=yes],
252                       [grub_cv_cc_Os=no])
253   ])
254   if test "x$grub_cv_cc_Os" = xyes; then
255     TARGET_CFLAGS="$TARGET_CFLAGS -Os"
256   else
257     TARGET_CFLAGS="$TARGET_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
258   fi
260   # Force no alignment to save space on i386.
261   if test "x$target_cpu" = xi386; then
262     AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
263       CFLAGS="$CFLAGS -falign-loops=1"
264       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
265                         [grub_cv_cc_falign_loop=yes],
266                         [grub_cv_cc_falign_loop=no])
267     ])
269     if test "x$grub_cv_cc_falign_loop" = xyes; then
270       TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
271     else
272       TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
273     fi
274   fi
277 grub_apple_target_cc
278 if test x$grub_cv_apple_target_cc = xyes ; then
279   TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions"
280   CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
281   TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
282   TARGET_APPLE_CC=1
283   AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
284   if test "x$OBJCONV" = x ; then
285      AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
286   fi
287   if test "x$OBJCONV" = x ; then
288     AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
289   fi
290   TARGET_IMG_LDSCRIPT=
291   TARGET_IMG_CFLAGS="-static"
292   TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
293   TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
294 else
295   TARGET_APPLE_CC=0
296 # Use linker script if present, otherwise use builtin -N script.
297 if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
298   TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
299   TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}  -Wl,-Ttext,"
300   TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
301 else
302   TARGET_IMG_LDSCRIPT=
303   TARGET_IMG_LDFLAGS='-Wl,-N  -Wl,-Ttext,'
304   TARGET_IMG_LDFLAGS_AC='-Wl,-N  -Wl,-Ttext,'
306 TARGET_IMG_CFLAGS=
309 AC_SUBST(TARGET_IMG_LDSCRIPT)
310 AC_SUBST(TARGET_IMG_LDFLAGS)
311 AC_SUBST(TARGET_IMG_CFLAGS)
313 # For platforms where ELF is not the default link format.
314 AC_MSG_CHECKING([for command to convert module to ELF format])
315 case "${host_os}" in
316   cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
317   *) ;;
318 esac
319 AC_SUBST(TARGET_OBJ2ELF)
320 AC_MSG_RESULT([$TARGET_OBJ2ELF])
323 if test "x$target_m32" = x1; then
324   # Force 32-bit mode.
325   TARGET_CFLAGS="$TARGET_CFLAGS -m32"
326   TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
327   TARGET_MODULE_FORMAT="elf32"
330 if test "x$target_m64" = x1; then
331   # Force 64-bit mode.
332   TARGET_CFLAGS="$TARGET_CFLAGS -m64"
333   TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
334   TARGET_MODULE_FORMAT="elf64"
337 if test "$target_cpu"-"$platform" = x86_64-efi; then
338   # Use large model to support 4G memory
339   AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
340     SAVED_CFLAGS=$CFLAGS
341     CFLAGS="$CFLAGS -m64 -mcmodel=large"
342     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
343                       [grub_cv_cc_mcmodel=yes],
344                       [grub_cv_cc_mcmodel=no])
345   ])
346   if test "x$grub_cv_cc_mcmodel" = xno; then
347     CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1"
348     TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1"
349     AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc])
350   else
351     TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
352   fi
354   # EFI writes to stack below %rsp, we must not use the red zone
355   AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
356     CFLAGS="$CFLAGS -m64 -mno-red-zone"
357     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
358                       [grub_cv_cc_no_red_zone=yes],
359                       [grub_cv_cc_no_red_zone=no])
360   ])
361   if test "x$grub_cv_cc_no_red_zone" = xno; then
362     AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
363   fi
365   TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
369 # Compiler features.
372 # Need __enable_execute_stack() for nested function trampolines?
373 grub_CHECK_ENABLE_EXECUTE_STACK
375 # Smashing stack protector.
376 grub_CHECK_STACK_PROTECTOR
377 # Need that, because some distributions ship compilers that include
378 # `-fstack-protector' in the default specs.
379 if test "x$ssp_possible" = xyes; then
380   TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
382 grub_CHECK_STACK_ARG_PROBE
383 # Cygwin's GCC uses alloca() to probe the stackframe on static
384 # stack allocations above some threshold.
385 if test x"$sap_possible" = xyes; then
386   TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
389 AC_SUBST(TARGET_CFLAGS)
390 AC_SUBST(TARGET_MODULE_FORMAT)
391 AC_SUBST(OBJCONV)
392 AC_SUBST(TARGET_APPLE_CC)
393 AC_SUBST(TARGET_ASFLAGS)
394 AC_SUBST(TARGET_CPPFLAGS)
395 AC_SUBST(TARGET_LDFLAGS)
397 # Set them to their new values for the tests below.
398 CC="$TARGET_CC"
399 if test "x$TARGET_APPLE_CC" = x1 ; then
400 CFLAGS="$TARGET_CFLAGS -nostdlib"
401 else
402 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
404 CPPFLAGS="$TARGET_CPPFLAGS"
405 LDFLAGS="$TARGET_LDFLAGS"
407 # Defined in aclocal.m4.
408 grub_PROG_TARGET_CC
409 if test "x$TARGET_APPLE_CC" != x1 ; then
410 grub_PROG_OBJCOPY_ABSOLUTE
412 grub_PROG_LD_BUILD_ID_NONE
413 grub_ASM_USCORE
414 if test "x$target_cpu" = xi386; then
415   if test ! -z "$TARGET_IMG_LDSCRIPT"; then
416     # Check symbols provided by linker script.
417     CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100"
418   fi
419   if test "x$TARGET_APPLE_CC" != x1 ; then
420     grub_CHECK_BSS_START_SYMBOL
421     grub_CHECK_END_SYMBOL
422   fi
423   CFLAGS="$TARGET_CFLAGS"
424   grub_I386_ASM_PREFIX_REQUIREMENT
425   grub_I386_ASM_ADDR32
426   grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
427 else
428   AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
431 AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
432 #define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
433 #else
434 #define NESTED_FUNC_ATTR
435 #endif])
437 if test "$target_cpu"-"$platform" = i386-pc; then
438 AC_ARG_ENABLE([efiemu64],
439               [AS_HELP_STRING([--enable-efiemu64],
440                              [build and install the 64-bit efiemu runtime (default=guessed)])])
441 if test x"$enable_efiemu64" = xno ; then
442   efiemu64_excuse="explicitly disabled"
444 if test x"$efiemu64_excuse" = x ; then
445   AC_CACHE_CHECK([whether options required for 64-bit efiemu work], grub_cv_cc_efiemu64, [
446     CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
447     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
448                       [grub_cv_cc_efiemu64=yes],
449                       [grub_cv_cc_efiemu64=no])
450   ])
451   if test x$grub_cv_cc_efiemu64 = xno; then
452      efiemu64_excuse="compiler doesn't support compiling with -m64 -mcmodel=large -mno-red-zone -nostdlib"
453   fi
455 if test x"$enable_efiemu64" = xyes && test x"$efiemu64_excuse" != x ; then
456   AC_MSG_ERROR([64-bit efiemu runtime was explicitly requested but can't be compiled])
458 if test x"$efiemu64_excuse" = x ; then
459 enable_efiemu64=yes
460 else
461 enable_efiemu64=no
463 AC_SUBST([enable_efiemu64])
466 # Restore the flags.
467 CC="$tmp_CC"
468 CFLAGS="$tmp_CFLAGS"
469 CPPFLAGS="$tmp_CPPFLAGS"
470 LDFLAGS="$tmp_LDFLAGS"
471 LIBS="$tmp_LIBS"
474 # Check for options.
477 # Memory manager debugging.
478 AC_ARG_ENABLE([mm-debug],
479               AS_HELP_STRING([--enable-mm-debug],
480                              [include memory manager debugging]),
481               [AC_DEFINE([MM_DEBUG], [1],
482                          [Define to 1 if you enable memory manager debugging.])])
484 AC_ARG_ENABLE([grub-emu],
485               [AS_HELP_STRING([--enable-grub-emu],
486                              [build and install the `grub-emu' debugging utility (default=guessed)])])
487 AC_ARG_ENABLE([grub-emu-usb],
488               [AS_HELP_STRING([--enable-grub-emu-usb],
489                              [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
490 AC_ARG_ENABLE([grub-emu-sdl],
491               [AS_HELP_STRING([--enable-grub-emu-sdl],
492                              [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
494 if test x"$enable_grub_emu" = xno ; then
495   grub_emu_excuse="explicitly disabled"
498   [# Check for curses libraries.]
499 [if [ x"$grub_emu_excuse" = x ]; then ]
500   AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
501     [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
502       [grub_emu_excuse=["(n)curses libraries are required to build \`grub-emu'"]])])
503   AC_SUBST([LIBCURSES])
504 [fi]
505 [if [ x"$grub_emu_excuse" = x ]; then ]
506   [# Check for headers.]
507   AC_CHECK_HEADERS([ncurses/curses.h], [],
508     [AC_CHECK_HEADERS([ncurses.h], [],
509       [AC_CHECK_HEADERS([curses.h], [],
510         [grub_emu_excuse=["(n)curses header files are required to build \`grub-emu'"]])])])
511 [fi]
513 if test x"$enable_grub_emu" = xyes && test x"$grub_emu_excuse" != x ; then
514   AC_MSG_ERROR([grub-emu was explicitly requested but can't be compiled])
516 if test x"$grub_emu_excuse" = x ; then
517 enable_grub_emu=yes
518 else
519 enable_grub_emu=no
520 grub_emu_usb_excuse="grub-emu isn't built"
521 grub_emu_sdl_excuse="grub-emu isn't built"
523 if test x"$enable_grub_emu_usb" = xno ; then
524   grub_emu_usb_excuse="explicitly disabled"
526 [if [ x"$grub_emu_usb_excuse" = x ]; then
527     # Check for libusb libraries.]
528 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
529     [grub_emu_usb_excuse=["libusb libraries are required to build \`grub-emu' with USB support"]])
530     AC_SUBST([LIBUSB])
531 [fi]
532 [if [ x"$grub_emu_usb_excuse" = x ]; then
533     # Check for headers.]
534     AC_CHECK_HEADERS([usb.h], [],
535       [grub_emu_usb_excuse=["libusb header file is required to build \`grub-emu' with USB support"]])
536 [fi]
537 if test x"enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
538   AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
540 if test x"$grub_emu_usb_excuse" = x ; then
541 enable_grub_emu_usb=yes
542 else
543 enable_grub_emu_usb=no
546 if test x"$enable_grub_emu_sdl" = xno ; then
547   grub_emu_sdl_excuse="explicitely disabled"
549 [if [ x"$grub_emu_sdl_excuse" = x ]; then
550     # Check for libSDL libraries.]
551 AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
552     [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
553     AC_SUBST([LIBSDL])
554 [fi]
555 [if [ x"$grub_emu_sdl_excuse" = x ]; then
556     # Check for headers.]
557     AC_CHECK_HEADERS([SDL/SDL.h], [],
558       [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
559 [fi]
560 if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
561   AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
563 if test x"$grub_emu_sdl_excuse" = x ; then
564 enable_grub_emu_sdl=yes
565 else
566 enable_grub_emu_sdl=no
569 AC_SUBST([enable_grub_emu])
570 AC_SUBST([enable_grub_emu_usb])
571 AC_SUBST([enable_grub_emu_sdl])
573 AC_ARG_ENABLE([grub-fstest],
574               [AS_HELP_STRING([--enable-grub-fstest],
575                              [build and install the `grub-fstest' debugging utility (default=guessed)])])
576 if test x"$enable_grub_fstest" = xno ; then
577   grub_fstest_excuse="explicitly disabled"
579 if test x"$grub_fstest_excuse" = x ; then
580 enable_grub_fstest=yes
581 else
582 enable_grub_fstest=no
584 AC_SUBST([enable_grub_fstest])
586 AC_ARG_ENABLE([grub-pe2elf],
587               [AS_HELP_STRING([--enable-grub-pe2elf],
588                              [build and install the `grub-pe2elf' conversion utility])])
589 AC_SUBST([enable_grub_pe2elf])
591 AC_ARG_ENABLE([grub-mkfont],
592               [AS_HELP_STRING([--enable-grub-mkfont],
593                              [build and install the `grub-mkfont' utility (default=guessed)])])
594 if test x"$enable_grub_mkfont" = xno ; then
595   grub_mkfont_excuse="explicitly disabled"
598 if test x"$grub_mkfont_excuse" = x ; then
599   # Check for freetype libraries.
600   AC_CHECK_PROGS([FREETYPE], [freetype-config])
601   if test "x$FREETYPE" = x ; then
602     grub_mkfont_excuse=["freetype2 libraries are required to build \`grub-mkfont'"]
603   fi
604   freetype_cflags=`freetype-config --cflags`
605   freetype_libs=`freetype-config --libs`
607 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
608   AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
610 if test x"$grub_mkfont_excuse" = x ; then
611 enable_grub_mkfont=yes
612 else
613 enable_grub_mkfont=no
615 AC_SUBST([enable_grub_mkfont])
616 AC_SUBST([freetype_cflags])
617 AC_SUBST([freetype_libs])
619 AC_SUBST(ASFLAGS)
621 # Output files.
622 grub_CHECK_LINK_DIR
623 if test x"$link_dir" = xyes ; then
624   AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu
625         include/grub/machine:include/grub/$target_cpu/$platform])
626 else
627   mkdir -p include/grub 2>/dev/null
628   rm -rf include/grub/cpu
629   cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
630   rm -rf include/grub/machine
631   cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
633 AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
634 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
635 AC_OUTPUT
637 echo "*******************************************************"
638 echo GRUB2 will be compiled with following components:
639 echo Platform: "$target_cpu"-"$platform"
640 if test "$target_cpu"-"$platform" = i386-pc; then
641 if [ x"$enable_lzo" = xyes ]; then
642 echo Compression: LZO
643 else
644 echo Compression: LZMA
647 if [ x"$grub_emu_excuse" = x ]; then
648 echo grub-emu: Yes
649 else
650 echo grub-emu: No "($grub_emu_excuse)"
652 if [ x"$grub_emu_usb_excuse" = x ]; then
653 echo USB support for grub-emu: Yes
654 else
655 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
657 if [ x"$grub_emu_sdl_excuse" = x ]; then
658 echo SDL support for grub-emu: Yes
659 else
660 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
662 if [ x"$enable_mm_debug" = xyes ]; then
663 echo With memory debugging: Yes
664 else
665 echo With memory debugging: No
667 if [ x"$enable_grub_pe2elf" = xyes ]; then
668 echo grub-pe2elf will be built and installed
669 elif [ x$TARGET_OBJ2ELF = xgrub-pe2elf ]; then
670 echo grub-pe2elf will be built but not installed
671 else
672 echo grub-pe2elf will not be built
674 if test "$target_cpu"-"$platform" = i386-pc; then
675 if [ x"$efiemu64_excuse" = x ]; then
676 echo efiemu64 runtime: Yes
677 else
678 echo efiemu64 runtime: No "($efiemu64_excuse)"
681 if [ x"$grub_fstest_excuse" = x ]; then
682 echo grub-fstest: Yes
683 else
684 echo grub-fstest: No "($grub_fstest_excuse)"
686 if [ x"$grub_mkfont_excuse" = x ]; then
687 echo grub-mkfont: Yes
688 else
689 echo grub-mkfont: No "($grub_mkfont_excuse)"
691 echo "*******************************************************"