This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC 3.0.3 build-procedure incompatibilities with POSIX 1003.1-2001


The new POSIX standard is now official (IEEE Std 1003.1-2001), and it
has removed support for some obsolete utility options that the GCC
build procedure still uses.  Here is a proposed patch, relative to GCC
3.0.3, to ensure that GCC still will build on POSIX 1003.1-2001 hosts.

I've done this patch by code inspection; I don't actually have a fully
conforming POSIX 1003.1-2001 host yet, though I do have some
experimental commands that insist on the -2001 behavior.

2002-02-19  Paul Eggert  <eggert@twinsun.com>

	* contrib/compare_tests: sort +0.4 -> sort -k 1.5, to conform
	to POSIX 1003.1-2001.

	* contrib/gcc_release (DIFF): diff -c3 -> diff -C3, to conform
	to POSIX 1003.1-2001.
	* contrib/snapshot: Likewise.
	* libstdc++-v3/docs/html/17_intro/contribute.html: Likewise.

	* contrib/test_summary: tail -1 -> tail -n 1, to conform to
	POSIX 1003.1-2001.

	* gcc/Makefile.in (STRIP15): New macro.
	(compare): Use it instead of "tail +16c", which is no longer portable
	as of POSIX 1003.1-2001.

	* gcc/configure.in (gcc_cv_as_leb128):
	head -1 -> sed q, to conform to POSIX 1003.1-2001.
	* ltcf-c.sh, ltcf-gcj.sh (archive_expsym_cmds): Likewise.

	* libstdc++-v3/mkcheck.in (size_command): Avoid tail -1, as
	it's no longer portable as of POSIX 1003.1-2001.

	* ltmain.sh: Avoid the need for "sort +2", which is not
        portable to POSIX 1003.1-2001 hosts.  Use "sort -u" rather
        than "uniq".  (This fix has also been sent to the libtool
        maintainers.)

===================================================================
RCS file: contrib/compare_tests,v
retrieving revision 3.0.3.0
retrieving revision 3.0.3.1
diff -pu -r3.0.3.0 -r3.0.3.1
--- contrib/compare_tests	1999/09/04 15:08:53	3.0.3.0
+++ contrib/compare_tests	2002/02/19 08:10:31	3.0.3.1
@@ -28,8 +28,8 @@ now=$tmp2
 
 trap "rm -f $tmp1 $tmp2 $now_s $before_s" 0 1 2 3 5 9 13 15
 
-sort +0.4 "$now" > "$now_s"
-sort +0.4 "$before" > "$before_s"
+sort -k 1.5 "$now" > "$now_s"
+sort -k 1.5 "$before" > "$before_s"
 
 grep '^FAIL' "$now_s" | sed 's/^....:	//' >$tmp1
 grep '^PASS' "$before_s" | sed 's/^....:	//' | comm -12 $tmp1 - >$tmp2
===================================================================
RCS file: contrib/gcc_release,v
retrieving revision 3.0.3.0
retrieving revision 3.0.3.1
diff -pu -r3.0.3.0 -r3.0.3.1
--- contrib/gcc_release	2001/08/24 20:16:05	3.0.3.0
+++ contrib/gcc_release	2002/02/19 08:10:31	3.0.3.1
@@ -425,7 +425,7 @@ FILE_LIST=""
 
 BZIP2="${BZIP2:-bzip2}"
 CVS="${CVS:-cvs -f -Q -z9}"
-DIFF="${DIFF:-diff -Nrc3pad}"
+DIFF="${DIFF:-diff -NrpadC3}"
 ENV="${ENV:-env}"
 GZIP="${GZIP:-gzip --best}"
 SCP="${SCP:-scp}"
===================================================================
RCS file: contrib/snapshot,v
retrieving revision 3.0.3.0
retrieving revision 3.0.3.1
diff -pu -r3.0.3.0 -r3.0.3.1
--- contrib/snapshot	2001/01/03 18:13:43	3.0.3.0
+++ contrib/snapshot	2002/02/19 08:10:31	3.0.3.1
@@ -70,7 +70,7 @@ rm -rf files_$date
 rm -rf files_$last_date
 
 # Diff them
-diff  -Nrc3p gcc-$last_date gcc-$date > gcc-core-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date gcc-$date > gcc-core-$last_date-$date.diff
 
 # Make the tarball for the core
 tar cf - gcc-$date | gzip --best > gcc-core-$date.tar.gz
@@ -95,34 +95,34 @@ rm -rf .brik_$last_date
 
 # Now make diffs for g77, g77-testsuite chill, java objc, g++, g++-testsuite,
 # testsuite, then the whole bloody thing.
