2002-12-27 08:53:07 +00:00
|
|
|
# Process this file with autoconf to produce a configure script.
|
|
|
|
|
2005-10-15 18:10:37 +00:00
|
|
|
# Copyright (C) 2002,2003,2004,2005 Free Software Foundation, Inc.
|
2002-12-27 08:53:07 +00:00
|
|
|
#
|
|
|
|
# This configure.ac is free software; the author
|
|
|
|
# gives unlimited permission to copy and/or distribute it,
|
|
|
|
# with or without modifications, as long as this notice is preserved.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
|
|
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
|
|
# PARTICULAR PURPOSE.
|
|
|
|
|
2005-10-15 18:10:37 +00:00
|
|
|
AC_INIT(GRUB, 1.91, [bug-grub@gnu.org])
|
2002-12-27 08:53:07 +00:00
|
|
|
AC_PREREQ(2.53)
|
2004-04-04 13:46:03 +00:00
|
|
|
AC_CONFIG_SRCDIR([include/grub/dl.h])
|
2002-12-27 08:53:07 +00:00
|
|
|
AC_CONFIG_HEADER([config.h])
|
|
|
|
|
|
|
|
# Checks for build and host systems.
|
|
|
|
AC_CANONICAL_BUILD
|
|
|
|
AC_CANONICAL_HOST
|
|
|
|
|
|
|
|
case "$host_cpu" in
|
|
|
|
i[[3456]]86) host_cpu=i386 ;;
|
2005-10-01 Marco Gerards <mgerards@xs4all.nl>
* configure.ac: Accept `x86_64' as host_cpu. In that case add
`-m32' to CFLAGS.
* genmk.rb (class PModule): Always use `$(#{prefix}_LDFLAGS)' when
linking.
* conf/i386-pc.rmk (COMMON_CFLAGS): Add `-m32'.
(COMMON_LDFLAGS): New variable.
(kernel_img_LDFLAGS): Include `COMMON_FLAGS'.
(_chain_mod_LDFLAGS, fshelp_mod_LDFLAGS, fat_mod_LDFLAGS)
(ext2_mod_LDFLAGS, ufs_mod_LDFLAGS, minix_mod_LDFLAGS)
(hfs_mod_LDFLAGS, jfs_mod_LDFLAGS, iso9660_mod_LDFLAGS)
(xfs_mod_LDFLAGS, _linux_mod_LDFLAGS, linux_mod_LDFLAGS)
(normal_mod_LDFLAGS, hello_mod_LDFLAGS, boot_mod_LDFLAGS)
(terminal_mod_LDFLAGS, ls_mod_LDFLAGS, cmp_mod_LDFLAGS)
(cat_mod_LDFLAGS, help_mod_LDFLAGS, reboot_mod_LDFLAGS)
(halt_mod_LDFLAGS, vga_mod_LDFLAGS, font_mod_LDFLAGS)
(terminfo_mod_LDFLAGS, serial_mod_LDFLAGS, _multiboot_mod_LDFLAGS)
(multiboot_mod_LDFLAGS, amiga_mod_LDFLAGS, apple_mod_LDFLAGS)
(pc_mod_LDFLAGS, sun_mod_LDFLAGS, loopback_mod_LDFLAGS)
(default_mod_LDFLAGS, timeout_mod_LDFLAGS, configfile_mod_LDFLAGS)
(vbe_mod_LDFLAGS, vesafb_mod_LDFLAGS, vbeinfo_mod_LDFLAGS)
(vbetest_mod_LDFLAGS, search_mod_LDFLAGS, gzio_mod_LDFLAGS): New
variables.
(normal_mod_ASFLAGS): Add `-m32'.
* include/grub/types.h (grub_host_addr_t, grub_host_off_t)
(grub_host_size_t, grub_host_ssize_t): New types.
(grub_addr_t, grub_off_t, grub_size_t, grub_ssize_t): Make type
dependant of `GRUB_CPU_SIZEOF_VOID_P' instead on
`GRUB_HOST_SIZEOF_VOID_P'.
* include/grub/kernel.h (struct grub_module_header): Type of
member offset changed to `grub_host_off_t'. Type of member size
changed to `grub_host_size_t'.
(struct grub_module_info): Type of member offset changed to
`grub_host_off_t'. Type of member size changed to
`grub_host_size_t'.
2005-10-01 19:49:55 +00:00
|
|
|
x86_64) host_cpu=i386 amd64=1 ;;
|
2004-03-28 21:52:02 +00:00
|
|
|
powerpc) ;;
|
2005-08-21 18:42:55 +00:00
|
|
|
sparc64) ;;
|
2002-12-27 08:53:07 +00:00
|
|
|
*) AC_MSG_ERROR([unsupported CPU type]) ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "$host_cpu"-"$host_vendor" in
|
|
|
|
i386-*) host_vendor=pc ;;
|
2004-03-28 21:52:02 +00:00
|
|
|
powerpc-*) host_vendor=ieee1275 ;;
|
2005-08-21 18:42:55 +00:00
|
|
|
sparc64-*) host_vendor=ieee1275 ;;
|
2002-12-27 08:53:07 +00:00
|
|
|
*) AC_MSG_ERROR([unsupported machine type]) ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
AC_SUBST(host_cpu)
|
|
|
|
AC_SUBST(host_vendor)
|
|
|
|
|
|
|
|
# Checks for programs.
|
|
|
|
if test "x$CFLAGS" = x; then
|
|
|
|
default_CFLAGS=yes
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_PROG_CC
|
2003-10-29 18:44:30 +00:00
|
|
|
AC_SYS_LARGEFILE
|
2002-12-27 08:53:07 +00:00
|
|
|
|
|
|
|
# Must be GCC.
|
|
|
|
test "x$GCC" = xyes || AC_MSG_ERROR([GCC is required])
|
|
|
|
|
|
|
|
if test "x$default_CFLAGS" = xyes; then
|
|
|
|
# debug flags.
|
2003-01-06 00:01:35 +00:00
|
|
|
tmp_CFLAGS="-Wall -W -Wshadow -Wpointer-arith -Wmissing-prototypes \
|
|
|
|
-Wundef -Wstrict-prototypes -g"
|
2002-12-27 08:53:07 +00:00
|
|
|
|
|
|
|
# optimization flags.
|
|
|
|
AC_CACHE_CHECK([whether optimization for size works], size_flag, [
|
|
|
|
CFLAGS=-Os
|
|
|
|
AC_TRY_COMPILE(, , size_flag=yes, size_flag=no)
|
|
|
|
])
|
|
|
|
if test "x$size_flag" = xyes; then
|
|
|
|
tmp_CFLAGS="$tmp_CFLAGS -Os"
|
|
|
|
else
|
|
|
|
tmp_CFLAGS="$tmp_CFLAGS -O2 -fno-strength-reduce -fno-unroll-loops"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Force no alignment to save space on i386.
|
|
|
|
if test "x$host_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
|
|
|
|
tmp_CFLAGS="$tmp_CFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
|
|
|
|
else
|
|
|
|
tmp_CFLAGS="$tmp_CFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2005-10-01 Marco Gerards <mgerards@xs4all.nl>
* configure.ac: Accept `x86_64' as host_cpu. In that case add
`-m32' to CFLAGS.
* genmk.rb (class PModule): Always use `$(#{prefix}_LDFLAGS)' when
linking.
* conf/i386-pc.rmk (COMMON_CFLAGS): Add `-m32'.
(COMMON_LDFLAGS): New variable.
(kernel_img_LDFLAGS): Include `COMMON_FLAGS'.
(_chain_mod_LDFLAGS, fshelp_mod_LDFLAGS, fat_mod_LDFLAGS)
(ext2_mod_LDFLAGS, ufs_mod_LDFLAGS, minix_mod_LDFLAGS)
(hfs_mod_LDFLAGS, jfs_mod_LDFLAGS, iso9660_mod_LDFLAGS)
(xfs_mod_LDFLAGS, _linux_mod_LDFLAGS, linux_mod_LDFLAGS)
(normal_mod_LDFLAGS, hello_mod_LDFLAGS, boot_mod_LDFLAGS)
(terminal_mod_LDFLAGS, ls_mod_LDFLAGS, cmp_mod_LDFLAGS)
(cat_mod_LDFLAGS, help_mod_LDFLAGS, reboot_mod_LDFLAGS)
(halt_mod_LDFLAGS, vga_mod_LDFLAGS, font_mod_LDFLAGS)
(terminfo_mod_LDFLAGS, serial_mod_LDFLAGS, _multiboot_mod_LDFLAGS)
(multiboot_mod_LDFLAGS, amiga_mod_LDFLAGS, apple_mod_LDFLAGS)
(pc_mod_LDFLAGS, sun_mod_LDFLAGS, loopback_mod_LDFLAGS)
(default_mod_LDFLAGS, timeout_mod_LDFLAGS, configfile_mod_LDFLAGS)
(vbe_mod_LDFLAGS, vesafb_mod_LDFLAGS, vbeinfo_mod_LDFLAGS)
(vbetest_mod_LDFLAGS, search_mod_LDFLAGS, gzio_mod_LDFLAGS): New
variables.
(normal_mod_ASFLAGS): Add `-m32'.
* include/grub/types.h (grub_host_addr_t, grub_host_off_t)
(grub_host_size_t, grub_host_ssize_t): New types.
(grub_addr_t, grub_off_t, grub_size_t, grub_ssize_t): Make type
dependant of `GRUB_CPU_SIZEOF_VOID_P' instead on
`GRUB_HOST_SIZEOF_VOID_P'.
* include/grub/kernel.h (struct grub_module_header): Type of
member offset changed to `grub_host_off_t'. Type of member size
changed to `grub_host_size_t'.
(struct grub_module_info): Type of member offset changed to
`grub_host_off_t'. Type of member size changed to
`grub_host_size_t'.
2005-10-01 19:49:55 +00:00
|
|
|
if test "x$amd64" = x1; then
|
|
|
|
tmp_CFLAGS="$tmp_CFLAGS -m32"
|
|
|
|
fi
|
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
CFLAGS="$tmp_CFLAGS"
|
|
|
|
fi
|
|
|
|
AC_SUBST(CFLAGS)
|
|
|
|
|
|
|
|
# Defined in aclocal.m4.
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_ASM_USCORE
|
2004-03-28 21:52:02 +00:00
|
|
|
if test "x$host_cpu" = xi386; then
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_CHECK_START_SYMBOL
|
|
|
|
grub_CHECK_BSS_START_SYMBOL
|
|
|
|
grub_CHECK_END_SYMBOL
|
2004-03-28 21:52:02 +00:00
|
|
|
fi
|
2002-12-27 08:53:07 +00:00
|
|
|
|
|
|
|
if test "x$host_cpu" = xi386; then
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_I386_ASM_PREFIX_REQUIREMENT
|
|
|
|
grub_I386_ASM_ADDR32
|
|
|
|
grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
|
|
|
|
grub_I386_CHECK_REGPARM_BUG
|
2003-12-03 19:17:27 +00:00
|
|
|
else
|
2005-08-07 17:12:52 +00:00
|
|
|
AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
|
2002-12-27 08:53:07 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_MAKE_SET
|
|
|
|
AC_CHECK_TOOL(OBJCOPY, objcopy)
|
2004-04-04 13:46:03 +00:00
|
|
|
grub_PROG_OBJCOPY_ABSOLUTE
|
2002-12-27 08:53:07 +00:00
|
|
|
AC_CHECK_TOOL(STRIP, strip)
|
|
|
|
AC_CHECK_TOOL(NM, nm)
|
2002-12-27 14:14:06 +00:00
|
|
|
AC_CHECK_TOOL(LD, ld)
|
2002-12-27 08:53:07 +00:00
|
|
|
|
|
|
|
# This is not a "must".
|
|
|
|
AC_PATH_PROG(RUBY, ruby)
|
|
|
|
|
|
|
|
# For cross-compiling.
|
2005-06-30 10:21:37 +00:00
|
|
|
if test "x$build" != "x$host"; then
|
2002-12-27 08:53:07 +00:00
|
|
|
AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc],
|
|
|
|
[AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])])
|
2004-03-28 21:52:02 +00:00
|
|
|
else
|
|
|
|
BUILD_CC="$CC"
|
|
|
|
AC_SUBST(BUILD_CC)
|
2002-12-27 08:53:07 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Test the C compiler for the build environment.
|
2002-12-27 14:14:06 +00:00
|
|
|
tmp_CC="$CC"
|
|
|
|
tmp_CFLAGS="$CFLAGS"
|
2005-10-01 Marco Gerards <mgerards@xs4all.nl>
* configure.ac: Accept `x86_64' as host_cpu. In that case add
`-m32' to CFLAGS.
* genmk.rb (class PModule): Always use `$(#{prefix}_LDFLAGS)' when
linking.
* conf/i386-pc.rmk (COMMON_CFLAGS): Add `-m32'.
(COMMON_LDFLAGS): New variable.
(kernel_img_LDFLAGS): Include `COMMON_FLAGS'.
(_chain_mod_LDFLAGS, fshelp_mod_LDFLAGS, fat_mod_LDFLAGS)
(ext2_mod_LDFLAGS, ufs_mod_LDFLAGS, minix_mod_LDFLAGS)
(hfs_mod_LDFLAGS, jfs_mod_LDFLAGS, iso9660_mod_LDFLAGS)
(xfs_mod_LDFLAGS, _linux_mod_LDFLAGS, linux_mod_LDFLAGS)
(normal_mod_LDFLAGS, hello_mod_LDFLAGS, boot_mod_LDFLAGS)
(terminal_mod_LDFLAGS, ls_mod_LDFLAGS, cmp_mod_LDFLAGS)
(cat_mod_LDFLAGS, help_mod_LDFLAGS, reboot_mod_LDFLAGS)
(halt_mod_LDFLAGS, vga_mod_LDFLAGS, font_mod_LDFLAGS)
(terminfo_mod_LDFLAGS, serial_mod_LDFLAGS, _multiboot_mod_LDFLAGS)
(multiboot_mod_LDFLAGS, amiga_mod_LDFLAGS, apple_mod_LDFLAGS)
(pc_mod_LDFLAGS, sun_mod_LDFLAGS, loopback_mod_LDFLAGS)
(default_mod_LDFLAGS, timeout_mod_LDFLAGS, configfile_mod_LDFLAGS)
(vbe_mod_LDFLAGS, vesafb_mod_LDFLAGS, vbeinfo_mod_LDFLAGS)
(vbetest_mod_LDFLAGS, search_mod_LDFLAGS, gzio_mod_LDFLAGS): New
variables.
(normal_mod_ASFLAGS): Add `-m32'.
* include/grub/types.h (grub_host_addr_t, grub_host_off_t)
(grub_host_size_t, grub_host_ssize_t): New types.
(grub_addr_t, grub_off_t, grub_size_t, grub_ssize_t): Make type
dependant of `GRUB_CPU_SIZEOF_VOID_P' instead on
`GRUB_HOST_SIZEOF_VOID_P'.
* include/grub/kernel.h (struct grub_module_header): Type of
member offset changed to `grub_host_off_t'. Type of member size
changed to `grub_host_size_t'.
(struct grub_module_info): Type of member offset changed to
`grub_host_off_t'. Type of member size changed to
`grub_host_size_t'.
2005-10-01 19:49:55 +00:00
|
|
|
tmp_LDFLAGS="$LDFLAGS"
|
2002-12-27 14:14:06 +00:00
|
|
|
tmp_CPPFLAGS="$CPPFLAGS"
|
2002-12-27 08:53:07 +00:00
|
|
|
CC="$BUILD_CC"
|
2002-12-27 14:14:06 +00:00
|
|
|
CFLAGS="$BUILD_CFLAGS"
|
|
|
|
CPPFLAGS="$BUILD_CPPFLAGS"
|
2005-10-01 Marco Gerards <mgerards@xs4all.nl>
* configure.ac: Accept `x86_64' as host_cpu. In that case add
`-m32' to CFLAGS.
* genmk.rb (class PModule): Always use `$(#{prefix}_LDFLAGS)' when
linking.
* conf/i386-pc.rmk (COMMON_CFLAGS): Add `-m32'.
(COMMON_LDFLAGS): New variable.
(kernel_img_LDFLAGS): Include `COMMON_FLAGS'.
(_chain_mod_LDFLAGS, fshelp_mod_LDFLAGS, fat_mod_LDFLAGS)
(ext2_mod_LDFLAGS, ufs_mod_LDFLAGS, minix_mod_LDFLAGS)
(hfs_mod_LDFLAGS, jfs_mod_LDFLAGS, iso9660_mod_LDFLAGS)
(xfs_mod_LDFLAGS, _linux_mod_LDFLAGS, linux_mod_LDFLAGS)
(normal_mod_LDFLAGS, hello_mod_LDFLAGS, boot_mod_LDFLAGS)
(terminal_mod_LDFLAGS, ls_mod_LDFLAGS, cmp_mod_LDFLAGS)
(cat_mod_LDFLAGS, help_mod_LDFLAGS, reboot_mod_LDFLAGS)
(halt_mod_LDFLAGS, vga_mod_LDFLAGS, font_mod_LDFLAGS)
(terminfo_mod_LDFLAGS, serial_mod_LDFLAGS, _multiboot_mod_LDFLAGS)
(multiboot_mod_LDFLAGS, amiga_mod_LDFLAGS, apple_mod_LDFLAGS)
(pc_mod_LDFLAGS, sun_mod_LDFLAGS, loopback_mod_LDFLAGS)
(default_mod_LDFLAGS, timeout_mod_LDFLAGS, configfile_mod_LDFLAGS)
(vbe_mod_LDFLAGS, vesafb_mod_LDFLAGS, vbeinfo_mod_LDFLAGS)
(vbetest_mod_LDFLAGS, search_mod_LDFLAGS, gzio_mod_LDFLAGS): New
variables.
(normal_mod_ASFLAGS): Add `-m32'.
* include/grub/types.h (grub_host_addr_t, grub_host_off_t)
(grub_host_size_t, grub_host_ssize_t): New types.
(grub_addr_t, grub_off_t, grub_size_t, grub_ssize_t): Make type
dependant of `GRUB_CPU_SIZEOF_VOID_P' instead on
`GRUB_HOST_SIZEOF_VOID_P'.
* include/grub/kernel.h (struct grub_module_header): Type of
member offset changed to `grub_host_off_t'. Type of member size
changed to `grub_host_size_t'.
(struct grub_module_info): Type of member offset changed to
`grub_host_off_t'. Type of member size changed to
`grub_host_size_t'.
2005-10-01 19:49:55 +00:00
|
|
|
LDFLAGS="$BUILD_LDDFLAGS"
|
2003-01-31 03:26:56 +00:00
|
|
|
|
|
|
|
# Identify characteristics of the build architecture.
|
2002-12-27 08:53:07 +00:00
|
|
|
AC_C_BIGENDIAN
|
|
|
|
AC_CHECK_SIZEOF(void *)
|
|
|
|
AC_CHECK_SIZEOF(long)
|
2003-01-31 03:26:56 +00:00
|
|
|
|
2004-03-28 21:52:02 +00:00
|
|
|
# Check LZO when compiling for the i386.
|
|
|
|
if test "x$host_cpu" = xi386; then
|
2005-08-08 23:15:21 +00:00
|
|
|
# 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"
|
2004-03-28 21:52:02 +00:00
|
|
|
AC_CHECK_FUNC(lzo1x_999_compress, ,
|
|
|
|
[AC_MSG_ERROR([LZO1X-999 must be enabled])])
|
2005-08-08 23:15:21 +00:00
|
|
|
|
|
|
|
# LZO version 2 uses lzo/lzo1x.h, while LZO version 1 uses lzo1x.h.
|
|
|
|
AC_CHECK_HEADERS(lzo/lzo1x.h lzo1x.h)
|
2004-03-28 21:52:02 +00:00
|
|
|
fi
|
2003-01-31 03:26:56 +00:00
|
|
|
|
2005-08-07 17:12:52 +00:00
|
|
|
# Check for curses.
|
|
|
|
AC_CHECK_LIB(ncurses, wgetch, [LIBCURSES="-lncurses"],
|
|
|
|
[AC_CHECK_LIB(curses, wgetch, [LIBCURSES="-lcurses"])])
|
|
|
|
AC_SUBST(LIBCURSES)
|
|
|
|
|
|
|
|
# Check for headers.
|
|
|
|
AC_CHECK_HEADERS(ncurses/curses.h ncurses.h curses.h)
|
|
|
|
|
2002-12-27 14:14:06 +00:00
|
|
|
CC="$tmp_CC"
|
|
|
|
CFLAGS="$tmp_CFLAGS"
|
|
|
|
CPPFLAGS="$tmp_CPPFLAGS"
|
2002-12-27 08:53:07 +00:00
|
|
|
|
|
|
|
# Output files.
|
2004-04-04 13:46:03 +00:00
|
|
|
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$host_cpu
|
|
|
|
include/grub/machine:include/grub/$host_cpu/$host_vendor])
|
2002-12-27 08:53:07 +00:00
|
|
|
AC_CONFIG_FILES([Makefile])
|
|
|
|
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
|
|
|
|
AC_OUTPUT
|