04bfb0
From 913582217c96512015fd60f270f0e262824579b7 Mon Sep 17 00:00:00 2001
04bfb0
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
04bfb0
Date: Tue, 12 Nov 2019 09:19:18 +0100
04bfb0
Subject: [PATCH] Adapt Configure to GCC version 10
04bfb0
MIME-Version: 1.0
04bfb0
Content-Type: text/plain; charset=UTF-8
04bfb0
Content-Transfer-Encoding: 8bit
04bfb0
04bfb0
I got a notice from Jeff Law <law@redhat.com>:
04bfb0
04bfb0
    Your particular package fails its testsuite. This was ultimately
04bfb0
    tracked down to a Configure problem. The perl configure script treated
04bfb0
    gcc-10 as gcc-1 and turned on -fpcc-struct-return. This is an ABI
04bfb0
    changing flag and caused Perl to not be able to interact properly with
04bfb0
    the dbm libraries on the system leading to a segfault.
04bfb0
04bfb0
His proposed patch corrected only this one instance of the version
04bfb0
mismatch. Reading the Configure script revealed more issues. This
04bfb0
patch fixes all of them I found.
04bfb0
04bfb0
Please note I did not test it because I don't have GCC 10 available.
04bfb0
04bfb0
Signed-off-by: Petr Písař <ppisar@redhat.com>
04bfb0
---
04bfb0
 Configure | 14 +++++++-------
04bfb0
 cflags.SH |  2 +-
04bfb0
 2 files changed, 8 insertions(+), 8 deletions(-)
04bfb0
04bfb0
diff --git a/Configure b/Configure
04bfb0
index fad1c9f2b1..706c0b64ed 100755
04bfb0
--- a/Configure
04bfb0
+++ b/Configure
04bfb0
@@ -4701,7 +4701,7 @@ else
04bfb0
 fi
04bfb0
 $rm -f try try.*
04bfb0
 case "$gccversion" in
04bfb0
-1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
04bfb0
+1.*) cpp=`./loc gcc-cpp $cpp $pth` ;;
04bfb0
 esac
04bfb0
 case "$gccversion" in
04bfb0
 '') gccosandvers='' ;;
04bfb0
@@ -4741,7 +4741,7 @@ esac
04bfb0
 # gcc 3.* complain about adding -Idirectories that they already know about,
04bfb0
 # so we will take those off from locincpth.
04bfb0
 case "$gccversion" in
04bfb0
-3*)
04bfb0
+3.*)
04bfb0
     echo "main(){}">try.c
04bfb0
     for incdir in $locincpth; do
04bfb0
        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
04bfb0
@@ -5467,13 +5467,13 @@ fi
04bfb0
 case "$hint" in
04bfb0
 default|recommended)
04bfb0
 	case "$gccversion" in
04bfb0
-	1*) dflt="$dflt -fpcc-struct-return" ;;
04bfb0
+	1.*) dflt="$dflt -fpcc-struct-return" ;;
04bfb0
 	esac
04bfb0
 	case "$optimize:$DEBUGGING" in
04bfb0
 	*-g*:old) dflt="$dflt -DDEBUGGING";;
04bfb0
 	esac
04bfb0
 	case "$gccversion" in
04bfb0
-	2*) if $test -d /etc/conf/kconfig.d &&
04bfb0
+	2.*) if $test -d /etc/conf/kconfig.d &&
04bfb0
 			$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
04bfb0
 		then
04bfb0
 			# Interactive Systems (ISC) POSIX mode.
04bfb0
@@ -5482,7 +5482,7 @@ default|recommended)
04bfb0
 		;;
04bfb0
 	esac
04bfb0
 	case "$gccversion" in
04bfb0
-	1*) ;;
04bfb0
+	1.*) ;;
04bfb0
 	2.[0-8]*) ;;
04bfb0
 	?*)	set strict-aliasing -fno-strict-aliasing
04bfb0
 		eval $checkccflag
04bfb0
@@ -5600,7 +5600,7 @@ case "$cppflags" in
04bfb0
     ;;
04bfb0
 esac
04bfb0
 case "$gccversion" in
04bfb0
-1*) cppflags="$cppflags -D__GNUC__"
04bfb0
+1.*) cppflags="$cppflags -D__GNUC__"
04bfb0
 esac
04bfb0
 case "$mips_type" in
04bfb0
 '');;
04bfb0
@@ -23103,7 +23103,7 @@ fi
04bfb0
 
04bfb0
 : add -D_FORTIFY_SOURCE if feasible and not already there
04bfb0
 case "$gccversion" in
04bfb0
-[456789].*)	case "$optimize$ccflags" in
04bfb0
+[456789].*|[1-9][0-9]*)	case "$optimize$ccflags" in
04bfb0
 	*-O*)	case "$ccflags$cppsymbols" in
04bfb0
 		*_FORTIFY_SOURCE=*) # Don't add it again.
04bfb0
 			echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
04bfb0
diff --git a/cflags.SH b/cflags.SH
04bfb0
index e60742fed1..f1bcd6c38e 100755
04bfb0
--- a/cflags.SH
04bfb0
+++ b/cflags.SH
04bfb0
@@ -156,7 +156,7 @@ esac
04bfb0
 
04bfb0
 case "$gccversion" in
04bfb0
 '') ;;
04bfb0
-[12]*) ;; # gcc versions 1 (gasp!) and 2 are not good for this.
04bfb0
+[12].*) ;; # gcc versions 1 (gasp!) and 2 are not good for this.
04bfb0
 Intel*) ;; # # Is that you, Intel C++?
04bfb0
 #
04bfb0
 # NOTE 1: the -std=c89 without -pedantic is a bit pointless.
04bfb0
-- 
04bfb0
2.21.0
04bfb0