add support for a preset menu file.

This commit is contained in:
okuji 2000-11-15 04:30:23 +00:00
parent 002f8f7c21
commit 455795862c
10 changed files with 366 additions and 92 deletions

View file

@ -1,3 +1,22 @@
2000-11-15 OKUJI Yoshinori <okuji@gnu.org>
* acconfig.h (PRESET_MENU_STRING): New entry.
* acinclude.m4 (grub_DEFINE_FILE): New M4 macro.
* configure.in (--enable-preset-menu): New option.
* stage2/stage2.c [PRESET_MENU_STRING] (preset_menu): New
variable.
[PRESET_MENU_STRING] (preset_menu_offset): Likewise.
[PRESET_MENU_STRING] (open_preset_menu): New function.
[PRESET_MENU_STRING] (read_from_preset_menu): Likewise.
[PRESET_MENU_STRING] (close_preset_menu): Likewise.
[!PRESET_MENU_STRING] (open_preset_menu): New macro.
[!PRESET_MENU_STRING] (read_from_preset_menu): Likewise.
[!PRESET_MENU_STRING] (close_preset_menu): Likewise.
(get_line_from_config): Accept a new argument READ_FROM_FILE.
If it is false, read data from the preset menu instead.
(cmain): If grub_open fails in opening the configuration file,
then try to open the preset menu.
2000-11-11 OKUJI Yoshinori <okuji@gnu.org>
From Jan Fricke <fricke@uni-greifswald.de>:

View file

@ -231,6 +231,12 @@ operates.
option is useful for GRUB developers, as you can test the
performance of a terminal emulation even on pseudo terminals.
`--enable-preset-menu=FILE'
Preset a menu file FILE in Stage 2. This is useful, if you cannot
put a configuration file on a filesystem for some reason (e.g. when
you need to set the default terminal to a serial terminal in an
embedded system).
`configure' also accepts several options for the network support. See
the file `netboot/README.netboot', for more information.

4
NEWS
View file

@ -15,6 +15,10 @@ New in 1.0 - XXXX-XX-XX:
* The new utility ``grub-md5-crypt'' is a fontend of the grub shell. It
encrypts a password in MD5 format.
* New commands, "testvbe" and "vbeprobe".
* The configure script accepts a new option, `--enable-preset-menu'. You
can embed a arbitrary configuration which will be used when Stage 2
cannot open a real configuration file, with this option. The argument
must be an existing file.
New in 0.5.96 - 2000-10-04:
* New commands, "reboot" and "halt".

View file

@ -27,3 +27,6 @@
/* Defined if an absolute indirect call/jump must NOT be prefixed with `*'. */
#undef ABSOLUTE_WITHOUT_ASTERISK
/* Defined if the user specifies --enable-preset-menu=FILE. */
#undef PRESET_MENU_STRING

View file

@ -312,3 +312,52 @@ fi
AC_MSG_RESULT([$grub_cv_check_uscore_end_symbol])
])
dnl grub_DEFINE_FILE(MACRO_NAME, FILE_NAME)
dnl grub_DEFINE_FILE defines a macro as the contents of a file safely.
dnl Replace some escape sequences, because autoconf doesn't handle them
dnl gracefully.
dnl Written by OKUJI Yoshinori.
AC_DEFUN(grub_DEFINE_FILE,
[AC_REQUIRE([AC_PROG_CC])
# Because early versions of GNU sed 3.x are too buggy, use a C program
# instead of shell commands. *sigh*
cat >conftest.c <<\EOF
#include <stdio.h>
int
main (void)
{
int c;
while ((c = getchar ()) != EOF)
{
switch (c)
{
case '\n':
fputs ("\\n", stdout);
break;
case '\r':
fputs ("\\r", stdout);
break;
case '\\':
fputs ("\\\\", stdout);
break;
default:
putchar (c);
}
}
return 0;
}
EOF
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} conftest.c -o conftest]) && test -s conftest; then
grub_tmp_value=`./conftest < "[$2]"`
else
AC_MSG_ERROR([${CC-cc} failed to produce an executable file])
fi
AC_DEFINE_UNQUOTED([$1], "$grub_tmp_value")
rm -f conftest*
])

