This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Cleanup $symbolic_link vs. $LN_S
- From: Paolo Bonzini <bonzini at gnu dot org>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Nathanael Nerode <neroden at gcc dot gnu dot org>
- Date: Wed, 06 Oct 2004 15:57:39 +0200
- Subject: [PATCH] Cleanup $symbolic_link vs. $LN_S
This patch removes the $symbolic_link variable from GCC's configure.ac,
and uses "ln -s" instead. To ensure the behavior is the same as before,
gcc_AC_PROG_LN_S is improved to test "cp -p" if both "ln" and "ln -s" work.
As I was there, this patch modifies the configure stuff to make hard
links of in-tree gas/ld/nm/objdump, rather than symbolic links. This is
needed for toplevel bootstrap because as-new will be in ../gas while
configuring GCC, and in ../prev-gas while building the next stage. Note
that, conversely, this is not necessary for AR, which is not invoked by
the driver.
Bootstrapped/regtested C/C++ in a combined tree, i686-pc-linux-gnu
Ok for mainline?
Paolo
2004-10-06 Paolo Bonzini <bonzini@gnu.org>
* configure.ac (symbolic_link): Replace with $LN_S.
(Assembler/Linker): Hard link from gas and binutils trees.
* aclocal.m4 (gcc_AC_PROG_LN_S): Try "cp -p" before cp.
* configure: Regenerate.
Index: configure.ac
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.ac,v
retrieving revision 2.72
diff -c -b -r2.72 configure.ac
*** configure.ac 27 Sep 2004 22:51:37 -0000 2.72
--- configure.ac 6 Oct 2004 08:51:40 -0000
***************
*** 1490,1521 ****
done
tmake_file="${tmake_file_}"
- symbolic_link='ln -s'
-
# If the host doesn't support symlinks, modify CC in
# FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works.
# Otherwise, we can use "CC=$(CC)".
rm -f symtest.tem
! if $symbolic_link $srcdir/gcc.c symtest.tem 2>/dev/null
! then
cc_set_by_configure="\$(CC)"
quoted_cc_set_by_configure="\$(CC)"
stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
quoted_stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
! else
! rm -f symtest.tem
! if cp -p $srcdir/gcc.c symtest.tem 2>/dev/null
! then
! symbolic_link="cp -p"
! else
! symbolic_link="cp"
! fi
cc_set_by_configure="\`case '\$(CC)' in stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`"
quoted_cc_set_by_configure="\\\`case '\\\$(CC)' in stage*) echo '\\\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(CC)';; esac\\\`"
stage_prefix_set_by_configure="\`case '\$(STAGE_PREFIX)' in stage*) echo '\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\$(STAGE_PREFIX)';; esac\`"
quoted_stage_prefix_set_by_configure="\\\`case '\\\$(STAGE_PREFIX)' in stage*) echo '\\\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(STAGE_PREFIX)';; esac\\\`"
! fi
! rm -f symtest.tem
out_object_file=`basename $out_file .c`.o
--- 1490,1513 ----
done
tmake_file="${tmake_file_}"
# If the host doesn't support symlinks, modify CC in
# FLAGS_TO_PASS so CC="stage1/xgcc -Bstage1/" works.
# Otherwise, we can use "CC=$(CC)".
rm -f symtest.tem
! case "$LN_S" in
! "ln -s")
cc_set_by_configure="\$(CC)"
quoted_cc_set_by_configure="\$(CC)"
stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
quoted_stage_prefix_set_by_configure="\$(STAGE_PREFIX)"
! ;;
! *)
cc_set_by_configure="\`case '\$(CC)' in stage*) echo '\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\$(CC)';; esac\`"
quoted_cc_set_by_configure="\\\`case '\\\$(CC)' in stage*) echo '\\\$(CC)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(CC)';; esac\\\`"
stage_prefix_set_by_configure="\`case '\$(STAGE_PREFIX)' in stage*) echo '\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\$(STAGE_PREFIX)';; esac\`"
quoted_stage_prefix_set_by_configure="\\\`case '\\\$(STAGE_PREFIX)' in stage*) echo '\\\$(STAGE_PREFIX)' | sed -e 's|stage|../stage|g';; *) echo '\\\$(STAGE_PREFIX)';; esac\\\`"
! ;;
! esac
out_object_file=`basename $out_file .c`.o
***************
*** 1754,1760 ****
in_tree_gas=yes
_gcc_COMPUTE_GAS_VERSION
rm -f as$host_exeext
! $symbolic_link ../gas/as-new$host_exeext as$host_exeext 2>/dev/null
in_tree_gas_is_elf=no
if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
|| (grep 'obj_format = multi' ../gas/Makefile \
--- 1746,1752 ----
in_tree_gas=yes
_gcc_COMPUTE_GAS_VERSION
rm -f as$host_exeext
! $LN ../gas/as-new$host_exeext as$host_exeext 2>/dev/null
in_tree_gas_is_elf=no
if grep 'obj_format = elf' ../gas/Makefile > /dev/null \
|| (grep 'obj_format = multi' ../gas/Makefile \
***************
*** 1883,1890 ****
gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
changequote([,])dnl
rm -f collect-ld$host_exeext
! $symbolic_link ../ld/ld-new$host_exeext collect-ld$host_exeext \
! 2>/dev/null
elif test -x "$LD_FOR_TARGET"; then
gcc_cv_ld="$LD_FOR_TARGET"
elif test -x "$LD" && test x$host = x$target; then
--- 1875,1881 ----
gcc_cv_gld_minor_version=`expr "$gcc_cv_gld_version" : "VERSION=[0-9]*\.\([0-9]*\)"`
changequote([,])dnl
rm -f collect-ld$host_exeext
! $LN ../ld/ld-new$host_exeext collect-ld$host_exeext 2>/dev/null
elif test -x "$LD_FOR_TARGET"; then
gcc_cv_ld="$LD_FOR_TARGET"
elif test -x "$LD" && test x$host = x$target; then
***************
*** 1971,1977 ****
in_tree_nm=yes
gcc_cv_nm=./nm$host_exeext
rm -f nm$host_exeext
! $symbolic_link ../binutils/nm-new$host_exeext nm$host_exeext 2>/dev/null
elif test "x$program_prefix" != xNONE; then
gcc_cv_nm=${program_prefix}nm$host_exeext
else
--- 1962,1968 ----
in_tree_nm=yes
gcc_cv_nm=./nm$host_exeext
rm -f nm$host_exeext
! $LN ../binutils/nm-new$host_exeext nm$host_exeext 2>/dev/null
elif test "x$program_prefix" != xNONE; then
gcc_cv_nm=${program_prefix}nm$host_exeext
else
***************
*** 1993,2000 ****
in_tree_objdump=yes
gcc_cv_objdump=./objdump$host_exeext
rm -f objdump$host_exeext
! $symbolic_link ../binutils/objdump$host_exeext \
! objdump$host_exeext 2>/dev/null
elif test "x$program_prefix" != xNONE; then
gcc_cv_objdump=${program_prefix}objdump$host_exeext
else
--- 1984,1990 ----
in_tree_objdump=yes
gcc_cv_objdump=./objdump$host_exeext
rm -f objdump$host_exeext
! $LN ../binutils/objdump$host_exeext objdump$host_exeext 2>/dev/null
elif test "x$program_prefix" != xNONE; then
gcc_cv_objdump=${program_prefix}objdump$host_exeext
else
***************
*** 3246,3252 ****
AC_SUBST(out_object_file)
AC_SUBST(stage_prefix_set_by_configure)
AC_SUBST(quoted_stage_prefix_set_by_configure)
- AC_SUBST(symbolic_link)
AC_SUBST(thread_file)
AC_SUBST(tm_file_list)
AC_SUBST(tm_include_list)
--- 3236,3241 ----
***************
*** 3309,3328 ****
# FLAGS_TO_PASS has been modified to solve the problem there.
# This is virtually a duplicate of what happens in configure.lang; we do
# an extra check to make sure this only happens if ln -s can be used.
! if test "$symbolic_link" = "ln -s"; then
for d in ${subdirs} ; do
STARTDIR=`${PWDCMD-pwd}`
cd $d
for t in stage1 stage2 stage3 stage4 stageprofile stagefeedback include
do
rm -f $t
! $symbolic_link ../$t $t 2>/dev/null
done
cd $STARTDIR
done
! else true ; fi
],
! [subdirs='$subdirs'
! symbolic_link='$symbolic_link'
! ])
AC_OUTPUT
--- 3298,3317 ----
# FLAGS_TO_PASS has been modified to solve the problem there.
# This is virtually a duplicate of what happens in configure.lang; we do
# an extra check to make sure this only happens if ln -s can be used.
! case "$LN_S" in
! "ln -s")
for d in ${subdirs} ; do
STARTDIR=`${PWDCMD-pwd}`
cd $d
for t in stage1 stage2 stage3 stage4 stageprofile stagefeedback include
do
rm -f $t
! $LN_S ../$t $t 2>/dev/null
done
cd $STARTDIR
done
! ;;
! esac
],
! [subdirs='$subdirs'])
AC_OUTPUT
Index: aclocal.m4
===================================================================
RCS file: /cvs/gcc/gcc/gcc/aclocal.m4,v
retrieving revision 1.97
diff -c -b -r1.97 aclocal.m4
*** aclocal.m4 27 Sep 2004 22:51:36 -0000 1.97
--- aclocal.m4 6 Oct 2004 08:51:40 -0000
***************
*** 126,133 ****
--- 126,138 ----
then
gcc_cv_prog_LN_S=ln
else
+ if cp -p conftestdata_f conftestdata_t 2>/dev/null
+ then
+ gcc_cv_prog_LN_S=ln
+ else
gcc_cv_prog_LN_S=cp
fi
+ fi
fi
rm -f conftestdata_f conftestdata_t
])dnl
***************
*** 138,144 ****
if test "$gcc_cv_prog_LN_S" = "ln"; then
AC_MSG_RESULT([no, using ln])
else
! AC_MSG_RESULT([no, and neither does ln, so using cp])
fi
fi
AC_SUBST(LN_S)dnl
--- 143,149 ----
if test "$gcc_cv_prog_LN_S" = "ln"; then
AC_MSG_RESULT([no, using ln])
else
! AC_MSG_RESULT([no, and neither does ln, so using $gcc_cv_prog_LN_S])
fi
fi
AC_SUBST(LN_S)dnl