summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore9
-rw-r--r--Makefile.in56
-rw-r--r--TODO2
-rw-r--r--bin/quilt.in4
-rwxr-xr-xconfigure2602
-rw-r--r--configure.ac74
-rw-r--r--doc/README.in7
-rw-r--r--doc/main.tex4
-rw-r--r--doc/quilt.pdfbin184786 -> 180206 bytes
-rw-r--r--lib/backup-files.c622
-rw-r--r--quilt.changes74
-rw-r--r--quilt.spec.in1
-rw-r--r--quilt/add.in2
-rw-r--r--quilt/grep.in4
-rw-r--r--quilt/import.in8
-rw-r--r--quilt/new.in3
-rw-r--r--quilt/pop.in6
-rw-r--r--quilt/push.in2
-rw-r--r--quilt/remove.in2
-rw-r--r--quilt/scripts/backup-files.in363
-rw-r--r--quilt/scripts/inspect.in2
-rw-r--r--quilt/scripts/patchfns.in67
-rw-r--r--quilt/scripts/utilfns54
-rw-r--r--quilt/setup.in14
-rw-r--r--quilt/snapshot.in2
-rw-r--r--test/backup-files.test231
-rw-r--r--test/delete.test2
-rw-r--r--test/import.test9
-rw-r--r--test/setup.test47
-rw-r--r--test/space-in-filenames.test7
30 files changed, 1085 insertions, 3195 deletions
diff --git a/.gitignore b/.gitignore
index cb6b082..c6ce24b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,11 +19,14 @@ debian/quilt
debian/quilt.substvars
doc/quilt.1
-doc/quilt.aux
+doc/quilt.aux
doc/quilt.dvi
doc/quilt.log
-doc/quilt.ps
-doc/README
+doc/quilt.ps
+doc/quilt-rus.aux
+doc/quilt-rus.log
+doc/quilt-rus.pdf
+doc/README
doc/reference
lib/backup-files
diff --git a/Makefile.in b/Makefile.in
index d2155df..209dcd3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -7,7 +7,6 @@ PACKAGE_BUGREPORT := @PACKAGE_BUGREPORT@
prefix := @prefix@
exec_prefix := @exec_prefix@
bindir := @bindir@
-libdir := @libdir@
datarootdir := @datarootdir@
datadir := @datadir@
docdir := @docdir@
@@ -34,7 +33,7 @@ FIND := @FIND@
DIFF := @DIFF@
PATCH := @PATCH@
MKTEMP := @MKTEMP@
-MSGMERGE := @MSGMERGE@
+MSGMERGE := @MSGMERGE@
MSGFMT := @MSGFMT@
XGETTEXT := @XGETTEXT@
MSGUNIQ := @MSGUNIQ@
@@ -44,20 +43,9 @@ RPMBUILD := @RPMBUILD@
SENDMAIL := @SENDMAIL@
USE_NLS := @USE_NLS@
+STAT_HARDLINK := @STAT_HARDLINK@
PATCH_WRAPPER := @PATCH_WRAPPER@
-CC := @CC@
-CPPFLAGS += @CPPFLAGS@ @DEFS@
-CFLAGS += @CFLAGS@
-LDFLAGS += @LDFLAGS@
-LIBS := @LIBS@
-EXEEXT := @EXEEXT@
-
-LIBOBJS := $(filter $(patsubst lib/%.c,lib/%.o,$(wildcard lib/*.c)), $(patsubst %,lib/%,@LIBOBJS@))
-ifneq ($(LIBOBJS),)
-CFLAGS += -Ilib
-endif
-
COMPAT_SYMLINKS := @COMPAT_SYMLINKS@
COMPAT_PROGRAMS := @COMPAT_PROGRAMS@
@@ -72,6 +60,10 @@ SRC += COPYING AUTHORS TODO Makefile.in configure.ac \
bash_completion quilt.quiltrc aclocal.m4 git-desc
DIRT += quilt.spec
+DIRT += $(PACKAGE)-*.tar.gz
+DIRT += $(PACKAGE)-*.tar.gz.sig
+DIRT += $(PACKAGE)-*.tar.bz2
+
BIN_IN := quilt guards
BIN_SRC := $(BIN_IN:%=%.in)
BIN := $(BIN_IN)
@@ -85,27 +77,26 @@ SRC += $(QUILT_SRC:%=quilt/%)
DIRT += $(QUILT_IN:%=quilt/%)
SCRIPTS_IN := patchfns inspect dependency-graph edmail \
- remove-trailing-ws
+ remove-trailing-ws backup-files
SCRIPTS_SRC := $(SCRIPTS_IN:%=%.in)
SCRIPTS := $(SCRIPTS_IN)
SRC += $(SCRIPTS_SRC:%=quilt/scripts/%)
+SRC += quilt/scripts/utilfns
DIRT += $(SCRIPTS_IN:%=quilt/scripts/%)
COMPAT := $(COMPAT_PROGRAMS:%=compat/%) $(COMPAT_SYMLINKS:%=compat/%)
SRC += $(wildcard compat/*.in) $(wildcard compat/*.sh)
DIRT += $(patsubst %.in,%,$(wildcard compat/*.in)) $(COMPAT_SYMLINKS:%=compat/%)
-LIB_SRC := backup-files.c quilt.el
-LIB := backup-files$(EXEEXT)
+LIB_SRC := quilt.el
SRC += $(LIB_SRC:%=lib/%)
-DIRT += lib/backup-files$(EXEEXT) $(LIB_SRC:%.c=lib/%.o)
DOC_IN := README quilt.1
DOC_SRC := $(DOC_IN:%=doc/%.in)
DOC := $(DOC_IN)
SRC += $(DOC_SRC)
-SRC += doc/main.tex doc/quilt.pdf doc/Makefile \
+SRC += doc/main.tex doc/quilt.pdf doc/Makefile \
doc/README.MAIL doc/README.EMACS
DIRT += $(DOC_IN:%=doc/%) doc/reference
@@ -118,12 +109,12 @@ endif
LINGUAS := fr de ja ru
PO := quilt.pot $(LINGUAS:%=%.po)
SRC += $(PO:%=po/%)
-DIRT += po/*.mo po/*~
+DIRT += po/*.mo po/*~
SRC += $(wildcard test/*.test) test/run test/test.quiltrc
SRC += changes2changelog
-NON_EXEC_IN := doc/quilt.1 doc/README quilt/scripts/patchfns
+NON_EXEC_IN := doc/quilt.1 doc/README quilt/scripts/patchfns quilt/scripts/utilfns
GIT_DESC := $(shell ./git-desc | sed -e 's:^v::')
@@ -133,16 +124,13 @@ DIRT += test/.depend $(wildcard test/.*.ok)
# Settings for running the uninstalled version of quilt in the source tree:
PATH := $(CURDIR)/bin:$(CURDIR)/compat:$(PATH)
QUILT_DIR := $(CURDIR)/quilt
-QUILT_LIB := $(CURDIR)/lib
QUILTRC := $(CURDIR)/test/test.quiltrc
-export QUILT_DIR QUILT_LIB QUILTRC
+export QUILT_DIR QUILTRC
#-----------------------------------------------------------------------
all : configure scripts compat $(DOC:%=doc/%) $(MAN1) mofiles
-$(LIB:%=lib/%) :: $(LIBOBJS)
-
ifeq ($(USE_NLS),yes)
mofiles : $(LINGUAS:%=po/%.mo)
else
@@ -156,7 +144,7 @@ endif
$(MSGMERGE) -o $@ $@ $^
scripts : $(BIN:%=bin/%) $(QUILT:%=quilt/%) \
- $(SCRIPTS:%=quilt/scripts/%) $(LIB:%=lib/%) \
+ $(SCRIPTS:%=quilt/scripts/%) \
$(if $(PATCH_WRAPPER),bin/patch-wrapper)
dist : clean $(PACKAGE)-$(VERSION).tar.gz
@@ -223,7 +211,7 @@ doc/quilt.1: doc/quilt.1.in doc/reference $(COMPAT)
esac; \
done < $< 2>&1 > $@
-doc/reference : bin/quilt $(QUILT:%=quilt/%) quilt/scripts/patchfns $(COMPAT)
+doc/reference : bin/quilt $(QUILT:%=quilt/%) quilt/scripts/patchfns quilt/scripts/utilfns $(COMPAT)
@unset LANG LC_MESSAGES LC_CTYPE LC_ALL; \
for i in $(QUILT); \
do \
@@ -264,11 +252,11 @@ $(PACKAGE).spec : $(PACKAGE).spec.in $(PACKAGE).changes Makefile
$(patsubst %.in,%,$(wildcard bin/*.in quilt/*.in quilt/scripts/*.in)) :: Makefile
% :: %.in
@echo "$< -> $@" >&2
- @$(SED) -e 's:@QUILT_LIB''@:$(libdir)/$(PACKAGE):g' \
- -e 's:@QUILT_DIR''@:$(datadir)/$(PACKAGE):g' \
+ @$(SED) -e 's:@QUILT_DIR''@:$(datadir)/$(PACKAGE):g' \
-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' \
@@ -277,8 +265,6 @@ $(patsubst %.in,%,$(wildcard bin/*.in quilt/*.in quilt/scripts/*.in)) :: Makefil
$< > $@
@$(if $(filter $@,$(NON_EXEC_IN)),,chmod +x $@)
-lib/backup-files.o :: Makefile
-
configure : configure.ac aclocal.m4
autoconf
@echo "Please run ./configure"
@@ -321,16 +307,13 @@ install-main :: scripts
$(INSTALL) -m 755 $(patsubst %,quilt/scripts/%, \
$(filter-out patchfns,$(SCRIPTS))) \
$(BUILD_ROOT)$(datadir)/$(PACKAGE)/scripts
- $(INSTALL) -m 644 quilt/scripts/patchfns \
+ $(INSTALL) -m 644 quilt/scripts/patchfns quilt/scripts/utilfns \
$(BUILD_ROOT)$(datadir)/$(PACKAGE)/scripts
ifneq ($(PATCH_WRAPPER),)
$(INSTALL) -d $(BUILD_ROOT)$(datadir)/$(PACKAGE)/wrapper
$(INSTALL) -m 755 bin/patch-wrapper \
$(BUILD_ROOT)$(datadir)/$(PACKAGE)/wrapper/patch
endif
-
- $(INSTALL) -d $(BUILD_ROOT)$(libdir)/$(PACKAGE)
- $(INSTALL) -m 755 $(LIB:%=lib/%) $(BUILD_ROOT)$(libdir)/$(PACKAGE)/
$(INSTALL) -d $(BUILD_ROOT)$(docdir)/
$(INSTALL) -m 644 doc/README \
@@ -368,7 +351,6 @@ install: install-main install-compat
uninstall ::
rm -rf $(BIN:%=$(BUILD_ROOT)$(bindir)/%) \
- $(BUILD_ROOT)$(libdir)/$(PACKAGE) \
$(BUILD_ROOT)$(datadir)/$(PACKAGE) \
$(patsubst %,$(BUILD_ROOT)$(mandir)/man1/%, \
$(notdir $(MAN1))) \
@@ -392,7 +374,7 @@ test/.patch-wrapper.ok : bin/patch-wrapper
# Include a run-time generated list of dependencies for each test case
test/.depend : Makefile $(TESTS)
- @( printf "%s : bin/quilt quilt/scripts/patchfns $(LIB:%=lib/%) $(COMPAT)\n" $(TESTS); \
+ @( printf "%s : bin/quilt quilt/scripts/patchfns quilt/scripts/utilfns quilt/scripts/backup-files $(COMPAT)\n" $(TESTS); \
$(AWK) 'sub(/.*\$$ *quilt /, "") \
{ print FILENAME, ":", "quilt/"$$1}' $(TESTS); \
$(AWK) 'sub(/.*\<quilt_command /, "") && ($$1 !~ /[^a-z]/) \
diff --git a/TODO b/TODO
index 4db69b2..eaaf11f 100644
--- a/TODO
+++ b/TODO
@@ -2,7 +2,7 @@ General:
- Abstract backup operations to/from the .pc/ directory, so that
optionally something like rcs can be used instead of
- lib/backup-files?
+ scripts/backup-files?
- Add something similar to cvs diff, which scans all files for
changes that have not been folded back into their patches,
diff --git a/bin/quilt.in b/bin/quilt.in
index 61114ad..30df4dc 100644
--- a/bin/quilt.in
+++ b/bin/quilt.in
@@ -9,8 +9,8 @@
export TEXTDOMAIN=quilt
export TEXTDOMAINDIR=@LOCALEDIR@
-: ${QUILT_DIR=@QUILT_DIR@} ${QUILT_LIB=@QUILT_LIB@}
-export QUILT_DIR QUILT_LIB
+: ${QUILT_DIR=@QUILT_DIR@}
+export QUILT_DIR
if [ -z "$QUILTRC" ]
then
diff --git a/configure b/configure
index 98ac00a..305cb7c 100755
--- a/configure
+++ b/configure
@@ -601,43 +601,8 @@ PACKAGE_VERSION='0.51'
PACKAGE_STRING='quilt 0.51'
PACKAGE_BUGREPORT='quilt-dev@nongnu.org'
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
-#endif
-#ifdef HAVE_STRING_H
-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-# include <memory.h>
-# endif
-# include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
ac_subst_vars='LTLIBOBJS
+LIBOBJS
COMPAT_PROGRAMS
COMPAT_SYMLINKS
RPMBUILD
@@ -660,8 +625,11 @@ COLUMN
POD2MAN
AWK
SED
+STAT_HARDLINK
+STAT
TR
TAIL
+GREP
PERL
DATE
CP
@@ -669,17 +637,6 @@ BASH
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
-LIBOBJS
-EGREP
-GREP
-CPP
-OBJEXT
-EXEEXT
-ac_ct_CC
-CPPFLAGS
-LDFLAGS
-CFLAGS
-CC
PACKAGE_RELEASE
target_alias
host_alias
@@ -728,6 +685,7 @@ with_perl
with_grep
with_tail
with_tr
+with_stat
with_sed
with_awk
with_pod2man
@@ -746,13 +704,7 @@ with_rpmbuild
'
ac_precious_vars='build_alias
host_alias
-target_alias
-CC
-CFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
-CPP'
+target_alias'
# Initialize some variables set by options.
@@ -1387,6 +1339,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
@@ -1407,19 +1360,6 @@ Optional Packages:
--with-patch-wrapper include GNU patch wrapper
--with-rpmbuild name of the rpmbuild executable to use
-Some influential environment variables:
- CC C compiler command
- CFLAGS C compiler flags
- LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
- nonstandard directory <lib dir>
- LIBS libraries to pass to the linker, e.g. -l<library>
- CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
- you have headers in a nonstandard directory <include dir>
- CPP C preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
Report bugs to <quilt-dev@nongnu.org>.
_ACEOF
ac_status=$?
@@ -1903,2358 +1843,6 @@ PACKAGE_RELEASE=1
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; 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_prog_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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_prog_CC="${ac_tool_prefix}gcc"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; 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_prog_ac_ct_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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_prog_ac_ct_CC="gcc"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_CC" = x; then
- CC=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- CC=$ac_ct_CC
- fi
-else
- CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; 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_prog_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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_prog_CC="${ac_tool_prefix}cc"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- fi
-fi
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; 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_prog_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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
- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# != 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
- fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- for ac_prog in cl.exe
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; 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_prog_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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_prog_CC="$ac_tool_prefix$ac_prog"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$CC" && break
- done
-fi
-if test -z "$CC"; then
- ac_ct_CC=$CC
- for ac_prog in cl.exe
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; 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_prog_ac_ct_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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_prog_ac_ct_CC="$ac_prog"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$ac_ct_CC" && break
-done
-
- if test "x$ac_ct_CC" = x; then
- CC=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- CC=$ac_ct_CC
- fi
-fi
-
-fi
-
-
-test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-
-# Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler --version >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler -v >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler -V >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-
-# The possible output files:
-ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
-
-ac_rmfiles=
-for ac_file in $ac_files
-do
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
- * ) ac_rmfiles="$ac_rmfiles $ac_file";;
- esac
-done
-rm -f $ac_rmfiles
-
-if { (ac_try="$ac_link_default"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link_default") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile. We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
-do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
- ;;
- [ab].out )
- # We found the default executable, but exeext='' is most
- # certainly right.
- break;;
- *.* )
- if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
- then :; else
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- fi
- # We set ac_cv_exeext here because the later test for it is not
- # safe: cross compilers may not add the suffix if given an `-o'
- # argument, so we may need to know it at that point already.
- # Even if this section looks crufty: it has the advantage of
- # actually working.
- break;;
- * )
- break;;
- esac
-done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
-else
- ac_file=''
-fi
-
-{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-if test -z "$ac_file"; then
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
- fi
- fi
-fi
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- break;;
- * ) break;;
- esac
-done
-else
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
-$as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- for ac_file in conftest.o conftest.obj conftest.*; do
- test -f "$ac_file" || continue;
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
- *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
- break;;
- esac
-done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-#ifndef __GNUC__
- choke me
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_compiler_gnu=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_compiler_gnu=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
- GCC=yes
-else
- GCC=
-fi
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_save_c_werror_flag=$ac_c_werror_flag
- ac_c_werror_flag=yes
- ac_cv_prog_cc_g=no
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_g=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- CFLAGS=""
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_c_werror_flag=$ac_save_c_werror_flag
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_g=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_c_werror_flag=$ac_save_c_werror_flag
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
- function prototypes and stuff, but not '\xHH' hex character constants.
- These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std is added to get
- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
- array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std. */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
- inside strings and character constants. */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
- ;
- return 0;
-}
-_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
- -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
- CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_c89=$ac_arg
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext
- test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
- x)
- { $as_echo "$as_me:$LINENO: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
- xno)
- { $as_echo "$as_me:$LINENO: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
- *)
- CC="$CC $ac_cv_prog_cc_c89"
- { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- # Broken: success on invalid input.
-continue
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-{ $as_echo "$as_me:$LINENO: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- # Broken: success on invalid input.
-continue
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- :
-else
- { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -z "$GREP"; then
- ac_path_GREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in grep ggrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
-# Check for GNU ac_path_GREP and select it if it is found.
- # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
- ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- $as_echo 'GREP' >> "conftest.nl"
- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
- if test $ac_count -gt ${ac_path_GREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_GREP="$ac_path_GREP"
- ac_path_GREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_GREP_found && break 3
- done
- done
-done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_GREP"; then
- { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
- fi
-else
- ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
- then ac_cv_path_EGREP="$GREP -E"
- else
- if test -z "$EGREP"; then
- ac_path_EGREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in egrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
- # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
- ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- $as_echo 'EGREP' >> "conftest.nl"
- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
- if test $ac_count -gt ${ac_path_EGREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_EGREP="$ac_path_EGREP"
- ac_path_EGREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_EGREP_found && break 3
- done
- done
-done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_EGREP"; then
- { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
- fi
-else
- ac_cv_path_EGREP=$EGREP
-fi
-
- fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_header_stdc=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_header_stdc=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then
- :
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then
- :
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- return 2;
- return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- :
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-
-
-for ac_func in fchmod chmod
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-
-for ac_func in mkstemp mktemp
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
- break
-fi
-done
-
-
-
-for ac_func in mkdir rmdir
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-
-for ac_func in strchr strrchr
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-for ac_func in strerror
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- eval "$as_ac_var=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
-$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if test "${ac_cv_c_const+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-/* FIXME: Include the comments suggested by Paul. */
-#ifndef __cplusplus
- /* Ultrix mips cc rejects this. */
- typedef int charset[2];
- const charset cs;
- /* SunOS 4.1.1 cc rejects this. */
- char const *const *pcpcc;
- char **ppc;
- /* NEC SVR4.0.2 mips cc rejects this. */
- struct point {int x, y;};
- static struct point const zero = {0,0};
- /* AIX XL C 1.02.0.0 rejects this.
- It does not let you subtract one const X* pointer from another in
- an arm of an if-expression whose if-part is not a constant
- expression */
- const char *g = "string";
- pcpcc = &g + (g ? g-g : 0);
- /* HPUX 7.0 cc rejects these. */
- ++pcpcc;
- ppc = (char**) pcpcc;
- pcpcc = (char const *const *) ppc;
- { /* SCO 3.2v4 cc rejects this. */
- char *t;
- char const *s = 0 ? (char *) 0 : (char const *) 0;
-
- *t++ = 0;
- if (s) return 0;
- }
- { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
- int x[] = {25, 17};
- const int *foo = &x[0];
- ++foo;
- }
- { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
- typedef const int *iptr;
- iptr p = 0;
- ++p;
- }
- { /* AIX XL C 1.02.0.0 rejects this saying
- "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
- struct s { int j; const int *ap[3]; };
- struct s *b; b->j = 5;
- }
- { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
- const int foo = 10;
- if (!foo) return 0;
- }
- return !cs[0] && !zero.x;
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_c_const=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_c_const=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
-$as_echo "$ac_cv_c_const" >&6; }
-if test $ac_cv_c_const = no; then
-
-cat >>confdefs.h <<\_ACEOF
-#define const /**/
-_ACEOF
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- eval "$as_ac_Header=yes"
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
- $as_echo "$as_val"'`
- if test "x$as_val" = x""yes; then
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-{ $as_echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5
-$as_echo_n "checking whether lstat dereferences a symlink specified with a trailing slash... " >&6; }
-if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- rm -f conftest.sym conftest.file
-echo >conftest.file
-if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
- if test "$cross_compiling" = yes; then
- ac_cv_func_lstat_dereferences_slashed_symlink=no
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-struct stat sbuf;
- /* Linux will dereference the symlink and fail.
- That is better in the sense that it means we will not
- have to compile and use the lstat wrapper. */
- return lstat ("conftest.sym/", &sbuf) == 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_lstat_dereferences_slashed_symlink=yes
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_lstat_dereferences_slashed_symlink=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-else
- # If the `ln -s' command failed, then we probably don't even
- # have an lstat function.
- ac_cv_func_lstat_dereferences_slashed_symlink=no
-fi
-rm -f conftest.sym conftest.file
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
-$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; }
-
-test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
-
-cat >>confdefs.h <<_ACEOF
-#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
-_ACEOF
-
-
-if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
- case " $LIBOBJS " in
- *" lstat.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS lstat.$ac_objext"
- ;;
-esac
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5
-$as_echo_n "checking whether stat accepts an empty string... " >&6; }
-if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_func_stat_empty_string_bug=yes
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-struct stat sbuf;
- return stat ("", &sbuf) == 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_func_stat_empty_string_bug=no
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_func_stat_empty_string_bug=yes
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5
-$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; }
-if test $ac_cv_func_stat_empty_string_bug = yes; then
- case " $LIBOBJS " in
- *" stat.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS stat.$ac_objext"
- ;;
-esac
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STAT_EMPTY_STRING_BUG 1
-_ACEOF
-
-fi
-
-
-#AC_CONFIG_LIBOBJ_DIR(lib)
-#AC_REPLACE_FUNCS()
-
-if test "$ac_compiler_gnu" = "yes"; then
- CFLAGS="$CFLAGS -Wall"
-fi
-EXEEXT="$ac_cv_exeext"
-
-
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
@@ -5206,6 +2794,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;
@@ -6195,6 +3907,29 @@ does understand -path, you can supply its path with the
{ (exit 1); exit 1; }; }
fi
+{ $as_echo "$as_me:$LINENO: checking whether $FIND -print0 works" >&5
+$as_echo_n "checking whether $FIND -print0 works... " >&6; }
+if $FIND . -path '*' -print0 >/dev/null 2>&1; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+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 find which doesn't understand -print0.
+$PACKAGE_NAME needs it. If you have access to a version of find which
+does understand -print0, you can supply its path with the
+'--with-find=' option.
+" >&5
+$as_echo "$as_me: error:
+Sorry, you have a version of find which doesn't understand -print0.
+$PACKAGE_NAME needs it. If you have access to a version of find which
+does understand -print0, you can supply its path with the
+'--with-find=' option.
+" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
@@ -6286,6 +4021,29 @@ $as_echo "$as_me: error: Please specify the location of xargs with the option '-
+{ $as_echo "$as_me:$LINENO: checking whether $XARGS -0 works" >&5
+$as_echo_n "checking whether $XARGS -0 works... " >&6; }
+if echo | $XARGS -0 echo >/dev/null 2>&1; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+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 xargs which doesn't understand -0.
+$PACKAGE_NAME needs it. If you have access to a version of xargs which
+does understand -0, you can supply its path with the
+'--with-xargs=' option.
+" >&5
+$as_echo "$as_me: error:
+Sorry, you have a version of xargs which doesn't understand -0.
+$PACKAGE_NAME needs it. If you have access to a version of xargs which
+does understand -0, you can supply its path with the
+'--with-xargs=' option.
+" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
# Check whether --with-diffstat was given.
@@ -7983,12 +5741,6 @@ $as_echo "" >&6; }
{ $as_echo "$as_me:$LINENO: result: Using '$prefix' for installation prefix." >&5
$as_echo "Using '$prefix' for installation prefix." >&6; }
-# we don't need to see this just for the backup-files command
-# but we may as well spec it for the future
-#AC_MSG_RESULT([Using '$CC' for C compiler.])
-#AC_MSG_RESULT([Building with '$CFLAGS' for C compiler flags.])
-#AC_MSG_RESULT([Building with '$LIBS' for linker flags.])
-
{ $as_echo "$as_me:$LINENO: result: " >&5
$as_echo "" >&6; }
{ $as_echo "$as_me:$LINENO: result: Report bugs to $PACKAGE_BUGREPORT" >&5
diff --git a/configure.ac b/configure.ac
index 09969c0..f0f73fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,25 +8,6 @@ PACKAGE_RELEASE=1
AC_SUBST(PACKAGE_RELEASE)
AC_SUBST(PACKAGE_TARNAME)
-dnl Setup for backup-files compilation
-AC_HEADER_STDC
-AC_CHECK_FUNCS([fchmod chmod])
-AC_CHECK_FUNCS([mkstemp mktemp], break)
-AC_CHECK_FUNCS([mkdir rmdir])
-AC_CHECK_FUNCS([strchr strrchr])
-AC_CHECK_FUNCS([strerror])
-AC_C_CONST
-AC_FUNC_STAT
-
-#AC_CONFIG_LIBOBJ_DIR(lib)
-#AC_REPLACE_FUNCS()
-
-if test "$ac_compiler_gnu" = "yes"; then
- CFLAGS="$CFLAGS -Wall"
-fi
-EXEEXT="$ac_cv_exeext"
-AC_SUBST(EXEEXT)
-
AC_PROG_INSTALL
AC_SYS_INTERPRETER
@@ -146,6 +127,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)])
@@ -302,8 +306,34 @@ does understand -path, you can supply its path with the
])
fi
+AC_MSG_CHECKING([whether $FIND -print0 works])
+if $FIND . -path '*' -print0 >/dev/null 2>&1; then
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([
+Sorry, you have a version of find which doesn't understand -print0.
+$PACKAGE_NAME needs it. If you have access to a version of find which
+does understand -print0, you can supply its path with the
+'--with-find=' option.
+])
+fi
+
QUILT_COMPAT_PROG_PATH(XARGS, xargs)
+AC_MSG_CHECKING([whether $XARGS -0 works])
+if echo | $XARGS -0 echo >/dev/null 2>&1; then
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([
+Sorry, you have a version of xargs which doesn't understand -0.
+$PACKAGE_NAME needs it. If you have access to a version of xargs which
+does understand -0, you can supply its path with the
+'--with-xargs=' option.
+])
+fi
+
QUILT_COMPAT_PROG_PATH_OPT(DIFFSTAT, diffstat)
if test "$DIFFSTAT" != "diffstat"; then
@@ -388,11 +418,5 @@ AC_MSG_RESULT([$PACKAGE_NAME version $PACKAGE_VERSION configured.])
AC_MSG_RESULT([])
AC_MSG_RESULT([Using '$prefix' for installation prefix.])
-# we don't need to see this just for the backup-files command
-# but we may as well spec it for the future
-#AC_MSG_RESULT([Using '$CC' for C compiler.])
-#AC_MSG_RESULT([Building with '$CFLAGS' for C compiler flags.])
-#AC_MSG_RESULT([Building with '$LIBS' for linker flags.])
-
AC_MSG_RESULT([])
AC_MSG_RESULT([Report bugs to $PACKAGE_BUGREPORT])
diff --git a/doc/README.in b/doc/README.in
index cc01cfa..3bdfa71 100644
--- a/doc/README.in
+++ b/doc/README.in
@@ -108,12 +108,9 @@ inspect
A script to create a series file from an rpm spec file (including
a list of tar files).
-parse-patch {-s|-u} section file [< replacement]
- Select a %section from a patch (-s) or replace a
- %section with the text from standard input (-u).
-
patchfns
- A collection of functions.
+utilfns
+ Collections of functions.
remove-trailing-ws
A utility to report trailing whitespace, and remove trailing
diff --git a/doc/main.tex b/doc/main.tex
index 51042dd..a3404c4 100644
--- a/doc/main.tex
+++ b/doc/main.tex
@@ -202,8 +202,8 @@ Patch files are located in the \textsf{patches} sub-directory of the
source tree (see Figure~\ref{fig:dir-layout}). The \textsf{QUILT\_PATCHES}
environment variable can be used to override this location and quilt
will remember this location by storing its value in the
-\textsf{.pc/.quilt\_patches} file. The
-\textsf{patches} directory may contain sub-directories.
+\textsf{.pc/.quilt\_patches} file. The \textsf{patches} directory may contain
+sub-directories, which is useful for grouping related patches together.
\textsf{patches} may also be a symbolic link instead of a directory.
A file called \textsf{series} contains a list of patch file names that
diff --git a/doc/quilt.pdf b/doc/quilt.pdf
index 6016d65..9153744 100644
--- a/doc/quilt.pdf
+++ b/doc/quilt.pdf
Binary files differ
diff --git a/lib/backup-files.c b/lib/backup-files.c
deleted file mode 100644
index e2c1ea1..0000000
--- a/lib/backup-files.c
+++ /dev/null
@@ -1,622 +0,0 @@
-/*
- File: backup-files.c
-
- Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
- Andreas Gruenbacher <agruen@suse.de>, SuSE Labs
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-/*
- * Create backup files of a list of files similar to GNU patch. A path
- * name prefix and suffix for the backup file can be specified with the
- * -B and -z options.
- */
-
-#define _GNU_SOURCE 1
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <utime.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <dirent.h>
-
-#if !defined(HAVE_MKSTEMP) && defined(HAVE_MKTEMP)
-# define mkstemp(x) creat(mktemp(x), 0600)
-#endif
-
-#ifndef PATH_MAX
-# define PATH_MAX 4096
-#endif
-
-#ifdef __MINGW32__
-#define mkdir(x,y) mkdir(x)
-/* Symlinks are not supported */
-#define lstat stat
-static int link(const char *oldpath, const char *newpath)
-{
- errno = ENOSYS;
- return -1;
-}
-#endif
-
-const char *progname;
-
-enum { what_noop, what_backup, what_restore, what_remove };
-
-const char *opt_prefix="", *opt_suffix="", *opt_file;
-int opt_silent, opt_what=what_noop;
-int opt_nolinks, opt_touch;
-int opt_keep_backup;
-
-#define LINE_LENGTH 1024
-
-
-static void
-usage(void)
-{
- printf("Usage: %s [-B prefix] [-z suffix] [-f {file|-}] [-sktL] [-b|-r|-x] {file|-} ...\n"
- "\n"
- "\tCreate hard linked backup copies of a list of files\n"
- "\tread from standard input.\n"
- "\n"
- "\t-b\tCreate backup\n"
- "\t-r\tRestore the backup\n"
- "\t-x\tRemove backup files and empty parent directories\n"
- "\t-k\tWhen doing a restore, keep the backup files\n"
- "\t-B\tPath name prefix for backup files\n"
- "\t-z\tPath name suffix for backup files\n"
- "\t-s\tSilent operation; only print error messages\n"
- "\t-f\tRead the filenames to process from file (- = standard input)\n"
- "\t-t\tTouch original files after restore (update their mtimes)\n\n"
- "\t-L\tEnsure that when finished, the source file has a link count of 1\n\n",
- progname);
-}
-
-static void *
-malloc_nofail(size_t size)
-{
- void *p = malloc(size);
- if (!p) {
- perror(progname);
- exit(1);
- }
- return p;
-}
-
-static void
-create_parents(const char *filename)
-{
- struct stat st;
- int rv = -1;
- char *fn = malloc_nofail(strlen(filename) + 1), *f;
-
- strcpy(fn, filename);
-
- f = strrchr(fn, '/');
- if (f == NULL)
- goto out;
- *f = '\0';
- if (stat(fn, &st) == 0)
- goto out;
- *f = '/';
-
- f = strchr(fn, '/');
- while (f != NULL) {
- *f = '\0';
- if (!rv || (rv = stat(fn, &st)) != 0) {
- mkdir(fn, 0777);
- }
- *f = '/';
- f = strchr(f+1, '/');
- }
-out:
- free(fn);
-}
-
-static void
-remove_parents(const char *filename)
-{
- char *fn = malloc_nofail(strlen(filename) + 1), *f;
-
- strcpy(fn, filename);
-
- f = strrchr(fn, '/');
- if (f == NULL)
- goto out;
- do {
- *f = '\0';
- if (rmdir(fn) == -1)
- goto out;
- } while ((f = strrchr(fn, '/')) != NULL);
- rmdir(fn);
-out:
- free(fn);
-}
-
-static int
-copy_fd(int from_fd, int to_fd)
-{
- char buffer[16384];
- char *wbuf;
- ssize_t len, l;
-
- for ( ;; ) {
- len = read(from_fd, buffer, sizeof(buffer));
- if (len == 0)
- return 0;
- if (len < 0) {
- if (errno == EINTR || errno == EAGAIN)
- continue;
- return 1;
- }
- for (wbuf = buffer; len != 0; ) {
- l = write(to_fd, wbuf, len);
- if (l < 0) {
- if (errno == EINTR || errno == EAGAIN)
- continue;
- return 1;
- }
- wbuf += l;
- len -= l;
- }
- }
-}
-
-static int
-copy_file(const char *from, const struct stat *st, const char *to)
-{
- int from_fd, to_fd, error = 1;
-
- if ((from_fd = open(from, O_RDONLY)) == -1) {
- perror(from);
- return 1;
- }
- unlink(to); /* make sure we don't inherit this file's mode. */
- if ((to_fd = creat(to, st->st_mode)) < 0) {
- perror(to);
- close(from_fd);
- return 1;
- }
-#if defined(HAVE_FCHMOD)
- (void) fchmod(to_fd, st->st_mode);
-#elif defined(HAVE_CHMOD)
- (void) chmod(to, st->st_mode);
-#endif
- if (copy_fd(from_fd, to_fd)) {
- fprintf(stderr, "%s -> %s: %s\n", from, to, strerror(errno));
- unlink(to);
- goto out;
- }
-
- error = 0;
-out:
- close(from_fd);
- close(to_fd);
-
- return error;
-}
-
-static int
-link_or_copy_file(const char *from, const struct stat *st, const char *to)
-{
- if (link(from, to) == 0)
- return 0;
- if (errno != EXDEV && errno != EPERM &&
- errno != EMLINK && errno != ENOSYS) {
- fprintf(stderr, "Could not link file `%s' to `%s': %s\n",
- from, to, strerror(errno));
- return 1;
- }
- return copy_file(from, st, to);
-}
-
-static int
-ensure_nolinks(const char *filename)
-{
- struct stat st;
-
- if (stat(filename, &st) != 0) {
- perror(filename);
- return 1;
- }
- if (st.st_nlink > 1) {
- char *tmpname = malloc(1 + strlen(filename) + 7 + 1), *c;
- int from_fd = -1, to_fd = -1;
- int error = 1;
-
- if (!tmpname)
- goto fail;
- from_fd = open(filename, O_RDONLY);
- if (from_fd == -1)
- goto fail;
-
- /* Temp file name is "path/to/.file.XXXXXX" */
- strcpy(tmpname, filename);
- strcat(tmpname, ".XXXXXX");
- c = strrchr(tmpname, '/');
- if (c == NULL)
- c = tmpname;
- else
- c++;
- memmove(c + 1, c, strlen(c) + 1);
- *c = '.';
-
- to_fd = mkstemp(tmpname);
- if (to_fd == -1)
- goto fail;
- if (copy_fd(from_fd, to_fd))
- goto fail;
-#if defined(HAVE_FCHMOD)
- (void) fchmod(to_fd, st.st_mode);
-#elif defined(HAVE_CHMOD)
- (void) chmod(tmpname, st.st_mode);
-#endif
- close(from_fd);
- from_fd = -1;
- close(to_fd);
- to_fd = -1;
- if (rename(tmpname, filename))
- goto fail;
-
- error = 0;
- fail:
- if (error)
- perror(filename);
- if (from_fd != -1)
- close(from_fd);
- if (to_fd != -1)
- close(to_fd);
- free(tmpname);
- return error;
- } else
- return 0;
-}
-
-static int
-process_file(const char *file)
-{
- char *backup = malloc_nofail(
- strlen(opt_prefix) + strlen(file) + strlen(opt_suffix) + 1);
-
- sprintf(backup, "%s%s%s", opt_prefix, file, opt_suffix);
-
- if (opt_what == what_backup) {
- struct stat st;
- int missing_file = (stat(file, &st) == -1 && errno == ENOENT);
-
- unlink(backup);
- create_parents(backup);
- if (missing_file) {
- int fd;
-
- if (!opt_silent)
- printf("New file %s\n", file);
- /* Old versions of GNU patch create new files with mode==0.
- (This has been changed/fixed in patch version 2.6.) */
- if ((fd = creat(backup, 0666)) == -1) {
- perror(backup);
- goto fail;
- }
- close(fd);
- } else {
- if (!opt_silent)
- printf("Copying %s\n", file);
- if (opt_nolinks && st.st_nlink == 1) {
- if (copy_file(file, &st, backup))
- goto fail;
- } else {
- if (link_or_copy_file(file, &st, backup))
- goto fail;
- if (opt_nolinks && ensure_nolinks(file))
- goto fail;
- }
- if (opt_touch)
- (void) utime(backup, NULL);
- else {
- struct utimbuf ut;
- ut.actime = ut.modtime = st.st_mtime;
- (void) utime(backup, &ut);
- }
- }
- } else if (opt_what == what_restore) {
- struct stat st;
-
- create_parents(file);
- if (stat(backup, &st) != 0) {
- perror(backup);
- goto fail;
- }
- if (st.st_size == 0) {
- if (unlink(file) == 0 || errno == ENOENT) {
- if (!opt_silent)
- printf("Removing %s\n", file);
- } else {
- perror(file);
- goto fail;
- }
- if (!opt_keep_backup) {
- unlink(backup);
- remove_parents(backup);
- }
- } else {
- if (!opt_silent)
- printf("Restoring %s\n", file);
- unlink(file);
- if (opt_nolinks && st.st_nlink != 1) {
- if (copy_file(backup, &st, file))
- goto fail;
- } else {
- if (link_or_copy_file(backup, &st, file))
- goto fail;
- if (opt_nolinks && ensure_nolinks(file))
- goto fail;
- }
- if (!opt_keep_backup) {
- unlink(backup);
- remove_parents(backup);
- }
- if (opt_touch)
- (void) utime(file, NULL);
- else {
- struct utimbuf ut;
- ut.actime = ut.modtime = st.st_mtime;
- (void) utime(file, &ut);
- }
- }
- } else if (opt_what == what_remove) {
- unlink(backup);
- remove_parents(backup);
- } else if (opt_what == what_noop) {
- struct stat st;
- int missing_file = (stat(file, &st) == -1 && errno == ENOENT);
-
- if (!missing_file && opt_nolinks) {
- if (ensure_nolinks(file))
- goto fail;
- }
- } else
- goto fail;
-
- free(backup);
- return 0;
-
-fail:
- free(backup);
- return 1;
-}
-
-static int
-foreachdir_rec(const char *path, struct stat *st,
- int (*walk)(const char *, const struct stat *))
-{
- DIR *dir;
- struct dirent *dp;
- int failed = 0;
-
- struct path {
- char *name;
- struct path *next;
- };
- struct path *paths = NULL, *last_path = NULL;
-
- if (access(path, R_OK|X_OK) || !(dir = opendir(path)))
- return walk(path, NULL);
- while ((dp = readdir(dir))) {
- struct path *p;
- size_t size;
-
- if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
- continue;
-
- p = malloc_nofail(sizeof(*p));
- if (!last_path)
- paths = p;
- else
- last_path->next = p;
- p->next = NULL;
- last_path = p;
-
- size = strlen(path) + 1 + strlen(dp->d_name) + 1;
- p->name = malloc_nofail(size);
- sprintf(p->name, "%s/%s", path, dp->d_name);
- }
- if (closedir(dir) != 0)
- failed = -1;
-
- while (paths != NULL) {
- struct path *next;
-
- if (lstat(paths->name, st))
- continue; /* file has disappeared meanwhile */
- if (S_ISDIR(st->st_mode)) {
- failed = foreachdir_rec(paths->name, st, walk);
- if (failed)
- goto out;
- } else {
- failed = walk(paths->name, st);
- if (failed)
- goto out;
- }
- next = paths->next;
- free(paths->name);
- free(paths);
- paths = next;
- }
-
-out:
- return failed;
-}
-
-static int
-foreachdir(const char *path,
- int (*walk)(const char *, const struct stat *))
-{
- struct stat st;
-
- if (lstat(path, &st))
- return walk(path, NULL);
- return foreachdir_rec(path, &st, walk);
-}
-
-static int
-walk(const char *path, const struct stat *st)
-{
- size_t prefix_len=strlen(opt_prefix), suffix_len=strlen(opt_suffix);
- size_t len = strlen(path);
- char *p;
- int ret;
-
- if (!st) {
- perror(path);
- return 1;
- }
- if (!S_ISREG(st->st_mode))
- return 0;
- if (strncmp(opt_prefix, path, prefix_len))
- return 0; /* prefix does not match */
- if (len < suffix_len || strcmp(opt_suffix, path + len - suffix_len))
- return 0; /* suffix does not match */
-
- p = malloc_nofail(len - prefix_len - suffix_len + 1);
- memcpy(p, path + prefix_len, len - prefix_len - suffix_len);
- p[len - prefix_len - suffix_len] = '\0';
- ret = process_file(p);
- free(p);
- return ret;
-}
-
-int
-main(int argc, char *argv[])
-{
- int opt, status = 0;
-
- progname = argv[0];
-
- while ((opt = getopt(argc, argv, "brkxB:z:f:shLt")) != -1) {
- switch(opt) {
- case 'b':
- opt_what = what_backup;
- break;
-
- case 'r':
- opt_what = what_restore;
- break;
-
- case 'k':
- opt_keep_backup = 1;
- break;
-
- case 'x':
- opt_what = what_remove;
- break;
-
- case 'B':
- opt_prefix = optarg;
- break;
-
- case 'f':
- opt_file = optarg;
- break;
-
- case 'z':
- opt_suffix = optarg;
- break;
-
- case 's':
- opt_silent = 1;
- break;
-
- case 'L':
- opt_nolinks = 1;
- break;
-
- case 't':
- opt_touch = 1;
- break;
-
- case 'h':
- default:
- usage();
- return 0;
- }
- }
-
- if ((*opt_prefix == '\0' && *opt_suffix == '\0') ||
- (opt_file == NULL && optind == argc)) {
- usage();
- return 1;
- }
-
- if (opt_file != NULL) {
- FILE *file;
- char line[LINE_LENGTH];
-
- if (!strcmp(opt_file, "-")) {
- file = stdin;
- } else {
- if ((file = fopen(opt_file, "r")) == NULL) {
- perror(opt_file);
- return 1;
- }
- }
-
- while (fgets(line, sizeof(line), file)) {
- char *l = strchr(line, '\0');
-
- if (l > line && *(l-1) == '\n')
- *(l-1) = '\0';
- if (*line == '\0')
- continue;
-
- if ((status = process_file(line)) != 0)
- return status;
- }
-
- if (file != stdin) {
- fclose(file);
- }
- }
- for (; optind < argc; optind++) {
- if (strcmp(argv[optind], "-") == 0) {
- struct stat st;
- char *dir = strdup(opt_prefix), *d = strrchr(dir, '/');
- if (d)
- *d = '\0';
- else
- d = ".";
- if (stat(dir, &st) == 0) {
- status = foreachdir(dir, walk);
- if (status == -1)
- perror(dir);
- }
- free(dir);
- } else
- status = process_file(argv[optind]);
- if (status)
- return status;
- }
-
- return status;
-}
diff --git a/quilt.changes b/quilt.changes
index 28a0151..c3e6f75 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,78 @@
-------------------------------------------------------------------
+Wed Feb 22 14:39:44 CET 2012 - jdelvare@suse.de
+
+- doc/main.tex, new: Document the patch grouping feature. This
+ fixes bug #12428.
+
+-------------------------------------------------------------------
+Fri Feb 17 21:18:06 CET 2012 - jdelvare@suse.de
+
+- setup.test: Increase coverage. Test for reverted patches, patches
+ without options in the series file, as well as spaces in
+ directory names.
+
+-------------------------------------------------------------------
+Fri Feb 17 21:14:20 CET 2012 - jdelvare@suse.de
+
+- setup, scripts/inspect: Properly escape spaces in directory and
+ archive names (bug #25579).
+
+-------------------------------------------------------------------
+Wed Feb 1 21:12:11 CET 2012 - jdelvare@suse.de
+
+- Makefile.in: Let "make clean" delete generated source tarballs.
+
+-------------------------------------------------------------------
+Wed Feb 1 21:00:45 CET 2012 - jdelvare@suse.de
+
+- grep: Accept file names with spaces.
+
+-------------------------------------------------------------------
+Wed Feb 1 20:15:01 CET 2012 - jdelvare@suse.de
+
+- Makefile.in: Include utilfns when generating source tarball.
+
+-------------------------------------------------------------------
+Wed Feb 1 17:23:39 CET 2012 - jdelvare@suse.de
+
+- backup-files: 32 performance improvements, developed during Suse
+ Hack Week VI (February 2010.) This speeds up backup-files by a
+ factor 50, roughly, bringing it close enough to the original C
+ implementation. Many thanks to Raphael Hertzog for reviewing
+ most of the series.
+
+-------------------------------------------------------------------
+Wed Feb 1 17:06:24 CET 2012 - jdelvare@suse.de
+
+- Finally get rid of the old C implementation of backup-files,
+ together with all the related checks in configure and variables
+ in Makefile.
+
+-------------------------------------------------------------------
+Wed Feb 1 17:02:32 CET 2012 - jdelvare@suse.de
+
+- backup-files: Avoid relying on GNU-specific extensions of stat,
+ cp and rmdir. Otherwise it fails on BSD systems and probably
+ others.
+
+-------------------------------------------------------------------
+Wed Feb 1 16:58:22 CET 2012 - mquinson@debian.org
+
+- Make backup-files a shell script. This makes it possible to
+ package quilt as an architecture-indepdendent package.
+
+-------------------------------------------------------------------
+Wed Feb 1 16:55:57 CET 2012 - jdelvare@suse.de
+
+- Add a dedicated test case for backup-files.
+
+-------------------------------------------------------------------
+Tue Jan 31 16:41:39 CET 2012 - jdelvare@suse.de
+
+- import.in, scripts/patchfns.in: Fix import of patches from a
+ subdirectory (bug #35244).
+
+-------------------------------------------------------------------
Sat Jan 28 16:38:10 CET 2012 - jdelvare@suse.de
- configure*: Bump version to 0.51.
diff --git a/quilt.spec.in b/quilt.spec.in
index 9df8ecb..e00d41a 100644
--- a/quilt.spec.in
+++ b/quilt.spec.in
@@ -47,7 +47,6 @@ rm -rf $RPM_BUILD_ROOT
/usr/bin/quilt
/usr/share/quilt/
/usr/share/emacs/
-/usr/lib/quilt/
/etc/bash_completion.d/quilt
%config(noreplace) /etc/quilt.quiltrc
%doc %{_mandir}/man1/guards.1*
diff --git a/quilt/add.in b/quilt/add.in
index dfd48f8..eee3c45 100644
--- a/quilt/add.in
+++ b/quilt/add.in
@@ -121,7 +121,7 @@ do
continue
fi
- if ! $QUILT_LIB/backup-files -b -s -L -B $QUILT_PC/$patch/ "$SUBDIR$file"
+ if ! $QUILT_DIR/scripts/backup-files -b -s -L -B $QUILT_PC/$patch/ "$SUBDIR$file"
then
printf $"Failed to back up file %s\n" "$SUBDIR$file" >&2
status=1
diff --git a/quilt/grep.in b/quilt/grep.in
index 270ba9c..0c32fcf 100644
--- a/quilt/grep.in
+++ b/quilt/grep.in
@@ -117,8 +117,8 @@ fi
find "${myargs[@]:-.}" \( \
-path "./$QUILT_PATCHES/*" -o \
-path "./$QUILT_PC/*" \) -prune -o \
- -type f -print \
-| xargs grep $opt_H "${args[@]}" \
+ -type f -print0 \
+| xargs -0 grep $opt_H "${args[@]}" \
| if [ ${#myargs[@]} -eq 0 ]; then
sed -e 's,^./,,'
else
diff --git a/quilt/import.in b/quilt/import.in
index efee4d1..cc9deed 100644
--- a/quilt/import.in
+++ b/quilt/import.in
@@ -152,16 +152,16 @@ then
fi
before=$(patch_after "$(top_patch)")
-for patch_file in "$@"
+for orig_patch_file in "$@"
do
if [ -n "$opt_patch" ]
then
patch=$opt_patch
else
- patch=${patch_file##*/}
+ patch=${orig_patch_file##*/}
fi
- patch_file=$(find_patch_file "$patch_file") || exit 1
+ patch_file=$(find_patch_file "$orig_patch_file") || exit 1
merged_patch_file="$patch_file"
if is_applied $patch
@@ -199,7 +199,7 @@ do
printf $"Importing patch %s\n" "$(print_patch $patch)"
else
printf $"Importing patch %s (stored as %s)\n" \
- "$patch_file" \
+ "$orig_patch_file" \
"$(print_patch $patch)"
mkdir -p "${dest%/*}"
diff --git a/quilt/new.in b/quilt/new.in
index 68aae20..92fe28a 100644
--- a/quilt/new.in
+++ b/quilt/new.in
@@ -24,7 +24,8 @@ usage()
then
printf $"
Create a new patch with the specified file name, and insert it after the
-topmost patch.
+topmost patch. The name can be prefixed with a sub-directory name, allowing
+for grouping related patches together.
-p n Create a -p n style patch (-p0 or -p1 are supported).
diff --git a/quilt/pop.in b/quilt/pop.in
index cbc21c1..efacf09 100644
--- a/quilt/pop.in
+++ b/quilt/pop.in
@@ -95,7 +95,7 @@ check_for_pending_changes()
local prefix=$QUILT_PC/$patch/
[ ${prefix:0:1} == / ] || prefix=$PWD/$prefix
if ! ( cd $workdir && \
- $QUILT_LIB/backup-files -B $prefix -rks - )
+ $QUILT_DIR/scripts/backup-files -B $prefix -r -k -s - )
then
printf $"Failed to copy files to temporary directory\n" >&2
rm -rf $workdir
@@ -162,7 +162,7 @@ remove_patch()
status=$?
else
printf $"Removing patch %s\n" "$(print_patch $patch)"
- $QUILT_LIB/backup-files $silent -r -t -B $QUILT_PC/$patch/ -
+ $QUILT_DIR/scripts/backup-files $silent -r -t -B $QUILT_PC/$patch/ -
status=$?
fi
remove_from_db $patch
@@ -264,7 +264,7 @@ else
# of one: This will automatically be the case in the usual
# situations, but we don't want to risk file corruption in weird
# corner cases such as files added to a patch but not modified.
- $QUILT_LIB/backup-files -L -s -B $QUILT_PC/$patch/ -
+ $QUILT_DIR/scripts/backup-files -L -s -B $QUILT_PC/$patch/ -
printf $"Now at patch %s\n" "$(print_patch $patch)"
fi
### Local Variables:
diff --git a/quilt/push.in b/quilt/push.in
index 17862fa..db84a47 100644
--- a/quilt/push.in
+++ b/quilt/push.in
@@ -140,7 +140,7 @@ rollback_patch()
{
local patch=$1
- $QUILT_LIB/backup-files $silent_unless_verbose -r -B $QUILT_PC/$patch/ -
+ $QUILT_DIR/scripts/backup-files $silent_unless_verbose -r -B $QUILT_PC/$patch/ -
}
cleanup_patch_output() {
diff --git a/quilt/remove.in b/quilt/remove.in
index 96a4e86..ff9aae5 100644
--- a/quilt/remove.in
+++ b/quilt/remove.in
@@ -86,7 +86,7 @@ do
fi
# Restore file from backup
- if ! $QUILT_LIB/backup-files -r -t -s -B $QUILT_PC/$patch/ "$SUBDIR$file"
+ if ! $QUILT_DIR/scripts/backup-files -r -t -s -B $QUILT_PC/$patch/ "$SUBDIR$file"
then
printf $"Failed to remove file %s from patch %s\n" \
"$SUBDIR$file" "$(print_patch $patch)" >&2
diff --git a/quilt/scripts/backup-files.in b/quilt/scripts/backup-files.in
new file mode 100644
index 0000000..07557e7
--- /dev/null
+++ b/quilt/scripts/backup-files.in
@@ -0,0 +1,363 @@
+#! @BASH@
+
+set -e
+# Keep /dev/null opened as we will need it repeatedly
+exec 4> /dev/null
+
+# Copyright (C) 2006 Steve Langasek <vorlon@debian.org>
+# Copyright (C) 2011 Jean Delvare <jdelvare@suse.de>
+# Loosely based on C implementation by Andreas Gruenbacher <agruen@suse.de>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 dated June, 1991.
+
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+usage () {
+ echo "Usage: $0 -B prefix {-b|-r|-c|-L} [-s] [-k] [-t] [-L] {-f {file|-}|-|file ...}
+
+ Create or restore backup copies of a list of files.
+
+ Mandatory parameters:
+ -B Path name prefix for backup files
+
+ Action parameters:
+ -b Create backup (preserve links)
+ -r Restore the backup
+ -c Create simple copy
+ -L Ensure that source files have a link count of 1
+
+ Common options:
+ -s Silent operation; only print error messages
+
+ Restore options:
+ -k Keep backup files
+ -t Touch original files after restore (update their mtimes)
+
+ Backup options:
+ -L Ensure that source files have a link count of 1
+
+ File list parameters:
+ -f Read the filenames to process from file (- = standard input)
+ - Read the filenames to process from backup
+"
+}
+
+: ${QUILT_DIR=@QUILT_DIR@}
+. $QUILT_DIR/scripts/utilfns
+
+ensure_nolinks() {
+ local filename=$1
+ local link_count tmpname
+
+ link_count=$(stat @STAT_HARDLINK@ "$filename")
+ if [ $link_count -gt 1 ]; then
+ tmpname=$(mktemp "$filename.XXXXXX")
+ cp -p "$filename" "$tmpname"
+ mv "$tmpname" "$filename"
+ fi
+}
+
+notify_action()
+{
+ [ $ECHO != : ] || return 0
+ local action=$1 filename=$2
+
+ while read -d $'\0' -r
+ do
+ $ECHO "$action ${REPLY#./}"
+ done < "$filename"
+}
+
+backup() {
+ local file=$1
+ local backup=$OPT_PREFIX$file
+ local dir
+
+ dir=$(dirname "$backup")
+ [ -d "$dir" ] || mkdir -p "$dir"
+
+ if [ -e "$file" ]; then
+ $ECHO "Copying $file"
+ if [ -n "$OPT_NOLINKS" -a "$(stat @STAT_HARDLINK@ "$file")" = 1 ]; then
+ cp -p "$file" "$backup"
+ else
+ ln "$file" "$backup" 2>&4 || cp -p "$file" "$backup"
+ if [ -n "$OPT_NOLINKS" ]; then
+ ensure_nolinks "$file"
+ fi
+ fi
+ else
+ $ECHO "New file $file"
+ : > "$backup"
+ fi
+}
+
+restore()
+{
+ local file=$1
+ local backup=$OPT_PREFIX$file
+
+ if [ ! -e "$backup" ]; then
+ return 1
+ fi
+ if [ -s "$backup" ]; then
+ $ECHO "Restoring $file"
+ if [ -e "$file" ]; then
+ rm "$file"
+ else
+ mkdir -p "$(dirname "$file")"
+ fi
+ ln "$backup" "$file" 2>&4 || cp -p "$backup" "$file"
+
+ if [ -n "$OPT_TOUCH" ]; then
+ touch "$file"
+ fi
+ else
+ $ECHO "Removing $file"
+ if [ -e "$file" ]; then
+ rm "$file"
+ fi
+ fi
+
+ if [ -z "$OPT_KEEP_BACKUP" ]; then
+ rm "$backup"
+ rmdir -p "${backup%/*}" 2>&4 || true
+ fi
+}
+
+restore_all()
+{
+ local EMPTY_FILES NONEMPTY_FILES
+
+ # Store the list of files to process
+ EMPTY_FILES=$(gen_tempfile)
+ NONEMPTY_FILES=$(gen_tempfile)
+ trap "rm -f \"$EMPTY_FILES\" \"$NONEMPTY_FILES\"" EXIT
+
+ cd "$OPT_PREFIX"
+ find . -type f -size 0 -print0 > "$EMPTY_FILES"
+ find . -type f -size +0 -print0 > "$NONEMPTY_FILES"
+ cd "$OLDPWD"
+
+ if [ -s "$EMPTY_FILES" ]; then
+ xargs -0 rm -f < "$EMPTY_FILES"
+ notify_action Removing "$EMPTY_FILES"
+ fi
+
+ if [ -s "$NONEMPTY_FILES" ]; then
+ # Try a mass link (or copy) first, as it is much faster.
+ # It is however not portable and may thus fail. If it fails,
+ # fallback to per-file processing, which always works.
+ local target_dir=$PWD
+
+ if (cd "$OPT_PREFIX" && \
+ xargs -0 cp -l --parents --remove-destination \
+ --target-directory="$target_dir" \
+ < "$NONEMPTY_FILES" 2>&4); then
+ notify_action Restoring "$NONEMPTY_FILES"
+ else
+ (cd "$OPT_PREFIX" && find . -type d -print0) \
+ | xargs -0 mkdir -p
+
+ xargs -0 rm -f < "$NONEMPTY_FILES"
+
+ while read -d $'\0' -r
+ do
+ local file=${REPLY#./}
+ local backup=$OPT_PREFIX$file
+
+ $ECHO "Restoring $file"
+ ln "$backup" "$file" 2>&4 || cp -p "$backup" "$file"
+ done < "$NONEMPTY_FILES"
+ fi
+
+ if [ -n "$OPT_TOUCH" ]; then
+ xargs -0 touch -c < "$NONEMPTY_FILES"
+ fi
+ fi
+
+ if [ -z "$OPT_KEEP_BACKUP" ]; then
+ rm -rf "$OPT_PREFIX"
+ fi
+}
+
+noop_nolinks()
+{
+ local file=$1
+
+ if [ -e "$file" ]; then
+ ensure_nolinks "$file"
+ fi
+}
+
+copy()
+{
+ local file=$1
+ local backup=$OPT_PREFIX$file
+ local dir
+
+ dir=$(dirname "$backup")
+ [ -d "$dir" ] || mkdir -p "$dir"
+
+ if [ -e "$file" ]; then
+ $ECHO "Copying $file"
+ cp -p "$file" "$backup"
+ else
+ $ECHO "New file $file"
+ : > "$backup"
+ fi
+}
+
+copy_many()
+{
+ local NONEMPTY_FILES
+
+ # Store the list of non-empty files to process
+ NONEMPTY_FILES=$(gen_tempfile)
+ trap "rm -f \"$NONEMPTY_FILES\"" EXIT
+
+ # Keep the temporary file opened to speed up the loop
+ exec 3> "$NONEMPTY_FILES"
+ cat "$OPT_FILE" \
+ | while read
+ do
+ if [ -e "$REPLY" ]; then
+ printf '%s\0' "$REPLY" >&3
+ else
+ # This is a rare case, not worth optimizing
+ copy "$REPLY"
+ fi
+ done
+ exec 3>&-
+
+ if [ -s "$NONEMPTY_FILES" ]; then
+ # Try a mass copy first, as it is much faster.
+ # It is however not portable and may thus fail. If it fails,
+ # fallback to per-file processing, which always works.
+
+ if xargs -0 cp -p --parents --target-directory="$OPT_PREFIX" \
+ < "$NONEMPTY_FILES" 2>&4; then
+ notify_action Copying "$NONEMPTY_FILES"
+ else
+ while read -d $'\0' -r
+ do
+ copy "$REPLY"
+ done < "$NONEMPTY_FILES"
+ fi
+ fi
+}
+
+# Test if some backed up files have a link count greater than 1
+some_files_have_links()
+{
+ (cd "$OPT_PREFIX" && find . -type f -print0) \
+ | xargs -0 stat @STAT_HARDLINK@ 2>&4 | grep -qv '^1$'
+}
+
+
+ECHO=echo
+while [ $# -gt 0 ]; do
+ case $1 in
+ -b) OPT_WHAT=backup
+ ;;
+ -r) OPT_WHAT=restore
+ ;;
+ -c) OPT_WHAT=copy
+ ;;
+ -B) OPT_PREFIX=$2
+ shift
+ ;;
+ -f) OPT_FILE=$2
+ shift
+ ;;
+ -s) ECHO=:
+ ;;
+ -k) OPT_KEEP_BACKUP=1
+ ;;
+ -L) OPT_NOLINKS=1
+ ;;
+ -t) OPT_TOUCH=1
+ ;;
+ -?*) usage
+ exit 0
+ ;;
+ *) break
+ ;;
+ esac
+
+ shift
+done
+
+if [ -z "$OPT_PREFIX" ]; then
+ usage
+ exit 1
+fi
+
+if [ "${OPT_PREFIX:(-1)}" != / ]; then
+ echo "Prefix must be a directory" >&2
+ exit 1
+fi
+
+if [ -z "$OPT_WHAT" ]; then
+ if [ -n "$OPT_NOLINKS" ]; then
+ OPT_WHAT=noop_nolinks
+ else
+ echo "Please specify an action" >&2
+ exit 1
+ fi
+fi
+
+if [ -n "$OPT_FILE" ]; then
+ if [ "$OPT_WHAT" = copy ]; then
+ copy_many
+ exit
+ fi
+
+ cat "$OPT_FILE" \
+ | while read nextfile; do
+ $OPT_WHAT "$nextfile"
+ done
+ exit
+fi
+
+if [ "$1" = - ]; then
+ # No backup directory? We're done
+ [ -d "$OPT_PREFIX" ] || exit 0
+
+ if [ "$OPT_WHAT" = restore ]; then
+ restore_all
+ exit
+ fi
+
+ # We typically expect the link count of backed up files to be 1
+ # already, so check quickly that this is the case, and only if not,
+ # take the slow path and walk the file list in search of files to fix.
+ if [ "$OPT_WHAT" = noop_nolinks ] && ! some_files_have_links; then
+ exit
+ fi
+
+ find "$OPT_PREFIX" -type f -print \
+ | while read
+ do
+ $OPT_WHAT "${REPLY#$OPT_PREFIX}"
+ done
+ if [ ${PIPESTATUS[0]} != 0 ]; then
+ exit 1
+ fi
+ exit
+fi
+
+while [ $# -gt 0 ]; do
+ $OPT_WHAT "$1"
+ shift
+done
diff --git a/quilt/scripts/inspect.in b/quilt/scripts/inspect.in
index dea5bac..7bc4ad5 100644
--- a/quilt/scripts/inspect.in
+++ b/quilt/scripts/inspect.in
@@ -291,6 +291,7 @@ cat <<-'EOF' > $tmpdir/bin/wrapper
fi
dir=${dir/$RPM_BUILD_DIR}
dir=${dir##/}
+ dir=${dir// /\\ }
echo "${0##*/} ${dir:-.} $unpackfile" \
$(strip_option "$@") $(reverse_option "$@") >&3
;;
@@ -305,6 +306,7 @@ cat <<-'EOF' > $tmpdir/bin/wrapper
fi
dir=${dir/$RPM_BUILD_DIR}
dir=${dir##/}
+ dir=${dir// /\\ }
echo "${0##*/} ${dir:-.} $unpackfile" >&3
;;
esac
diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in
index e1fc237..d0c426e 100644
--- a/quilt/scripts/patchfns.in
+++ b/quilt/scripts/patchfns.in
@@ -41,6 +41,8 @@ if [ -n "$QUILT_COMMAND" ]; then
unset args
fi
+. $QUILT_DIR/scripts/utilfns
+
# ========================================================
declare -a exit_handlers
@@ -86,42 +88,6 @@ quote_re()
echo "$1" | sed -e 's:\([][?{(|)}^$/.+*\\]\):\\\1:g'
}
-basename()
-{
- local path=$1
- while [ "${path:(-1)}" = "/" ]
- do
- path=${path%/}
- done
- echo "${path##*/}"
-}
-
-dirname()
-{
- local path=$1
- while [ "${path:(-1)}" = "/" ]
- do
- path=${path%/}
- done
- local basename="${path##*/}"
- path="${path:0:${#path}-${#basename}}"
- while [ "${path:(-1)}" = "/" ]
- do
- path=${path%/}
- done
- if [ -n "$path" ]
- then
- echo "$path"
- else
- if [ ${1:0:1} = "/" ]
- then
- echo "/"
- else
- echo "."
- fi
- fi
-}
-
patch_file_name()
{
echo "$QUILT_PATCHES/$1"
@@ -641,10 +607,21 @@ find_patch_file()
{
local name="$1"
- if [ -r "$name" ]
+ if [ ${name:0:1} = / ]
then
- echo "$name"
- return
+ # Patch has absolute path
+ if [ -r "$name" ]
+ then
+ echo "$name"
+ return
+ fi
+ else
+ # Patch has a relative path
+ if [ -r "$SUBDIR$name" ]
+ then
+ echo "$SUBDIR$name"
+ return
+ fi
fi
local patch
@@ -870,16 +847,6 @@ in_array()
return 1
}
-gen_tempfile()
-{
- if [ "$1" = -d ]
- then
- mktemp -d ${2:-${TMPDIR:-/tmp}/quilt.}XXXXXX
- else
- mktemp ${1:-${TMPDIR:-/tmp}/quilt.}XXXXXX
- fi
-}
-
first_modified_by()
{
local file=$1 patch
@@ -914,7 +881,7 @@ apply_patch_temporarily()
local prefix=$QUILT_PC/$patch/
[ ${prefix:0:1} == / ] || prefix=$PWD/$prefix
if ! ( cd $workdir && \
- $QUILT_LIB/backup-files -B $prefix -rks ${@:--} )
+ $QUILT_DIR/scripts/backup-files -B $prefix -r -k -s ${@:--} )
then
printf $"Failed to copy files to temporary directory\n" >&2
return 1
diff --git a/quilt/scripts/utilfns b/quilt/scripts/utilfns
new file mode 100644
index 0000000..b2ab3d5
--- /dev/null
+++ b/quilt/scripts/utilfns
@@ -0,0 +1,54 @@
+# This file contains the common functions used by patchfns and backup-files.
+# It is meant to be sourced by bash scripts.
+
+# This script is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# See the COPYING and AUTHORS files for more details.
+
+basename()
+{
+ local path=$1
+ while [ "${path:(-1)}" = "/" ]
+ do
+ path=${path%/}
+ done
+ echo "${path##*/}"
+}
+
+dirname()
+{
+ local path=$1
+ while [ "${path:(-1)}" = "/" ]
+ do
+ path=${path%/}
+ done
+ local basename="${path##*/}"
+ path="${path:0:${#path}-${#basename}}"
+ while [ "${path:(-1)}" = "/" ]
+ do
+ path=${path%/}
+ done
+ if [ -n "$path" ]
+ then
+ echo "$path"
+ else
+ if [ ${1:0:1} = "/" ]
+ then
+ echo "/"
+ else
+ echo "."
+ fi
+ fi
+}
+
+gen_tempfile()
+{
+ if [ "$1" = -d ]
+ then
+ mktemp -d ${2:-${TMPDIR:-/tmp}/quilt.}XXXXXX
+ else
+ mktemp ${1:-${TMPDIR:-/tmp}/quilt.}XXXXXX
+ fi
+}
diff --git a/quilt/setup.in b/quilt/setup.in
index acd4ea2..90a8c85 100644
--- a/quilt/setup.in
+++ b/quilt/setup.in
@@ -161,13 +161,19 @@ case "$1" in
case "$@" in
"# Sourcedir: "*)
shift 2
- tar_dir="$@" ;;
+ tar_dir="$@"
+ tar_dir=${tar_dir// /\\ }
+ ;;
"# Source: "*)
shift 2
- echo "tar ${tar_dir:-.} $@" ;;
+ source="$@"
+ echo "tar ${tar_dir:-.} ${source// /\\ }"
+ ;;
"# Patchdir: "*)
shift 2
- patch_dir="$@" ;;
+ patch_dir="$@"
+ patch_dir=${patch_dir// /\\ }
+ ;;
''|'#'*)
;;
*)
@@ -184,7 +190,7 @@ do
case "$tag" in
tar)
tarball=$sourcedir$arg1
- if [ ! -e $tarball ]
+ if [ ! -e "$tarball" ]
then
printf $"File %s not found\n" "$tarball" >&2
exit 1
diff --git a/quilt/snapshot.in b/quilt/snapshot.in
index 312003f..ccddd0a 100644
--- a/quilt/snapshot.in
+++ b/quilt/snapshot.in
@@ -86,7 +86,7 @@ done \
}
{ print }
' \
-| $QUILT_LIB/backup-files -b -s -L -f - -B "$QUILT_PC/$snap_subdir/"
+| $QUILT_DIR/scripts/backup-files -c -s -f - -B "$QUILT_PC/$snap_subdir/"
### Local Variables:
### mode: shell-script
diff --git a/test/backup-files.test b/test/backup-files.test
new file mode 100644
index 0000000..8cbfc1c
--- /dev/null
+++ b/test/backup-files.test
@@ -0,0 +1,231 @@
+Unit test of the backup-files script.
+
+ # Test backup without options; it should link, not copy
+ $ echo foo > foo
+ $ echo bar > "space bar"
+ $ sleep 1
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b foo
+ > Copying foo
+
+ $ ls -l foo | awk '{ print $2 }'
+ > 2
+ $ ls -l backup/foo | awk '{ print $2 }'
+ > 2
+ $ [ backup/foo -nt foo ] && echo "mtimes differ"
+
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r foo
+ > Restoring foo
+ $ ls -l foo | awk '{ print $2 }'
+ > 1
+
+ # Test silent backup with -L; it should copy, not link
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -s -L foo
+
+ $ ls -l foo | awk '{ print $2 }'
+ > 1
+ $ ls -l backup/foo | awk '{ print $2 }'
+ > 1
+ $ [ backup/foo -nt foo ] && echo "mtimes differ"
+
+ # Test restore without options
+ $ echo modified > foo
+ $ sleep 1
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r foo
+ > Restoring foo
+
+ $ cat foo
+ > foo
+ $ [ -e backup/foo ] && echo "backup/foo not deleted"
+ $ [ -e backup ] && echo "backup directory not deleted"
+
+ # Test backup files with hard links
+ $ ln foo foo2
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -s -L foo
+ $ ls -l foo | awk '{ print $2 }'
+ > 1
+ $ ls -l backup/foo | awk '{ print $2 }'
+ > 2
+
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -s -L foo2
+ $ ls -l foo | awk '{ print $2 }'
+ > 1
+ $ ls -l foo2 | awk '{ print $2 }'
+ > 1
+ $ ls -l backup/foo | awk '{ print $2 }'
+ > 2
+ $ ls -l backup/foo2 | awk '{ print $2 }'
+ > 2
+
+ # Test restore of files with hard links
+ $ rm -f foo foo2
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r -s foo
+ $ ls -l foo | awk '{ print $2 }'
+ > 2
+ $ ls -l backup/foo2 | awk '{ print $2 }'
+ > 2
+ $ [ -e backup/foo ] && echo "backup/foo not deleted"
+ $ [ ! -e foo2 ] || echo "file foo2 shouldn't exist"
+
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r -s foo2
+ $ ls -l foo | awk '{ print $2 }'
+ > 2
+ $ ls -l foo2 | awk '{ print $2 }'
+ > 2
+ $ [ -e backup/foo2 ] && echo "backup/foo2 not deleted"
+ $ [ -e backup ] && echo "backup directory not deleted"
+
+ # Test restore with -t
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -s foo
+ $ touch -r foo foo.timeref
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r -s -t foo
+
+ $ ls -l foo | awk '{ print $2 }'
+ > 2
+ $ [ foo -nt foo.timeref ] || echo "touch failed"
+
+ # Test restore with -k
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -s -L foo "space bar"
+ $ touch -r "space bar" bar.timeref
+ $ ls -l backup/foo | awk '{ print $2 }'
+ > 2
+ $ ls -l "backup/space bar" | awk '{ print $2 }'
+ > 1
+ $ mkdir tmp
+ $ cd tmp
+ $ %{QUILT_DIR}/scripts/backup-files -B ../backup/ -r -s -k foo "space bar"
+ $ cd ..
+
+ $ ls -l foo | awk '{ print $2 }'
+ > 1
+ $ ls -l "space bar" | awk '{ print $2 }'
+ > 1
+ $ ls -l backup/foo | awk '{ print $2 }'
+ > 3
+ $ ls -l "backup/space bar" | awk '{ print $2 }'
+ > 2
+ $ ls -l tmp/foo | awk '{ print $2 }'
+ > 3
+ $ ls -l "tmp/space bar" | awk '{ print $2 }'
+ > 2
+ $ rm -rf tmp
+
+ # Test restore all (-)
+ $ rm -f foo "space bar"
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r -s -t -
+ $ cat foo
+ > foo
+ $ cat "space bar"
+ > bar
+ $ [ "space bar" -nt bar.timeref ] || echo "touch failed"
+
+ # Backup and restore a non-existing files
+ $ mkdir "dir with spaces"
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -s -L new "dir with spaces/space file"
+ $ echo data > new
+ $ echo data2 > "dir with spaces/space file"
+ $ ls -l backup/new | awk '{ print $5 }'
+ > 0
+ $ ls -l "backup/dir with spaces/space file" | awk '{ print $5 }'
+ > 0
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r -s -
+ $ [ ! -e backup/new ] || echo "file backup/new shouldn't exist"
+ $ [ ! -e new ] || echo "file new shouldn't exist"
+ $ [ ! -e "backup/dir with spaces/space file" ] || echo "file backup/dir with spaces/space file shouldn't exist"
+ $ [ ! -e "dir with spaces/space file" ] || echo "file dir with spaces/space file shouldn't exist"
+
+ # Test restore involving a dir name with spaces
+ $ echo data > "dir with spaces/space file"
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -L "dir with spaces/space file"
+ > Copying dir with spaces/space file
+ $ rm -rf "dir with spaces"
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r -
+ > Restoring dir with spaces/space file
+ $ cat "dir with spaces/space file"
+ > data
+ $ [ -e backup ] && echo "backup directory not deleted"
+
+ # Test backup reading file list from a file
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -s -L -f -
+ < foo
+ < new
+ < space bar
+ $ echo data > new
+ $ echo modified > foo
+ $ rm -f "space bar"
+ $ [ -e backup/new -a ! -s backup/new ] || echo "file backup/new isn't empty"
+ $ ls -l backup/new | awk '{ print $5 }'
+ > 0
+ $ cat backup/foo
+ > foo
+ $ cat "backup/space bar"
+ > bar
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r -s -f -
+ < foo
+ < new
+ < space bar
+ $ [ ! -e backup/new ] || echo "file backup/new shouldn't exist"
+ $ [ ! -e new ] || echo "file new shouldn't exist"
+ $ cat foo
+ > foo
+ $ cat "space bar"
+ > bar
+
+ # Test the special -L alone case
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -b -L -f -
+ < new
+ < foo
+ < space bar
+ > New file new
+ > Copying foo
+ > Copying space bar
+ $ ln "space bar" "linked space"
+ $ ls -l foo | awk '{ print $2 }'
+ > 1
+ $ ls -l "space bar" | awk '{ print $2 }'
+ > 2
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -L -
+ $ ls -l foo | awk '{ print $2 }'
+ > 1
+ $ ls -l "space bar" | awk '{ print $2 }'
+ > 1
+ $ [ ! -e new ] || echo "file new shouldn't exist"
+ # Second call should be idempotent
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -L -
+ $ ls -l foo | awk '{ print $2 }'
+ > 1
+ $ ls -l "space bar" | awk '{ print $2 }'
+ > 1
+ $ [ ! -e new ] || echo "file new shouldn't exist"
+ $ %{QUILT_DIR}/scripts/backup-files -B backup/ -r - | sort
+ > Removing new
+ > Restoring foo
+ > Restoring space bar
+ $ rm "linked space"
+
+ # Test copy (as used by quilt snapshot)
+ $ %{QUILT_DIR}/scripts/backup-files -B snapshot/ -c -f -
+ < new
+ < foo
+ < space bar
+ < dir with spaces/space file
+ > New file new
+ > Copying foo
+ > Copying space bar
+ > Copying dir with spaces/space file
+ $ ls -l foo | awk '{ print $2 }'
+ > 2
+ $ ls -l "space bar" | awk '{ print $2 }'
+ > 1
+ $ ls -l "dir with spaces/space file" | awk '{ print $2 }'
+ > 1
+ $ [ ! -e new ] || echo "file new shouldn't exist"
+ $ ls -l snapshot/new | awk '{ print $2 }'
+ > 1
+ $ ls -l snapshot/foo | awk '{ print $2 }'
+ > 1
+ $ ls -l snapshot/"space bar" | awk '{ print $2 }'
+ > 1
+ $ ls -l snapshot/"dir with spaces/space file" | awk '{ print $2 }'
+ > 1
+ $ [ ! -s new ] || echo "file snapshot/new should be empty"
+ $ rm -rf snapshot
diff --git a/test/delete.test b/test/delete.test
index 3dfc584..f527ec5 100644
--- a/test/delete.test
+++ b/test/delete.test
@@ -77,7 +77,7 @@ Test the delete command.
$ quilt delete "test3"
> Removing patch %{P}test3
- > .pc/test3/dir: Permission denied
+ >~ find: `?\./dir'?: Permission denied
$ chmod a+rx .pc/test3/dir
diff --git a/test/import.test b/test/import.test
index 8eb40c7..6336854 100644
--- a/test/import.test
+++ b/test/import.test
@@ -246,3 +246,12 @@
$ cat patches/series
> patch1.diff
> patchR.diff
+
+# Also test importing when in a subdirectory
+ $ touch empty.patch
+ $ cd t
+ $ touch empty2.patch
+ $ quilt import ../empty.patch
+ > Importing patch ../empty.patch (stored as ../patches/empty.patch)
+ $ quilt import %{PWD}/empty2.patch
+ > Importing patch %{PWD}/empty2.patch (stored as ../patches/empty2.patch)
diff --git a/test/setup.test b/test/setup.test
index 5e09e75..e94ef3f 100644
--- a/test/setup.test
+++ b/test/setup.test
@@ -3,6 +3,8 @@ $ mkdir dir
$ echo 1 > dir/foo.orig
$ echo 2 > dir/foo
$ diff -u dir/foo.orig dir/foo > foo.diff
+$ diff -u dir/foo.orig dir/foo > revert.diff
+$ diff -u dir/foo.orig dir/foo > again.diff
$ mv dir/foo.orig dir/foo
$ tar cf - dir | gzip > dir.tar.gz
$ rm -rf dir
@@ -11,6 +13,8 @@ $ cat > series
< # Patchdir: dir
< #
< foo.diff -p1
+< revert.diff -p1 -R
+< again.diff
$ quilt setup series
> Unpacking archive dir.tar.gz
$ cd dir
@@ -19,7 +23,9 @@ $ ls -l patches series | sed -e 's:.* -> ::'
> ../series
$ quilt push -qa
> Applying patch patches/foo.diff
-> Now at patch patches/foo.diff
+> Applying patch patches/revert.diff
+> Applying patch patches/again.diff
+> Now at patch patches/again.diff
$ cd ..
$ rm -rf dir
$ quilt setup -d other series
@@ -30,7 +36,9 @@ $ ls -l patches series | sed -e 's:.* -> ::'
> ../../series
$ quilt push -qa
> Applying patch patches/foo.diff
-> Now at patch patches/foo.diff
+> Applying patch patches/revert.diff
+> Applying patch patches/again.diff
+> Now at patch patches/again.diff
$ cd ../..
$ rm -rf other
$ mkdir dir1
@@ -46,4 +54,37 @@ $ ls -l patches series | sed -e 's:.* -> ::'
> ../../dir1/series
$ quilt push -qa
> Applying patch patches/foo.diff
-> Now at patch patches/foo.diff
+> Applying patch patches/revert.diff
+> Applying patch patches/again.diff
+> Now at patch patches/again.diff
+
+# Now a basic test with space in dir name
+$ mkdir "space [dir]"
+$ echo 1 > "space [dir]/foo.orig"
+$ echo 2 > "space [dir]/foo"
+$ diff -u "space [dir]/foo.orig" "space [dir]/foo" > foo.diff
+$ diff -u "space [dir]/foo.orig" "space [dir]/foo" > revert.diff
+$ diff -u "space [dir]/foo.orig" "space [dir]/foo" > again.diff
+$ mv "space [dir]/foo.orig" "space [dir]/foo"
+$ tar cf - "space [dir]" | gzip > "space [dir].tar.gz"
+$ rm -rf "space [dir]"
+$ cat > series
+< # Source: space [dir].tar.gz
+< # Patchdir: space [dir]
+< #
+< foo.diff -p1
+< revert.diff -p1 -R
+< again.diff
+$ quilt setup series
+> Unpacking archive space [dir].tar.gz
+$ cd space\ [dir]
+$ ls -l patches series | sed -e 's:.* -> ::'
+> ..
+> ../series
+$ quilt push -qa
+> Applying patch patches/foo.diff
+> Applying patch patches/revert.diff
+> Applying patch patches/again.diff
+> Now at patch patches/again.diff
+$ cd ..
+$ rm -rf "space [dir]"
diff --git a/test/space-in-filenames.test b/test/space-in-filenames.test
index eb0d035..fa0ddf8 100644
--- a/test/space-in-filenames.test
+++ b/test/space-in-filenames.test
@@ -77,6 +77,13 @@ $ cat patches/test.diff
> -foo
> +bar
+$ quilt grep bar
+> foo bar:bar
+$ quilt grep new
+> a: b [c]:new line
+$ quilt grep " "
+> a: b [c]:new line
+
$quilt remove "a: b [c]"
> File a: b [c] removed from patch patches/test.diff