]> git.proxmox.com Git - grub2.git/blame - configure.ac
2009-09-10 Felix Zielcke <fzielcke@z-51.de>
[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
4ff0d7a4 34AC_INIT([GRUB],[1.97~beta2],[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
4889bdec 174# Check for functions.
df38d0bb 175AC_CHECK_FUNCS(posix_memalign memalign asprintf)
4889bdec 176
b977bf01 177#
178# Check for target programs.
179#
180
5b5d4aa5 181# Find tools for the target.
182if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
b977bf01 183 tmp_ac_tool_prefix="$ac_tool_prefix"
184 ac_tool_prefix=$target_alias-
185
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)
191
192 ac_tool_prefix="$tmp_ac_tool_prefix"
193else
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)
200fi
201AC_SUBST(TARGET_CC)
202
203
204# Test the C compiler for the target environment.
205tmp_CC="$CC"
206tmp_CFLAGS="$CFLAGS"
207tmp_LDFLAGS="$LDFLAGS"
208tmp_CPPFLAGS="$CPPFLAGS"
aa6d7826 209tmp_LIBS="$LIBS"
b977bf01 210CC="$TARGET_CC"
211CFLAGS="$TARGET_CFLAGS"
212CPPFLAGS="$TARGET_CPPFLAGS"
213LDFLAGS="$TARGET_LDFLAGS"
aa6d7826 214LIBS=""
b977bf01 215
216if test "x$TARGET_CFLAGS" = x; then
6a161fa9 217 # debug flags.
b977bf01 218 TARGET_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
219 -Wundef -Wstrict-prototypes -g"
6a161fa9 220
221 # optimization flags.
322562ea 222 AC_CACHE_CHECK([whether optimization for size works], grub_cv_cc_Os, [
6a161fa9 223 CFLAGS=-Os
eb73121d 224 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
225 [grub_cv_cc_Os=yes],
226 [grub_cv_cc_Os=no])
6a161fa9 227 ])
322562ea 228 if test "x$grub_cv_cc_Os" = xyes; then
b977bf01 229 TARGET_CFLAGS="$TARGET_CFLAGS -Os"
6a161fa9 230 else
b977bf01 231 TARGET_CFLAGS="$TARGET_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
6a161fa9 232 fi
233
234 # Force no alignment to save space on i386.
b977bf01 235 if test "x$target_cpu" = xi386; then
322562ea 236 AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
2b167a72 237 CFLAGS="$CFLAGS -falign-loops=1"
eb73121d 238 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
239 [grub_cv_cc_falign_loop=yes],
240 [grub_cv_cc_falign_loop=no])
6a161fa9 241 ])
242
322562ea 243 if test "x$grub_cv_cc_falign_loop" = xyes; then
b977bf01 244 TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
6a161fa9 245 else
b977bf01 246 TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
6a161fa9 247 fi
248 fi
77c55a87 249
250 # By default, GCC 4.4 generates .eh_frame sections containing unwind
251 # information in some cases where it previously did not. GRUB doesn't need
252 # these and they just use up vital space. Restore the old compiler
253 # behaviour.
254 AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
255 SAVE_CFLAGS="$CFLAGS"
256 CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
257 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
258 [grub_cv_cc_fno_dwarf2_cfi_asm=yes],
259 [grub_cv_cc_fno_dwarf2_cfi_asm=no])
260 CFLAGS="$SAVE_CFLAGS"
261 ])
262
263 if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
264 TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
265 fi
b977bf01 266fi
6a161fa9 267
2b167a72 268grub_apple_target_cc
c9da87d0 269if test x$grub_cv_apple_target_cc = xyes ; then
2b167a72 270 TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions"
271 CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
272 TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
273 TARGET_APPLE_CC=1
cf00df31 274 AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
275 if test "x$OBJCONV" = x ; then
276 AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
277 fi
278 if test "x$OBJCONV" = x ; then
279 AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
280 fi
2b167a72 281 TARGET_IMG_LDSCRIPT=
282 TARGET_IMG_CFLAGS="-static"
283 TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
284 TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
285else
286 TARGET_APPLE_CC=0
287# Use linker script if present, otherwise use builtin -N script.
2b167a72 288if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
289 TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
290 TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext,"
291 TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
292else
293 TARGET_IMG_LDSCRIPT=
294 TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
295 TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,'
296fi
297TARGET_IMG_CFLAGS=
298fi
299
300AC_SUBST(TARGET_IMG_LDSCRIPT)
301AC_SUBST(TARGET_IMG_LDFLAGS)
302AC_SUBST(TARGET_IMG_CFLAGS)
2b167a72 303
304# For platforms where ELF is not the default link format.
305AC_MSG_CHECKING([for command to convert module to ELF format])
306case "${host_os}" in
307 cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
308 *) ;;
309esac
310AC_SUBST(TARGET_OBJ2ELF)
311AC_MSG_RESULT([$TARGET_OBJ2ELF])
312
313
b977bf01 314if test "x$target_m32" = x1; then
315 # Force 32-bit mode.
316 TARGET_CFLAGS="$TARGET_CFLAGS -m32"
317 TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
2b167a72 318 TARGET_MODULE_FORMAT="elf32"
6a161fa9 319fi
b977bf01 320
20011694 321if test "x$target_m64" = x1; then
322 # Force 64-bit mode.
7e9ca17a 323 TARGET_CFLAGS="$TARGET_CFLAGS -m64"
324 TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
2b167a72 325 TARGET_MODULE_FORMAT="elf64"
7e9ca17a 326fi
327
328if test "$target_cpu"-"$platform" = x86_64-efi; then
329 # Use large model to support 4G memory
6e09b8b7 330 AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
c8600122 331 SAVED_CFLAGS=$CFLAGS
332 CFLAGS="$CFLAGS -m64 -mcmodel=large"
6e09b8b7 333 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
334 [grub_cv_cc_mcmodel=yes],
335 [grub_cv_cc_mcmodel=no])
336 ])
c8600122 337 if test "x$grub_cv_cc_mcmodel" = xno; then
338 CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1"
b39f9d20 339 TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1"
ce7a733d 340 AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc])
c8600122 341 else
342 TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
6e09b8b7 343 fi
7e9ca17a 344
345 # EFI writes to stack below %rsp, we must not use the red zone
346 AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
c8600122 347 CFLAGS="$CFLAGS -m64 -mno-red-zone"
7e9ca17a 348 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
349 [grub_cv_cc_no_red_zone=yes],
350 [grub_cv_cc_no_red_zone=no])
351 ])
352 if test "x$grub_cv_cc_no_red_zone" = xno; then
353 AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
354 fi
355
c8600122 356 TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
20011694 357fi
358
baa2a121 359#
360# Compiler features.
361#
362
9035dce4 363# Need __enable_execute_stack() for nested function trampolines?
364grub_CHECK_ENABLE_EXECUTE_STACK
365
93a81088 366# Position independent executable.
367grub_CHECK_PIE
368[# Need that, because some distributions ship compilers that include
369# `-fPIE' in the default specs.
370if [ x"$pie_possible" = xyes ]; then
371 TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
372fi]
373
baa2a121 374# Smashing stack protector.
375grub_CHECK_STACK_PROTECTOR
c3db8364 376# Need that, because some distributions ship compilers that include
baa2a121 377# `-fstack-protector' in the default specs.
c3db8364 378if test "x$ssp_possible" = xyes; then
379 TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
380fi
2a8a80e4 381grub_CHECK_STACK_ARG_PROBE
382# Cygwin's GCC uses alloca() to probe the stackframe on static
383# stack allocations above some threshold.
384if test x"$sap_possible" = xyes; then
385 TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
386fi
baa2a121 387
b977bf01 388AC_SUBST(TARGET_CFLAGS)
2b167a72 389AC_SUBST(TARGET_MODULE_FORMAT)
cf00df31 390AC_SUBST(OBJCONV)
2b167a72 391AC_SUBST(TARGET_APPLE_CC)
392AC_SUBST(TARGET_ASFLAGS)
b977bf01 393AC_SUBST(TARGET_CPPFLAGS)
394AC_SUBST(TARGET_LDFLAGS)
6a161fa9 395
aa6d7826 396# Set them to their new values for the tests below.
397CC="$TARGET_CC"
26de2bcd 398if test "x$TARGET_APPLE_CC" = x1 ; then
399CFLAGS="$TARGET_CFLAGS -nostdlib"
400else
7d83bd47 401CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
26de2bcd 402fi
aa6d7826 403CPPFLAGS="$TARGET_CPPFLAGS"
404LDFLAGS="$TARGET_LDFLAGS"
405
6a161fa9 406# Defined in aclocal.m4.
f6130a12 407grub_PROG_TARGET_CC
2b167a72 408if test "x$TARGET_APPLE_CC" != x1 ; then
b977bf01 409grub_PROG_OBJCOPY_ABSOLUTE
2b167a72 410fi
cb71ba20 411grub_PROG_LD_BUILD_ID_NONE
4b13b216 412grub_ASM_USCORE
b977bf01 413if test "x$target_cpu" = xi386; then
2a8a80e4 414 if test ! -z "$TARGET_IMG_LDSCRIPT"; then
415 # Check symbols provided by linker script.
416 CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100"
417 fi
58750afc 418 if test "x$TARGET_APPLE_CC" != x1 ; then
2a8a80e4 419 grub_CHECK_BSS_START_SYMBOL
420 grub_CHECK_END_SYMBOL
421 fi
422 CFLAGS="$TARGET_CFLAGS"
4b13b216 423 grub_I386_ASM_PREFIX_REQUIREMENT
424 grub_I386_ASM_ADDR32
425 grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
5aded270 426else
f4917dfd 427 AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
6a161fa9 428fi
429
bf6a5fb2 430AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
431#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
432#else
433#define NESTED_FUNC_ATTR
434#endif])
435
5ce5507f 436AC_ARG_ENABLE([efiemu],
437 [AS_HELP_STRING([--enable-efiemu],
438 [build and install the efiemu runtimes (default=guessed)])])
439if test x"$enable_efiemu" = xno ; then
ce7a733d 440 efiemu_excuse="explicitly disabled"
5ce5507f 441fi
442if test x"$efiemu_excuse" = x ; then
43e6200c 443 AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
d2838156 444 CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
5ce5507f 445 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
446 [grub_cv_cc_efiemu=yes],
447 [grub_cv_cc_efiemu=no])
448 ])
55c70904 449 if test x$grub_cv_cc_efiemu = xno; then
e98cd0c2 450 efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
5ce5507f 451 fi
452fi
453if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
ce7a733d 454 AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
5ce5507f 455fi
456if test x"$efiemu_excuse" = x ; then
457enable_efiemu=yes
458else
459enable_efiemu=no
460fi
461AC_SUBST([enable_efiemu])
462
463
c9a86192 464# Restore the flags.
9962ed99 465CC="$tmp_CC"
466CFLAGS="$tmp_CFLAGS"
467CPPFLAGS="$tmp_CPPFLAGS"
c9a86192 468LDFLAGS="$tmp_LDFLAGS"
aa6d7826 469LIBS="$tmp_LIBS"
6a161fa9 470
4fe9862e 471#
2965c7cc 472# Check for options.
4fe9862e 473#
474
475# Memory manager debugging.
b39f9d20 476AC_ARG_ENABLE([mm-debug],
2965c7cc 477 AS_HELP_STRING([--enable-mm-debug],
90ce5d56 478 [include memory manager debugging]),
2965c7cc 479 [AC_DEFINE([MM_DEBUG], [1],
480 [Define to 1 if you enable memory manager debugging.])])
481
4fe9862e 482AC_ARG_ENABLE([grub-emu],
483 [AS_HELP_STRING([--enable-grub-emu],
5ce5507f 484 [build and install the `grub-emu' debugging utility (default=guessed)])])
d64399b5 485AC_ARG_ENABLE([grub-emu-usb],
486 [AS_HELP_STRING([--enable-grub-emu-usb],
5ce5507f 487 [build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
488if test x"$enable_grub_emu" = xno ; then
ce7a733d 489 grub_emu_excuse="explicitly disabled"
5ce5507f 490fi
491
492 [# Check for curses libraries.]
493[if [ x"$grub_emu_excuse" = x ]; then ]
4fe9862e 494 AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
495 [AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
e98cd0c2 496 [grub_emu_excuse=["need (n)curses libraries"]])])
4fe9862e 497 AC_SUBST([LIBCURSES])
5ce5507f 498[fi]
499[if [ x"$grub_emu_excuse" = x ]; then ]
4fe9862e 500 [# Check for headers.]
501 AC_CHECK_HEADERS([ncurses/curses.h], [],
502 [AC_CHECK_HEADERS([ncurses.h], [],
503 [AC_CHECK_HEADERS([curses.h], [],
e98cd0c2 504 [grub_emu_excuse=["need (n)curses headers"]])])])
5ce5507f 505[fi]
d64399b5 506
5ce5507f 507if test x"$enable_grub_emu" = xyes && test x"$grub_emu_excuse" != x ; then
ce7a733d 508 AC_MSG_ERROR([grub-emu was explicitly requested but can't be compiled])
5ce5507f 509fi
510if test x"$grub_emu_excuse" = x ; then
511enable_grub_emu=yes
512else
513enable_grub_emu=no
514grub_emu_usb_excuse="grub-emu isn't built"
515fi
516if test x"$enable_grub_emu_usb" = xno ; then
ce7a733d 517 grub_emu_usb_excuse="explicitly disabled"
5ce5507f 518fi
519[if [ x"$grub_emu_usb_excuse" = x ]; then
d64399b5 520 # Check for libusb libraries.]
5ce5507f 521AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
e98cd0c2 522 [grub_emu_usb_excuse=["need libusb library"]])
d64399b5 523 AC_SUBST([LIBUSB])
5ce5507f 524[fi]
525[if [ x"$grub_emu_usb_excuse" = x ]; then
526 # Check for headers.]
d64399b5 527 AC_CHECK_HEADERS([usb.h], [],
e98cd0c2 528 [grub_emu_usb_excuse=["need libusb headers"]])
4fe9862e 529[fi]
5ce5507f 530if test x"enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
ce7a733d 531 AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
5ce5507f 532fi
533if test x"$grub_emu_usb_excuse" = x ; then
534enable_grub_emu_usb=yes
535else
536enable_grub_emu_usb=no
537fi
538
4fe9862e 539AC_SUBST([enable_grub_emu])
d64399b5 540AC_SUBST([enable_grub_emu_usb])
4fe9862e 541
99fadbaa 542AC_ARG_ENABLE([grub-fstest],
543 [AS_HELP_STRING([--enable-grub-fstest],
5ce5507f 544 [build and install the `grub-fstest' debugging utility (default=guessed)])])
545if test x"$enable_grub_fstest" = xno ; then
ce7a733d 546 grub_fstest_excuse="explicitly disabled"
5ce5507f 547fi
548if test x"$grub_fstest_excuse" = x ; then
549enable_grub_fstest=yes
550else
551enable_grub_fstest=no
552fi
99fadbaa 553AC_SUBST([enable_grub_fstest])
554
2d05bc6a 555AC_ARG_ENABLE([grub-pe2elf],
556 [AS_HELP_STRING([--enable-grub-pe2elf],
557 [build and install the `grub-pe2elf' conversion utility])])
558AC_SUBST([enable_grub_pe2elf])
559
e52db1f7 560AC_ARG_ENABLE([grub-mkfont],
561 [AS_HELP_STRING([--enable-grub-mkfont],
5ce5507f 562 [build and install the `grub-mkfont' utility (default=guessed)])])
563if test x"$enable_grub_mkfont" = xno ; then
ce7a733d 564 grub_mkfont_excuse="explicitly disabled"
5ce5507f 565fi
566
567if test x"$grub_mkfont_excuse" = x ; then
e52db1f7 568 # Check for freetype libraries.
569 AC_CHECK_PROGS([FREETYPE], [freetype-config])
570 if test "x$FREETYPE" = x ; then
e98cd0c2 571 grub_mkfont_excuse=["need freetype2 library"]
e52db1f7 572 fi
573 freetype_cflags=`freetype-config --cflags`
574 freetype_libs=`freetype-config --libs`
575fi
5ce5507f 576if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
ce7a733d 577 AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
5ce5507f 578fi
579if test x"$grub_mkfont_excuse" = x ; then
580enable_grub_mkfont=yes
581else
582enable_grub_mkfont=no
583fi
e52db1f7 584AC_SUBST([enable_grub_mkfont])
585AC_SUBST([freetype_cflags])
586AC_SUBST([freetype_libs])
587
2b167a72 588AC_SUBST(ASFLAGS)
fc45fb58 589
6a161fa9 590# Output files.
1f4147aa 591grub_CHECK_LINK_DIR
592if test x"$link_dir" = xyes ; then
593 AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu
b977bf01 594 include/grub/machine:include/grub/$target_cpu/$platform])
1f4147aa 595else
596 mkdir -p include/grub 2>/dev/null
597 rm -rf include/grub/cpu
598 cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
599 rm -rf include/grub/machine
600 cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
601fi
7b455f4d 602AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
6a161fa9 603AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
604AC_OUTPUT
5ce5507f 605[
606echo "*******************************************************"
607echo GRUB2 will be compiled with following components:
608echo Platform: "$target_cpu"-"$platform"
5ce5507f 609if [ x"$grub_emu_excuse" = x ]; then
610echo grub-emu: Yes
611else
612echo grub-emu: No "($grub_emu_excuse)"
613fi
614if [ x"$grub_emu_usb_excuse" = x ]; then
615echo USB support for grub-emu: Yes
616else
617echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
618fi
619if [ x"$enable_mm_debug" = xyes ]; then
620echo With memory debugging: Yes
621else
622echo With memory debugging: No
623fi
624if [ x"$enable_grub_pe2elf" = xyes ]; then
625echo grub-pe2elf will be built and installed
626elif [ x$TARGET_OBJ2ELF = xgrub-pe2elf ]; then
627echo grub-pe2elf will be built but not installed
628else
629echo grub-pe2elf will not be built
630fi
631if [ x"$efiemu_excuse" = x ]; then
632echo efiemu runtime: Yes
633else
634echo efiemu runtime: No "($efiemu_excuse)"
635fi
636if [ x"$grub_fstest_excuse" = x ]; then
637echo grub-fstest: Yes
638else
639echo grub-fstest: No "($grub_fstest_excuse)"
640fi
641if [ x"$grub_mkfont_excuse" = x ]; then
642echo grub-mkfont: Yes
643else
644echo grub-mkfont: No "($grub_mkfont_excuse)"
645fi
646echo "*******************************************************"
647]