Resync with trunk
This commit is contained in:
commit
e68d3b243f
706 changed files with 157184 additions and 45875 deletions
565
configure.ac
565
configure.ac
|
@ -1,6 +1,6 @@
|
|||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
# Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
#
|
||||
# This configure.ac is free software; the author
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
@ -31,8 +31,9 @@ dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
|
|||
dnl type.
|
||||
|
||||
|
||||
AC_INIT(GRUB, 1.95, [bug-grub@gnu.org])
|
||||
AC_PREREQ(2.53)
|
||||
AC_INIT([GRUB],[1.97],[bug-grub@gnu.org])
|
||||
AM_INIT_AUTOMAKE()
|
||||
AC_PREREQ(2.60)
|
||||
AC_CONFIG_SRCDIR([include/grub/dl.h])
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
|
||||
|
@ -43,18 +44,14 @@ AC_CANONICAL_TARGET
|
|||
# Program name transformations
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
case "$host_cpu" in
|
||||
powerpc64) host_m32=1 ;;
|
||||
esac
|
||||
# Optimization flag. Allow user to override.
|
||||
if test "x$TARGET_CFLAGS" = x; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -Os"
|
||||
fi
|
||||
|
||||
case "$target_cpu" in
|
||||
i[[3456]]86) target_cpu=i386 ;;
|
||||
x86_64) target_cpu=i386 target_m32=1 ;;
|
||||
powerpc) ;;
|
||||
powerpc64) target_cpu=powerpc target_m32=1;;
|
||||
sparc64) ;;
|
||||
ia64) ;;
|
||||
*) AC_MSG_ERROR([unsupported CPU type $target_cpu]) ;;
|
||||
i[[3456]]86) target_cpu=i386 ;;
|
||||
sparc) target_cpu=sparc64 ;;
|
||||
esac
|
||||
|
||||
# Specify the platform (such as firmware).
|
||||
|
@ -67,27 +64,78 @@ if test "x$with_platform" = x; then
|
|||
case "$target_cpu"-"$target_vendor" in
|
||||
i386-apple) platform=efi ;;
|
||||
i386-*) platform=pc ;;
|
||||
x86_64-apple) platform=efi ;;
|
||||
x86_64-*) platform=pc ;;
|
||||
powerpc-*) platform=ieee1275 ;;
|
||||
powerpc64-*) platform=ieee1275 ;;
|
||||
sparc64-*) platform=ieee1275 ;;
|
||||
ia64*) platform=efi ;;
|
||||
*) AC_MSG_ERROR([unsupported machine type]) ;;
|
||||
ia64-*) platform=efi ;;
|
||||
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
|
||||
esac
|
||||
else
|
||||
platform="$with_platform"
|
||||
fi
|
||||
|
||||
# Sanity check.
|
||||
# Adjust CPU unless target was explicitly specified.
|
||||
if test -z "$target_alias"; then
|
||||
case "$target_cpu"-"$platform" in
|
||||
x86_64-efi) ;;
|
||||
x86_64-*) target_cpu=i386 ;;
|
||||
powerpc64-ieee1275) target_cpu=powerpc ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Check if the platform is supported, make final adjustments.
|
||||
case "$target_cpu"-"$platform" in
|
||||
i386-efi) ;;
|
||||
x86_64-efi) ;;
|
||||
i386-pc) ;;
|
||||
i386-linuxbios) ;;
|
||||
i386-coreboot) ;;
|
||||
i386-linuxbios) platform=coreboot ;;
|
||||
i386-ieee1275) ;;
|
||||
i386-qemu) ;;
|
||||
powerpc-ieee1275) ;;
|
||||
sparc64-ieee1275) ;;
|
||||
ia64-efi) ;;
|
||||
*) AC_MSG_ERROR([unsupported machine type]) ;;
|
||||
*-emu) ;;
|
||||
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
|
||||
esac
|
||||
|
||||
case "$target_cpu" in
|
||||
i386 | powerpc) target_m32=1 ;;
|
||||
x86_64 | sparc64) target_m64=1 ;;
|
||||
esac
|
||||
|
||||
case "$host_os" in
|
||||
mingw32*) host_os=cygwin ;;
|
||||
esac
|
||||
|
||||
# This normalizes the names, and creates a new variable ("host_kernel")
|
||||
# while at it, since the mapping is not always 1:1 (e.g. different OSes
|
||||
# using the same kernel type).
|
||||
case "$host_os" in
|
||||
gnu*) host_kernel=hurd ;;
|
||||
linux*) host_kernel=linux ;;
|
||||
freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
|
||||
cygwin) host_kernel=windows ;;
|
||||
esac
|
||||
|
||||
case "$platform" in
|
||||
coreboot) machine_CFLAGS="-DGRUB_MACHINE_COREBOOT=1" ;;
|
||||
efi) machine_CFLAGS="-DGRUB_MACHINE_EFI=1" ;;
|
||||
ieee1275) machine_CFLAGS="-DGRUB_MACHINE_IEEE1275=1" ;;
|
||||
qemu) machine_CFLAGS="-DGRUB_MACHINE_QEMU=1" ;;
|
||||
pc) machine_CFLAGS="-DGRUB_MACHINE_PCBIOS=1" ;;
|
||||
emu) machine_CFLAGS="-DGRUB_MACHINE_EMU=1" ;;
|
||||
esac
|
||||
CFLAGS="$CFLAGS $machine_CFLAGS"
|
||||
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS $machine_CFLAGS"
|
||||
|
||||
AC_SUBST(host_cpu)
|
||||
AC_SUBST(host_os)
|
||||
AC_SUBST(host_kernel)
|
||||
|
||||
AC_SUBST(target_cpu)
|
||||
AC_SUBST(platform)
|
||||
|
||||
|
@ -107,9 +155,9 @@ if test "x$YACC" = x; then
|
|||
AC_MSG_ERROR([bison is not found])
|
||||
fi
|
||||
|
||||
for file in /usr/share/unifont/unifont.hex ; do
|
||||
for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz ; do
|
||||
if test -e $file ; then
|
||||
AC_SUBST([UNIFONT_HEX], [$file])
|
||||
AC_SUBST([FONT_SOURCE], [$file])
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
@ -117,9 +165,11 @@ done
|
|||
AC_PROG_INSTALL
|
||||
AC_PROG_AWK
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_MKDIR_P
|
||||
|
||||
# This is not a "must".
|
||||
# These are not a "must".
|
||||
AC_PATH_PROG(RUBY, ruby)
|
||||
AC_PATH_PROG(MAKEINFO, makeinfo)
|
||||
|
||||
#
|
||||
# Checks for host programs.
|
||||
|
@ -130,6 +180,7 @@ AC_PROG_CC
|
|||
test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
|
||||
|
||||
AC_GNU_SOURCE
|
||||
AM_GNU_GETTEXT([external])
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
# Identify characteristics of the host architecture.
|
||||
|
@ -137,39 +188,34 @@ AC_C_BIGENDIAN
|
|||
AC_CHECK_SIZEOF(void *)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
|
||||
if test "x$host_m32" = x1; then
|
||||
# Force 32-bit mode.
|
||||
CFLAGS="$CFLAGS -m32"
|
||||
LDFLAGS="$LDFLAGS -m32"
|
||||
grub_apple_cc
|
||||
if test x$grub_cv_apple_cc = xyes ; then
|
||||
CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
|
||||
ASFLAGS="$ASFLAGS -DAPPLE_CC=1"
|
||||
fi
|
||||
|
||||
# Check LZO when compiling for the i386-pc.
|
||||
if test "$target_cpu"-"$platform" = i386-pc; then
|
||||
# There are three possibilities. LZO version 2 installed with the name
|
||||
# liblzo2, with the name liblzo, and LZO version 1.
|
||||
AC_CHECK_LIB(lzo2, __lzo_init_v2, [LIBLZO="-llzo2"],
|
||||
AC_CHECK_LIB(lzo, __lzo_init_v2, [LIBLZO="-llzo"],
|
||||
AC_CHECK_LIB(lzo, __lzo_init2, [LIBLZO="-llzo"],
|
||||
AC_MSG_ERROR([LZO library version 1.02 or later is required]))))
|
||||
AC_SUBST(LIBLZO)
|
||||
LIBS="$LIBS $LIBLZO"
|
||||
AC_CHECK_FUNC(lzo1x_999_compress, ,
|
||||
[AC_MSG_ERROR([LZO1X-999 must be enabled])])
|
||||
|
||||
# LZO version 2 uses lzo/lzo1x.h, while LZO version 1 uses lzo1x.h.
|
||||
AC_CHECK_HEADERS(lzo/lzo1x.h lzo1x.h)
|
||||
if test "x$cross_compiling" = xyes; then
|
||||
AC_MSG_WARN([cannot generate manual pages while cross compiling])
|
||||
else
|
||||
AC_PATH_PROG(HELP2MAN, help2man)
|
||||
fi
|
||||
|
||||
# Check for functions.
|
||||
AC_CHECK_FUNCS(posix_memalign memalign)
|
||||
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf)
|
||||
|
||||
# For grub-mkisofs
|
||||
AC_HEADER_MAJOR
|
||||
AC_HEADER_DIRENT
|
||||
AC_CHECK_FUNCS(memmove sbrk strdup lstat getuid getgid)
|
||||
AC_CHECK_HEADERS(sys/mkdev.h sys/sysmacros.h malloc.h termios.h sys/types.h)
|
||||
AC_CHECK_HEADERS(unistd.h string.h strings.h sys/stat.h sys/fcntl.h)
|
||||
|
||||
#
|
||||
# Check for target programs.
|
||||
#
|
||||
|
||||
# For cross-compiling.
|
||||
if test "x$target" != "x$host"; then
|
||||
# XXX this depends on the implementation of autoconf!
|
||||
# Find tools for the target.
|
||||
if test "x$target_alias" != x && test "x$host_alias" != "x$target_alias"; then
|
||||
tmp_ac_tool_prefix="$ac_tool_prefix"
|
||||
ac_tool_prefix=$target_alias-
|
||||
|
||||
|
@ -203,90 +249,253 @@ CPPFLAGS="$TARGET_CPPFLAGS"
|
|||
LDFLAGS="$TARGET_LDFLAGS"
|
||||
LIBS=""
|
||||
|
||||
if test "x$TARGET_CFLAGS" = x; then
|
||||
# debug flags.
|
||||
TARGET_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
|
||||
-Wundef -Wstrict-prototypes -g"
|
||||
# debug flags.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
|
||||
-Wundef -Wstrict-prototypes -g"
|
||||
|
||||
# optimization flags.
|
||||
AC_CACHE_CHECK([whether optimization for size works], size_flag, [
|
||||
CFLAGS=-Os
|
||||
AC_TRY_COMPILE(, , size_flag=yes, size_flag=no)
|
||||
# Force no alignment to save space on i386.
|
||||
if test "x$target_cpu" = xi386; then
|
||||
AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
|
||||
CFLAGS="$CFLAGS -falign-loops=1"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_falign_loop=yes],
|
||||
[grub_cv_cc_falign_loop=no])
|
||||
])
|
||||
if test "x$size_flag" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -Os"
|
||||
|
||||
if test "x$grub_cv_cc_falign_loop" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
|
||||
else
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
|
||||
fi
|
||||
|
||||
# Force no alignment to save space on i386.
|
||||
if test "x$target_cpu" = xi386; then
|
||||
AC_CACHE_CHECK([whether -falign-loops works], [falign_loop_flag], [
|
||||
CFLAGS="-falign-loops=1"
|
||||
AC_TRY_COMPILE(, , [falign_loop_flag=yes], [falign_loop_flag=no])
|
||||
])
|
||||
|
||||
if test "x$falign_loop_flag" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
|
||||
else
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
|
||||
fi
|
||||
fi
|
||||
# Some toolchains enable these features by default, but they need
|
||||
# registers that aren't set up properly in GRUB.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-3dnow"
|
||||
fi
|
||||
|
||||
# By default, GCC 4.4 generates .eh_frame sections containing unwind
|
||||
# information in some cases where it previously did not. GRUB doesn't need
|
||||
# these and they just use up vital space. Restore the old compiler
|
||||
# behaviour.
|
||||
AC_CACHE_CHECK([whether -fno-dwarf2-cfi-asm works], [grub_cv_cc_fno_dwarf2_cfi_asm], [
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_fno_dwarf2_cfi_asm=yes],
|
||||
[grub_cv_cc_fno_dwarf2_cfi_asm=no])
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
])
|
||||
|
||||
if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
|
||||
fi
|
||||
|
||||
grub_apple_target_cc
|
||||
if test x$grub_cv_apple_target_cc = xyes ; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -DAPPLE_CC=1 -fnested-functions"
|
||||
CFLAGS="$CFLAGS -DAPPLE_CC=1 -fnested-functions"
|
||||
TARGET_ASFLAGS="$TARGET_ASFLAGS -DAPPLE_CC=1"
|
||||
TARGET_APPLE_CC=1
|
||||
AC_CHECK_PROG([OBJCONV], [objconv], [objconv], [])
|
||||
if test "x$OBJCONV" = x ; then
|
||||
AC_CHECK_PROG([OBJCONV], [objconv], [./objconv], [], [.])
|
||||
fi
|
||||
if test "x$OBJCONV" = x ; then
|
||||
AC_MSG_ERROR([objconv not found which is required when building with apple compiler])
|
||||
fi
|
||||
TARGET_IMG_LDSCRIPT=
|
||||
TARGET_IMG_CFLAGS="-static"
|
||||
TARGET_IMG_LDFLAGS='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
|
||||
TARGET_IMG_LDFLAGS_AC='-nostdlib -static -Wl,-preload -Wl,-segalign,20 -Wl,-image_base,'
|
||||
else
|
||||
TARGET_APPLE_CC=0
|
||||
# Use linker script if present, otherwise use builtin -N script.
|
||||
if test -f "${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"; then
|
||||
TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
|
||||
TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT} -Wl,-Ttext,"
|
||||
TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/${target_cpu}-${platform}-${host_os}-img-ld.sc"
|
||||
else
|
||||
TARGET_IMG_LDSCRIPT=
|
||||
TARGET_IMG_LDFLAGS='-Wl,-N -Wl,-Ttext,'
|
||||
TARGET_IMG_LDFLAGS_AC='-Wl,-N -Wl,-Ttext,'
|
||||
fi
|
||||
TARGET_IMG_CFLAGS=
|
||||
fi
|
||||
|
||||
AC_SUBST(TARGET_IMG_LDSCRIPT)
|
||||
AC_SUBST(TARGET_IMG_LDFLAGS)
|
||||
AC_SUBST(TARGET_IMG_CFLAGS)
|
||||
|
||||
# For platforms where ELF is not the default link format.
|
||||
AC_MSG_CHECKING([for command to convert module to ELF format])
|
||||
case "${host_os}" in
|
||||
cygwin) TARGET_OBJ2ELF='grub-pe2elf' ;;
|
||||
*) ;;
|
||||
esac
|
||||
AC_SUBST(TARGET_OBJ2ELF)
|
||||
AC_MSG_RESULT([$TARGET_OBJ2ELF])
|
||||
|
||||
|
||||
if test "x$target_m32" = x1; then
|
||||
# Force 32-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
|
||||
TARGET_MODULE_FORMAT="elf32"
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([whether the linker accepts `--build-id=none'])
|
||||
save_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS -Wl,--build-id=none"
|
||||
AC_TRY_LINK(, , build_id_flag=yes, build_id_flag=no)
|
||||
AC_MSG_RESULT([$build_id_flag])
|
||||
LDFLAGS="$save_LDFLAGS"
|
||||
if test "x$build_id_flag" = xyes; then
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,--build-id=none"
|
||||
if test "x$target_m64" = x1; then
|
||||
# Force 64-bit mode.
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
|
||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
|
||||
TARGET_MODULE_FORMAT="elf64"
|
||||
fi
|
||||
|
||||
if test "$target_cpu"-"$platform" = x86_64-efi; then
|
||||
# Use large model to support 4G memory
|
||||
AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
|
||||
SAVED_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS -m64 -mcmodel=large"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_mcmodel=yes],
|
||||
[grub_cv_cc_mcmodel=no])
|
||||
])
|
||||
if test "x$grub_cv_cc_mcmodel" = xno; then
|
||||
CFLAGS="$SAVED_CFLAGS -m64 -DMCMODEL_SMALL=1"
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -DMCMODEL_SMALL=1"
|
||||
AC_MSG_WARN([-mcmodel=large not supported. You won't be able to use the memory over 4GiB. Upgrade your gcc])
|
||||
else
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
|
||||
fi
|
||||
|
||||
# EFI writes to stack below %rsp, we must not use the red zone
|
||||
AC_CACHE_CHECK([whether option -mno-red-zone works], grub_cv_cc_no_red_zone, [
|
||||
CFLAGS="$CFLAGS -m64 -mno-red-zone"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_no_red_zone=yes],
|
||||
[grub_cv_cc_no_red_zone=no])
|
||||
])
|
||||
if test "x$grub_cv_cc_no_red_zone" = xno; then
|
||||
AC_MSG_ERROR([-mno-red-zone not supported, upgrade your gcc])
|
||||
fi
|
||||
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -mno-red-zone"
|
||||
fi
|
||||
|
||||
#
|
||||
# Compiler features.
|
||||
#
|
||||
|
||||
# Smashing stack protector.
|
||||
grub_CHECK_STACK_PROTECTOR
|
||||
# Need __enable_execute_stack() for nested function trampolines?
|
||||
grub_CHECK_ENABLE_EXECUTE_STACK
|
||||
|
||||
# Position independent executable.
|
||||
grub_CHECK_PIE
|
||||
[# Need that, because some distributions ship compilers that include
|
||||
# `-fstack-protector' in the default specs.
|
||||
if [ x"$ssp_possible" = xyes ]; then
|
||||
TARGET_CFLAGS=$TARGET_CFLAGS\ -fno-stack-protector
|
||||
# `-fPIE' in the default specs.
|
||||
if [ x"$pie_possible" = xyes ]; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-PIE"
|
||||
fi]
|
||||
|
||||
# Smashing stack protector.
|
||||
grub_CHECK_STACK_PROTECTOR
|
||||
# Need that, because some distributions ship compilers that include
|
||||
# `-fstack-protector' in the default specs.
|
||||
if test "x$ssp_possible" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector"
|
||||
fi
|
||||
grub_CHECK_STACK_ARG_PROBE
|
||||
# Cygwin's GCC uses alloca() to probe the stackframe on static
|
||||
# stack allocations above some threshold.
|
||||
if test x"$sap_possible" = xyes; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -mno-stack-arg-probe"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([werror],
|
||||
[AS_HELP_STRING([--disable-werror],
|
||||
[do not use -Werror when building GRUB])])
|
||||
if test x"$enable_werror" != xno ; then
|
||||
TARGET_CFLAGS="$TARGET_CFLAGS -Werror"
|
||||
fi
|
||||
|
||||
AC_SUBST(TARGET_CFLAGS)
|
||||
AC_SUBST(TARGET_MODULE_FORMAT)
|
||||
AC_SUBST(OBJCONV)
|
||||
AC_SUBST(TARGET_APPLE_CC)
|
||||
AC_SUBST(TARGET_ASFLAGS)
|
||||
AC_SUBST(TARGET_CPPFLAGS)
|
||||
AC_SUBST(TARGET_LDFLAGS)
|
||||
|
||||
# Check for libgcc symbols (must be performed before we add -nostdlib to LDFLAGS)
|
||||
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2)
|
||||
|
||||
# Set them to their new values for the tests below.
|
||||
CC="$TARGET_CC"
|
||||
CFLAGS="$TARGET_CFLAGS"
|
||||
if test "x$TARGET_APPLE_CC" = x1 ; then
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib"
|
||||
else
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100"
|
||||
fi
|
||||
CPPFLAGS="$TARGET_CPPFLAGS"
|
||||
LDFLAGS="$TARGET_LDFLAGS"
|
||||
|
||||
# Defined in aclocal.m4.
|
||||
grub_PROG_TARGET_CC
|
||||
if test "x$TARGET_APPLE_CC" != x1 ; then
|
||||
grub_PROG_OBJCOPY_ABSOLUTE
|
||||
fi
|
||||
grub_PROG_LD_BUILD_ID_NONE
|
||||
grub_ASM_USCORE
|
||||
if test "x$target_cpu" = xi386; then
|
||||
grub_CHECK_START_SYMBOL
|
||||
grub_CHECK_BSS_START_SYMBOL
|
||||
grub_CHECK_END_SYMBOL
|
||||
if test ! -z "$TARGET_IMG_LDSCRIPT"; then
|
||||
# Check symbols provided by linker script.
|
||||
CFLAGS="$TARGET_CFLAGS -nostdlib $TARGET_IMG_LDFLAGS_AC -Wl,-Ttext,8000,--defsym,___main=0x8100"
|
||||
fi
|
||||
if test "x$TARGET_APPLE_CC" != x1 ; then
|
||||
grub_CHECK_BSS_START_SYMBOL
|
||||
grub_CHECK_END_SYMBOL
|
||||
fi
|
||||
CFLAGS="$TARGET_CFLAGS"
|
||||
grub_I386_ASM_PREFIX_REQUIREMENT
|
||||
grub_I386_ASM_ADDR32
|
||||
grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
|
||||
grub_I386_CHECK_REGPARM_BUG
|
||||
else
|
||||
AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
|
||||
fi
|
||||
|
||||
AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
|
||||
#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
|
||||
#else
|
||||
#define NESTED_FUNC_ATTR
|
||||
#endif])
|
||||
|
||||
AC_ARG_ENABLE([efiemu],
|
||||
[AS_HELP_STRING([--enable-efiemu],
|
||||
[build and install the efiemu runtimes (default=guessed)])])
|
||||
if test x"$enable_efiemu" = xno ; then
|
||||
efiemu_excuse="explicitly disabled"
|
||||
fi
|
||||
if test x"$efiemu_excuse" = x ; then
|
||||
AC_CACHE_CHECK([whether options required for efiemu work], grub_cv_cc_efiemu, [
|
||||
CFLAGS="$CFLAGS -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||
[grub_cv_cc_efiemu=yes],
|
||||
[grub_cv_cc_efiemu=no])
|
||||
])
|
||||
if test x$grub_cv_cc_efiemu = xno; then
|
||||
efiemu_excuse="cannot compile with -m64 -mcmodel=large -mno-red-zone -nostdlib"
|
||||
fi
|
||||
fi
|
||||
if test x"$enable_efiemu" = xyes && test x"$efiemu_excuse" != x ; then
|
||||
AC_MSG_ERROR([efiemu runtime was explicitly requested but can't be compiled])
|
||||
fi
|
||||
if test x"$efiemu_excuse" = x ; then
|
||||
enable_efiemu=yes
|
||||
else
|
||||
enable_efiemu=no
|
||||
fi
|
||||
AC_SUBST([enable_efiemu])
|
||||
|
||||
|
||||
# Restore the flags.
|
||||
CC="$tmp_CC"
|
||||
CFLAGS="$tmp_CFLAGS"
|
||||
|
@ -299,33 +508,193 @@ LIBS="$tmp_LIBS"
|
|||
#
|
||||
|
||||
# Memory manager debugging.
|
||||
AC_ARG_ENABLE([mm-debug],
|
||||
AC_ARG_ENABLE([mm-debug],
|
||||
AS_HELP_STRING([--enable-mm-debug],
|
||||
[include memory manager debugging]),
|
||||
[AC_DEFINE([MM_DEBUG], [1],
|
||||
[Define to 1 if you enable memory manager debugging.])])
|
||||
|
||||
AC_ARG_ENABLE([grub-emu],
|
||||
[AS_HELP_STRING([--enable-grub-emu],
|
||||
[build and install the `grub-emu' debugging utility])])
|
||||
[if [ x"$enable_grub_emu" = xyes ]; then
|
||||
# Check for curses libraries.]
|
||||
AC_ARG_ENABLE([grub-emu-usb],
|
||||
[AS_HELP_STRING([--enable-grub-emu-usb],
|
||||
[build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
|
||||
|
||||
AC_ARG_ENABLE([grub-emu-pci],
|
||||
[AS_HELP_STRING([--enable-grub-emu-pci],
|
||||
[build and install the `grub-emu' debugging utility with PCI support (potentially dangerous) (default=no)])])
|
||||
|
||||
if test "$platform" = emu; then
|
||||
missing_ncurses=
|
||||
[# Check for curses libraries.]
|
||||
AC_CHECK_LIB([ncurses], [wgetch], [LIBCURSES="-lncurses"],
|
||||
[AC_CHECK_LIB([curses], [wgetch], [LIBCURSES="-lcurses"],
|
||||
[AC_MSG_ERROR([(n)curses libraries are required to build `grub-emu'])])])
|
||||
[missing_ncurses=[true]])])
|
||||
AC_SUBST([LIBCURSES])
|
||||
|
||||
[if [ x"$missing_ncurses" = x ]; then ]
|
||||
[# Check for headers.]
|
||||
AC_CHECK_HEADERS([ncurses/curses.h], [],
|
||||
[AC_CHECK_HEADERS([ncurses.h], [],
|
||||
[AC_CHECK_HEADERS([curses.h], [],
|
||||
[AC_MSG_ERROR([(n)curses header files are required to build `grub-emu'])])])])
|
||||
[missing_ncurses=[true]])])])
|
||||
[fi]
|
||||
AC_SUBST([enable_grub_emu])
|
||||
if test x"$missing_ncurses" = xtrue ; then
|
||||
AC_MSG_ERROR([grub-emu can't be compiled without ncurses])
|
||||
fi
|
||||
|
||||
if test x"$enable_grub_emu_usb" = xno ; then
|
||||
grub_emu_usb_excuse="explicitly disabled"
|
||||
fi
|
||||
|
||||
if test x"$enable_grub_emu_pci" = xyes ; then
|
||||
grub_emu_usb_excuse="conflicts with PCI support"
|
||||
fi
|
||||
|
||||
[if [ x"$grub_emu_usb_excuse" = x ]; then
|
||||
# Check for libusb libraries.]
|
||||
AC_CHECK_LIB([usb], [usb_claim_interface], [LIBUSB="-lusb"],
|
||||
[grub_emu_usb_excuse=["need libusb library"]])
|
||||
AC_SUBST([LIBUSB])
|
||||
[fi]
|
||||
[if [ x"$grub_emu_usb_excuse" = x ]; then
|
||||
# Check for headers.]
|
||||
AC_CHECK_HEADERS([usb.h], [],
|
||||
[grub_emu_usb_excuse=["need libusb headers"]])
|
||||
[fi]
|
||||
if test x"$enable_grub_emu_usb" = xyes && test x"$grub_emu_usb_excuse" != x ; then
|
||||
AC_MSG_ERROR([USB support for grub-emu was explicitly requested but can't be compiled])
|
||||
fi
|
||||
if test x"$grub_emu_usb_excuse" = x ; then
|
||||
enable_grub_emu_usb=yes
|
||||
else
|
||||
enable_grub_emu_usb=no
|
||||
fi
|
||||
|
||||
if test x"$enable_grub_emu_pci" != xyes ; then
|
||||
grub_emu_pci_excuse="not enabled"
|
||||
fi
|
||||
|
||||
if test x"$enable_grub_emu_usb" = xyes ; then
|
||||
grub_emu_pci_excuse="conflicts with USB support"
|
||||
fi
|
||||
|
||||
[if [ x"$grub_emu_pci_excuse" = x ]; then
|
||||
# Check for libpci libraries.]
|
||||
AC_CHECK_LIB([pciaccess], [pci_system_init], [LIBPCIACCESS="-lpciaccess"],
|
||||
[grub_emu_pci_excuse=["need libpciaccess library"]])
|
||||
AC_SUBST([LIBPCIACCESS])
|
||||
[fi]
|
||||
[if [ x"$grub_emu_pci_excuse" = x ]; then
|
||||
# Check for headers.]
|
||||
AC_CHECK_HEADERS([pci/pci.h], [],
|
||||
[grub_emu_pci_excuse=["need libpciaccess headers"]])
|
||||
[fi]
|
||||
|
||||
if test x"$grub_emu_pci_excuse" = x ; then
|
||||
enable_grub_emu_pci=yes
|
||||
else
|
||||
enable_grub_emu_pci=no
|
||||
fi
|
||||
|
||||
AC_SUBST([enable_grub_emu_usb])
|
||||
AC_SUBST([enable_grub_emu_pci])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([grub-fstest],
|
||||
[AS_HELP_STRING([--enable-grub-fstest],
|
||||
[build and install the `grub-fstest' debugging utility (default=guessed)])])
|
||||
if test x"$enable_grub_fstest" = xno ; then
|
||||
grub_fstest_excuse="explicitly disabled"
|
||||
fi
|
||||
if test x"$grub_fstest_excuse" = x ; then
|
||||
enable_grub_fstest=yes
|
||||
else
|
||||
enable_grub_fstest=no
|
||||
fi
|
||||
AC_SUBST([enable_grub_fstest])
|
||||
|
||||
AC_ARG_ENABLE([grub-mkfont],
|
||||
[AS_HELP_STRING([--enable-grub-mkfont],
|
||||
[build and install the `grub-mkfont' utility (default=guessed)])])
|
||||
if test x"$enable_grub_mkfont" = xno ; then
|
||||
grub_mkfont_excuse="explicitly disabled"
|
||||
fi
|
||||
|
||||
if test x"$grub_mkfont_excuse" = x ; then
|
||||
# Check for freetype libraries.
|
||||
AC_CHECK_PROGS([FREETYPE], [freetype-config])
|
||||
if test "x$FREETYPE" = x ; then
|
||||
grub_mkfont_excuse=["need freetype2 library"]
|
||||
fi
|
||||
freetype_cflags=`freetype-config --cflags`
|
||||
freetype_libs=`freetype-config --libs`
|
||||
fi
|
||||
if test x"$enable_grub_mkfont" = xyes && test x"$grub_mkfont_excuse" != x ; then
|
||||
AC_MSG_ERROR([grub-mkfont was explicitly requested but can't be compiled])
|
||||
fi
|
||||
if test x"$grub_mkfont_excuse" = x ; then
|
||||
enable_grub_mkfont=yes
|
||||
else
|
||||
enable_grub_mkfont=no
|
||||
fi
|
||||
AC_SUBST([enable_grub_mkfont])
|
||||
AC_SUBST([freetype_cflags])
|
||||
AC_SUBST([freetype_libs])
|
||||
|
||||
AC_SUBST(ASFLAGS)
|
||||
|
||||
# Output files.
|
||||
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu
|
||||
include/grub/machine:include/grub/$target_cpu/$platform])
|
||||
grub_CHECK_LINK_DIR
|
||||
if test x"$link_dir" = xyes ; then
|
||||
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
|
||||
if test "$platform" != emu ; then
|
||||
AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
|
||||
fi
|
||||
else
|
||||
mkdir -p include/grub 2>/dev/null
|
||||
rm -rf include/grub/cpu
|
||||
cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
|
||||
if test "$platform" != emu ; then
|
||||
rm -rf include/grub/machine
|
||||
cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
AC_CONFIG_FILES([Makefile gensymlist.sh genkernsyms.sh])
|
||||
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
|
||||
AC_OUTPUT
|
||||
[
|
||||
echo "*******************************************************"
|
||||
echo GRUB2 will be compiled with following components:
|
||||
echo Platform: "$target_cpu"-"$platform"
|
||||
if [ x"$platform" = xemu ]; then
|
||||
if [ x"$grub_emu_usb_excuse" = x ]; then
|
||||
echo USB support for grub-emu: Yes
|
||||
else
|
||||
echo USB support for grub-emu: No "($grub_emu_usb_excuse)"
|
||||
fi
|
||||
if [ x"$grub_emu_pci_excuse" = x ]; then
|
||||
echo PCI support for grub-emu: Yes
|
||||
else
|
||||
echo PCI support for grub-emu: No "($grub_emu_pci_excuse)"
|
||||
fi
|
||||
fi
|
||||
if [ x"$enable_mm_debug" = xyes ]; then
|
||||
echo With memory debugging: Yes
|
||||
else
|
||||
echo With memory debugging: No
|
||||
fi
|
||||
if [ x"$efiemu_excuse" = x ]; then
|
||||
echo efiemu runtime: Yes
|
||||
else
|
||||
echo efiemu runtime: No "($efiemu_excuse)"
|
||||
fi
|
||||
if [ x"$grub_fstest_excuse" = x ]; then
|
||||
echo grub-fstest: Yes
|
||||
else
|
||||
echo grub-fstest: No "($grub_fstest_excuse)"
|
||||
fi
|
||||
if [ x"$grub_mkfont_excuse" = x ]; then
|
||||
echo grub-mkfont: Yes
|
||||
else
|
||||
echo grub-mkfont: No "($grub_mkfont_excuse)"
|
||||
fi
|
||||
echo "*******************************************************"
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue