diff --git a/ChangeLog b/ChangeLog index c59a0b1a5..2026f4b6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +1999-10-08 OKUJI Yoshinori + + * configure.in (--with-binutils): New option to specify a + directory to find binutils. + (CFLAGS): If WITH_BINUTILS is not empty, added the option `-B'. + (LD): Do not check for this. We don't use ld directly anyway. + (RANLIB): If WITH_BINUTILS is not empty, search the directory + WITH_BINUTILS first. + (OBJCOPY): Likewise. + * acinclude.m4 (grub_ASM_USCORE): Add CFLAGS into + AC_TRY_COMMAND. + (grub_ASM_ADDR32): Likewise. + (grub_ASM_PREFIX_REQUIREMENT): Likewise. + (grub_PROG_OBJCOPY_ABSOLUTE): Use CC instead of LD. + 1999-10-04 Pavel Roskin * stage2/freebsd.h (struct bootinfo): New member, bi_bios_dev. diff --git a/Makefile.in b/Makefile.in index 6cc2d270f..6559e94d1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -66,7 +66,6 @@ CC = @CC@ FSYS_CFLAGS = @FSYS_CFLAGS@ GRUB_CFLAGS = @GRUB_CFLAGS@ GRUB_LIBS = @GRUB_LIBS@ -LD = @LD@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ NET_CFLAGS = @NET_CFLAGS@ diff --git a/README b/README index 7c6baedbf..40d98200a 100644 --- a/README +++ b/README @@ -32,9 +32,7 @@ GNU ld version 2.9.5 (with BFD 2.9.5.0.13) The latter is what you should see. If you have installed a recent version of binutils but this version number is not identical with it, -GCC uses a fixed path rather than the environment variable PATH to find -binutils. In this case, you need to install your binutils into the path -which GCC sees (typically, /usr/bin), or reinstall GCC. +you need to specify the option ``--with-binutils=DIR'' for configure. These below are required when you develop GRUB or when you get it from diff --git a/acinclude.m4 b/acinclude.m4 index 175d73279..aa91ca8a6 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -15,7 +15,7 @@ func (int *list) } EOF -if AC_TRY_COMMAND([${CC-cc} -S conftest.c]) && test -s conftest.s; then +if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -S conftest.c]) && test -s conftest.s; then true else AC_MSG_ERROR([${CC-cc} failed to produce assembly code]) @@ -45,7 +45,7 @@ AC_DEFUN(grub_PROG_OBJCOPY_ABSOLUTE, AC_CACHE_VAL(grub_cv_prog_objcopy_absolute, [cat > conftest.c <<\EOF void -blah (void) +main (void) { *((int *) 0x1000) = 2; } @@ -57,9 +57,9 @@ else 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 : + if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then : else - AC_MSG_ERROR([${LD-ld} cannot link at address $link_addr]) + AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr]) fi if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec conftest]); then : else @@ -104,7 +104,7 @@ else sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s fi -if AC_TRY_COMMAND([${CC-cc} -c conftest.s]) && test -s conftest.o; then +if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then grub_cv_asm_addr32=yes else grub_cv_asm_addr32=no @@ -128,7 +128,7 @@ AC_CACHE_VAL(grub_cv_asm_prefix_requirement, l1: addr32 movb %al, l1 EOF -if AC_TRY_COMMAND([${CC-cc} -c conftest.s]) && test -s conftest.o; then +if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then grub_cv_asm_prefix_requirement=yes else grub_cv_asm_prefix_requirement=no diff --git a/aclocal.m4 b/aclocal.m4 index f0997df92..07e0a2065 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -27,7 +27,7 @@ func (int *list) } EOF -if AC_TRY_COMMAND([${CC-cc} -S conftest.c]) && test -s conftest.s; then +if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -S conftest.c]) && test -s conftest.s; then true else AC_MSG_ERROR([${CC-cc} failed to produce assembly code]) @@ -57,7 +57,7 @@ AC_DEFUN(grub_PROG_OBJCOPY_ABSOLUTE, AC_CACHE_VAL(grub_cv_prog_objcopy_absolute, [cat > conftest.c <<\EOF void -blah (void) +main (void) { *((int *) 0x1000) = 2; } @@ -69,9 +69,9 @@ else 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 : + if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then : else - AC_MSG_ERROR([${LD-ld} cannot link at address $link_addr]) + AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr]) fi if AC_TRY_COMMAND([${OBJCOPY-objcopy} -O binary conftest.exec conftest]); then : else @@ -116,7 +116,7 @@ else sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s fi -if AC_TRY_COMMAND([${CC-cc} -c conftest.s]) && test -s conftest.o; then +if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then grub_cv_asm_addr32=yes else grub_cv_asm_addr32=no @@ -140,7 +140,7 @@ AC_CACHE_VAL(grub_cv_asm_prefix_requirement, l1: addr32 movb %al, l1 EOF -if AC_TRY_COMMAND([${CC-cc} -c conftest.s]) && test -s conftest.o; then +if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then grub_cv_asm_prefix_requirement=yes else grub_cv_asm_prefix_requirement=no diff --git a/configure b/configure index 6873df7af..a6ce65a8b 100644 --- a/configure +++ b/configure @@ -14,6 +14,8 @@ ac_default_prefix=/usr/local ac_help="$ac_help --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --with-binutils=DIR search the directory DIR to find binutils" ac_help="$ac_help --without-curses do not use curses" ac_help="$ac_help @@ -597,7 +599,7 @@ ac_configure="$SHELL $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:601: checking for a BSD compatible install" >&5 +echo "configure:603: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"\${ac_cv_path_install+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -654,7 +656,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:658: checking whether build environment is sane" >&5 +echo "configure:660: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -715,7 +717,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:719: checking for $ac_word" >&5 +echo "configure:721: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_AWK+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -745,7 +747,7 @@ test -n "$AWK" && break done echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:749: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:751: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -794,7 +796,7 @@ EOF missing_dir=`cd $ac_aux_dir && pwd` echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 -echo "configure:798: checking for working aclocal" >&5 +echo "configure:800: checking for working aclocal" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -807,7 +809,7 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:811: checking for working autoconf" >&5 +echo "configure:813: checking for working autoconf" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -820,7 +822,7 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:824: checking for working automake" >&5 +echo "configure:826: checking for working automake" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -833,7 +835,7 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:837: checking for working autoheader" >&5 +echo "configure:839: checking for working autoheader" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -846,7 +848,7 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:850: checking for working makeinfo" >&5 +echo "configure:852: checking for working makeinfo" >&5 # Run test in a subshell; some versions of sh will print an error if # an executable is not found, even if stderr is redirected. # Redirect stdin to placate older versions of autoconf. Sigh. @@ -866,7 +868,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:870: checking for $ac_word" >&5 +echo "configure:872: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_AMTAR+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -910,7 +912,7 @@ fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:914: checking host system type" >&5 +echo "configure:916: checking host system type" >&5 if test "x$ac_cv_host" = "x" || (test "x$host" != "xNONE" && test "x$host" != "x$ac_cv_host_alias"); then # Make sure we can run config.sub. @@ -963,7 +965,7 @@ esac # echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:967: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:969: 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" @@ -989,7 +991,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:993: checking for $ac_word" >&5 +echo "configure:995: checking for $ac_word" >&5 if eval "test \"\${ac_cv_path_PERL+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1037,7 +1039,7 @@ fi echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1041: checking build system type" >&5 +echo "configure:1043: checking build system type" >&5 if test "x$ac_cv_build" = "x" || (test "x$build" != "xNONE" && test "x$build" != "x$ac_cv_build_alias"); then # Make sure we can run config.sub. @@ -1084,7 +1086,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:1088: checking for $ac_word" >&5 +echo "configure:1090: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1116,7 +1118,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:1120: checking for $ac_word" >&5 +echo "configure:1122: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1146,7 +1148,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:1150: checking for $ac_word" >&5 +echo "configure:1152: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1197,7 +1199,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:1201: checking for $ac_word" >&5 +echo "configure:1203: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_CC+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1229,7 +1231,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1233: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5 +echo "configure:1235: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1240,12 +1242,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1244 "configure" +#line 1246 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1249: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1251: \"$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 @@ -1271,12 +1273,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 $CPPFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1275: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1277: checking whether the C compiler ($CC $CFLAGS $CPPFLAGS $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:1280: checking whether we are using GNU C" >&5 +echo "configure:1282: checking whether we are using GNU C" >&5 if eval "test \"\${ac_cv_prog_gcc+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1285,7 +1287,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1289: \"$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:1291: \"$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 @@ -1304,7 +1306,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:1308: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1310: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"\${ac_cv_prog_cc_g+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1335,10 +1337,56 @@ else fi fi -# Extract the first word of "ranlib", so it can be a program name with args. + +# Check whether --with-binutils or --without-binutils was given. +if test "${with_binutils+set}" = set; then + withval="$with_binutils" + : +fi + + +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:1342: checking for $ac_word" >&5 +echo "configure:1353: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_path_RANLIB+set}\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$RANLIB" in + /*) + ac_cv_path_RANLIB="$RANLIB" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_RANLIB="$RANLIB" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy=""$with_binutils:$PATH"" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_RANLIB="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_RANLIB" && ac_cv_path_RANLIB=":" + ;; +esac +fi +RANLIB="$ac_cv_path_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +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:1390: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_RANLIB+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1365,15 +1413,20 @@ else echo "$ac_t""no" 1>&6 fi +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" echo $ac_n "checking whether optimization for size works""... $ac_c" 1>&6 -echo "configure:1377: checking whether optimization for size works" >&5 +echo "configure:1430: checking whether optimization for size works" >&5 if eval "test \"\${size_flag+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1381,14 +1434,14 @@ else saved_CFLAGS=$CFLAGS CFLAGS="-Os -g" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1445: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* size_flag=yes else @@ -1418,42 +1471,47 @@ fi # Enforce coding standards. CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused" -# Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. -set dummy ${ac_tool_prefix}ld; ac_word=$2 +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:1425: checking for $ac_word" >&5 -if eval "test \"\${ac_cv_prog_LD+set}\" = set"; then +echo "configure:1479: checking for $ac_word" >&5 +if eval "test \"\${ac_cv_path_OBJCOPY+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$LD"; then - ac_cv_prog_LD="$LD" # Let the user override the test. -else + case "$OBJCOPY" in + /*) + ac_cv_path_OBJCOPY="$OBJCOPY" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_OBJCOPY="$OBJCOPY" # Let the user override the test with a dos path. + ;; + *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do + ac_dummy=""$with_binutils:$PATH"" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_LD="${ac_tool_prefix}ld" + ac_cv_path_OBJCOPY="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_LD" && ac_cv_prog_LD="ld" + ;; +esac fi -fi -LD="$ac_cv_prog_LD" -if test -n "$LD"; then - echo "$ac_t""$LD" 1>&6 +OBJCOPY="$ac_cv_path_OBJCOPY" +if test -n "$OBJCOPY"; then + echo "$ac_t""$OBJCOPY" 1>&6 else echo "$ac_t""no" 1>&6 fi - - -# Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args. +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:1457: checking for $ac_word" >&5 +echo "configure:1515: checking for $ac_word" >&5 if eval "test \"\${ac_cv_prog_OBJCOPY+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1482,11 +1540,12 @@ fi +fi # Defined in acinclude.m4. echo $ac_n "checking if C symbols get an underscore after compilation""... $ac_c" 1>&6 -echo "configure:1490: checking if C symbols get an underscore after compilation" >&5 +echo "configure:1549: checking if C symbols get an underscore after compilation" >&5 if eval "test \"\${grub_cv_asm_uscore+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1499,7 +1558,7 @@ func (int *list) } EOF -if { ac_try='${CC-cc} -S conftest.c'; { (eval echo configure:1503: \"$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:1562: \"$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; } @@ -1525,33 +1584,33 @@ 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:1529: checking whether ${OBJCOPY} works for absolute addresses" >&5 +echo "configure:1588: checking whether ${OBJCOPY} works for absolute addresses" >&5 if eval "test \"\${grub_cv_prog_objcopy_absolute+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <<\EOF void -blah (void) +main (void) { *((int *) 0x1000) = 2; } EOF -if { (eval echo configure:1541: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then : +if { (eval echo configure:1600: \"$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:1547: \"$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:1606: \"$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; } + { 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:1551: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then : + if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest'; { (eval echo configure:1610: \"$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:1555: \"$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:1614: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then mv -f conftest conftest.old else grub_cv_prog_objcopy_absolute=no @@ -1568,7 +1627,7 @@ fi echo $ac_n "checking whether addr32 must be in the same line as the instruction""... $ac_c" 1>&6 -echo "configure:1572: checking whether addr32 must be in the same line as the instruction" >&5 +echo "configure:1631: checking whether addr32 must be in the same line as the instruction" >&5 if eval "test \"\${grub_cv_asm_prefix_requirement+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1577,7 +1636,7 @@ else l1: addr32 movb %al, l1 EOF -if { ac_try='${CC-cc} -c conftest.s'; { (eval echo configure:1581: \"$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:1640: \"$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 @@ -1609,7 +1668,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:1613: checking for .code16 addr32 assembler support" >&5 +echo "configure:1672: checking for .code16 addr32 assembler support" >&5 if eval "test \"\${grub_cv_asm_addr32+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1624,7 +1683,7 @@ else sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s fi -if { ac_try='${CC-cc} -c conftest.s'; { (eval echo configure:1628: \"$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:1687: \"$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 @@ -1641,19 +1700,19 @@ fi echo $ac_n "checking if start is defined by the compiler""... $ac_c" 1>&6 -echo "configure:1645: checking if start is defined by the compiler" >&5 +echo "configure:1704: checking if start is defined by the compiler" >&5 if eval "test \"\${grub_cv_check_start_symbol+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1716: \"$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 @@ -1677,19 +1736,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:1681: checking if _start is defined by the compiler" >&5 +echo "configure:1740: checking if _start is defined by the compiler" >&5 if eval "test \"\${grub_cv_check_uscore_start_symbol+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1752: \"$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 @@ -1718,19 +1777,19 @@ fi echo $ac_n "checking if end is defined by the compiler""... $ac_c" 1>&6 -echo "configure:1722: checking if end is defined by the compiler" >&5 +echo "configure:1781: checking if end is defined by the compiler" >&5 if eval "test \"\${grub_cv_check_end_symbol+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1793: \"$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 @@ -1754,19 +1813,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:1758: checking if _end is defined by the compiler" >&5 +echo "configure:1817: checking if _end is defined by the compiler" >&5 if eval "test \"\${grub_cv_check_uscore_end_symbol+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1829: \"$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 @@ -1804,7 +1863,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:1808: checking for wgetch in -lncurses" >&5 +echo "configure:1867: checking for wgetch in -lncurses" >&5 ac_lib_var=`echo ncurses'_'wgetch | sed 'y%./+-:%__p__%'` if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1812,7 +1871,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1886: \"$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 @@ -1846,7 +1905,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for wgetch in -lcurses""... $ac_c" 1>&6 -echo "configure:1850: checking for wgetch in -lcurses" >&5 +echo "configure:1909: checking for wgetch in -lcurses" >&5 ac_lib_var=`echo curses'_'wgetch | sed 'y%./+-:%__p__%'` if eval "test \"\${ac_cv_lib_$ac_lib_var+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1854,7 +1913,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1928: \"$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 @@ -1897,7 +1956,7 @@ fi # Check for headers. echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1901: checking how to run the C preprocessor" >&5 +echo "configure:1960: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1912,13 +1971,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1922: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1981: \"$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 : @@ -1929,13 +1988,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1939: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1998: \"$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 : @@ -1946,13 +2005,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1956: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2015: \"$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 : @@ -1980,17 +2039,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:1984: checking for $ac_hdr" >&5 +echo "configure:2043: checking for $ac_hdr" >&5 if eval "test \"\${ac_cv_header_$ac_safe+set}\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2053: \"$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* @@ -2396,7 +2455,6 @@ s%@RANLIB@%$RANLIB%g s%@STAGE1_CFLAGS@%$STAGE1_CFLAGS%g s%@STAGE2_CFLAGS@%$STAGE2_CFLAGS%g s%@GRUB_CFLAGS@%$GRUB_CFLAGS%g -s%@LD@%$LD%g s%@OBJCOPY@%$OBJCOPY%g s%@GRUB_LIBS@%$GRUB_LIBS%g s%@CPP@%$CPP%g diff --git a/configure.in b/configure.in index c0a5736f9..df3903b0d 100644 --- a/configure.in +++ b/configure.in @@ -53,12 +53,24 @@ fi AC_CHECK_TOOL(CC, gcc) AC_PROG_CC -AC_PROG_RANLIB + +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, [ @@ -82,8 +94,11 @@ AC_SUBST(GRUB_CFLAGS) # Enforce coding standards. CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused" -AC_CHECK_TOOL(LD, ld) -AC_CHECK_TOOL(OBJCOPY, objcopy) +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 diff --git a/debian/Makefile.in b/debian/Makefile.in index 3d70e0db1..e822cdc32 100644 --- a/debian/Makefile.in +++ b/debian/Makefile.in @@ -66,7 +66,6 @@ CC = @CC@ FSYS_CFLAGS = @FSYS_CFLAGS@ GRUB_CFLAGS = @GRUB_CFLAGS@ GRUB_LIBS = @GRUB_LIBS@ -LD = @LD@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ NET_CFLAGS = @NET_CFLAGS@ diff --git a/docs/Makefile.in b/docs/Makefile.in index b338b7057..edee376c0 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -66,7 +66,6 @@ CC = @CC@ FSYS_CFLAGS = @FSYS_CFLAGS@ GRUB_CFLAGS = @GRUB_CFLAGS@ GRUB_LIBS = @GRUB_LIBS@ -LD = @LD@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ NET_CFLAGS = @NET_CFLAGS@ diff --git a/grub/Makefile.in b/grub/Makefile.in index b5a91c1f9..32ce21f9d 100644 --- a/grub/Makefile.in +++ b/grub/Makefile.in @@ -66,7 +66,6 @@ CC = @CC@ FSYS_CFLAGS = @FSYS_CFLAGS@ GRUB_CFLAGS = @GRUB_CFLAGS@ GRUB_LIBS = @GRUB_LIBS@ -LD = @LD@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ NET_CFLAGS = @NET_CFLAGS@ diff --git a/lib/Makefile.in b/lib/Makefile.in index 7983c2cf1..0c3e2f749 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -66,7 +66,6 @@ CC = @CC@ FSYS_CFLAGS = @FSYS_CFLAGS@ GRUB_CFLAGS = @GRUB_CFLAGS@ GRUB_LIBS = @GRUB_LIBS@ -LD = @LD@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ NET_CFLAGS = @NET_CFLAGS@ diff --git a/netboot/Makefile.in b/netboot/Makefile.in index e8b26331b..974d8c87e 100644 --- a/netboot/Makefile.in +++ b/netboot/Makefile.in @@ -66,7 +66,6 @@ CC = @CC@ FSYS_CFLAGS = @FSYS_CFLAGS@ GRUB_CFLAGS = @GRUB_CFLAGS@ GRUB_LIBS = @GRUB_LIBS@ -LD = @LD@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ NET_CFLAGS = @NET_CFLAGS@ diff --git a/stage1/Makefile.in b/stage1/Makefile.in index 7d6e4ec4a..5f08956e1 100644 --- a/stage1/Makefile.in +++ b/stage1/Makefile.in @@ -64,7 +64,6 @@ CC = @CC@ FSYS_CFLAGS = @FSYS_CFLAGS@ GRUB_CFLAGS = @GRUB_CFLAGS@ GRUB_LIBS = @GRUB_LIBS@ -LD = @LD@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ NET_CFLAGS = @NET_CFLAGS@ diff --git a/stage2/Makefile.in b/stage2/Makefile.in index 5f1945b03..61851bc3a 100644 --- a/stage2/Makefile.in +++ b/stage2/Makefile.in @@ -64,7 +64,6 @@ CC = @CC@ FSYS_CFLAGS = @FSYS_CFLAGS@ GRUB_CFLAGS = @GRUB_CFLAGS@ GRUB_LIBS = @GRUB_LIBS@ -LD = @LD@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ NET_CFLAGS = @NET_CFLAGS@