Merge branch 'makefile' into haiku
[grub2/phcoder.git] / configure.ac
blob132dc677eaccee1ec355379c4a86a11a07937ef3
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 for functions.
175 AC_CHECK_FUNCS(posix_memalign memalign asprintf)
178 # Check for target programs.
181 # Find tools for the target.
182 if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
183   tmp_ac_tool_prefix="$ac_tool_prefix"
184   ac_tool_prefix=$target_alias-
186   AC_CHECK_TOOLS(TARGET_CC, [gcc egcs cc],
187                  [AC_MSG_ERROR([none of gcc, egcs and cc is found. set TARGET_CC manually.])])
188   AC_CHECK_TOOL(OBJCOPY, objcopy)
189   AC_CHECK_TOOL(STRIP, strip)
190   AC_CHECK_TOOL(NM, nm)
192   ac_tool_prefix="$tmp_ac_tool_prefix"
193 else
194   if test "x$TARGET_CC" = x; then
195     TARGET_CC=$CC
196   fi
197   AC_CHECK_TOOL(OBJCOPY, objcopy)
198   AC_CHECK_TOOL(STRIP, strip)
199   AC_CHECK_TOOL(NM, nm)
201 AC_SUBST(TARGET_CC)
204 # Test the C compiler for the target environment.
205 tmp_CC="$CC"
206 tmp_CFLAGS="$CFLAGS"
207 tmp_LDFLAGS="$LDFLAGS"
208 tmp_CPPFLAGS="$CPPFLAGS"
209 tmp_LIBS="$LIBS"
210 CC="$TARGET_CC"
211 CFLAGS="$TARGET_CFLAGS"
212 CPPFLAGS="$TARGET_CPPFLAGS"
213 LDFLAGS="$TARGET_LDFLAGS"
214 LIBS=""
216 if test "x$TARGET_CFLAGS" = x; then
217   # debug flags.
218   TARGET_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
219                  -Wundef -Wstrict-prototypes -g"
221   # optimization flags.
222   AC_CACHE_CHECK([whether optimization for size works], grub_cv_cc_Os, [
223     CFLAGS=-Os
224     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
225                       [grub_cv_cc_Os=yes],
226                       [grub_cv_cc_Os=no])
227   ])
228   if test "x$grub_cv_cc_Os" = xyes; then
229     TARGET_CFLAGS="$TARGET_CFLAGS -Os"
230   else
231     TARGET_CFLAGS="$TARGET_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
232   fi
234   # Force no alignment to save space on i386.
235   if test "x$target_cpu" = xi386; then
236     AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
237       SAVED_CFLAGS="$CFLAGS"
238       CFLAGS="$CFLAGS -falign-loops=1"
239       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
240                         [grub_cv_cc_falign_loop=yes],
241                         [grub_cv_cc_falign_loop=no])
242       CFLAGS="$SAVED_CFLAGS"
243     ])
245     if test "x$grub_cv_cc_falign_loop" = xyes; then
246       TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
247     else
248       AC_CACHE_CHECK([whether -malign-loops works], [grub_cv_cc_malign_loop], [
249         CFLAGS="$CFLAGS -malign-loops=1"
250         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
251                           [grub_cv_cc_malign_loop=yes],
252                           [grub_cv_cc_malign_loop=no])
253                      ])
254       if test "x$grub_cv_cc_malign_loop" = xyes; then
255         TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
256       fi
257     fi
258   fi
261 grub_apple_target_cc
262 if test x$grub_cv_apple_target_cc = xyes ; then
263   TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions"
264   CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
265   TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
266   TARGET_APPLE_CC=1
267   AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
268   if test "x$OBJCONV" = x ; then
269      AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
270   fi
271   if test "x$OBJCONV" = x ; then
272     AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
273   fi
274   TARGET_IMG_LDSCRIPT=
275   TARGET_IMG_CFLAGS="-static"
276   TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
277   TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
278 else
279   TARGET_APPLE_CC=0
280 # Use linker script if present, otherwise use builtin -N script.
281 if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
282   TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
283   TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}  -Wl,-Ttext,"
284   TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
285 else
286   TARGET_IMG_LDSCRIPT=
287   TARGET_IMG_LDFLAGS='-Wl,-N  -Wl,-Ttext,'
288   TARGET_IMG_LDFLAGS_AC='-Wl,-N  -Wl,-Ttext,'
290 TARGET_IMG_CFLAGS=
293 AC_SUBST(TARGET_IMG_LDSCRIPT)
294 AC_SUBST(TARGET_IMG_LDFLAGS)
295 AC_SUBST(TARGET_IMG_CFLAGS)
297 # For platforms where ELF is not the default link format.
298 AC_MSG_CHECKING([for command to convert module to ELF format])
299 case "${host_os}" in
300   cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
301   *) ;;
302 esac
303 AC_SUBST(TARGET_OBJ2ELF)
304 AC_MSG_RESULT([$TARGET_OBJ2ELF])
307 if test "x$target_m32" = x1; then
308   AC_CACHE_CHECK([whether option -m32 is supported], grub_cv_cc_m32, [
309     SAVED_CFLAGS=$CFLAGS
310     CFLAGS="$CFLAGS -m32"
311     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
312                       [grub_cv_cc_m32=yes],
313                       [grub_cv_cc_m32=no])
314   ])
315   CFLAGS=$SAVED_CFLAGS
316   if test "x$grub_cv_cc_m32" = xyes; then
317      TARGET_CFLAGS="$TARGET_CFLAGS -m32"
318      TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
319      CFLAGS="$SAVED_CFLAGS -m32"
320   fi
321   TARGET_MODULE_FORMAT="elf32"
324 if test "x$target_m64" = x1; then
325   AC_CACHE_CHECK([whether option -m64 is supported], grub_cv_cc_m64, [
326     SAVED_CFLAGS=$CFLAGS
327     CFLAGS="$CFLAGS -m64"
328     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
329                       [grub_cv_cc_m64=yes],
330                       [grub_cv_cc_m64=no])
331   ])
332   CFLAGS=$SAVED_CFLAGS
333   if test "x$grub_cv_cc_m64" = xyes; then
334      TARGET_CFLAGS="$TARGET_CFLAGS -m64"
335      TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
336      CFLAGS="$SAVED_CFLAGS -m64"
337   fi
338   TARGET_MODULE_FORMAT="elf64"
341 if test "$target_cpu"-"$platform" = x86_64-efi; then
342   # Use large model to support 4G memory
343   AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
344     SAVED_CFLAGS=$CFLAGS
345     CFLAGS="$CFLAGS -mcmodel=large"
346     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
347                       [grub_cv_cc_mcmodel=yes],
348                       [grub_cv_cc_mcmodel=no])
349   ])
350   if test "x$grub_cv_cc_mcmodel" = xno; then
351     CFLAGS="$SAVED_CFLAGS -DMCMODEL_SMALL=1"
352     TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1"
353     AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc])
354   else
355     TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
356   fi
358   # EFI writes to stack below %rsp, we must not use the red zone
359   AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
360     CFLAGS="$CFLAGS -mno-red-zone"
361     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
362                       [grub_cv_cc_no_red_zone=yes],
363                       [grub_cv_cc_no_red_zone=no])
364   ])
365   if test "x$grub_cv_cc_no_red_zone" = xno; then
366     AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
367   fi
369   TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
373 # Compiler features.
376 # Need __enable_execute_stack() for nested function trampolines?
377 grub_CHECK_ENABLE_EXECUTE_STACK
379 # Smashing stack protector.
380 grub_CHECK_STACK_PROTECTOR
381 # Need that, because some distributions ship compilers that include
382 # `-fstack-protector' in the default specs.
383 if test "x$ssp_possible" = xyes; then
384   TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
386 grub_CHECK_STACK_ARG_PROBE
387 # Cygwin's GCC uses alloca() to probe the stackframe on static
388 # stack allocations above some threshold.
389 if test x"$sap_possible" = xyes; then
390   TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
393 AC_SUBST(TARGET_CFLAGS)
394 AC_SUBST(TARGET_MODULE_FORMAT)
395 AC_SUBST(OBJCONV)
396 AC_SUBST(TARGET_APPLE_CC)
397 AC_SUBST(TARGET_ASFLAGS)
398 AC_SUBST(TARGET_CPPFLAGS)
399 AC_SUBST(TARGET_LDFLAGS)
401 # Set them to their new values for the tests below.
402 CC="$TARGET_CC"
403 if test "x$TARGET_APPLE_CC" = x1 ; then
404 CFLAGS="$TARGET_CFLAGS -nostdlib"
405 else
406 CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
408 CPPFLAGS="$TARGET_CPPFLAGS"
409 LDFLAGS="$TARGET_LDFLAGS"
411 # Defined in aclocal.m4.
412 grub_PROG_TARGET_CC
413 if test "x$TARGET_APPLE_CC" != x1 ; then
414 grub_PROG_OBJCOPY_ABSOLUTE
416 grub_PROG_LD_BUILD_ID_NONE
417 grub_ASM_USCORE
418 if test "x$target_cpu" = xi386; then
419   if test ! -z "$TARGET_IMG_LDSCRIPT"; then
420     # Check symbols provided by linker script.
421     CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100"
422   fi
423   if test "x$TARGET_APPLE_CC" != x1 ; then
424     grub_CHECK_BSS_START_SYMBOL
425     grub_CHECK_END_SYMBOL
426   fi
427   CFLAGS="$TARGET_CFLAGS"
428   grub_I386_ASM_PREFIX_REQUIREMENT
429   grub_I386_ASM_ADDR32
430   grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
431 else
432   AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
435 AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
436 #define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
437 #else
438 #define NESTED_FUNC_ATTR
439 #endif])
441 if test "$target_cpu"-"$platform" = i386-pc; then
442 AC_ARG_ENABLE([efiemu64],
443               [AS_HELP_STRING([--enable-efiemu64],
444                              [build and install the 64-bit efiemu runtime (default=guessed)])])
445 if test x"$enable_efiemu64" = xno ; then
446   efiemu64_excuse="explicitly disabled"
448 if test x"$efiemu64_excuse" = x ; then
449   AC_CACHE_CHECK([whether options required for 64-bit efiemu work], grub_cv_cc_efiemu64, [
450     CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
451     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
452                       [grub_cv_cc_efiemu64=yes],
453                       [grub_cv_cc_efiemu64=no])
454   ])
455   if test x$grub_cv_cc_efiemu64 = xno; then
456      efiemu64_excuse="compiler doesn't support compiling with -m64 -mcmodel=large -mno-red-zone -nostdlib"
457   fi
459 if test x"$enable_efiemu64" = xyes && test x"$efiemu64_excuse" != x ; then
460   AC_MSG_ERROR([64-bit efiemu runtime was explicitly requested but can't be compiled])
462 if test x"$efiemu64_excuse" = x ; then
463 enable_efiemu64=yes
464 else
465 enable_efiemu64=no
467 AC_SUBST([enable_efiemu64])
470 # Restore the flags.
471 CC="$tmp_CC"
472 CFLAGS="$tmp_CFLAGS"
473 CPPFLAGS="$tmp_CPPFLAGS"
474 LDFLAGS="$tmp_LDFLAGS"
475 LIBS="$tmp_LIBS"
478 # Check for options.
481 # Memory manager debugging.
482 AC_ARG_ENABLE([mm-debug],
483               AS_HELP_STRING([--enable-mm-debug],
484                              [include memory manager debugging]),
485               [AC_DEFINE([MM_DEBUG], [1],
486                          [Define to 1 if you enable memory manager debugging.])])
488 AC_ARG_ENABLE([grub-emu],
489               [AS_HELP_STRING([--enable-grub-emu],
490                              [build and install the `grub-emu' debugging utility (default=guessed)])])
491 AC_ARG_ENABLE([grub-emu-usb],
492               [AS_HELP_STRING([--enable-grub-emu-usb],
493                              [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
494 AC_ARG_ENABLE([grub-emu-sdl],
495               [AS_HELP_STRING([--enable-grub-emu-sdl],
496                              [build and install the `grub-emu' debugging utility with SDL support (default=guessed)])])
498 if test x"$enable_grub_emu" = xno ; then
499   grub_emu_excuse="explicitly disabled"
502   [# Check for curses libraries.]
503 [if [ x"$grub_emu_excuse" = x ]; then ]
504   AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
505     [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
506       [grub_emu_excuse=["need (n)curses libraries"]])])
507   AC_SUBST([LIBCURSES])
508 [fi]
509 [if [ x"$grub_emu_excuse" = x ]; then ]
510   [# Check for headers.]
511   AC_CHECK_HEADERS([ncurses/curses.h], [],
512     [AC_CHECK_HEADERS([ncurses.h], [],
513       [AC_CHECK_HEADERS([curses.h], [],
514         [grub_emu_excuse=["need (n)curses headers"]])])])
515 [fi]
517 if test x"$enable_grub_emu" = xyes && test x"$grub_emu_excuse" != x ; then
518   AC_MSG_ERROR([grub-emu was explicitly requested but can't be compiled])
520 if test x"$grub_emu_excuse" = x ; then
521 enable_grub_emu=yes
522 else
523 enable_grub_emu=no
524 grub_emu_usb_excuse="grub-emu isn't built"
525 grub_emu_sdl_excuse="grub-emu isn't built"
527 if test x"$enable_grub_emu_usb" = xno ; then
528   grub_emu_usb_excuse="explicitly disabled"
530 [if [ x"$grub_emu_usb_excuse" = x ]; then
531     # Check for libusb libraries.]
532 AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
533     [grub_emu_usb_excuse=["need libusb library"]])
534     AC_SUBST([LIBUSB])
535 [fi]
536 [if [ x"$grub_emu_usb_excuse" = x ]; then
537     # Check for headers.]
538     AC_CHECK_HEADERS([usb.h], [],
539       [grub_emu_usb_excuse=["need libusb headers"]])
540 [fi]
541 if test x"enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
542   AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
544 if test x"$grub_emu_usb_excuse" = x ; then
545 enable_grub_emu_usb=yes
546 else
547 enable_grub_emu_usb=no
550 if test x"$enable_grub_emu_sdl" = xno ; then
551   grub_emu_sdl_excuse="explicitely disabled"
553 [if [ x"$grub_emu_sdl_excuse" = x ]; then
554     # Check for libSDL libraries.]
555 AC_CHECK_LIB([SDL], [SDL_Init], [LIBSDL="-lSDL"],
556     [grub_emu_sdl_excuse=["libSDL libraries are required to build \`grub-emu' with SDL support"]])
557     AC_SUBST([LIBSDL])
558 [fi]
559 [if [ x"$grub_emu_sdl_excuse" = x ]; then
560     # Check for headers.]
561     AC_CHECK_HEADERS([SDL/SDL.h], [],
562       [grub_emu_sdl_excuse=["libSDL header file is required to build \`grub-emu' with SDL support"]])
563 [fi]
564 if test x"enable_grub_emu_sdl" = xyes && test x"$grub_emu_sdl_excuse" != x ; then
565   AC_MSG_ERROR([SDL support for grub-emu was explicitely requested but can't be compiled])
567 if test x"$grub_emu_sdl_excuse" = x ; then
568 enable_grub_emu_sdl=yes
569 else
570 enable_grub_emu_sdl=no
573 AC_SUBST([enable_grub_emu])
574 AC_SUBST([enable_grub_emu_usb])
575 AC_SUBST([enable_grub_emu_sdl])
577 AC_ARG_ENABLE([grub-fstest],
578               [AS_HELP_STRING([--enable-grub-fstest],
579                              [build and install the `grub-fstest' debugging utility (default=guessed)])])
580 if test x"$enable_grub_fstest" = xno ; then
581   grub_fstest_excuse="explicitly disabled"
583 if test x"$grub_fstest_excuse" = x ; then
584 enable_grub_fstest=yes
585 else
586 enable_grub_fstest=no
588 AC_SUBST([enable_grub_fstest])
590 AC_ARG_ENABLE([grub-pe2elf],
591               [AS_HELP_STRING([--enable-grub-pe2elf],
592                              [build and install the `grub-pe2elf' conversion utility])])
593 AC_SUBST([enable_grub_pe2elf])
595 AC_ARG_ENABLE([grub-mkfont],
596               [AS_HELP_STRING([--enable-grub-mkfont],
597                              [build and install the `grub-mkfont' utility (default=guessed)])])
598 if test x"$enable_grub_mkfont" = xno ; then
599   grub_mkfont_excuse="explicitly disabled"
602 if test x"$grub_mkfont_excuse" = x ; then
603   # Check for freetype libraries.
604   AC_CHECK_PROGS([FREETYPE], [freetype-config])
605   if test "x$FREETYPE" = x ; then
606     grub_mkfont_excuse=["need freetype2 library"]
607   fi
608   freetype_cflags=`freetype-config --cflags`
609   freetype_libs=`freetype-config --libs`
611 if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
612   AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
614 if test x"$grub_mkfont_excuse" = x ; then
615 enable_grub_mkfont=yes
616 else
617 enable_grub_mkfont=no
619 AC_SUBST([enable_grub_mkfont])
620 AC_SUBST([freetype_cflags])
621 AC_SUBST([freetype_libs])
623 AC_SUBST(ASFLAGS)
625 # Output files.
626 grub_CHECK_LINK_DIR
627 if test x"$link_dir" = xyes ; then
628   AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu
629         include/grub/machine:include/grub/$target_cpu/$platform])
630 else
631   mkdir -p include/grub 2>/dev/null
632   rm -rf include/grub/cpu
633   cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
634   rm -rf include/grub/machine
635   cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
637 AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
638 AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
639 AC_OUTPUT
641 echo "*******************************************************"
642 echo GRUB2 will be compiled with following components:
643 echo Platform: "$target_cpu"-"$platform"
644 if [ x"$grub_emu_excuse" = x ]; then
645 echo grub-emu: Yes
646 else
647 echo grub-emu: No "($grub_emu_excuse)"
649 if [ x"$grub_emu_usb_excuse" = x ]; then
650 echo USB support for grub-emu: Yes
651 else
652 echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
654 if [ x"$grub_emu_sdl_excuse" = x ]; then
655 echo SDL support for grub-emu: Yes
656 else
657 echo SDL support for grub-emu: No "($grub_emu_sdl_excuse)"
659 if [ x"$enable_mm_debug" = xyes ]; then
660 echo With memory debugging: Yes
661 else
662 echo With memory debugging: No
664 if [ x"$enable_grub_pe2elf" = xyes ]; then
665 echo grub-pe2elf will be built and installed
666 elif [ x$TARGET_OBJ2ELF = xgrub-pe2elf ]; then
667 echo grub-pe2elf will be built but not installed
668 else
669 echo grub-pe2elf will not be built
671 if test "$target_cpu"-"$platform" = i386-pc; then
672 if [ x"$efiemu64_excuse" = x ]; then
673 echo efiemu64 runtime: Yes
674 else
675 echo efiemu64 runtime: No "($efiemu64_excuse)"
678 if [ x"$grub_fstest_excuse" = x ]; then
679 echo grub-fstest: Yes
680 else
681 echo grub-fstest: No "($grub_fstest_excuse)"
683 if [ x"$grub_mkfont_excuse" = x ]; then
684 echo grub-mkfont: Yes
685 else
686 echo grub-mkfont: No "($grub_mkfont_excuse)"
688 echo "*******************************************************"