From: Akim Demaille Date: Sat, 27 Jan 2001 13:19:14 +0000 (+0000) Subject: Follow Tim Van Holder's suggestions for a uniform handling of X-Git-Tag: autoconf-2.50~185 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fea900426abc8e2d6de17d47701a50672904c26f;p=thirdparty%2Fautoconf.git Follow Tim Van Holder's suggestions for a uniform handling of symlinks. * m4sh.m4: Stay in `as_', not `ac_'. (_AS_LN_S_PREPARE): Eve out from... * acspecific.m4 (AC_PROG_LN_S): here. Adjust. * m4sh.m4 (AS_LN_S): New. (AS_SHELL_PREPARE): Call _AS_LN_S_PREPARE. --- diff --git a/ChangeLog b/ChangeLog index df0c2ae93..0aa9e743b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2001-01-27 Akim Demaille + + Follow Tim Van Holder's suggestions for a uniform handling of + symlinks. + + * m4sh.m4: Stay in `as_', not `ac_'. + (_AS_LN_S_PREPARE): Eve out from... + * acspecific.m4 (AC_PROG_LN_S): here. Adjust. + * m4sh.m4 (AS_LN_S): New. + (AS_SHELL_PREPARE): Call _AS_LN_S_PREPARE. + 2001-01-26 Assar Westerlund * autoreconf.sh (find): Fix precedence. diff --git a/acgeneral.m4 b/acgeneral.m4 index 4e7770075..075c38cc9 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -4284,10 +4284,9 @@ for ac_file in : $CONFIG_LINKS; do test "x$ac_file" = x: && continue esac # Make a symlink if possible; otherwise try a hard link. - if ln -s $ac_rel_source $ac_dest 2>/dev/null || - ln $srcdir/$ac_source $ac_dest; then :; else + ln -s $ac_rel_source $ac_dest 2>/dev/null || + ln $srcdir/$ac_source $ac_dest || AC_MSG_ERROR([cannot link $ac_dest to $srcdir/$ac_source]) - fi m4_ifset([AC_LIST_LINKS_COMMANDS], [ # Run the commands associated with the file. case $ac_file in diff --git a/acspecific.m4 b/acspecific.m4 index 6fc7d401f..e82742939 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -268,28 +268,8 @@ AC_SUBST(INSTALL_DATA)dnl # ------------ AC_DEFUN([AC_PROG_LN_S], [AC_MSG_CHECKING([whether ln -s works]) -AC_CACHE_VAL(ac_cv_prog_LN_S, -[rm -f conftest conftest.exe conftest.file -echo >conftest.file -dnl Don't use conftest.sym to avoid filename issues on DJGPP, where this -dnl would yield conftest.sym.exe for DJGPP < 2.04. -if ln -s conftest.file conftest 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conftest.exe; then - ac_cv_prog_LN_S="cp -p" # Don't use ln at all; we don't have any links - else - ac_cv_prog_LN_S="ln -s" - fi -elif ln conftest.file conftest 2>/dev/null; then - ac_cv_prog_LN_S=ln -else - ac_cv_prog_LN_S=cp -fi -rm -f conftest conftest.exe conftest.file])dnl -ac_ln_s=$ac_cv_prog_LN_S -AC_SUBST([LN_S], [$ac_cv_prog_LN_S]) -if test "$ac_cv_prog_LN_S" = "ln -s"; then +AC_SUBST([LN_S], [$as_ln_s])dnl +if test "$LN_S" = "ln -s"; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no, using $LN_S]) diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 794039a13..acc327972 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -2791,7 +2791,7 @@ distribution. If @samp{ln -s} works on the current file system (the operating system and file system support symbolic links), set output variable @code{LN_S} to @samp{ln -s}, otherwise if @samp{ln} works, set @code{LN_S} to -@samp{ln}, and otherwise set to @samp{cp}. +@samp{ln}, and otherwise set to @samp{cp -p}. If the link is put in a directory other than the current directory, its meaning depends on whether @samp{ln} or @samp{ln -s} is used. To safely diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 4e7770075..075c38cc9 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -4284,10 +4284,9 @@ for ac_file in : $CONFIG_LINKS; do test "x$ac_file" = x: && continue esac # Make a symlink if possible; otherwise try a hard link. - if ln -s $ac_rel_source $ac_dest 2>/dev/null || - ln $srcdir/$ac_source $ac_dest; then :; else + ln -s $ac_rel_source $ac_dest 2>/dev/null || + ln $srcdir/$ac_source $ac_dest || AC_MSG_ERROR([cannot link $ac_dest to $srcdir/$ac_source]) - fi m4_ifset([AC_LIST_LINKS_COMMANDS], [ # Run the commands associated with the file. case $ac_file in diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index 6fc7d401f..e82742939 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -268,28 +268,8 @@ AC_SUBST(INSTALL_DATA)dnl # ------------ AC_DEFUN([AC_PROG_LN_S], [AC_MSG_CHECKING([whether ln -s works]) -AC_CACHE_VAL(ac_cv_prog_LN_S, -[rm -f conftest conftest.exe conftest.file -echo >conftest.file -dnl Don't use conftest.sym to avoid filename issues on DJGPP, where this -dnl would yield conftest.sym.exe for DJGPP < 2.04. -if ln -s conftest.file conftest 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conftest.exe; then - ac_cv_prog_LN_S="cp -p" # Don't use ln at all; we don't have any links - else - ac_cv_prog_LN_S="ln -s" - fi -elif ln conftest.file conftest 2>/dev/null; then - ac_cv_prog_LN_S=ln -else - ac_cv_prog_LN_S=cp -fi -rm -f conftest conftest.exe conftest.file])dnl -ac_ln_s=$ac_cv_prog_LN_S -AC_SUBST([LN_S], [$ac_cv_prog_LN_S]) -if test "$ac_cv_prog_LN_S" = "ln -s"; then +AC_SUBST([LN_S], [$as_ln_s])dnl +if test "$LN_S" = "ln -s"; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no, using $LN_S]) diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 9ad6a9195..3f16848bd 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -67,6 +67,7 @@ elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then fi _AS_EXPR_PREPARE +_AS_LN_S_PREPARE _AS_TEST_PREPARE _AS_UNSET_PREPARE @@ -82,9 +83,9 @@ AS_UNSET([LC_MESSAGES], [C]) # IFS # We need space, tab and new line, in precisely that order. -ac_nl=' +as_nl=' ' -IFS=" $ac_nl" +IFS=" $as_nl" # CDPATH. AS_UNSET([CDPATH], [:]) @@ -149,7 +150,7 @@ fi # AS_UNSET(VAR, [VALUE-IF-UNSET-NOT-SUPPORTED = `']) # -------------------------------------------------- # Try to unset the env VAR, otherwise set it to -# VALUE-IF-UNSET-NOT-SUPPORTED. `ac_unset' must have been computed. +# VALUE-IF-UNSET-NOT-SUPPORTED. `as_unset' must have been computed. m4_defun([AS_UNSET], [m4_require([_AS_UNSET_PREPARE])dnl $as_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }]) @@ -313,22 +314,57 @@ fi ])# _AS_EXPR_PREPARE +# _AS_LN_S_PREPARE +# ---------------- +# Don't use conftest.sym to avoid filename issues on DJGPP, where this +# would yield conftest.sym.exe for DJGPP < 2.04. +m4_defun([_AS_LN_S_PREPARE], +[rm -f conftest conftest.exe conftest.file +echo >conftest.file +if ln -s conftest.file conftest 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conftest.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conftest.file conftest 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conftest conftest.exe conftest.file +])# _AS_LN_S_PREPARE + + +# AS_LN_S(FILE, LINK) +# ------------------- +# FIXME: Should we add the glue code to handle properly relative symlinks +# simulated with `ln' or `cp'? +m4_defun([AS_LN_S], +[m4_require([_AS_LN_S_PREPARE])dnl +$as_ln_s $1 $2 +]) + + # AS_MKDIR_P(PATH) # ---------------- # Emulate `mkdir -p' with plain `mkdir'. m4_define([AS_MKDIR_P], [{ case $1 in - [[\\/]]* | ?:[[\\/]]* ) ac_incr_dir=;; - *) ac_incr_dir=.;; + [[\\/]]* | ?:[[\\/]]* ) as_incr_dir=;; + *) as_incr_dir=.;; esac -ac_dummy=$1 -for ac_mkdir_dir in `IFS='\\/'; set X $ac_dummy; shift; echo "$[@]"`; do - case $ac_mkdir_dir in +as_dummy=$1 +for as_mkdir_dir in `IFS='\\/'; set X $as_dummy; shift; echo "$[@]"`; do + case $as_mkdir_dir in # Skip DOS drivespec - ?:) ac_incr_dir=$ac_mkdir_dir ;; + ?:) as_incr_dir=$as_mkdir_dir ;; *) - ac_incr_dir=$ac_incr_dir/$ac_mkdir_dir - test -d "$ac_incr_dir" || mkdir "$ac_incr_dir" + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; } diff --git a/m4sh.m4 b/m4sh.m4 index 9ad6a9195..3f16848bd 100644 --- a/m4sh.m4 +++ b/m4sh.m4 @@ -67,6 +67,7 @@ elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then fi _AS_EXPR_PREPARE +_AS_LN_S_PREPARE _AS_TEST_PREPARE _AS_UNSET_PREPARE @@ -82,9 +83,9 @@ AS_UNSET([LC_MESSAGES], [C]) # IFS # We need space, tab and new line, in precisely that order. -ac_nl=' +as_nl=' ' -IFS=" $ac_nl" +IFS=" $as_nl" # CDPATH. AS_UNSET([CDPATH], [:]) @@ -149,7 +150,7 @@ fi # AS_UNSET(VAR, [VALUE-IF-UNSET-NOT-SUPPORTED = `']) # -------------------------------------------------- # Try to unset the env VAR, otherwise set it to -# VALUE-IF-UNSET-NOT-SUPPORTED. `ac_unset' must have been computed. +# VALUE-IF-UNSET-NOT-SUPPORTED. `as_unset' must have been computed. m4_defun([AS_UNSET], [m4_require([_AS_UNSET_PREPARE])dnl $as_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }]) @@ -313,22 +314,57 @@ fi ])# _AS_EXPR_PREPARE +# _AS_LN_S_PREPARE +# ---------------- +# Don't use conftest.sym to avoid filename issues on DJGPP, where this +# would yield conftest.sym.exe for DJGPP < 2.04. +m4_defun([_AS_LN_S_PREPARE], +[rm -f conftest conftest.exe conftest.file +echo >conftest.file +if ln -s conftest.file conftest 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conftest.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conftest.file conftest 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conftest conftest.exe conftest.file +])# _AS_LN_S_PREPARE + + +# AS_LN_S(FILE, LINK) +# ------------------- +# FIXME: Should we add the glue code to handle properly relative symlinks +# simulated with `ln' or `cp'? +m4_defun([AS_LN_S], +[m4_require([_AS_LN_S_PREPARE])dnl +$as_ln_s $1 $2 +]) + + # AS_MKDIR_P(PATH) # ---------------- # Emulate `mkdir -p' with plain `mkdir'. m4_define([AS_MKDIR_P], [{ case $1 in - [[\\/]]* | ?:[[\\/]]* ) ac_incr_dir=;; - *) ac_incr_dir=.;; + [[\\/]]* | ?:[[\\/]]* ) as_incr_dir=;; + *) as_incr_dir=.;; esac -ac_dummy=$1 -for ac_mkdir_dir in `IFS='\\/'; set X $ac_dummy; shift; echo "$[@]"`; do - case $ac_mkdir_dir in +as_dummy=$1 +for as_mkdir_dir in `IFS='\\/'; set X $as_dummy; shift; echo "$[@]"`; do + case $as_mkdir_dir in # Skip DOS drivespec - ?:) ac_incr_dir=$ac_mkdir_dir ;; + ?:) as_incr_dir=$as_mkdir_dir ;; *) - ac_incr_dir=$ac_incr_dir/$ac_mkdir_dir - test -d "$ac_incr_dir" || mkdir "$ac_incr_dir" + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" ;; esac done; }