📄 configure.ac
字号:
dnl Configure script for GRUB.dnl Copyright 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.dnl Permission to use, copy, modify and distribute this software and itsdnl documentation is hereby granted, provided that both the copyrightdnl notice and this permission notice appear in all copies of thednl software, derivative works or modified versions, and any portionsdnl thereof, and that both notices appear in supporting documentation.dnldnl THE FREE SOFTWARE FOUNDATION ALLOWS FREE USE OF THIS SOFTWARE IN ITSdnl "AS IS" CONDITION. THE FREE SOFTWARE FOUNDATION DISCLAIMS ANYdnl LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THEdnl USE OF THIS SOFTWARE.AC_PREREQ(2.57)AC_INIT([GRUB], [0.95], [bug-grub@gnu.org])AC_CONFIG_SRCDIR([stage2/stage2.c])AC_CONFIG_HEADER([config.h])AM_INIT_AUTOMAKEAC_CANONICAL_HOSTcase "$host_cpu" ini[[3456]]86) host_cpu=i386 ;;x86_64) host_cpu=x86_64 ;;*) AC_MSG_ERROR([unsupported CPU type]) ;;esacAC_SUBST(host_cpu)AC_SUBST(host_vendor)## Options#AM_MAINTAINER_MODEif test "x$enable_maintainer_mode" = xyes; then AC_PATH_PROG(PERL,perl) if test -z "$PERL"; then AC_MSG_ERROR([perl not found]) fifi# This should be checked before AC_PROG_CCif test "x$CFLAGS" = x; then default_CFLAGS=yesfiif test "x$host_cpu" = xx86_64; then CFLAGS="-m32 $CFLAGS"fi## Programs#AC_CHECK_TOOL(CC, gcc)AC_PROG_CC# We need this for older versions of Autoconf._AM_DEPENDENCIES(CC)dnl Because recent automake complains about AS, set it here.CCAS="$CC"AC_SUBST(CCAS)AC_ARG_WITH(binutils, [ --with-binutils=DIR search the directory DIR to find binutils])if test "x$with_binutils" != x; thendnl AC_PATH_TOOL is not seen in autoconf 2.13, so use AC_PATH_PROGdnl instead for now. It is preferable when you cross-compile GRUB.dnl AC_PATH_TOOL(RANLIB, ranlib, :, "$with_binutils:$PATH") AC_PATH_PROG(RANLIB, ranlib, :, "$with_binutils:$PATH")else AC_PROG_RANLIBfi# optimization flagsif test "x$ac_cv_prog_gcc" = xyes; then if test "x$default_CFLAGS" = xyes; then # Autoconf may set CFLAGS to -O2 and/or -g. So eliminate them. CFLAGS="`echo $CFLAGS | sed -e 's/-g//g' -e 's/-O[[0-9]]//g'` -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 # OpenBSD has a GCC extension for protecting applications from # stack smashing attacks, but GRUB doesn't want this feature. AC_CACHE_CHECK([whether gcc has -fno-stack-protector], no_stack_protector_flag, [ saved_CFLAGS=$CFLAGS CFLAGS="-fno-stack-protector" AC_TRY_COMPILE(, , no_stack_protector_flag=yes, no_stack_protector_flag=no) CFLAGS=$saved_CFLAGS ]) if test "x$no_stack_protector_flag" = xyes; then STAGE2_CFLAGS="$STAGE2_CFLAGS -fno-stack-protector" fi fifiAC_SUBST(STAGE1_CFLAGS)AC_SUBST(STAGE2_CFLAGS)AC_SUBST(GRUB_CFLAGS)# Enforce coding standards.CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused -Wshadow"CPPFLAGS="$CPPFLAGS -Wpointer-arith"AC_CACHE_CHECK([whether -Wundef works], undef_flag, [ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-Wundef" AC_TRY_COMPILE(, , undef_flag=yes, undef_flag=no) CPPFLAGS="$saved_CPPFLAGS"])# The options `-falign-*' are supported by gcc 3.0 or later.# Probably it is sufficient to only check for -falign-loops.AC_CACHE_CHECK([whether -falign-loops works], [falign_loop_flag], [ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="-falign-loops=1" AC_TRY_COMPILE(, , [falign_loop_flag=yes], [falign_loop_flag=no]) CPPFLAGS="$saved_CPPFLAGS"])# Force no alignment to save space.if test "x$falign_loop_flag" = xyes; then CPPFLAGS="$CPPFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"else CPPFLAGS="$CPPFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"fiif test "x$undef_flag" = xyes; then CPPFLAGS="$CPPFLAGS -Wundef"fiif test "x$with_binutils" != x; thendnl AC_PATH_TOOL(OBJCOPY, objcopy, , "$with_binutils:$PATH") AC_PATH_PROG(OBJCOPY, objcopy, , "$with_binutils:$PATH")else AC_CHECK_TOOL(OBJCOPY, objcopy)fi# Defined in acinclude.m4.grub_ASM_USCOREgrub_PROG_OBJCOPY_ABSOLUTEif test "x$grub_cv_prog_objcopy_absolute" != xyes; then AC_MSG_ERROR([GRUB requires a working absolute objcopy; upgrade your binutils])figrub_ASM_PREFIX_REQUIREMENTgrub_ASM_ADDR32if test "x$grub_cv_asm_addr32" != xyes; then AC_MSG_ERROR([GRUB requires GAS .code16 addr32 support; upgrade your binutils])figrub_ASM_ABSOLUTE_WITHOUT_ASTERISKgrub_CHECK_START_SYMBOLgrub_CHECK_USCORE_START_SYMBOLif 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])figrub_CHECK_USCORE_USCORE_BSS_START_SYMBOLgrub_CHECK_USCORE_EDATA_SYMBOLgrub_CHECK_EDATA_SYMBOLif test "x$grub_cv_check_uscore_uscore_bss_start_symbol" != "xyes" \ -a "x$grub_cv_check_uscore_edata_symbol" != "xyes" \ -a "x$grub_cv_check_edata_symbol" != "xyes"; then AC_MSG_ERROR([None of __bss_start, _edata, edata defined])figrub_CHECK_END_SYMBOLgrub_CHECK_USCORE_END_SYMBOLif 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])# Get the filename or the whole disk and open it.# Known to work on NetBSD.AC_CHECK_LIB(util, opendisk, [GRUB_LIBS="$GRUB_LIBS -lutil" AC_DEFINE(HAVE_OPENDISK, 1, [Define if opendisk() in -lutil can be used])])# 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, 1, [Define if you have a curses library])], [AC_CHECK_LIB(curses, wgetch, [GRUB_LIBS="$GRUB_LIBS -lcurses" AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have a curses library])])])fiAC_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"fiAC_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"fiAC_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"fiAC_ARG_ENABLE(ufs2, [ --disable-ufs2 disable UFS2 support in Stage 2])if test x"$enable_ufs2" != xno; then FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_UFS2=1"fiAC_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"fiAC_ARG_ENABLE(reiserfs, [ --disable-reiserfs disable ReiserFS support in Stage 2])if test x"$enable_reiserfs" != xno; then FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_REISERFS=1"fiAC_ARG_ENABLE(vstafs, [ --disable-vstafs disable VSTa FS support in Stage 2])if test x"$enable_vstafs" != xno; then FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_VSTAFS=1"fiAC_ARG_ENABLE(jfs, [ --disable-jfs disable IBM JFS support in Stage 2])if test x"$enable_jfs" != xno; then FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_JFS=1"fiAC_ARG_ENABLE(xfs, [ --disable-xfs disable SGI XFS support in Stage 2])if test x"$enable_xfs" != xno; then FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_XFS=1"fiAC_ARG_ENABLE(iso9660, [ --disable-iso9660 disable ISO9660 support in Stage 2])if test x"$enable_iso9660" != xno; then FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_ISO9660=1"fidnl AC_ARG_ENABLE(tftp,dnl [ --enable-tftp enable TFTP support in Stage 2])dnl dnl #if test x"$enable_tftp" = xyes; thendnl FSYS_CFLAGS="$FSYS_CFLAGS -DFSYS_TFTP=1"dnl fiAC_ARG_ENABLE(gunzip, [ --disable-gunzip disable decompression in Stage 2])if test x"$enable_gunzip" = xno; then FSYS_CFLAGS="$FSYS_CFLAGS -DNO_DECOMPRESSION=1"fiAC_ARG_ENABLE(md5-password, [ --disable-md5-password disable MD5 password support in Stage 2])if test "x$enable_md5_password" != xno; then FSYS_CFLAGS="$FSYS_CFLAGS -DUSE_MD5_PASSWORDS=1"fidnl The netboot support.dnl General options.AC_ARG_ENABLE(packet-retransmission, [ --disable-packet-retransmission turn off packet retransmission])if test "x$enable_packet_retransmission" != xno; then NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONGESTED=1"fiAC_ARG_ENABLE(pci-direct, [ --enable-pci-direct access PCI directly instead of using BIOS])if test "x$enable_pci_direct" = xyes; then NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCONFIG_PCI_DIRECT=1"fidnl Device drivers.AC_ARG_ENABLE(3c509, [ --enable-3c509 enable 3Com509 driver])if test "x$enable_3c509" = xyes; then NET_CFLAGS="$NET_CFLAGS -DINCLUDE_3C509" NETBOOT_DRIVERS="$NETBOOT_DRIVERS 3c509.o"fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -