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