grub/configure.ac

145 lines
3.7 KiB
Text
Raw Normal View History

2002-12-27 08:53:07 +00:00
# Process this file with autoconf to produce a configure script.
# Copyright (C) 2002,2003 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.
AC_INIT(GRUB, 1.90, [bug-grub@gnu.org])
2002-12-27 08:53:07 +00:00
AC_PREREQ(2.53)
AC_CONFIG_SRCDIR([include/pupa/dl.h])
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 ;;
*) AC_MSG_ERROR([unsupported CPU type]) ;;
esac
case "$host_cpu"-"$host_vendor" in
i386-*) host_vendor=pc ;;
*) 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
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 Yoshinori K. Okuji <okuji@enbug.org> * util/i386/pc/pupa-setup.c: Include pupa/machine/kernel.h. (setup): Configure the installed partition information and the dl prefix. * loader/i386/pc/chainloader.c (my_mod): New variable. (pupa_chainloader_unload): New function. (pupa_rescue_cmd_chainloader): Refer itself. (PUPA_MOD_INIT): Save its own module in MY_MOD. * kern/i386/pc/startup.S (install_partition): Removed. (version_string): Likewise. (config_file): Likewise. (pupa_install_dos_part): New variable. (pupa_install_bsd_part): Likewise. (pupa_prefix): Likewise. (pupa_chainloader_real_boot): Call pupa_dl_unload_all. * kern/i386/pc/init.c: Include pupa/machine/kernel.h, pupa/dl.h and pupa/misc.h. (make_install_device): New function. (pupa_machine_init): Set the dl prefix. * kern/rescue.c: Include pupa/rescue.h and pupa/dl.h. (buf): Renamed to ... (linebuf): ... this. (pupa_rescue_cmd_prefix): New function. (pupa_rescue_cmd_insmod): Likewise. (pupa_rescue_cmd_rmmod): Likewise. (pupa_rescue_cmd_lsmod): Likewise. (pupa_enter_rescue_mode): Register new commands: prefix, insmod, rmmod and lsmod. * kern/mm.c (pupa_memalign): If failed even after invalidating disk caches, unload unneeded modules and retry. * kern/misc.c (pupa_memmove): New function. (pupa_memcpy): Removed. (pupa_strcpy): New function. (pupa_itoa): Made static. * kern/dl.c (pupa_dl_iterate): New function. (pupa_dl_ref): Likewise. (pupa_dl_unref): Likewise. (pupa_dl_unload): Return if succeeded or not. (pupa_dl_unload_unneeded): New function. (pupa_dl_unload_all): Likewise. (pupa_dl_init): Renamed to ... (pupa_dl_set_prefix): ... this. (pupa_dl_get_prefix): New function. * include/pupa/i386/pc/kernel.h: Include pupa/types.h. (PUPA_KERNEL_MACHINE_INSTALL_DOS_PART): New macro. (PUPA_KERNEL_MACHINE_INSTALL_BSD_PART): Likewise. (PUPA_KERNEL_MACHINE_PREFIX): Likewise. (pupa_install_dos_part): Declared. (pupa_install_bsd_part): Likewise. (pupa_prefix): Likewise. (pupa_boot_drive): Likewise. * include/pupa/types.h: Fix a typo. * include/pupa/misc.h (pupa_memcpy): New macro. Just an alias to pupa_memmove. (pupa_memmove): Declared. (pupa_strcpy): Likewise. * include/pupa/dl.h (PUPA_MOD_INIT): Change the prototype. Now pupa_mod_init takes one argument, its own module. (pupa_dl_unload_unneeded): Declared. (pupa_dl_unload_all): Likewise. (pupa_dl_ref): Likewise. (pupa_dl_unref): Likewise. (pupa_dl_iterate): Likewise. (pupa_dl_init): Renamed to ... (pupa_dl_set_prefix): ... this. (pupa_dl_get_prefix): Declared. * fs/fat.c [!PUPA_UTIL] (my_mod): New variable. (pupa_fat_dir) [!PUPA_UTIL]: Prevent the fat module from being unloaded. (pupa_fat_open) [!PUPA_UTIL]: Refer itself if succeeded. (pupa_fat_close) [!PUPA_UTIL]: Unrefer itself. * configure.ac (tmp_CFLAGS): Added -Wshadow, -Wpointer-arith, -Wmissing-prototypes, -Wundef and -Wstrict-prototypes.
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
CFLAGS="$tmp_CFLAGS"
fi
AC_SUBST(CFLAGS)
# Defined in aclocal.m4.
pupa_ASM_USCORE
pupa_CHECK_START_SYMBOL
pupa_CHECK_BSS_START_SYMBOL
pupa_CHECK_END_SYMBOL
if test "x$host_cpu" = xi386; then
pupa_I386_ASM_PREFIX_REQUIREMENT
pupa_I386_ASM_ADDR32
pupa_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
pupa_I386_CHECK_REGPARM_BUG
else
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)
pupa_PROG_OBJCOPY_ABSOLUTE
AC_CHECK_TOOL(STRIP, strip)
AC_CHECK_TOOL(NM, nm)
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.
if test "x$build" = "x$host"; then
BUILD_CC="$CC"
AC_SUBST(BUILD_CC)
else
AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc],
[AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])])
fi
# Test the C compiler for the build environment.
tmp_CC="$CC"
tmp_CFLAGS="$CFLAGS"
tmp_CPPFLAGS="$CPPFLAGS"
2002-12-27 08:53:07 +00:00
CC="$BUILD_CC"
CFLAGS="$BUILD_CFLAGS"
CPPFLAGS="$BUILD_CPPFLAGS"
# 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)
# Check LZO.
AC_CHECK_LIB(lzo, __lzo_init2, ,
AC_MSG_ERROR([LZO library version 1.02 or later is required]))
AC_CHECK_FUNC(lzo1x_999_compress, ,
[AC_MSG_ERROR([LZO1X-999 must be enabled])])
CC="$tmp_CC"
CFLAGS="$tmp_CFLAGS"
CPPFLAGS="$tmp_CPPFLAGS"
2002-12-27 08:53:07 +00:00
# Output files.
AC_CONFIG_LINKS([include/pupa/cpu:include/pupa/$host_cpu
include/pupa/machine:include/pupa/$host_cpu/$host_vendor])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
AC_OUTPUT