]> git.proxmox.com Git - grub2.git/blame - configure.ac
2009-07-16 Pavel Roskin <proski@gnu.org>
[grub2.git] / configure.ac
CommitLineData
6a161fa9 1# Process this file with autoconf to produce a configure script.
2
1e901a75 3# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
6a161fa9 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
b977bf01 14dnl This configure script is complicated, because GRUB needs to deal
15dnl with three potentially different types:
16dnl
17dnl build -- the environment for building GRUB
18dnl host -- the environment for running utilities
19dnl target -- the environment for running GRUB
20dnl
21dnl In addition, GRUB needs to deal with a platform specification
22dnl which specifies the system running GRUB, such as firmware.
23dnl This is necessary because the target type in autoconf does not
24dnl describe such a system very well.
25dnl
26dnl The current strategy is to use variables with no prefix (such as
27dnl CC, CFLAGS, etc.) for the host type as well as the build type,
28dnl because GRUB does not need to use those variables for the build
29dnl type, so there is no conflict. Variables with the prefix "TARGET_"
30dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
31dnl type.
32
33
eb73121d 34AC_INIT([GRUB],[1.96],[bug-grub@gnu.org])
46e04eb9 35AC_PREREQ(2.59)
4b13b216 36AC_CONFIG_SRCDIR([include/grub/dl.h])
6a161fa9 37AC_CONFIG_HEADER([config.h])
38
b977bf01 39# Checks for host and target systems.
6a161fa9 40AC_CANONICAL_HOST
b977bf01 41AC_CANONICAL_TARGET
6a161fa9 42
1d543c3e 43# Program name transformations
44AC_ARG_PROGRAM
45
b977bf01 46case "$target_cpu" in
02164e1b 47 i[[3456]]86) target_cpu=i386 ;;
48 sparc) target_cpu=sparc64 ;;
6a161fa9 49esac
50
05568c2e 51# Specify the platform (such as firmware).
52AC_ARG_WITH([platform],
53 AS_HELP_STRING([--with-platform=PLATFORM],
83b984de 54 [select the host platform [[guessed]]]))
05568c2e 55
56# Guess the platform if not specified.
57if test "x$with_platform" = x; then
b977bf01 58 case "$target_cpu"-"$target_vendor" in
05568c2e 59 i386-apple) platform=efi ;;
60 i386-*) platform=pc ;;
58393a2d 61 x86_64-apple) platform=efi ;;
737feb35 62 x86_64-*) platform=pc ;;
05568c2e 63 powerpc-*) platform=ieee1275 ;;
58393a2d 64 powerpc64-*) platform=ieee1275 ;;
05568c2e 65 sparc64-*) platform=ieee1275 ;;
58393a2d 66 *) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
05568c2e 67 esac
68else
69 platform="$with_platform"
70fi
71
58393a2d 72# Adjust CPU unless target was explicitly specified.
73if test -z "$target_alias"; then
74 case "$target_cpu"-"$platform" in
75 x86_64-efi) ;;
3f4ce737 76 x86_64-*) target_cpu=i386 ;;
77 powerpc64-ieee1275) target_cpu=powerpc ;;
20011694 78 esac
79fi
80
58393a2d 81# Check if the platform is supported, make final adjustments.
b977bf01 82case "$target_cpu"-"$platform" in
05568c2e 83 i386-efi) ;;
3f4ce737 84 x86_64-efi) ;;
05568c2e 85 i386-pc) ;;
546f966a 86 i386-coreboot) ;;
58393a2d 87 i386-linuxbios) platform=coreboot ;;
3d04eab8 88 i386-ieee1275) ;;
8231fb77 89 i386-qemu) ;;
05568c2e 90 powerpc-ieee1275) ;;
91 sparc64-ieee1275) ;;
58393a2d 92 *) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
6a161fa9 93esac
94
3f4ce737 95case "$target_cpu" in
96 i386 | powerpc) target_m32=1 ;;
97 x86_64 | sparc64) target_m64=1 ;;
98esac
99
6e5a42fe 100case "$host_os" in
101 mingw32) host_os=cygwin ;;
102esac
103
9304eef1 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).
107case "$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 ;;
112esac
113
56978920 114AC_SUBST(host_cpu)
115AC_SUBST(host_os)
9304eef1 116AC_SUBST(host_kernel)
6e5a42fe 117
b977bf01 118AC_SUBST(target_cpu)
05568c2e 119AC_SUBST(platform)
6a161fa9 120
b977bf01 121#
122# Checks for build programs.
123#
144f1f98 124
6c826348 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.
127AC_CHECK_PROGS([CMP], [cmp])
128if test "x$CMP" = x; then
129 AC_MSG_ERROR([cmp is not found])
130fi
131
144f1f98 132AC_CHECK_PROGS([YACC], [bison])
1569ec51 133if test "x$YACC" = x; then
6c826348 134 AC_MSG_ERROR([bison is not found])
1569ec51 135fi
136
1e901a75 137for file in /usr/src/unifont.bdf ; do
4931827f 138 if test -e $file ; then
1e901a75 139 AC_SUBST([UNIFONT_BDF], [$file])
4931827f 140 break
141 fi
142done
143
b977bf01 144AC_PROG_INSTALL
145AC_PROG_AWK
146AC_PROG_MAKE_SET
147
68807e5f 148# These are not a "must".
b977bf01 149AC_PATH_PROG(RUBY, ruby)
68807e5f 150AC_PATH_PROG(HELP2MAN, help2man)
6a161fa9 151
b977bf01 152#
153# Checks for host programs.
154#
155
156AC_PROG_CC
6a161fa9 157# Must be GCC.
158test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
159
4889bdec 160AC_GNU_SOURCE
b977bf01 161AC_SYS_LARGEFILE
162
163# Identify characteristics of the host architecture.
164AC_C_BIGENDIAN
165AC_CHECK_SIZEOF(void *)
166AC_CHECK_SIZEOF(long)
167
2b167a72 168grub_apple_cc
c9da87d0 169if test x$grub_cv_apple_cc = xyes ; then
2b167a72 170 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
171 ASFLAGS="$ASFLAGS -DAPPLE_CC=1"
172fi
b977bf01 173
174# Check LZO when compiling for the i386-pc.
175if test "$target_cpu"-"$platform" = i386-pc; then
aa24b516 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], ,
b977bf01 190 [AC_MSG_ERROR([LZO1X-999 must be enabled])])
191
aa24b516 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])
b977bf01 198fi
199
4889bdec 200# Check for functions.
df38d0bb 201AC_CHECK_FUNCS(posix_memalign memalign asprintf)
4889bdec 202
b977bf01 203#
204# Check for target programs.
205#
206
5b5d4aa5 207# Find tools for the target.
208if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
b977bf01 209 tmp_ac_tool_prefix="$ac_tool_prefix"
210 ac_tool_prefix=$target_alias-
211
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)
217
218 ac_tool_prefix="$tmp_ac_tool_prefix"
219else
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)
226fi
227AC_SUBST(TARGET_CC)
228
229
230# Test the C compiler for the target environment.
231tmp_CC="$CC"
232tmp_CFLAGS="$CFLAGS"
233tmp_LDFLAGS="$LDFLAGS"
234tmp_CPPFLAGS="$CPPFLAGS"
aa6d7826 235tmp_LIBS="$LIBS"
b977bf01 236CC="$TARGET_CC"
237CFLAGS="$TARGET_CFLAGS"
238CPPFLAGS="$TARGET_CPPFLAGS"
239LDFLAGS="$TARGET_LDFLAGS"
aa6d7826 240LIBS=""
b977bf01 241
242if test "x$TARGET_CFLAGS" = x; then
6a161fa9 243 # debug flags.
b977bf01 244 TARGET_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
245 -Wundef -Wstrict-prototypes -g"
6a161fa9 246
247 # optimization flags.
322562ea 248 AC_CACHE_CHECK([whether optimization for size works], grub_cv_cc_Os, [
6a161fa9 249 CFLAGS=-Os
eb73121d 250 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
251 [grub_cv_cc_Os=yes],
252 [grub_cv_cc_Os=no])
6a161fa9 253 ])
322562ea 254 if test "x$grub_cv_cc_Os" = xyes; then
b977bf01 255 TARGET_CFLAGS="$TARGET_CFLAGS -Os"
6a161fa9 256 else
b977bf01 257 TARGET_CFLAGS="$TARGET_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
6a161fa9 258 fi
259
260 # Force no alignment to save space on i386.
b977bf01 261 if test "x$target_cpu" = xi386; then
322562ea 262 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
2b167a72 263 CFLAGS="$CFLAGS -falign-loops=1"
eb73121d 264 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
265 [grub_cv_cc_falign_loop=yes],
266 [grub_cv_cc_falign_loop=no])
6a161fa9 267 ])
268
322562ea 269 if test "x$grub_cv_cc_falign_loop" = xyes; then
b977bf01 270 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
6a161fa9 271 else
b977bf01 272 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
6a161fa9 273 fi
274 fi
b977bf01 275fi
6a161fa9 276
2b167a72 277grub_apple_target_cc
c9da87d0 278if test x$grub_cv_apple_target_cc = xyes ; then
2b167a72 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
cf00df31 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
2b167a72 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,'
294else
295 TARGET_APPLE_CC=0
296# Use linker script if present, otherwise use builtin -N script.
2b167a72 297if 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"
301else
302 TARGET_IMG_LDSCRIPT=
303 TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
304 TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,'
305fi
306TARGET_IMG_CFLAGS=
307fi
308
309AC_SUBST(TARGET_IMG_LDSCRIPT)
310AC_SUBST(TARGET_IMG_LDFLAGS)
311AC_SUBST(TARGET_IMG_CFLAGS)
2b167a72 312
313# For platforms where ELF is not the default link format.
314AC_MSG_CHECKING([for command to convert module to ELF format])
315case "${host_os}" in
316 cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
317 *) ;;
318esac
319AC_SUBST(TARGET_OBJ2ELF)
320AC_MSG_RESULT([$TARGET_OBJ2ELF])
321
322
b977bf01 323if test "x$target_m32" = x1; then
324 # Force 32-bit mode.
325 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
326 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
2b167a72 327 TARGET_MODULE_FORMAT="elf32"
6a161fa9 328fi
b977bf01 329
20011694 330if test "x$target_m64" = x1; then
331 # Force 64-bit mode.
7e9ca17a 332 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
333 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
2b167a72 334 TARGET_MODULE_FORMAT="elf64"
7e9ca17a 335fi
336
337if test "$target_cpu"-"$platform" = x86_64-efi; then
338 # Use large model to support 4G memory
6e09b8b7 339 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
c8600122 340 SAVED_CFLAGS=$CFLAGS
341 CFLAGS="$CFLAGS -m64 -mcmodel=large"
6e09b8b7 342 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
343 [grub_cv_cc_mcmodel=yes],
344 [grub_cv_cc_mcmodel=no])
345 ])
c8600122 346 if test "x$grub_cv_cc_mcmodel" = xno; then
347 CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1"
b39f9d20 348 TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1"
c8600122 349 AC_MSG_WARN([-mcmodel=large not supported. You wan't be able to use the memory over 4GiB. Upgrade your gcc])
350 else
351 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
6e09b8b7 352 fi
7e9ca17a 353
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, [
c8600122 356 CFLAGS="$CFLAGS -m64 -mno-red-zone"
7e9ca17a 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
364
c8600122 365 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
20011694 366fi
367
baa2a121 368#
369# Compiler features.
370#
371
9035dce4 372# Need __enable_execute_stack() for nested function trampolines?
373grub_CHECK_ENABLE_EXECUTE_STACK
374
baa2a121 375# Smashing stack protector.
376grub_CHECK_STACK_PROTECTOR
c3db8364 377# Need that, because some distributions ship compilers that include
baa2a121 378# `-fstack-protector' in the default specs.
c3db8364 379if test "x$ssp_possible" = xyes; then
380 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
381fi
2a8a80e4 382grub_CHECK_STACK_ARG_PROBE
383# Cygwin's GCC uses alloca() to probe the stackframe on static
384# stack allocations above some threshold.
385if test x"$sap_possible" = xyes; then
386 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
387fi
baa2a121 388
b977bf01 389AC_SUBST(TARGET_CFLAGS)
2b167a72 390AC_SUBST(TARGET_MODULE_FORMAT)
cf00df31 391AC_SUBST(OBJCONV)
2b167a72 392AC_SUBST(TARGET_APPLE_CC)
393AC_SUBST(TARGET_ASFLAGS)
b977bf01 394AC_SUBST(TARGET_CPPFLAGS)
395AC_SUBST(TARGET_LDFLAGS)
6a161fa9 396
aa6d7826 397# Set them to their new values for the tests below.
398CC="$TARGET_CC"
26de2bcd 399if test "x$TARGET_APPLE_CC" = x1 ; then
400CFLAGS="$TARGET_CFLAGS -nostdlib"
401else
7d83bd47 402CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
26de2bcd 403fi
aa6d7826 404CPPFLAGS="$TARGET_CPPFLAGS"
405LDFLAGS="$TARGET_LDFLAGS"
406
6a161fa9 407# Defined in aclocal.m4.
f6130a12 408grub_PROG_TARGET_CC
2b167a72 409if test "x$TARGET_APPLE_CC" != x1 ; then
b977bf01 410grub_PROG_OBJCOPY_ABSOLUTE
2b167a72 411fi
cb71ba20 412grub_PROG_LD_BUILD_ID_NONE
4b13b216 413grub_ASM_USCORE
b977bf01 414if test "x$target_cpu" = xi386; then
2a8a80e4 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
58750afc 419 if test "x$TARGET_APPLE_CC" != x1 ; then
2a8a80e4 420 grub_CHECK_BSS_START_SYMBOL
421 grub_CHECK_END_SYMBOL
422 fi
423 CFLAGS="$TARGET_CFLAGS"
4b13b216 424 grub_I386_ASM_PREFIX_REQUIREMENT
425 grub_I386_ASM_ADDR32
426 grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
5aded270 427else
f4917dfd 428 AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
6a161fa9 429fi
430
bf6a5fb2 431AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
432#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
433#else
434#define NESTED_FUNC_ATTR
435#endif])
436
5ce5507f 437AC_ARG_ENABLE([efiemu],
438 [AS_HELP_STRING([--enable-efiemu],
439 [build and install the efiemu runtimes (default=guessed)])])
440if test x"$enable_efiemu" = xno ; then
441 efiemu_excuse="explicitely disabled"
442fi
443if test x"$efiemu_excuse" = x ; then
444 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_no_red_zone, [
445 CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib -c"
446 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
447 [grub_cv_cc_efiemu=yes],
448 [grub_cv_cc_efiemu=no])
449 ])
450 if test x$grub_cv_cc_efiemu = x$no; then
451 efiemu_excuse="compiler doesn't support compiling with -m64 -mcmodel=large -mno-red-zone -nostdlib -c"
452 fi
453fi
454if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
455 AC_MSG_ERROR([efiemu runtime was explicitely requested but can't be compiled])
456fi
457if test x"$efiemu_excuse" = x ; then
458enable_efiemu=yes
459else
460enable_efiemu=no
461fi
462AC_SUBST([enable_efiemu])
463
464
c9a86192 465# Restore the flags.
9962ed99 466CC="$tmp_CC"
467CFLAGS="$tmp_CFLAGS"
468CPPFLAGS="$tmp_CPPFLAGS"
c9a86192 469LDFLAGS="$tmp_LDFLAGS"
aa6d7826 470LIBS="$tmp_LIBS"
6a161fa9 471
4fe9862e 472#
2965c7cc 473# Check for options.
4fe9862e 474#
475
476# Memory manager debugging.
b39f9d20 477AC_ARG_ENABLE([mm-debug],
2965c7cc 478 AS_HELP_STRING([--enable-mm-debug],
90ce5d56 479 [include memory manager debugging]),
2965c7cc 480 [AC_DEFINE([MM_DEBUG], [1],
481 [Define to 1 if you enable memory manager debugging.])])
482
4fe9862e 483AC_ARG_ENABLE([grub-emu],
484 [AS_HELP_STRING([--enable-grub-emu],
5ce5507f 485 [build and install the `grub-emu' debugging utility (default=guessed)])])
d64399b5 486AC_ARG_ENABLE([grub-emu-usb],
487 [AS_HELP_STRING([--enable-grub-emu-usb],
5ce5507f 488 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
489if test x"$enable_grub_emu" = xno ; then
490 grub_emu_excuse="explicitely disabled"
491fi
492
493 [# Check for curses libraries.]
494[if [ x"$grub_emu_excuse" = x ]; then ]
4fe9862e 495 AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
496 [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
5ce5507f 497 [grub_emu_excuse=["(n)curses libraries are required to build \`grub-emu'"]])])
4fe9862e 498 AC_SUBST([LIBCURSES])
5ce5507f 499[fi]
500[if [ x"$grub_emu_excuse" = x ]; then ]
4fe9862e 501 [# Check for headers.]
502 AC_CHECK_HEADERS([ncurses/curses.h], [],
503 [AC_CHECK_HEADERS([ncurses.h], [],
504 [AC_CHECK_HEADERS([curses.h], [],
5ce5507f 505 [grub_emu_excuse=["(n)curses header files are required to build \`grub-emu'"]])])])
506[fi]
d64399b5 507
5ce5507f 508if test x"$enable_grub_emu" = xyes && test x"$grub_emu_excuse" != x ; then
509 AC_MSG_ERROR([grub-emu was explicitely requested but can't be compiled])
510fi
511if test x"$grub_emu_excuse" = x ; then
512enable_grub_emu=yes
513else
514enable_grub_emu=no
515grub_emu_usb_excuse="grub-emu isn't built"
516fi
517if test x"$enable_grub_emu_usb" = xno ; then
518 grub_emu_usb_excuse="explicitely disabled"
519fi
520[if [ x"$grub_emu_usb_excuse" = x ]; then
d64399b5 521 # Check for libusb libraries.]
5ce5507f 522AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
523 [grub_emu_usb_excuse=["libusb libraries are required to build \`grub-emu' with USB support"]])
d64399b5 524 AC_SUBST([LIBUSB])
5ce5507f 525[fi]
526[if [ x"$grub_emu_usb_excuse" = x ]; then
527 # Check for headers.]
d64399b5 528 AC_CHECK_HEADERS([usb.h], [],
5ce5507f 529 [grub_emu_usb_excuse=["libusb header file is required to build \`grub-emu' with USB support"]])
4fe9862e 530[fi]
5ce5507f 531if test x"enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
532 AC_MSG_ERROR([USB support for grub-emu was explicitely requested but can't be compiled])
533fi
534if test x"$grub_emu_usb_excuse" = x ; then
535enable_grub_emu_usb=yes
536else
537enable_grub_emu_usb=no
538fi
539
4fe9862e 540AC_SUBST([enable_grub_emu])
d64399b5 541AC_SUBST([enable_grub_emu_usb])
4fe9862e 542
99fadbaa 543AC_ARG_ENABLE([grub-fstest],
544 [AS_HELP_STRING([--enable-grub-fstest],
5ce5507f 545 [build and install the `grub-fstest' debugging utility (default=guessed)])])
546if test x"$enable_grub_fstest" = xno ; then
547 grub_fstest_excuse="explicitely disabled"
548fi
549if test x"$grub_fstest_excuse" = x ; then
550enable_grub_fstest=yes
551else
552enable_grub_fstest=no
553fi
99fadbaa 554AC_SUBST([enable_grub_fstest])
555
2d05bc6a 556AC_ARG_ENABLE([grub-pe2elf],
557 [AS_HELP_STRING([--enable-grub-pe2elf],
558 [build and install the `grub-pe2elf' conversion utility])])
559AC_SUBST([enable_grub_pe2elf])
560
e52db1f7 561AC_ARG_ENABLE([grub-mkfont],
562 [AS_HELP_STRING([--enable-grub-mkfont],
5ce5507f 563 [build and install the `grub-mkfont' utility (default=guessed)])])
564if test x"$enable_grub_mkfont" = xno ; then
565 grub_mkfont_excuse="explicitely disabled"
566fi
567
568if test x"$grub_mkfont_excuse" = x ; then
e52db1f7 569 # Check for freetype libraries.
570 AC_CHECK_PROGS([FREETYPE], [freetype-config])
571 if test "x$FREETYPE" = x ; then
5ce5507f 572 grub_mkfont_excuse=["freetype2 libraries are required to build \`grub-mkfont'"]
e52db1f7 573 fi
574 freetype_cflags=`freetype-config --cflags`
575 freetype_libs=`freetype-config --libs`
576fi
5ce5507f 577if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
578 AC_MSG_ERROR([grub-mkfont was explicitely requested but can't be compiled])
579fi
580if test x"$grub_mkfont_excuse" = x ; then
581enable_grub_mkfont=yes
582else
583enable_grub_mkfont=no
584fi
e52db1f7 585AC_SUBST([enable_grub_mkfont])
586AC_SUBST([freetype_cflags])
587AC_SUBST([freetype_libs])
588
2b167a72 589AC_SUBST(ASFLAGS)
fc45fb58 590
6a161fa9 591# Output files.
1f4147aa 592grub_CHECK_LINK_DIR
593if test x"$link_dir" = xyes ; then
594 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu
b977bf01 595 include/grub/machine:include/grub/$target_cpu/$platform])
1f4147aa 596else
597 mkdir -p include/grub 2>/dev/null
598 rm -rf include/grub/cpu
599 cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
600 rm -rf include/grub/machine
601 cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
602fi
7b455f4d 603AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
6a161fa9 604AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
605AC_OUTPUT
5ce5507f 606[
607echo "*******************************************************"
608echo GRUB2 will be compiled with following components:
609echo Platform: "$target_cpu"-"$platform"
610if test "$target_cpu"-"$platform" = i386-pc; then
611if [ x"$enable_lzo" = xyes ]; then
612echo Compression: LZO
613else
614echo Compression: LZMA
615fi
616fi
617if [ x"$grub_emu_excuse" = x ]; then
618echo grub-emu: Yes
619else
620echo grub-emu: No "($grub_emu_excuse)"
621fi
622if [ x"$grub_emu_usb_excuse" = x ]; then
623echo USB support for grub-emu: Yes
624else
625echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
626fi
627if [ x"$enable_mm_debug" = xyes ]; then
628echo With memory debugging: Yes
629else
630echo With memory debugging: No
631fi
632if [ x"$enable_grub_pe2elf" = xyes ]; then
633echo grub-pe2elf will be built and installed
634elif [ x$TARGET_OBJ2ELF = xgrub-pe2elf ]; then
635echo grub-pe2elf will be built but not installed
636else
637echo grub-pe2elf will not be built
638fi
639if [ x"$efiemu_excuse" = x ]; then
640echo efiemu runtime: Yes
641else
642echo efiemu runtime: No "($efiemu_excuse)"
643fi
644if [ x"$grub_fstest_excuse" = x ]; then
645echo grub-fstest: Yes
646else
647echo grub-fstest: No "($grub_fstest_excuse)"
648fi
649if [ x"$grub_mkfont_excuse" = x ]; then
650echo grub-mkfont: Yes
651else
652echo grub-mkfont: No "($grub_mkfont_excuse)"
653fi
654echo "*******************************************************"
655]