49
aclocal.m4 vendored
View file

@ -325,6 +325,55 @@ fi
AC_MSG_RESULT([$grub_cv_check_uscore_end_symbol])
])
dnl grub_DEFINE_FILE(MACRO_NAME, FILE_NAME)
dnl grub_DEFINE_FILE defines a macro as the contents of a file safely.
dnl Replace some escape sequences, because autoconf doesn't handle them
dnl gracefully.
dnl Written by OKUJI Yoshinori.
AC_DEFUN(grub_DEFINE_FILE,
[AC_REQUIRE([AC_PROG_CC])
# Because early versions of GNU sed 3.x are too buggy, use a C program
# instead of shell commands. *sigh*
cat >conftest.c <<\EOF
#include <stdio.h>
int
main (void)
{
int c;
while ((c = getchar ()) != EOF)
{
switch (c)
{
case '\n':
fputs ("\\n", stdout);
break;
case '\r':
fputs ("\\r", stdout);
break;
case '\\':
fputs ("\\\\", stdout);
break;
default:
putchar (c);
}
}
return 0;
}
EOF
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} conftest.c -o conftest]) && test -s conftest; then
grub_tmp_value=`./conftest < "[$2]"`
else
AC_MSG_ERROR([${CC-cc} failed to produce an executable file])
fi
AC_DEFINE_UNQUOTED([$1], "$grub_tmp_value")
rm -f conftest*
])
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.

View file

@ -27,6 +27,9 @@
/* Defined if an absolute indirect call/jump must NOT be prefixed with `*'. */
#undef ABSOLUTE_WITHOUT_ASTERISK
/* Defined if the user specifies --enable-preset-menu=FILE. */
#undef PRESET_MENU_STRING
/* Define if you have the <curses.h> header file. */
#undef HAVE_CURSES_H

229
configure vendored
View file

