Re: RCS 5.9.0 does not compile on Solaris

Paul Eggert <[email protected]> Tue, 04 Jun 2013 14:29:16 -0700
Newsgroups gmane.comp.version-control.rcs.bugs
Message-ID <[email protected]>
On 06/04/13 13:27, Thien-Thi Nguyen wrote:
> Yes, you're right.  I made a mistake.  How about "true" instead of "echo 0"?

We shouldn't need that kind of contortion; we can
just use ||.

Please try the following patch instead.
It should cause 'rcs' to build on Solaris 9.
A lot of tests fail, but I haven't investigated them.

The main problem comes from quirks in Solaris 9 /bin/sh, which
is still basically the Bourne shell.  You can't trust
backslashes inside `...`, and you can't use "if !".
Also, as you've noted, grep -q doesn't work; I expect
this explains many of the test failures.
One more thing: you can't use "$<" in regular Makefile
rules; you gotta spell it out.
This stuff is all documented somewhere, I expect in the
Autoconf manual.

--- build-aux/extract-help.old	Thu May  2 01:45:44 2013
+++ build-aux/extract-help	Tue Jun  4 14:16:35 2013
@@ -58,17 +58,19 @@
     shift
 fi
 
-if [ x"$1" = x ] ; then
-    echo >&2 "ERROR: Missing arg: INFILE (try --help)"
-    exit 1
-else
+case $1 in
+*.c)
     in="$1"
     if [ -r "$in" ] ; then : ; else
         echo >&2 "ERROR: Cannot read input file: $in"
         exit 1
     fi
-    vprefix=`echo $in | sed 's/\.c$/_/;s|.*/||'`
-fi
+    vprefix_pat='.*/\([^/]*\)\.c$'
+    vprefix=`expr "/$in" : "$vprefix_pat"`_;;
+*)
+    echo >&2 "ERROR: Missing arg: INFILE (try --help)"
+    exit 1;;
+esac
 
 test -z "$out" || exec 1>"$out"
 echo '#include "gnu-h-v.h"'
@@ -84,8 +86,7 @@
 echo ';'
 
 # Pull in command support only if needed.
-if ! grep -q 'CHECK_HV (".*")' "$in" ; then
+grep 'CHECK_HV (".*")' "$in" >/dev/null ||
     echo '#include "b-yacmd.h"'
-fi
 
 # extract-help
--- man/Makefile.am-old	Sat Apr 20 11:08:38 2013
+++ man/Makefile.am	Tue Jun  4 14:20:49 2013
@@ -53,7 +53,7 @@
 
 REL: $(top_srcdir)/configure
 	@{ echo '.ds Rv $(PACKAGE_VERSION)' ;		\
-	   date -u +'.ds Dt %Y-%m-%d' -r $< ; } > $@t ;	\
+	   date -u +'.ds Dt %Y-%m-%d' -r $(top_srcdir)/configure ; } > $@t ;	\
 	if [ -f $@ ] && cmp -s $@t $@ ;			\
 	  then rm -f $@t ;				\
 	  else mv $@t $@ ; echo Created $@ ;		\
--- src/Makefile.am-old	Fri May  3 01:24:44 2013
+++ src/Makefile.am	Tue Jun  4 14:21:50 2013
@@ -25,7 +25,7 @@
 bin_SCRIPTS = $(subs)
 
 $(subs): sub.TEMPLATE
-	sed 's/SUB/$@/;s/VERSION/$(VERSION)/' $< > $@
+	sed 's/SUB/$@/;s/VERSION/$(VERSION)/' sub.TEMPLATE > $@
 	chmod +x $@
 
 noinst_LIBRARIES = libparts.a