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