@ -121,6 +121,9 @@ ac_help="$ac_help
ac_help="$ac_help
--enable-serial-speed-simulation
simulate the slowness of a serial device"
ac_help="$ac_help
--enable-preset-menu=FILE
preset a menu file FILE in Stage 2"
# Initialize some variables set by options.
# The variables have the same names as the options, with
@ -662,7 +665,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:666: checking for a BSD compatible install" >&5
echo "configure:669: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -715,7 +718,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
echo "configure:719: checking whether build environment is sane" >&5
echo "configure:722: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@ -787,7 +790,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:791: checking for $ac_word" >&5
echo "configure:794: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -817,7 +820,7 @@ test -n "$AWK" && break
done
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
echo "configure:821: checking whether ${MAKE-make} sets \${MAKE}" >&5
echo "configure:824: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -943,7 +946,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
echo "configure:947: checking host system type" >&5
echo "configure:950: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@ -977,7 +980,7 @@ esac
#
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
echo "configure:981: checking whether to enable maintainer-specific portions of Makefiles" >&5
echo "configure:984: checking whether to enable maintainer-specific portions of Makefiles" >&5
# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
enableval="$enable_maintainer_mode"
@ -1003,7 +1006,7 @@ if test "x$enable_maintainer_mode" = xyes; then
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1007: checking for $ac_word" >&5
echo "configure:1010: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1050,7 +1053,7 @@ fi
#
echo $ac_n "checking build system type""... $ac_c" 1>&6
echo "configure:1054: checking build system type" >&5
echo "configure:1057: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@ -1076,7 +1079,7 @@ fi
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1080: checking for $ac_word" >&5
echo "configure:1083: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1108,7 +1111,7 @@ fi
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1112: checking for $ac_word" >&5
echo "configure:1115: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1138,7 +1141,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1142: checking for $ac_word" >&5
echo "configure:1145: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1189,7 +1192,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1193: checking for $ac_word" >&5
echo "configure:1196: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1221,7 +1224,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
echo "configure:1225: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
echo "configure:1228: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@ -1232,12 +1235,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
#line 1236 "configure"
#line 1239 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
if { (eval echo configure:1241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@ -1263,12 +1266,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
echo "configure:1267: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "configure:1270: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
echo "configure:1272: checking whether we are using GNU C" >&5
echo "configure:1275: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1277,7 +1280,7 @@ else
yes;
#endif
EOF
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1281: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@ -1296,7 +1299,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
echo "configure:1300: checking whether ${CC-cc} accepts -g" >&5
echo "configure:1303: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1329,7 +1332,7 @@ fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
echo "configure:1333: checking how to run the C preprocessor" >&5
echo "configure:1336: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@ -1344,13 +1347,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
#line 1348 "configure"
#line 1351 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1354: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1357: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1361,13 +1364,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
#line 1365 "configure"
#line 1368 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1371: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1374: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1378,13 +1381,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
#line 1382 "configure"
#line 1385 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:1388: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:1391: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@ -1417,7 +1420,7 @@ echo "$ac_t""$CPP" 1>&6
depcc="$CC"
depcpp="$CPP"
echo $ac_n "checking dependency style of $depcc""... $ac_c" 1>&6
echo "configure:1421: checking dependency style of $depcc" >&5
echo "configure:1424: checking dependency style of $depcc" >&5
if eval "test \"`echo '$''{'am_cv_CC_dependencies_compiler_type'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1473,7 +1476,7 @@ if test "x$with_binutils" != x; then
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1477: checking for $ac_word" >&5
echo "configure:1480: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1510,7 +1513,7 @@ else
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1514: checking for $ac_word" >&5
echo "configure:1517: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1550,7 +1553,7 @@ if test "x$ac_cv_prog_gcc" = xyes; then
STAGE1_CFLAGS="-O2"
GRUB_CFLAGS="-O2"
echo $ac_n "checking whether optimization for size works""... $ac_c" 1>&6
echo "configure:1554: checking whether optimization for size works" >&5
echo "configure:1557: checking whether optimization for size works" >&5
if eval "test \"`echo '$''{'size_flag'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1558,14 +1561,14 @@ else
saved_CFLAGS=$CFLAGS
CFLAGS="-Os -g"
cat > conftest.$ac_ext <<EOF
#line 1562 "configure"
#line 1565 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
if { (eval echo configure:1569: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1572: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
size_flag=yes
else
@ -1597,7 +1600,7 @@ CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused -Wshadow"
CPPFLAGS="$CPPFLAGS -Wpointer-arith"
echo $ac_n "checking whether -Wundef works""... $ac_c" 1>&6
echo "configure:1601: checking whether -Wundef works" >&5
echo "configure:1604: checking whether -Wundef works" >&5
if eval "test \"`echo '$''{'undef_flag'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1605,14 +1608,14 @@ else
saved_CPPFLAGS=$CPPFLAGS
CPPFLAGS="-Wundef"
cat > conftest.$ac_ext <<EOF
#line 1609 "configure"
#line 1612 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
if { (eval echo configure:1616: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:1619: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
undef_flag=yes
else
@ -1639,7 +1642,7 @@ if test "x$with_binutils" != x; then
# Extract the first word of "objcopy", so it can be a program name with args.
set dummy objcopy; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1643: checking for $ac_word" >&5
echo "configure:1646: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_OBJCOPY'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1675,7 +1678,7 @@ else
# Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args.
set dummy ${ac_tool_prefix}objcopy; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:1679: checking for $ac_word" >&5
echo "configure:1682: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1709,7 +1712,7 @@ fi
# Defined in acinclude.m4.
echo $ac_n "checking if C symbols get an underscore after compilation""... $ac_c" 1>&6
echo "configure:1713: checking if C symbols get an underscore after compilation" >&5
echo "configure:1716: checking if C symbols get an underscore after compilation" >&5
if eval "test \"`echo '$''{'grub_cv_asm_uscore'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1722,7 +1725,7 @@ func (int *list)
}
EOF
if { ac_try='${CC-cc} ${CFLAGS} -S conftest.c'; { (eval echo configure:1726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.s; then
if { ac_try='${CC-cc} ${CFLAGS} -S conftest.c'; { (eval echo configure:1729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.s; then
true
else
{ echo "configure: error: ${CC-cc} failed to produce assembly code" 1>&2; exit 1; }
@ -1748,7 +1751,7 @@ fi
echo "$ac_t""$grub_cv_asm_uscore" 1>&6
echo $ac_n "checking whether ${OBJCOPY} works for absolute addresses""... $ac_c" 1>&6
echo "configure:1752: checking whether ${OBJCOPY} works for absolute addresses" >&5
echo "configure:1755: checking whether ${OBJCOPY} works for absolute addresses" >&5
if eval "test \"`echo '$''{'grub_cv_prog_objcopy_absolute'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1760,21 +1763,21 @@ cmain (void)
}
EOF
if { (eval echo configure:1764: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then :
if { (eval echo configure:1767: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then :
else
{ echo "configure: error: ${CC-cc} cannot compile C source code" 1>&2; exit 1; }
fi
grub_cv_prog_objcopy_absolute=yes
for link_addr in 2000 8000 7C00; do
if { ac_try='${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec'; { (eval echo configure:1770: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then :
if { ac_try='${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec'; { (eval echo configure:1773: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then :
else
{ echo "configure: error: ${CC-cc} cannot link at address $link_addr" 1>&2; exit 1; }
fi
if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest'; { (eval echo configure:1774: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then :
if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest'; { (eval echo configure:1777: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then :
else
{ echo "configure: error: ${OBJCOPY-objcopy} cannot create binary files" 1>&2; exit 1; }
fi
if test ! -f conftest.old || { ac_try='cmp -s conftest.old conftest'; { (eval echo configure:1778: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
if test ! -f conftest.old || { ac_try='cmp -s conftest.old conftest'; { (eval echo configure:1781: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
mv -f conftest conftest.old
else
grub_cv_prog_objcopy_absolute=no
@ -1791,7 +1794,7 @@ fi
echo $ac_n "checking whether addr32 must be in the same line as the instruction""... $ac_c" 1>&6
echo "configure:1795: checking whether addr32 must be in the same line as the instruction" >&5
echo "configure:1798: checking whether addr32 must be in the same line as the instruction" >&5
if eval "test \"`echo '$''{'grub_cv_asm_prefix_requirement'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1800,7 +1803,7 @@ else
l1: addr32 movb %al, l1
EOF
if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1804: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then
if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1807: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then
grub_cv_asm_prefix_requirement=yes
else
grub_cv_asm_prefix_requirement=no
@ -1832,7 +1835,7 @@ echo "$ac_t""$grub_cv_asm_prefix_requirement" 1>&6
echo $ac_n "checking for .code16 addr32 assembler support""... $ac_c" 1>&6
echo "configure:1836: checking for .code16 addr32 assembler support" >&5
echo "configure:1839: checking for .code16 addr32 assembler support" >&5
if eval "test \"`echo '$''{'grub_cv_asm_addr32'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1847,7 +1850,7 @@ else
sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s
fi
if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1851: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then
if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1854: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then
grub_cv_asm_addr32=yes
else
grub_cv_asm_addr32=no
@ -1864,7 +1867,7 @@ fi
echo $ac_n "checking whether an absolute indirect call/jump must not be prefixed with an asterisk""... $ac_c" 1>&6
echo "configure:1868: checking whether an absolute indirect call/jump must not be prefixed with an asterisk" >&5
echo "configure:1871: checking whether an absolute indirect call/jump must not be prefixed with an asterisk" >&5
if eval "test \"`echo '$''{'grub_cv_asm_absolute_without_asterisk'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -1875,7 +1878,7 @@ offset:
.word 0
EOF
if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1879: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then
if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1882: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then
grub_cv_asm_absolute_without_asterisk=no
else
grub_cv_asm_absolute_without_asterisk=yes
@ -1896,19 +1899,19 @@ echo "$ac_t""$grub_cv_asm_absolute_without_asterisk" 1>&6
echo $ac_n "checking if start is defined by the compiler""... $ac_c" 1>&6
echo "configure:1900: checking if start is defined by the compiler" >&5
echo "configure:1903: checking if start is defined by the compiler" >&5
if eval "test \"`echo '$''{'grub_cv_check_start_symbol'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1905 "configure"
#line 1908 "configure"
#include "confdefs.h"
int main() {
asm ("incl start")
; return 0; }
EOF
if { (eval echo configure:1912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
grub_cv_check_start_symbol=yes
else
@ -1932,19 +1935,19 @@ echo "$ac_t""$grub_cv_check_start_symbol" 1>&6
echo $ac_n "checking if _start is defined by the compiler""... $ac_c" 1>&6
echo "configure:1936: checking if _start is defined by the compiler" >&5
echo "configure:1939: checking if _start is defined by the compiler" >&5
if eval "test \"`echo '$''{'grub_cv_check_uscore_start_symbol'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1941 "configure"
#line 1944 "configure"
#include "confdefs.h"
int main() {
asm ("incl _start")
; return 0; }
EOF
if { (eval echo configure:1948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1951: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
grub_cv_check_uscore_start_symbol=yes
else
@ -1973,19 +1976,19 @@ fi
echo $ac_n "checking if __bss_start is defined by the compiler""... $ac_c" 1>&6
echo "configure:1977: checking if __bss_start is defined by the compiler" >&5
echo "configure:1980: checking if __bss_start is defined by the compiler" >&5
if eval "test \"`echo '$''{'grub_cv_check_uscore_uscore_bss_start_symbol'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 1982 "configure"
#line 1985 "configure"
#include "confdefs.h"
int main() {
asm ("incl __bss_start")
; return 0; }
EOF
if { (eval echo configure:1989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:1992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
grub_cv_check_uscore_uscore_bss_start_symbol=yes
else
@ -2009,19 +2012,19 @@ echo "$ac_t""$grub_cv_check_uscore_uscore_bss_start_symbol" 1>&6
echo $ac_n "checking if _edata is defined by the compiler""... $ac_c" 1>&6
echo "configure:2013: checking if _edata is defined by the compiler" >&5
echo "configure:2016: checking if _edata is defined by the compiler" >&5
if eval "test \"`echo '$''{'grub_cv_check_uscore_edata_symbol'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2018 "configure"
#line 2021 "configure"
#include "confdefs.h"
int main() {
asm ("incl _edata")
; return 0; }
EOF
if { (eval echo configure:2025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
grub_cv_check_uscore_edata_symbol=yes
else
@ -2045,19 +2048,19 @@ echo "$ac_t""$grub_cv_check_uscore_edata_symbol" 1>&6
echo $ac_n "checking if edata is defined by the compiler""... $ac_c" 1>&6
echo "configure:2049: checking if edata is defined by the compiler" >&5
echo "configure:2052: checking if edata is defined by the compiler" >&5
if eval "test \"`echo '$''{'grub_cv_check_edata_symbol'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2054 "configure"
#line 2057 "configure"
#include "confdefs.h"
int main() {
asm ("incl edata")
; return 0; }
EOF
if { (eval echo configure:2061: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
grub_cv_check_edata_symbol=yes
else
@ -2087,19 +2090,19 @@ fi
echo $ac_n "checking if end is defined by the compiler""... $ac_c" 1>&6
echo "configure:2091: checking if end is defined by the compiler" >&5
echo "configure:2094: checking if end is defined by the compiler" >&5
if eval "test \"`echo '$''{'grub_cv_check_end_symbol'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2096 "configure"
#line 2099 "configure"
#include "confdefs.h"
int main() {
asm ("incl end")
; return 0; }
EOF
if { (eval echo configure:2103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
grub_cv_check_end_symbol=yes
else
@ -2123,19 +2126,19 @@ echo "$ac_t""$grub_cv_check_end_symbol" 1>&6
echo $ac_n "checking if _end is defined by the compiler""... $ac_c" 1>&6
echo "configure:2127: checking if _end is defined by the compiler" >&5
echo "configure:2130: checking if _end is defined by the compiler" >&5
if eval "test \"`echo '$''{'grub_cv_check_uscore_end_symbol'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2132 "configure"
#line 2135 "configure"
#include "confdefs.h"
int main() {
asm ("incl _end")
; return 0; }
EOF
if { (eval echo configure:2139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
grub_cv_check_uscore_end_symbol=yes
else
@ -2173,7 +2176,7 @@ fi
# Get the filename or the whole disk and open it.
# Known to work on NetBSD.
echo $ac_n "checking for opendisk in -lutil""... $ac_c" 1>&6
echo "configure:2177: checking for opendisk in -lutil" >&5
echo "configure:2180: checking for opendisk in -lutil" >&5
ac_lib_var=`echo util'_'opendisk | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -2181,7 +2184,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lutil $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2185 "configure"
#line 2188 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -2192,7 +2195,7 @@ int main() {
opendisk()
; return 0; }
EOF
if { (eval echo configure:2196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2220,7 +2223,7 @@ fi
# Unless the user specify --without-curses, check for curses.
if test "x$with_curses" != "xno"; then
echo $ac_n "checking for wgetch in -lncurses""... $ac_c" 1>&6
echo "configure:2224: checking for wgetch in -lncurses" >&5
echo "configure:2227: checking for wgetch in -lncurses" >&5
ac_lib_var=`echo ncurses'_'wgetch | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -2228,7 +2231,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lncurses $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2232 "configure"
#line 2235 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -2239,7 +2242,7 @@ int main() {
wgetch()
; return 0; }
EOF
if { (eval echo configure:2243: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2262,7 +2265,7 @@ EOF
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for wgetch in -lcurses""... $ac_c" 1>&6
echo "configure:2266: checking for wgetch in -lcurses" >&5
echo "configure:2269: checking for wgetch in -lcurses" >&5
ac_lib_var=`echo curses'_'wgetch | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@ -2270,7 +2273,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lcurses $LIBS"
cat > conftest.$ac_ext <<EOF
#line 2274 "configure"
#line 2277 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@ -2281,7 +2284,7 @@ int main() {
wgetch()
; return 0; }
EOF
if { (eval echo configure:2285: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:2288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -2316,17 +2319,17 @@ for ac_hdr in string.h strings.h ncurses/curses.h ncurses.h curses.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:2320: checking for $ac_hdr" >&5
echo "configure:2323: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2325 "configure"
#line 2328 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2330: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2333: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -2889,6 +2892,66 @@ if test "x$enable_diskless" = xyes; then
fi
fi
# Check whether --enable-preset-menu or --disable-preset-menu was given.
if test "${enable_preset_menu+set}" = set; then
enableval="$enable_preset_menu"
:
fi
if test "x$enable_preset_menu" = x; then
:
else
if test -r $enable_preset_menu; then
# Because early versions of GNU sed 3.x are too buggy, use a C program
# instead of shell commands. *sigh*
cat >conftest.c <<\EOF
#include <stdio.h>
int
main (void)
{
int c;
while ((c = getchar ()) != EOF)
{
switch (c)
{
case '\n':
fputs ("\\n", stdout);
break;
case '\r':
fputs ("\\r", stdout);
break;
case '\\':
fputs ("\\\\", stdout);
break;
default:
putchar (c);
}
}
return 0;
}
EOF
if { ac_try='${CC-cc} ${CFLAGS} conftest.c -o conftest'; { (eval echo configure:2939: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest; then
grub_tmp_value=`./conftest < "$enable_preset_menu"`
else
{ echo "configure: error: ${CC-cc} failed to produce an executable file" 1>&2; exit 1; }
fi
cat >> confdefs.h <<EOF
#define PRESET_MENU_STRING "$grub_tmp_value"
EOF
rm -f conftest*
else
{ echo "configure: error: Cannot read the preset menu file $enable_preset_menu" 1>&2; exit 1; }
fi
fi

View file

@ -517,6 +517,20 @@ if test "x$enable_diskless" = xyes; then
fi
fi
dnl Embed a menu string in GRUB itself.
AC_ARG_ENABLE(preset-menu,
[ --enable-preset-menu=FILE
preset a menu file FILE in Stage 2])
if test "x$enable_preset_menu" = x; then
:
else
if test -r $enable_preset_menu; then
grub_DEFINE_FILE(PRESET_MENU_STRING, [$enable_preset_menu])
else
AC_MSG_ERROR([Cannot read the preset menu file $enable_preset_menu])
fi
fi
dnl Now substitute the variables.
AC_SUBST(FSYS_CFLAGS)
AC_SUBST(NET_CFLAGS)

View file

@ -22,6 +22,47 @@
grub_jmp_buf restart_env;
#ifdef PRESET_MENU_STRING
static const char *preset_menu = PRESET_MENU_STRING;
static int preset_menu_offset;
static int
open_preset_menu (void)
{
preset_menu_offset = 0;
return 1;
}
static int
read_from_preset_menu (char *buf, int maxlen)
{
int len = grub_strlen (preset_menu + preset_menu_offset);
if (len > maxlen)
len = maxlen;
grub_memmove (buf, preset_menu + preset_menu_offset, len);
preset_menu_offset += len;
return len;
}
static void
close_preset_menu (void)
{
/* Do nothing. */
}
#else /* ! PRESET_MENU_STRING */
#define open_preset_menu() 0
#define read_from_preset_menu(buf, maxlen) 0
#define close_preset_menu()
#endif /* ! PRESET_MENU_STRING */
static char *
get_entry (char *list, int num, int nested)
{
@ -728,13 +769,24 @@ restart:
static int
get_line_from_config (char *cmdline, int maxlen)
get_line_from_config (char *cmdline, int maxlen, int read_from_file)
{
int pos = 0, literal = 0, comment = 0;
char c; /* since we're loading it a byte at a time! */
while (grub_read (&c, 1))
while (1)
{
if (read_from_file)
{
if (! grub_read (&c, 1))
break;
}
else
{
if (! read_from_preset_menu (&c, 1))
break;
}
/* translate characters first! */
if (c == '\\' && ! literal)
{
@ -793,6 +845,9 @@ cmain (void)
/* Never return. */
for (;;)
{
int is_opened = 0;
int is_preset = 0;
auto_fill = 1;
config_len = 0;
menu_len = 0;
@ -804,10 +859,16 @@ cmain (void)
/* Here load the configuration file. */
#ifdef GRUB_UTIL
if (use_config_file && grub_open (config_file))
#else
if (grub_open (config_file))
#endif
if (use_config_file)
#endif /* GRUB_UTIL */
{
is_opened = grub_open (config_file);
errnum = ERR_NONE;
if (! is_opened)
is_opened = is_preset = open_preset_menu ();
}
if (is_opened)
{
/* STATE 0: Before any title command.
STATE 1: In a title command.
@ -816,7 +877,7 @@ cmain (void)
char *cmdline;
cmdline = (char *) CMDLINE_BUF;
while (get_line_from_config (cmdline, NEW_HEAPSIZE))
while (get_line_from_config (cmdline, NEW_HEAPSIZE, ! is_preset))
{
struct builtin *builtin;
@ -896,7 +957,10 @@ cmain (void)
grub_memmove (config_entries + config_len, menu_entries, menu_len);
menu_entries = config_entries + config_len;
grub_close ();
if (is_preset)
close_preset_menu ();
else
grub_close ();
}
if (! num_entries)