diff options
-rw-r--r-- | Makefile.in | 2 | ||||
-rwxr-xr-x | configure | 128 | ||||
-rw-r--r-- | configure.ac | 23 | ||||
-rw-r--r-- | quilt/scripts/backup-files.in | 6 |
4 files changed, 156 insertions, 3 deletions
diff --git a/Makefile.in b/Makefile.in index 02f8a0f..5f20c04 100644 --- a/Makefile.in +++ b/Makefile.in @@ -43,6 +43,7 @@ RPMBUILD := @RPMBUILD@ SENDMAIL := @SENDMAIL@ USE_NLS := @USE_NLS@ +STAT_HARDLINK := @STAT_HARDLINK@ PATCH_WRAPPER := @PATCH_WRAPPER@ CC := @CC@ @@ -257,6 +258,7 @@ $(patsubst %.in,%,$(wildcard bin/*.in quilt/*.in quilt/scripts/*.in)) :: Makefil -e 's:@PERL''@:$(PERL):g' \ -e 's:@BASH''@:$(BASH):g' \ -e 's:@PATCH''@:$(PATCH):g' \ + -e 's:@STAT_HARDLINK''@:$(STAT_HARDLINK):g' \ -e 's:@VERSION''@:$(VERSION):g' \ -e 's:@RELEASE''@:$(RELEASE):g' \ -e 's:@ETCDIR''@:$(etcdir):g' \ @@ -660,6 +660,8 @@ COLUMN POD2MAN AWK SED +STAT_HARDLINK +STAT TR TAIL PERL @@ -728,6 +730,7 @@ with_perl with_grep with_tail with_tr +with_stat with_sed with_awk with_pod2man @@ -1387,6 +1390,7 @@ Optional Packages: --with-grep name of the grep executable to use --with-tail name of the tail executable to use --with-tr name of the tr executable to use + --with-stat name of the stat executable to use --with-sed name of the sed executable to use --with-awk name of the awk executable to use --with-pod2man name of the pod2man executable to use (use @@ -5206,6 +5210,130 @@ fi +# Check whether --with-stat was given. +if test "${with_stat+set}" = set; then + withval=$with_stat; + if test x"$withval" = xnone; then + { { $as_echo "$as_me:$LINENO: error: Invalid configure argument. use --without-stat" >&5 +$as_echo "$as_me: error: Invalid configure argument. use --without-stat" >&2;} + { (exit 1); exit 1; }; } + fi + if test x"$withval" != xno; then + { $as_echo "$as_me:$LINENO: checking for stat" >&5 +$as_echo_n "checking for stat... " >&6; } + STAT="$withval" + if test -e "$STAT"; then + if test ! -f "$STAT" -a ! -h "$STAT" || test ! -x "$STAT"; then + { { $as_echo "$as_me:$LINENO: error: $STAT is not an executable file" >&5 +$as_echo "$as_me: error: $STAT is not an executable file" >&2;} + { (exit 1); exit 1; }; } + fi + fi + { $as_echo "$as_me:$LINENO: result: $STAT" >&5 +$as_echo "$STAT" >&6; } + if test ! -e "$STAT"; then + { $as_echo "$as_me:$LINENO: WARNING: $STAT does not exist" >&5 +$as_echo "$as_me: WARNING: $STAT does not exist" >&2;} + fi + COMPAT_SYMLINKS="$COMPAT_SYMLINKS stat" + fi + +else + + + # Extract the first word of "stat", so it can be a program name with args. +set dummy stat; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_STAT+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $STAT in + [\\/]* | ?:[\\/]*) + ac_cv_path_STAT="$STAT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_STAT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +STAT=$ac_cv_path_STAT +if test -n "$STAT"; then + { $as_echo "$as_me:$LINENO: result: $STAT" >&5 +$as_echo "$STAT" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +fi + + if test -z "$STAT"; then + + { { $as_echo "$as_me:$LINENO: error: Please specify the location of stat with the option '--with-stat'" >&5 +$as_echo "$as_me: error: Please specify the location of stat with the option '--with-stat'" >&2;} + { (exit 1); exit 1; }; } + + fi + + + +{ $as_echo "$as_me:$LINENO: checking whether $STAT -c '%h' works" >&5 +$as_echo_n "checking whether $STAT -c '%h' works... " >&6; } +if $STAT -c '%h' /dev/null >/dev/null 2>/dev/null; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + STAT_HARDLINK="-c '%h'" +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:$LINENO: checking whether $STAT -f '%l' works" >&5 +$as_echo_n "checking whether $STAT -f '%l' works... " >&6; } + if $STAT -f '%l' /dev/null >/dev/null 2>/dev/null; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + STAT_HARDLINK="-f '%l'" + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:$LINENO: error: +Sorry, you have a version of stat which understands neither -c nor -f. +$PACKAGE_NAME needs it. If you have access to a version of stat which does +understand -c or -f, you can supply its path with the '--with-stat=' option. +" >&5 +$as_echo "$as_me: error: +Sorry, you have a version of stat which understands neither -c nor -f. +$PACKAGE_NAME needs it. If you have access to a version of stat which does +understand -c or -f, you can supply its path with the '--with-stat=' option. +" >&2;} + { (exit 1); exit 1; }; } + fi +fi + + + + + + # Check whether --with-sed was given. if test "${with_sed+set}" = set; then withval=$with_sed; diff --git a/configure.ac b/configure.ac index 16f9b88..2d1d10a 100644 --- a/configure.ac +++ b/configure.ac @@ -146,6 +146,29 @@ Solaris users can use /usr/xpg4/bin/tr. ]) fi +QUILT_COMPAT_PROG_PATH(STAT, stat) + +AC_MSG_CHECKING([whether $STAT -c '%h' works]) +if $STAT -c '%h' /dev/null >/dev/null 2>/dev/null; then + AC_MSG_RESULT(yes) + STAT_HARDLINK="-c '%h'" +else + AC_MSG_RESULT(no) + AC_MSG_CHECKING([whether $STAT -f '%l' works]) + if $STAT -f '%l' /dev/null >/dev/null 2>/dev/null; then + AC_MSG_RESULT(yes) + STAT_HARDLINK="-f '%l'" + else + AC_MSG_RESULT(no) + AC_MSG_ERROR([ +Sorry, you have a version of stat which understands neither -c nor -f. +$PACKAGE_NAME needs it. If you have access to a version of stat which does +understand -c or -f, you can supply its path with the '--with-stat=' option. +]) + fi +fi +AC_SUBST(STAT_HARDLINK) + QUILT_COMPAT_PROG_PATH(SED, sed) AC_MSG_CHECKING([whether $SED understands (foo|bar)]) diff --git a/quilt/scripts/backup-files.in b/quilt/scripts/backup-files.in index f691ed4..728fced 100644 --- a/quilt/scripts/backup-files.in +++ b/quilt/scripts/backup-files.in @@ -66,7 +66,7 @@ ensure_nolinks() { local filename="$1" local link_count dirname basename tmpname - link_count=$(stat -c '%h' "$filename") + link_count=$(stat @STAT_HARDLINK@ "$filename") if [ -z "$link_count" ] || [ "$link_count" -gt 1 ]; then dirname=$(dirname "$filename") basename=$(basename "$filename") @@ -92,7 +92,7 @@ process_file() { touch "$backup" else $ECHO "Copying $file" - if [ -n "$OPT_NOLINKS" -a "$(stat -c '%h' "$file")" = "1" ]; then + if [ -n "$OPT_NOLINKS" -a "$(stat @STAT_HARDLINK@ "$file")" = "1" ]; then copy_file "$file" "$backup" else link_or_copy_file "$file" "$backup" @@ -131,7 +131,7 @@ process_file() { if [ -e "$file" ]; then rm "$file" fi - if [ -n "$OPT_NOLINKS" -a "$(stat -c '%h' "$backup")" != "1" ]; then + if [ -n "$OPT_NOLINKS" -a "$(stat @STAT_HARDLINK@ "$backup")" != "1" ]; then copy_file "$backup" "$file" else link_or_copy_file "$backup" "$file" |