-diff  -Nrc3p gcc-$last_date/gcc/f gcc-$date/gcc/f > gcc-g77-$last_date-$date.diff
-diff  -Nrc3p gcc-$last_date/libf2c gcc-$date/libf2c >> gcc-g77-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/gcc/f gcc-$date/gcc/f > gcc-g77-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/libf2c gcc-$date/libf2c >> gcc-g77-$last_date-$date.diff
 
-diff  -Nrc3p gcc-$last_date/gcc/testsuite/g77.f-torture  gcc-$date/gcc/testsuite/g77.f-torture > gcc-g77-testsuite-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/gcc/testsuite/g77.f-torture  gcc-$date/gcc/testsuite/g77.f-torture > gcc-g77-testsuite-$last_date-$date.diff
 
-diff  -Nrc3p gcc-$last_date/gcc/objc gcc-$date/gcc/objc > gcc-objc-$last_date-$date.diff
-diff  -Nrc3p gcc-$last_date/libobjc gcc-$date/libobjc >> gcc-objc-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/gcc/objc gcc-$date/gcc/objc > gcc-objc-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/libobjc gcc-$date/libobjc >> gcc-objc-$last_date-$date.diff
 
-diff  -Nrc3p gcc-$last_date/gcc/java gcc-$date/gcc/java > gcc-java-$last_date-$date.diff
-diff  -Nrc3p gcc-$last_date/boehm-gc gcc-$date/boehm-gc >> gcc-java-$last_date-$date.diff
-diff  -Nrc3p gcc-$last_date/fastjar gcc-$date/fastjar >> gcc-java-$last_date-$date.diff
-diff  -Nrc3p gcc-$last_date/libffi gcc-$date/libffi >> gcc-java-$last_date-$date.diff
-diff  -Nrc3p gcc-$last_date/libjava gcc-$date/libjava >> gcc-java-$last_date-$date.diff
-diff  -Nrc3p gcc-$last_date/zlib gcc-$date/zlib >> gcc-java-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/gcc/java gcc-$date/gcc/java > gcc-java-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/boehm-gc gcc-$date/boehm-gc >> gcc-java-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/fastjar gcc-$date/fastjar >> gcc-java-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/libffi gcc-$date/libffi >> gcc-java-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/libjava gcc-$date/libjava >> gcc-java-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/zlib gcc-$date/zlib >> gcc-java-$last_date-$date.diff
 
-diff  -Nrc3p gcc-$last_date/gcc/ch gcc-$date/gcc/ch > gcc-chill-$last_date-$date.diff
-diff  -Nrc3p gcc-$last_date/libchill gcc-$date/libchill >> gcc-chill-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/gcc/ch gcc-$date/gcc/ch > gcc-chill-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/libchill gcc-$date/libchill >> gcc-chill-$last_date-$date.diff
 
-diff  -Nrc3p gcc-$last_date/gcc/cp gcc-$date/gcc/cp > gcc-g++-$last_date-$date.diff
-diff  -Nrc3p gcc-$last_date/libio gcc-$date/libio >> gcc-g++-$last_date-$date.diff
-diff  -Nrc3p gcc-$last_date/libstdc++ gcc-$date/libstdc++ >> gcc-g++-$last_date-$date.diff
-diff  -Nrc3p gcc-$last_date/libstdc++-v3 gcc-$date/libstdc++-v3 >> gcc-g++-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/gcc/cp gcc-$date/gcc/cp > gcc-g++-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/libio gcc-$date/libio >> gcc-g++-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/libstdc++ gcc-$date/libstdc++ >> gcc-g++-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/libstdc++-v3 gcc-$date/libstdc++-v3 >> gcc-g++-$last_date-$date.diff
 
-diff  -Nrc3p gcc-$last_date/gcc/testsuite/g++.old-deja gcc-$date/gcc/testsuite/g++.old-deja > gcc-g++-tests-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/gcc/testsuite/g++.old-deja gcc-$date/gcc/testsuite/g++.old-deja > gcc-g++-tests-$last_date-$date.diff
 
-diff  -Nrc3p gcc-$last_date/gcc/testsuite gcc-$date/gcc/testsuite > gcc-tests-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date/gcc/testsuite gcc-$date/gcc/testsuite > gcc-tests-$last_date-$date.diff
 
-diff  -Nrc3p gcc-$last_date gcc-$date > gcc-$last_date-$date.diff
+diff  -NrpC3 gcc-$last_date gcc-$date > gcc-$last_date-$date.diff
 
 
 # Apply the patches to the old snapshot and run another diff to see if anything
@@ -134,7 +134,7 @@ rm -rf .brik.orig
 find . -name \*.rej > $STATEDIR/CHECKME
 ~law/bin/brik -C .brik >> $STATEDIR/CHECKME
 cd ..
