blob: df3903b0ddf6332276f3ef141f072d43c6dbcb0f [file] [log] [blame] [raw]
dnl Configure script for GRUB.
dnl Copyright 1999 Free Software Foundation, Inc.
dnl Permission to use, copy, modify and distribute this software and its
dnl documentation is hereby granted, provided that both the copyright
dnl notice and this permission notice appear in all copies of the
dnl software, derivative works or modified versions, and any portions
dnl thereof, and that both notices appear in supporting documentation.
dnl
dnl THE FREE SOFTWARE FOUNDATION ALLOWS FREE USE OF THIS SOFTWARE IN ITS
dnl "AS IS" CONDITION. THE FREE SOFTWARE FOUNDATION DISCLAIMS ANY
dnl LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
dnl USE OF THIS SOFTWARE.
AC_INIT(stage2/stage2.c)
dnl Grab the package and version from the top debian/changelog entry.
AM_INIT_AUTOMAKE(
esyscmd([sed 's/ .*$//; q' debian/changelog]),
esyscmd([sed 's/^.*(\(.*\)).*$/\1/; q' debian/changelog]))dnl
AM_CONFIG_HEADER(config.h)
AC_PREREQ(2.13)
AC_CANONICAL_HOST
case "$host_cpu" in
i[[3456]]86) host_cpu=i386 ;;
*) AC_MSG_ERROR([unsupported CPU type]) ;;
esac
AC_SUBST(host_cpu)
AC_SUBST(host_vendor)
#
# Options
#
AM_MAINTAINER_MODE
if test "x$enable_maintainer_mode" = xyes; then
AC_PATH_PROG(PERL,perl)
if test -z "$PERL"; then
AC_MSG_ERROR([perl not found])
fi
fi
# This should be checked before AC_PROG_CC
if test "x$CFLAGS" = x; then
default_CFLAGS=yes
fi
#
# Programs
#
AC_CHECK_TOOL(CC, gcc)
AC_PROG_CC
AC_ARG_WITH(binutils,
[ --with-binutils=DIR search the directory DIR to find binutils])
if test "x$with_binutils" != x; then
AC_PATH_PROG(RANLIB, ranlib, :, "$with_binutils:$PATH")
else
AC_PROG_RANLIB
fi
# optimization flags
if test "x$ac_cv_prog_gcc" = xyes; then
if test "x$default_CFLAGS" = xyes; then
CFLAGS="-g"
# If the user specify the directory for binutils, add the option `-B'.
if test "x$with_binutils" != x; then
CFLAGS="-B$with_binutils/ $CFLAGS"
fi
STAGE1_CFLAGS="-O2"
GRUB_CFLAGS="-O2"
AC_CACHE_CHECK([whether optimization for size works], size_flag, [
saved_CFLAGS=$CFLAGS
CFLAGS="-Os -g"
AC_TRY_COMPILE(, , size_flag=yes, size_flag=no)
CFLAGS=$saved_CFLAGS
])
if test "x$size_flag" = xyes; then
STAGE2_CFLAGS="-Os"
else
STAGE2_CFLAGS="-O2 -fno-strength-reduce -fno-unroll-loops"
fi
fi
fi
AC_SUBST(STAGE1_CFLAGS)
AC_SUBST(STAGE2_CFLAGS)
AC_SUBST(GRUB_CFLAGS)
# Enforce coding standards.
CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused"
if test "x$with_binutils" != x; then
AC_PATH_PROG(OBJCOPY, objcopy, , "$with_binutils:$PATH")
else
AC_CHECK_TOOL(OBJCOPY, objcopy)
fi
# Defined in acinclude.m4.
grub_ASM_USCORE
grub_PROG_OBJCOPY_ABSOLUTE
if test "x$grub_cv_prog_objcopy_absolute" != xyes; then
AC_MSG_ERROR([GRUB requires a working absolute objcopy; upgrade your binutils])
fi
grub_ASM_PREFIX_REQUIREMENT
grub_ASM_ADDR32
if test "x$grub_cv_asm_addr32" != xyes; then
AC_MSG_ERROR([GRUB requires GAS .code16 addr32 support; upgrade your binutils])
fi
grub_CHECK_START_SYMBOL
grub_CHECK_USCORE_START_SYMBOL
if test "x$grub_cv_check_start_symbol" != "xyes" \
-a "x$grub_cv_check_uscore_start_symbol" != "xyes"; then
AC_MSG_ERROR([Neither start nor _start is defined])
fi
grub_CHECK_END_SYMBOL
grub_CHECK_USCORE_END_SYMBOL
if test "x$grub_cv_check_end_symbol" != "xyes" \
-a "x$grub_cv_check_uscore_end_symbol" != "xyes"; then
AC_MSG_ERROR([Neither end nor _end is defined])
fi
# Check for curses libraries.
AC_ARG_WITH(curses,
[ --without-curses do not use curses])
# Unless the user specify --without-curses, check for curses.
if test "x$with_curses" != "xno"; then
AC_CHECK_LIB(ncurses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lncurses"
AC_DEFINE(HAVE_LIBCURSES)],
[AC_CHECK_LIB(curses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lcurses"
AC_DEFINE(HAVE_LIBCURSES)])])
fi
AC_SUBST(GRUB_LIBS)
# Check for headers.
AC_CHECK_HEADERS(string.h strings.h ncurses/curses.h ncurses.h curses.h)
# Check for user options.
# filesystems support.
AC_ARG_ENABLE(ext2fs,
[ --disable-ext2fs disable ext2fs support in Stage 2])
if test x"$enable_ext2fs" != xno; then
FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_EXT2FS=1"
fi
AC_ARG_ENABLE(fat,
[ --disable-fat disable FAT support in Stage 2])
if test x"$enable_fat" != xno; then
FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FAT=1"
fi
AC_ARG_ENABLE(ffs,
[ --disable-ffs disable FFS support in Stage 2])
if test x"$enable_ffs" != xno; then
FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_FFS=1"
fi
AC_ARG_ENABLE(minix,
[ --disable-minix disable Minix fs support in Stage 2])
if test x"$enable_minix" != xno; then
FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_MINIX=1"
fi
AC_ARG_ENABLE(tftp,
[ --enable-tftp enable TFTP support in Stage 2])
if test x"$enable_tftp" = xyes; then
FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1"
fi
AC_ARG_ENABLE(gunzip,
[ --disable-gunzip disable decompression in Stage 2])
if test x"$enable_gunzip" = xno; then
FSYS_CFLAGS="$FSYS_CFLAGS -DNO_DECOMPRESSION=1"
fi
AC_SUBST(FSYS_CFLAGS)
AC_ARG_ENABLE(ne,
[ --enable-ne enable NE1000/2000 network driver in Stage 2])
if test x"$enable_ne" = xyes; then
NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NE=1"
fi
AC_ARG_ENABLE(nepci,
[ --enable-nepci enable PCI NE2000 network driver in Stage 2])
if test x"$enable_nepci" = xyes; then
NET_CFLAGS="$NET_CFLAGS -DINCLUDE_NEPCI=1"
fi
AC_ARG_ENABLE(wd,
[ --enable-wd enable WD/SMC network driver in Stage 2])
if test x"$enable_wd" = xyes; then
NET_CFLAGS="$NET_CFLAGS -DINCLUDE_WD=1"
fi
AC_ARG_ENABLE(t503,
[ --enable-t503 enable 3C503 network driver in Stage 2])
if test x"$enable_t503" = xyes; then
NET_CFLAGS="$NET_CFLAGS -DINCLUDE_T503=1"
fi
AC_ARG_ENABLE(t509,
[ --enable-t509 enable 3C509 network driver in Stage 2])
if test x"$enable_t509" = xyes; then
NET_CFLAGS="$NET_CFLAGS -DINCLUDE_T509=1"
fi
AC_ARG_ENABLE(3c59x,
[ --enable-3c59x enable 3C59x network driver in Stage 2])
if test x"$enable_3c59x" = xyes; then
NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C59X=1"
fi
AC_ARG_ENABLE(lance,
[ --enable-lance enable LANCE network driver in Stage 2])
if test x"$enable_lance" = xyes; then
NET_CFLAGS="$NET_CFLAGS -DINCLUDE_LANCE=1"
fi
AC_ARG_ENABLE(cs,
[ --enable-cs enable CS89*0 network driver in Stage 2])
if test x"$enable_cs" = xyes; then
NET_CFLAGS="$NET_CFLAGS -DINCLUDE_CS=1"
fi
AC_ARG_ENABLE(eepro100,
[ --enable-eepro100 enable EtherExpress100 network driver in Stage 2])
if test x"$enable_eepro100" = xyes; then
NET_CFLAGS="$NET_CFLAGS -DINCLUDE_EEPRO100=1"
fi
AC_SUBST(NET_CFLAGS)
AM_CONDITIONAL(NETBOOT_SUPPORT, test ! -z "$NET_CFLAGS")
AC_ARG_ENABLE(ne-scan,
[ --enable-ne-scan set the parameter for NE network driver],
[NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=$enable_ne_scan"],
[NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DNE_SCAN=0x280,0x300,0x320,0x340"])
AC_ARG_ENABLE(wd-default-mem,
[ --enable-wd-default-mem set the parameter for WD network driver],
[NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=$enable_wd_default_mem"],
[NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DWD_DEFAULT_MEM=0xCC000"])
AC_ARG_ENABLE(cs-scan,
[ --enable-cs-scan set the parameter for CS network driver],
[NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCS_SCAN=$enable_cs_scan"])
AC_SUBST(NET_EXTRAFLAGS)
# Output.
AC_OUTPUT([Makefile stage1/Makefile stage2/Makefile docs/Makefile \
debian/Makefile lib/Makefile grub/Makefile netboot/Makefile])