summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog39
-rw-r--r--bootstrap.conf4
-rw-r--r--build-aux/check.mk81
-rw-r--r--src/Makefile.am11
-rw-r--r--tests/check.mk2
5 files changed, 94 insertions, 43 deletions
diff --git a/ChangeLog b/ChangeLog
index df756b9d9..37a3e0b75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,44 @@
2007-11-15 Paul Eggert <eggert@cs.ucla.edu>
+ Port to Solaris 'make' and use a Posixish shell on Solaris.
+ * bootstrap.conf (gnulib_modules): Add gnu-make, posix-shell.
+ * build-aux/check.mk (SHELL): Set to $(PREFERABLY_POSIX_SHELL),
+ so that commands can assume Posix syntax.
+ (ENABLE_HARD_ERRORS, TEST_LOGS): Don't use GNU Make's "?=" syntax.
+ (SH_E_WORKAROUND): New macro.
+ (am__check_pre, $(TEST_SUITE_LOG)): Use it.
+ (am__check_pre): Fail if "mkdir" fails. Use $(SHELL)
+ rather than relying on the "#!/bin/sh" in the file, so that tests
+ can use Posix syntax.
+ (am__check_pre, am__tty_colors): Use $$src rather than $$<, to
+ support the Posix-make $(TEST_LOGS) rule.
+ (%.log: %.test, %.log: %$(EXEEXT)): Remove unused inference rules
+ that rely on a GNU Make extension and cause Solaris 'make' to fail.
+ (SUFFIXES): New macro, so that we can use Posix style inference rules.
+ (%.log: %): Use this rule only if GNU_MAKE.
+ Set $$src so that macros can use $$src rather than $$<.
+ (CHECK-FORCE, DEPENDENCY, $(TEST_LOGS)): New macros and rules,
+ which rely only on Posix 'make' semantics, and are used only with
+ non-GNU 'make' implementations. $(TEST_LOGS) invokes 'make'
+ recursively (and a bit inefficiently) to simulate the GNU 'make'
+ rules.
+ (.log.html): Renamed from "%.html: %.log", so that it relies only
+ on Posix 'make' semantics.
+ (check-clean, .PHONY): Do not depend on check-clean-local, since
+ Solaris 'make' complains about nonexistent rules like that.
+ * src/Makefile.am (SUFFIXES): Remove; no longer needed.
+ (groups): Use a specific rule rather than an inference rule that
+ is only instantiated once. The inference-rule approach does not
+ work with Solaris 'make', which gets confused by the "groups:
+ Makefile" line. It's not clear from the Posix spec that Solaris
+ 'make' is buggy here, so instead of worrying about it, rewrite
+ the makefile so that it clearly conforms to Posix.
+ * tests/check.mk (TESTS_ENVIRONMENT): Export PACKAGE_BUGREPORT.
+ GNU 'make' does this automatically for us, but Solaris 'make'
+ doesn't.
+
+2007-11-15 Paul Eggert <eggert@cs.ucla.edu>
+
Port to Solaris 8 perl, which does not support "use warnings;".
* tests/dd/skip-seek: Skip test if "use warnings;" fails.
* tests/du/files0-from: Likewise.
diff --git a/bootstrap.conf b/bootstrap.conf
index 40f0e6c6e..090945026 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -55,7 +55,7 @@ gnulib_modules="
getline getloadavg getndelim2 getopt getpagesize getpass-gnu
gettext gettime gettimeofday getugroups getusershell
git-version-gen
- gnupload
+ gnu-make gnupload
group-member hard-locale hash hash-pjw host-os human idcache
inttostr inttypes isapipe
lchmod lchown lib-ignore linebuffer link-follow
@@ -63,7 +63,7 @@ gnulib_modules="
memrchr mgetgroups
mkancesdirs mkdir mkdir-p mkstemp mktime modechange
mountlist mpsort obstack pathmax perl physmem
- posixtm posixver putenv
+ posix-shell posixtm posixver putenv
quote quotearg raise readlink areadlink-with-size
randint
randperm
diff --git a/build-aux/check.mk b/build-aux/check.mk
index fd6fb2b8d..9f63b6d17 100644
--- a/build-aux/check.mk
+++ b/build-aux/check.mk
@@ -23,18 +23,24 @@
## wait for all the tests to be compiled).
##
## Define TEST_SUITE_LOG to be the name of the global log to create.
-## Define TEST_LOGS to the set of logs to include in it. It defaults
-## to $(TESTS:.test=.log).
+## Define TEST_LOGS to the set of logs to include in it. One possibility
+## is $(TESTS:.test=.log).
##
## In addition to the magic "exit 77 means SKIP" feature (which was
## imported from automake), there is a magic "exit 177 means FAIL" feature
## which is useful if you need to issue a hard error no matter whether the
## test is XFAIL or not.
+# Use a POSIX-compatible shell if available, as this file uses
+# features of the POSIX shell that are not supported by some standard
+# shell implementations (e.g., Solaris 10 /bin/sh).
+SHELL = $(PREFERABLY_POSIX_SHELL)
+
# Set this to `false' to disable hard errors.
-ENABLE_HARD_ERRORS ?= :
+ENABLE_HARD_ERRORS = :
-## We use GNU Make extensions (%-rules), and override check-TESTS.
+## We use GNU Make extensions (%-rules) inside GNU_MAKE checks,
+## and we override check-TESTS.
AUTOMAKE_OPTIONS = -Wno-portability -Wno-override
# Restructured Text title and section.
@@ -78,15 +84,21 @@ tput sgr0 >/dev/null 2>&1 && \
std=$$(tput sgr0); \
}
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL). This contradicts POSIX. Work around the problem
+# by disabling -e (using the XSI extension "set +e") if it's set.
+SH_E_WORKAROUND = case $$- in *e*) set +e;; esac
+
# To be inserted before the command running the test. Creates the
# directory for the log if needed. Stores in $dir the directory
-# containing $<, and passes the TEST_ENVIRONMENT.
+# containing $src, and passes TESTS_ENVIRONMENT.
am__check_pre = \
-$(mkdir_p) "$$(dirname $@)"; \
-if test -f ./$<; then dir=./; \
-elif test -f $<; then dir=; \
+$(SH_E_WORKAROUND); \
+$(mkdir_p) "$$(dirname $@)" || exit; \
+if test -f "./$$src"; then dir=./; \
+elif test -f "$$src"; then dir=; \
else dir="$(srcdir)/"; fi; \
-$(TESTS_ENVIRONMENT)
+$(TESTS_ENVIRONMENT) $(SHELL)
# To be appended to the command running the test. Handles the stdout
# and stderr redirection, and catch the exit status.
@@ -99,7 +111,7 @@ fi; \
$(am__tty_colors); \
xfailed=PASS; \
for xfail in : $(XFAIL_TESTS); do \
- case $< in \
+ case $$src in \
$$xfail | */$$xfail) xfailed=XFAIL; break; \
esac; \
done; \
@@ -117,31 +129,34 @@ echo "$$res: $@ (exit: $$estatus)" | \
cat $@-t >>$@; \
rm $@-t
-# From a test file to a log file.
-# Do not use a regular `.test.log:' rule here, since in that case the
-# following rule (without incoming extension) will mask this one.
-%.log: %.test
- @$(am__check_pre) $${dir}$< $(am__check_post)
-
-# The exact same commands, but for programs.
-#
-# Should be active by default, because it sometimes triggers when in
-# should not. For instance I had foo.chk tests that relied on
-# directories with the name, without extensions (foo). Then Make
-# tried to run the directories to produce foo.log, not foo.chk.
-#
-%.log: %$(EXEEXT)
- @$(am__check_pre) $${dir}$< $(am__check_post)
-
-# The exact same commands, but for scripts without extension.
+SUFFIXES = .html .log
+
+# From a test (with no extension) to a log file.
+if GNU_MAKE
%.log: %
- @$(am__check_pre) $${dir}$< $(am__check_post)
+ @src='$<'; $(am__check_pre) "$$dir$$src" $(am__check_post)
+else
+# With POSIX 'make', inference rules cannot have FOO.log depend on FOO.
+# Work around the problem by calculating the dependency dynamically, and
+# then invoking a submake with the calculated dependency.
+CHECK-FORCE:
+DEPENDENCY = CHECK-FORCE
+$(TEST_LOGS): $(DEPENDENCY)
+ @if test '$(DEPENDENCY)' = CHECK-FORCE; then \
+ dst=$@; \
+ exec $(MAKE) $(AM_MAKEFLAGS) DEPENDENCY='$(srcdir)'/$${dst%.log} $@;\
+ else \
+ src='$(DEPENDENCY)'; \
+ $(am__check_pre) "$$dir$$src" $(am__check_post); \
+ fi
+endif
-TEST_LOGS ?= $(TESTS:.test=.log)
+#TEST_LOGS = $(TESTS:.test=.log)
TEST_SUITE_LOG = test-suite.log
$(TEST_SUITE_LOG): $(TEST_LOGS)
- @results=$$(for f in $(TEST_LOGS); do sed 1q $$f; done); \
+ @$(SH_E_WORKAROUND); \
+ results=$$(for f in $(TEST_LOGS); do sed 1q $$f; done); \
all=$$(echo "$$results" | wc -l | sed -e 's/^[ \t]*//'); \
fail=$$(echo "$$results" | grep -c '^FAIL'); \
pass=$$(echo "$$results" | grep -c '^PASS'); \
@@ -215,7 +230,7 @@ check-TESTS:
TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html)
-%.html: %.log
+.log.html:
@for r2h in $(RST2HTML) $$RST2HTML rst2html rst2html.py; \
do \
if ($$r2h --version) >/dev/null 2>&1; then \
@@ -245,7 +260,7 @@ check-html:
## Clean. ##
## ------- ##
-check-clean: check-clean-local
+check-clean:
rm -f $(CHECK_CLEANFILES) $(TEST_SUITE_LOG) $(TEST_SUITE_HTML) $(TEST_LOGS)
-.PHONY: check-clean check-clean-local
+.PHONY: check-clean
clean-local: check-clean
diff --git a/src/Makefile.am b/src/Makefile.am
index bc67ff2b8..49979fd08 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -137,25 +137,22 @@ stat_LDADD = $(LDADD) $(LIB_SELINUX)
$(PROGRAMS): ../lib/libcoreutils.a
-SUFFIXES = .sh
-
# Get the release year from ../lib/version-etc.c.
RELEASE_YEAR = \
`sed -n '/.*COPYRIGHT_YEAR = \([0-9][0-9][0-9][0-9]\) };/s//\1/p' \
$(top_srcdir)/lib/version-etc.c`
-# Ensure that version changes (reflected in Makefile's VERSION definition)
+# This depends on 'Makefile', so that version changes
+#(reflected in Makefile's VERSION definition)
# are reflected into groups --version also between releases.
-groups: Makefile
-
-.sh:
+groups: groups.sh Makefile
rm -f $@ $@-t
sed \
-e 's!@''bindir''@!$(bindir)!' \
-e 's/@''RELEASE_YEAR'@/$(RELEASE_YEAR)/ \
-e 's/@''PACKAGE_NAME''@/$(PACKAGE_NAME)/' \
-e 's/@''PACKAGE_BUGREPORT''@/$(PACKAGE_BUGREPORT)/' \
- -e 's/@''VERSION''@/$(VERSION)/' $< > $@-t
+ -e 's/@''VERSION''@/$(VERSION)/' $(srcdir)/groups.sh > $@-t
chmod +x $@-t
mv $@-t $@
diff --git a/tests/check.mk b/tests/check.mk
index 4c299e653..c33aa8922 100644
--- a/tests/check.mk
+++ b/tests/check.mk
@@ -47,6 +47,7 @@ TESTS_ENVIRONMENT = \
EGREP='$(EGREP)' \
EXEEXT='$(EXEEXT)' \
MAKE=$(MAKE) \
+ PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)' \
PACKAGE_VERSION=$(PACKAGE_VERSION) \
PERL='$(PERL)' \
REPLACE_GETCWD=$(REPLACE_GETCWD) \
@@ -55,5 +56,4 @@ TESTS_ENVIRONMENT = \
TEST_LOGS = $(TESTS:=.log)
# Parallel replacement of Automake's check-TESTS target.
-# CAVEAT: code in the following relies on GNU make.
include $(top_srcdir)/build-aux/check.mk