Add all macros to acinclude.m4, update Makefiles.

Update version string with Automake package version.
This commit is contained in:
gord 1999-03-01 21:49:59 +00:00
parent 791601f51d
commit 4b55a25ce8
18 changed files with 250 additions and 72 deletions

View file

@ -1,5 +1,8 @@
1999-03-01 Gordon Matzigkeit <gord@trick.fig.org>
* shared_src/asm.S (version_string): Set the version string from
the VERSION specified in configure.in.
* Change all Makefiles into Makefile.ams. Many major build
environment changes to get Automake/Autoconf working nicely.

View file

@ -1,16 +1,11 @@
dnl grub_CHECK_C_SYMBOL_NAME checks what name gcc will use for C symbol.
dnl grub_ASM_EXT_C checks what name gcc will use for C symbol.
dnl Originally written by Erich Boleyn, the author of GRUB, and modified
dnl by OKUJI Yoshinori to autoconfiscate the test.
AC_DEFUN(grub_ASM_EXT_C,
[AC_PROG_CC
if test "x$GCC" != xyes; then
AC_MSG_ERROR([GNU C compiler not found])
fi
AC_MSG_CHECKING([symbol names produced by ${CC}])
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING([symbol names produced by ${CC-cc}])
AC_CACHE_VAL(grub_cv_asm_ext_c,
[cat << EOF > conftest.c
[cat > conftest.c <<\EOF
int
func (int *list)
{
@ -19,10 +14,9 @@ func (int *list)
}
EOF
if AC_TRY_COMMAND(${CC} -S conftest.c) && test -s conftest.s; then
true
if AC_TRY_COMMAND([${CC-cc} -S conftest.c]) && test -s conftest.s; then :
else
AC_MSG_ERROR([${CC} failed to produce assembly code])
AC_MSG_ERROR([${CC-cc} failed to produce assembly code])
fi
set dummy `grep \.globl conftest.s | grep func | sed -e s/\\.globl// | sed -e s/func/\ sym\ /`
@ -39,13 +33,73 @@ while shift; do
done
rm -f conftest*])
AC_MSG_RESULT($grub_cv_asm_ext_c)
AC_MSG_RESULT([$grub_cv_asm_ext_c])
AC_DEFINE_UNQUOTED([EXT_C(sym)], $grub_cv_asm_ext_c)
])
AC_DEFUN(grub_PROG_OBJCOPY_WORKS,
[echo "FIXME: would test objcopy"])
dnl Some versions of `objcopy -O binary' vary their output depending
dnl on the link address.
AC_DEFUN(grub_PROG_OBJCOPY_ABSOLUTE,
[AC_MSG_CHECKING([whether ${OBJCOPY} works for absolute addresses])
AC_CACHE_VAL(grub_cv_prog_objcopy_absolute,
[cat > conftest.c <<\EOF
void
blah (void)
{
*((int *) 0x1000) = 2;
}
EOF
AC_DEFUN(grub_GAS_ADDR32,
[echo "FIXME: would test addr32"])
if AC_TRY_EVAL(ac_compile) && test -s conftest.o; then :
else
AC_MSG_ERROR([${CC-cc} cannot compile C source code])
fi
grub_cv_prog_objcopy_absolute=yes
for link_addr in 2000 8000 7C00; do
if AC_TRY_COMMAND([${LD-ld} -N -Ttext $link_addr conftest.o -o conftest.exec]); then :
else
AC_MSG_ERROR([${LD-ld} cannot link at address $link_addr])
fi
if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec conftest]); then :
else
AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files])
fi
if test ! -f conftest.old || AC_TRY_COMMAND([cmp -s conftest.old conftest]); then :
else
grub_cv_prog_objcopy_absolute=no
break
fi
done
rm -f conftest*])
AC_MSG_RESULT([$grub_cv_prog_objcopy_absolute])])
dnl Mass confusion!
dnl Older versions of GAS interpret `.code16' to mean ``generate 32-bit
dnl instructions, but implicitly insert addr32 and data32 bytes so
dnl that the code works in real mode''.
dnl
dnl Newer versions of GAS interpret `.code16' to mean ``generate 16-bit
dnl instructions,'' which seems right. This requires the programmer
dnl to explicitly insert addr32 and data32 instructions when they want
dnl them.
dnl
dnl We only support the newer versions, because the old versions cause
dnl major pain, by requiring manual assembly to get 16-bit instructions into
dnl stage1/stage1.S.
AC_DEFUN(grub_ASM_ADDR32,
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING([for .code16 addr32 assembler support])
AC_CACHE_VAL(grub_cv_asm_addr32,
[cat > conftest.s <<\EOF
.code16
l1: addr32
movb %al, l1
EOF
if AC_TRY_COMMAND([${CC-cc} -c conftest.s]) && test -s conftest.o; then
grub_cv_asm_addr32=yes
else
grub_cv_asm_addr32=no
fi])
AC_MSG_RESULT([$grub_cv_asm_addr32])])

88
aclocal.m4 vendored
View file

@ -10,19 +10,14 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
dnl grub_CHECK_C_SYMBOL_NAME checks what name gcc will use for C symbol.
dnl grub_ASM_EXT_C checks what name gcc will use for C symbol.
dnl Originally written by Erich Boleyn, the author of GRUB, and modified
dnl by OKUJI Yoshinori to autoconfiscate the test.
AC_DEFUN(grub_ASM_EXT_C,
[AC_PROG_CC
if test "x$GCC" != xyes; then
AC_MSG_ERROR([GNU C compiler not found])
fi
AC_MSG_CHECKING([symbol names produced by ${CC}])
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING([symbol names produced by ${CC-cc}])
AC_CACHE_VAL(grub_cv_asm_ext_c,
[cat << EOF > conftest.c
[cat > conftest.c <<\EOF
int
func (int *list)
{
@ -31,10 +26,9 @@ func (int *list)
}
EOF
if AC_TRY_COMMAND(${CC} -S conftest.c) && test -s conftest.s; then
true
if AC_TRY_COMMAND([${CC-cc} -S conftest.c]) && test -s conftest.s; then :
else
AC_MSG_ERROR([${CC} failed to produce assembly code])
AC_MSG_ERROR([${CC-cc} failed to produce assembly code])
fi
set dummy `grep \.globl conftest.s | grep func | sed -e s/\\.globl// | sed -e s/func/\ sym\ /`
@ -51,16 +45,76 @@ while shift; do
done
rm -f conftest*])
AC_MSG_RESULT($grub_cv_asm_ext_c)
AC_MSG_RESULT([$grub_cv_asm_ext_c])
AC_DEFINE_UNQUOTED([EXT_C(sym)], $grub_cv_asm_ext_c)
])
AC_DEFUN(grub_PROG_OBJCOPY_WORKS,
[echo "FIXME: would test objcopy"])
dnl Some versions of `objcopy -O binary' vary their output depending
dnl on the link address.
AC_DEFUN(grub_PROG_OBJCOPY_ABSOLUTE,
[AC_MSG_CHECKING([whether ${OBJCOPY} works for absolute addresses])
AC_CACHE_VAL(grub_cv_prog_objcopy_absolute,
[cat > conftest.c <<\EOF
void
blah (void)
{
*((int *) 0x1000) = 2;
}
EOF
AC_DEFUN(grub_GAS_ADDR32,
[echo "FIXME: would test addr32"])
if AC_TRY_EVAL(ac_compile) && test -s conftest.o; then :
else
AC_MSG_ERROR([${CC-cc} cannot compile C source code])
fi
grub_cv_prog_objcopy_absolute=yes
for link_addr in 2000 8000 7C00; do
if AC_TRY_COMMAND([${LD-ld} -N -Ttext $link_addr conftest.o -o conftest.exec]); then :
else
AC_MSG_ERROR([${LD-ld} cannot link at address $link_addr])
fi
if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec conftest]); then :
else
AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files])
fi
if test ! -f conftest.old || AC_TRY_COMMAND([cmp -s conftest.old conftest]); then :
else
grub_cv_prog_objcopy_absolute=no
break
fi
done
rm -f conftest*])
AC_MSG_RESULT([$grub_cv_prog_objcopy_absolute])])
dnl Mass confusion!
dnl Older versions of GAS interpret `.code16' to mean ``generate 32-bit
dnl instructions, but implicitly insert addr32 and data32 bytes so
dnl that the code works in real mode''.
dnl
dnl Newer versions of GAS interpret `.code16' to mean ``generate 16-bit
dnl instructions,'' which seems right. This requires the programmer
dnl to explicitly insert addr32 and data32 instructions when they want
dnl them.
dnl
dnl We only support the newer versions, because the old versions cause
dnl major pain, by requiring manual assembly to get 16-bit instructions into
dnl stage1/stage1.S.
AC_DEFUN(grub_ASM_ADDR32,
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING([for .code16 addr32 assembler support])
AC_CACHE_VAL(grub_cv_asm_addr32,
[cat > conftest.s <<\EOF
.code16
l1: addr32
movb %al, l1
EOF
if AC_TRY_COMMAND([${CC-cc} -c conftest.s]) && test -s conftest.o; then
grub_cv_asm_addr32=yes
else
grub_cv_asm_addr32=no
fi])
AC_MSG_RESULT([$grub_cv_asm_addr32])])
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.

80
configure vendored
View file

@ -1183,16 +1183,13 @@ else
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
if test "x$GCC" != xyes; then
{ echo "configure: error: GNU C compiler not found" 1>&2; exit 1; }
fi
echo $ac_n "checking symbol names produced by ${CC}""... $ac_c" 1>&6
echo "configure:1192: checking symbol names produced by ${CC}" >&5
echo $ac_n "checking symbol names produced by ${CC-cc}""... $ac_c" 1>&6
echo "configure:1189: checking symbol names produced by ${CC-cc}" >&5
if eval "test \"`echo '$''{'grub_cv_asm_ext_c'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat << EOF > conftest.c
cat > conftest.c <<\EOF
int
func (int *list)
{
@ -1201,10 +1198,9 @@ func (int *list)
}
EOF
if { ac_try='${CC} -S conftest.c'; { (eval echo configure:1205: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.s; then
true
if { ac_try='${CC-cc} -S conftest.c'; { (eval echo configure:1202: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.s; then :
else
{ echo "configure: error: ${CC} failed to produce assembly code" 1>&2; exit 1; }
{ echo "configure: error: ${CC-cc} failed to produce assembly code" 1>&2; exit 1; }
fi
set dummy `grep \.globl conftest.s | grep func | sed -e s/\\.globl// | sed -e s/func/\ sym\ /`
@ -1229,8 +1225,70 @@ cat >> confdefs.h <<EOF
EOF
echo "FIXME: would test objcopy"
echo "FIXME: would test addr32"
echo $ac_n "checking whether ${OBJCOPY} works for absolute addresses""... $ac_c" 1>&6
echo "configure:1230: 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
cat > conftest.c <<\EOF
void
blah (void)
{
*((int *) 0x1000) = 2;
}
EOF
if { (eval echo configure:1242: \"$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='${LD-ld} -N -Ttext $link_addr conftest.o -o conftest.exec'; { (eval echo configure:1248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then :
else
{ echo "configure: error: ${LD-ld} cannot link at address $link_addr" 1>&2; exit 1; }
fi
if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest'; { (eval echo configure:1252: \"$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:1256: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then :
else
grub_cv_prog_objcopy_absolute=no
break
fi
done
rm -f conftest*
fi
echo "$ac_t""$grub_cv_prog_objcopy_absolute" 1>&6
if test "x$grub_cv_prog_objcopy_absolute" != xyes; then
{ echo "configure: error: GRUB requires a working absolute objcopy; upgrade your binutils" 1>&2; exit 1; }
fi
echo $ac_n "checking for .code16 addr32 assembler support""... $ac_c" 1>&6
echo "configure:1272: 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
cat > conftest.s <<\EOF
.code16
l1: addr32
movb %al, l1
EOF
if { ac_try='${CC-cc} -c conftest.s'; { (eval echo configure:1282: \"$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
fi
fi
echo "$ac_t""$grub_cv_asm_addr32" 1>&6
if test "x$grub_cv_asm_addr32" != xyes; then
{ echo "configure: error: GRUB requires GAS .code16 addr32 support; upgrade your binutils" 1>&2; exit 1; }
fi
# Create rules for our shared sources.
SHARED_SRC_RULES=./ssrcrules.mk

View file

@ -50,8 +50,15 @@ AC_CHECK_TOOL(OBJCOPY, objcopy)
# Defined in acinclude.m4.
grub_ASM_EXT_C
grub_PROG_OBJCOPY_WORKS
grub_GAS_ADDR32
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_ADDR32
if test "x$grub_cv_asm_addr32" != xyes; then
AC_MSG_ERROR([GRUB requires GAS .code16 addr32 support; upgrade your binutils])
fi
# Create rules for our shared sources.
AC_SUBST_FILE(SHARED_SRC_RULES)dnl

View file

@ -7,8 +7,8 @@ pkglib_DATA = e2fs_stage1_5
CLEANFILES = $(pkglib_DATA) $(pkglib_DATA)T
noinst_PROGRAMS = e2fs_stage1_5.exec
# We can't use builtins.
COMPILE = $(CC) -fno-builtin -DFSYS_EXT2FS=1 -DNO_DECOMPRESSION=1 \
# We can't use builtins or standard includes.
COMPILE = $(CC) -fno-builtin -nostdinc -DFSYS_EXT2FS=1 -DNO_DECOMPRESSION=1 \
-DNO_FANCY_STUFF=1 -DNO_BLOCK_FILES=1 \
-DCONFIG_FILE_ASM='.string "/boot/grub/stage2"' \
$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)

View file

@ -76,8 +76,8 @@ pkglib_DATA = e2fs_stage1_5
CLEANFILES = $(pkglib_DATA) $(pkglib_DATA)T
noinst_PROGRAMS = e2fs_stage1_5.exec
# We can't use builtins.
COMPILE = $(CC) -fno-builtin -DFSYS_EXT2FS=1 -DNO_DECOMPRESSION=1 \
# We can't use builtins or standard includes.
COMPILE = $(CC) -fno-builtin -nostdinc -DFSYS_EXT2FS=1 -DNO_DECOMPRESSION=1 \
-DNO_FANCY_STUFF=1 -DNO_BLOCK_FILES=1 \
-DCONFIG_FILE_ASM='.string "/boot/grub/stage2"' \
$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)

View file

@ -7,8 +7,8 @@ pkglib_DATA = fat_stage1_5
CLEANFILES = $(pkglib_DATA) $(pkglib_DATA)T
noinst_PROGRAMS = fat_stage1_5.exec
# We can't use builtins.
COMPILE = $(CC) -fno-builtin -DFSYS_FAT=1 -DNO_DECOMPRESSION=1 \
# We can't use builtins or standard includes.
COMPILE = $(CC) -fno-builtin -nostdinc -DFSYS_FAT=1 -DNO_DECOMPRESSION=1 \
-DNO_FANCY_STUFF=1 -DCONFIG_FILE_ASM='.string "/boot/grub/stage2"' \
$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
INCLUDES = -I$(top_srcdir)/shared_src

View file

@ -76,8 +76,8 @@ pkglib_DATA = fat_stage1_5
CLEANFILES = $(pkglib_DATA) $(pkglib_DATA)T
noinst_PROGRAMS = fat_stage1_5.exec
# We can't use builtins.
COMPILE = $(CC) -fno-builtin -DFSYS_FAT=1 -DNO_DECOMPRESSION=1 \
# We can't use builtins or standard includes.
COMPILE = $(CC) -fno-builtin -nostdinc -DFSYS_FAT=1 -DNO_DECOMPRESSION=1 \
-DNO_FANCY_STUFF=1 -DCONFIG_FILE_ASM='.string "/boot/grub/stage2"' \
$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
INCLUDES = -I$(top_srcdir)/shared_src

View file

@ -7,8 +7,8 @@ pkglib_DATA = ffs_stage1_5
CLEANFILES = $(pkglib_DATA) $(pkglib_DATA)T
noinst_PROGRAMS = ffs_stage1_5.exec
# We can't use builtins.
COMPILE = $(CC) -fno-builtin -DFSYS_FFS=1 -DNO_DECOMPRESSION=1 \
# We can't use builtins or standard includes.
COMPILE = $(CC) -fno-builtin -nostdinc -DFSYS_FFS=1 -DNO_DECOMPRESSION=1 \
-DNO_FANCY_STUFF=1 -DNO_BLOCK_FILES=1 \
-DCONFIG_FILE_ASM='.string "/boot/grub/stage2"' \
$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)

View file

@ -76,8 +76,8 @@ pkglib_DATA = ffs_stage1_5
CLEANFILES = $(pkglib_DATA) $(pkglib_DATA)T
noinst_PROGRAMS = ffs_stage1_5.exec
# We can't use builtins.
COMPILE = $(CC) -fno-builtin -DFSYS_FFS=1 -DNO_DECOMPRESSION=1 \
# We can't use builtins or standard includes.
COMPILE = $(CC) -fno-builtin -nostdinc -DFSYS_FFS=1 -DNO_DECOMPRESSION=1 \
-DNO_FANCY_STUFF=1 -DNO_BLOCK_FILES=1 \
-DCONFIG_FILE_ASM='.string "/boot/grub/stage2"' \
$(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)

View file

@ -53,7 +53,7 @@ ENTRY(start)
VARIABLE(install_partition)
.long 0x020000
VARIABLE(version_string)
.string "0.5"
.string VERSION
VARIABLE(config_file)
#ifndef CONFIG_FILE_ASM
.string "/boot/grub/menu.lst"

View file

@ -4,8 +4,8 @@ pkglibdir = $(exec_prefix)/lib/$(PACKAGE)
pkglib_DATA = stage1
CLEANFILES = stage1
# We can't use builtins.
COMPILE = $(CC) -fno-builtin $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
# We can't use builtins or standard includes.
COMPILE = $(CC) -fno-builtin -nostdinc $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
noinst_PROGRAMS = stage1.exec
stage1_exec_SOURCES = stage1.S

View file

@ -73,8 +73,8 @@ pkglibdir = $(exec_prefix)/lib/$(PACKAGE)
pkglib_DATA = stage1
CLEANFILES = stage1
# We can't use builtins.
COMPILE = $(CC) -fno-builtin $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
# We can't use builtins or standard includes.
COMPILE = $(CC) -fno-builtin -nostdinc $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
noinst_PROGRAMS = stage1.exec
stage1_exec_SOURCES = stage1.S

View file

@ -5,8 +5,8 @@ pkglib_DATA = stage2
CLEANFILES = stage2
MOSTLYCLEANFILES = stage2.exec
# We can't use builtins.
COMPILE = $(CC) -fno-builtin $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
# We can't use builtins or standard includes.
COMPILE = $(CC) -fno-builtin -nostdinc $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
INCLUDES = -I$(top_srcdir)/shared_src
# asm.o absolutely needs to come first!

View file

@ -74,8 +74,8 @@ pkglib_DATA = stage2
CLEANFILES = stage2
MOSTLYCLEANFILES = stage2.exec
# We can't use builtins.
COMPILE = $(CC) -fno-builtin $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
# We can't use builtins or standard includes.
COMPILE = $(CC) -fno-builtin -nostdinc $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
INCLUDES = -I$(top_srcdir)/shared_src
# asm.o absolutely needs to come first!

View file

@ -6,8 +6,9 @@ EXTRA_DATA = stage2_debug
CLEANFILES = stage2_debug
MOSTLYCLEANFILES = stage2_debug.exec
# We can't use builtins.
COMPILE = $(CC) -fno-builtin -DDEBUG=1 $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
# We can't use builtins or standard includes.
COMPILE = $(CC) -fno-builtin -nostdinc -DDEBUG=1 $(DEFS) $(INCLUDES) \
$(CPPFLAGS) $(CFLAGS)
INCLUDES = -I$(top_srcdir)/shared_src
# asm.o absolutely needs to come first!

View file

@ -75,8 +75,9 @@ EXTRA_DATA = stage2_debug
CLEANFILES = stage2_debug
MOSTLYCLEANFILES = stage2_debug.exec
# We can't use builtins.
COMPILE = $(CC) -fno-builtin -DDEBUG=1 $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
# We can't use builtins or standard includes.
COMPILE = $(CC) -fno-builtin -nostdinc -DDEBUG=1 $(DEFS) $(INCLUDES) \
$(CPPFLAGS) $(CFLAGS)
INCLUDES = -I$(top_srcdir)/shared_src
# asm.o absolutely needs to come first!