-diff  -Nrc3p gcc-$last_date gcc-$date >> $STATEDIR/CHECKME
+diff  -NrpC3 gcc-$last_date gcc-$date >> $STATEDIR/CHECKME
 
 # Remove the old snapshot, we're done with it.
 #rm -rf gcc-$last_date
===================================================================
RCS file: contrib/test_summary,v
retrieving revision 3.0.3.0
retrieving revision 3.0.3.1
diff -pu -r3.0.3.0 -r3.0.3.1
--- contrib/test_summary	2001/07/29 06:46:24	3.0.3.0
+++ contrib/test_summary	2002/02/19 08:10:31	3.0.3.1
@@ -98,7 +98,7 @@ $1 ~ /\/configure$/ {
     srcdir = $1;
     gsub(/\/configure$/, "", srcdir);
     printf "LAST_UPDATED: ";
-    system("tail -1 " srcdir "/LAST_UPDATED");
+    system("tail -n 1 " srcdir "/LAST_UPDATED");
     print "";
 
     $1 = "configure flags:"; configflags = $0;
===================================================================
RCS file: gcc/Makefile.in,v
retrieving revision 3.0.3.0
retrieving revision 3.0.3.1
diff -pu -r3.0.3.0 -r3.0.3.1
--- gcc/Makefile.in	2001/11/19 00:46:43	3.0.3.0
+++ gcc/Makefile.in	2002/02/19 08:10:31	3.0.3.1
@@ -3131,21 +3131,26 @@ cleanstrap:
 # Compare the object files in the current directory with those in the
 # stage2 directory.
 
+# Copy all but the first 15 bytes of standard input to standard output.
+# This used to be "tail +16c", but POSIX 1003.1-2001 no longer allows that,
+# and some older "tail" implementations don't support the POSIX syntax.
+STRIP15 = (dd bs=15 count=1 >/dev/null 2>&1; cat)
+
 # ./ avoids bug in some versions of tail.
 compare compare3 compare4 compare-lean compare3-lean compare4-lean: force
 	-rm -f .bad_compare
 	case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
 	for file in *$(objext); do \
-	  tail +16c ./$$file > tmp-foo1; \
-	  tail +16c stage$$stage/$$file > tmp-foo2 \
+	  $(STRIP15) < ./$$file > tmp-foo1; \
+	  $(STRIP15) < stage$$stage/$$file > tmp-foo2 \
 	    && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
 	done
 	case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
 	for dir in tmp-foo intl $(SUBDIRS); do \
 	  if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
 	    for file in $$dir/*$(objext); do \
-	      tail +16c ./$$file > tmp-foo1; \
-	      tail +16c stage$$stage/$$file > tmp-foo2 \
+	      $(STRIP15) < ./$$file > tmp-foo1; \
+	      $(STRIP15) < stage$$stage/$$file > tmp-foo2 \
 	        && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
 	    done; \
 	  else true; fi; \
===================================================================
RCS file: gcc/configure.in,v
retrieving revision 3.0.3.0
retrieving revision 3.0.3.1
diff -pu -r3.0.3.0 -r3.0.3.1
--- gcc/configure.in	2001/12/04 19:42:38	3.0.3.0
+++ gcc/configure.in	2002/02/19 08:10:31	3.0.3.1
@@ -1326,7 +1326,7 @@ EOF
 		# ??? There exists an elf-specific test that will crash
 		# the assembler.  Perhaps it's better to figure out whether
 		# arbitrary sections are supported and try the test.
-		as_ver=`$gcc_cv_as --version 2>/dev/null | head -1`
+		as_ver=`$gcc_cv_as --version 2>/dev/null | sed q`
 		if echo "$as_ver" | grep GNU > /dev/null; then
 			as_ver=`echo $as_ver | sed -e 's/.* //'`
 			as_major=`echo $as_ver | sed 's/\..*//'`
@@ -1354,7 +1354,7 @@ if test x$gcc_cv_gas_major_version != x 
   fi
 elif test x$gcc_cv_as != x; then
 	# Check if this is GAS.
-	as_ver=`$gcc_cv_as --version < /dev/null 2> /dev/null | head -1`
+	as_ver=`$gcc_cv_as --version < /dev/null 2> /dev/null | sed q`
 	rm -f a.out 2> /dev/null
 	if echo "$as_ver" | grep GNU > /dev/null; then
 		# Versions up to and including 2.11.0 may mis-optimize
@@ -1407,7 +1407,7 @@ EOF
 		# and we got the correct data, then succeed.
 		if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
 		   && objdump -s -j .eh_frame conftest.o 2>/dev/null \
-		      | tail -3 > conftest.got \
+		      | (tail -n 3 2>/dev/null || tail -3) > conftest.got \
 		   && { cmp conftest.lit conftest.got > /dev/null 2>&1 \
 		        || cmp conftest.big conftest.got > /dev/null 2>&1; }
 		then
===================================================================
RCS file: libstdc++-v3/docs/html/17_intro/contribute.html,v
retrieving revision 3.0.3.0
retrieving revision 3.0.3.1
diff -pu -r3.0.3.0 -r3.0.3.1
--- libstdc++-v3/docs/html/17_intro/contribute.html	2000/12/10 04:03:09	3.0.3.0
+++ libstdc++-v3/docs/html/17_intro/contribute.html	2002/02/19 08:10:31	3.0.3.1
@@ -82,7 +82,7 @@ response from the maintainers) it would 
  simply show the existing error or test new functionality.
 
  <li> The patch itself. If you are accessing the CVS repository at
