From: Taylor R Campbell Date: Mon, 2 Nov 2009 16:29:03 +0000 (-0500) Subject: Make the compiler/configure script idempotent. X-Git-Tag: 20100708-Gtk~273^2 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=3444c77254126f63729ccee66523b2677ba0b51e;p=mit-scheme.git Make the compiler/configure script idempotent. --- diff --git a/src/compiler/configure b/src/compiler/configure index e7f57d023..c4e9ac5d6 100755 --- a/src/compiler/configure +++ b/src/compiler/configure @@ -42,11 +42,23 @@ while test $# -gt 0; do done MACHINE=`./choose-machine.sh "${MACHINE}"` -CMD="rm -f machine" -echo "${CMD}"; eval "${CMD}" +make_link () +{ + local target link + target="${1}" + link="${2}" + if [ -e "${link}" -a ! -L "${link}" ]; then + cat <&2 +${link} is not a symbolic link; refusing to clobber it. +EOF + exit 1 + else + CMDS="rm -f ${link} && ln -s ${target} ${link}" + echo "${CMDS}"; eval "${CMDS}" + fi +} -CMD="ln -s machines/${MACHINE} machine" -echo "${CMD}"; eval "${CMD}" +make_link "machines/${MACHINE}" machine LINKS="compiler.cbf compiler.pkg compiler.sf make.com" if test "${MACHINE}" = C; then @@ -54,8 +66,5 @@ if test "${MACHINE}" = C; then fi for FN in ${LINKS}; do - if [ ! -f "${FN}" ]; then - CMD="ln -s machine/${FN} ." - echo "${CMD}"; eval "${CMD}" - fi + make_link "machine/${FN}" "${FN}" done