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