[Bug target/52122] [4.6/4.7/4.8 Regression] incorrect ln -s replacement for mingw like targets in configure files

daniel.f.starke at freenet dot de gcc-bugzilla@gcc.gnu.org
Sat Sep 22 16:00:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52122

--- Comment #7 from Daniel Starke <daniel.f.starke at freenet dot de> 2012-09-22 16:00:03 UTC ---
It seems to be partly a gcc autoconfig macro issue. Seeing the following in
gcc/acinclude.m4

dnl See if symbolic links work and if not, try to substitute either hard links
or simple copy.
AC_DEFUN([gcc_AC_PROG_LN_S],
[AC_MSG_CHECKING(whether ln -s works)
AC_CACHE_VAL(gcc_cv_prog_LN_S,
[rm -f conftestdata_t
echo >conftestdata_f
if ln -s conftestdata_f conftestdata_t 2>/dev/null
then
  gcc_cv_prog_LN_S="ln -s"
else
  if ln conftestdata_f conftestdata_t 2>/dev/null
  then
    gcc_cv_prog_LN_S=ln
  else
    if cp -p conftestdata_f conftestdata_t 2>/dev/null
    then
      gcc_cv_prog_LN_S="cp -p"
    else
      gcc_cv_prog_LN_S=cp
    fi
  fi
fi
rm -f conftestdata_f conftestdata_t
])dnl
LN_S="$gcc_cv_prog_LN_S"
if test "$gcc_cv_prog_LN_S" = "ln -s"; then
  AC_MSG_RESULT(yes)
else
  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
])

it is obvious that gcc_cv_prog_LN_S="cp -p" needs to be changed to
gcc_cv_prog_LN_S="cp -pr".

On the other hand running autoconfig on this configure.ac:
AC_PREREQ(2.64)
AC_INIT
AC_PROG_LN_S

returns the wrong output as also seen in the patch with:
if (echo >conf$$.file) 2>/dev/null; then
  if ln -s conf$$.file conf$$ 2>/dev/null; then
    as_ln_s='ln -s'
    # ... but there are two gotchas:
    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
    # In both cases, we have to default to `cp -p'.
    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
      as_ln_s='cp -p'
  elif ln conf$$.file conf$$ 2>/dev/null; then
    as_ln_s=ln
  else
    as_ln_s='cp -p'
  fi
else
  as_ln_s='cp -p'
fi

The part mentioned by Tim Vanholder that was not in the attached patch was
certainly just overseen by me as it was not necessary to build gcc.
I have just filed a bug report against autoconf.



More information about the Gcc-bugs mailing list