From 61894e17cdbe6d0828c9bd94bad9b1b2d721311a Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Mon, 10 Oct 2016 14:41:33 +0300 Subject: [PATCH] build: win32: don't use mklink - use ln or fallback to cp For the following reasons: - Native windows links are rarely used in general. - Require elevated privileges even if the current user has administrator privileges (needs further "run as administrator"). - Most/all windows shell environments capable of running configure already support ln (msys[1], msys2, most probably cygwin too). - If cross building tcc on linux for windows then native mklink is not available, as well as 'cmd' (in this scenario the build later fails for other reasons, but at least configures succeeds now). - cp is good enough as fallback since we only copy 5 makefiles anyway. - The only environment I'm aware of which doesn't support ln -s is busybox for windows, and with this patch it falls back to cp and completes configure successfully (and the build later succeeds, assuming valid $CC and $AR). --- configure | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 7c5d4384..efffeec2 100755 --- a/configure +++ b/configure @@ -551,11 +551,8 @@ fn_makelink() esac ;; esac - if test "$mingw32" = "yes" ; then - cmd //c mklink `echo "$2 $tgt" | sed 's,/,\\\\,g'` - else - ln -sfn $tgt $2 - fi + + ln -sfn $tgt $2 || ( echo "ln failed. Using cp instead."; cp -f $1/$2 $2 ) } if test "$source_path_used" = "yes" ; then