- Cygnus, use "cvs update; cvs diff -c3p NEW"; else, use "diff -c3p OLD
+ Cygnus, use "cvs update; cvs diff -pC3 NEW"; else, use "diff -pC3 OLD
  NEW" ... If your version of diff does not support these options, then
  get the latest version of GNU diff.
 
===================================================================
RCS file: libstdc++-v3/mkcheck.in,v
retrieving revision 3.0.3.0
retrieving revision 3.0.3.1
diff -pu -r3.0.3.0 -r3.0.3.1
--- libstdc++-v3/mkcheck.in	2001/07/13 20:55:54	3.0.3.0
+++ libstdc++-v3/mkcheck.in	2002/02/19 08:10:31	3.0.3.1
@@ -184,9 +184,9 @@ setup_size_command()
     function size_command()
     {
       case $1 in
-        TEXT)  TEXT=$(size -B $EXENAME | tail -1 | awk '{print $1}')  ;;
-        DATA)  DATA=$(size -B $EXENAME | tail -1 | awk '{print $2}')  ;;
-        SIZE)  SIZE=$(size -B $EXENAME | tail -1 | awk '{print $4}')  ;;
+        TEXT)  TEXT=$(size -B $EXENAME | awk '{x = $1} END {print x}')  ;;
+        DATA)  DATA=$(size -B $EXENAME | awk '{x = $2} END {print x}')  ;;
+        SIZE)  SIZE=$(size -B $EXENAME | awk '{x = $4} END {print x}')  ;;
       esac
     }
   else
===================================================================
RCS file: ltcf-c.sh,v
retrieving revision 3.0.3.0
retrieving revision 3.0.3.1
diff -pu -r3.0.3.0 -r3.0.3.1
--- ltcf-c.sh	2001/07/31 01:39:20	3.0.3.0
+++ ltcf-c.sh	2002/02/19 08:10:31	3.0.3.1
@@ -153,7 +153,7 @@ EOF
     # If the export-symbols file already is a .def file (1st line
     # is EXPORTS), use it as is.
     # If DATA tags from a recent dlltool are present, honour them!
-    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
+    archive_expsym_cmds='if test "x`sed q $export_symbols`" = xEXPORTS; then
         cp $export_symbols $output_objdir/$soname-def;
       else
         echo EXPORTS > $output_objdir/$soname-def;
===================================================================
RCS file: ltcf-gcj.sh,v
retrieving revision 3.0.3.0
retrieving revision 3.0.3.1
diff -pu -r3.0.3.0 -r3.0.3.1
--- ltcf-gcj.sh	2001/07/23 20:23:11	3.0.3.0
+++ ltcf-gcj.sh	2002/02/19 08:10:31	3.0.3.1
@@ -156,7 +156,7 @@ EOF
     # If the export-symbols file already is a .def file (1st line
     # is EXPORTS), use it as is.
     # If DATA tags from a recent dlltool are present, honour them!
-    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
+    archive_expsym_cmds='if test "x`sed q $export_symbols`" = xEXPORTS; then
         cp $export_symbols $output_objdir/$soname-def;
       else
         echo EXPORTS > $output_objdir/$soname-def;
===================================================================
RCS file: ltmain.sh,v
retrieving revision 3.0.3.0
retrieving revision 3.0.3.1
diff -pu -r3.0.3.0 -r3.0.3.1
--- ltmain.sh	2001/07/21 04:32:39	3.0.3.0
+++ ltmain.sh	2002/02/19 08:10:31	3.0.3.1
@@ -3712,12 +3712,8 @@ extern \"C\" {
 	      $mv "$nlist"T "$nlist"
 	    fi
 
-	    # Try sorting and uniquifying the output.
-	    if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
-	      :
-	    else
-	      grep -v "^: " < "$nlist" > "$nlist"S
-	    fi
+	    # Sort and uniquify the output.
+	    grep -v "^: " < "$nlist" | sort -u > "$nlist"S
 
 	    if test -f "$nlist"S; then
 	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]