From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by dpdk.org (Postfix) with ESMTP id BAEB92BA9 for ; Tue, 22 Mar 2016 18:13:41 +0100 (CET) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DB69DACB3 for ; Tue, 22 Mar 2016 17:13:40 +0000 (UTC) From: Markos Chandras To: dev@dpdk.org Cc: Markos Chandras Date: Tue, 22 Mar 2016 17:13:36 +0000 Message-Id: <1458666816-29778-1-git-send-email-mchandras@suse.de> X-Mailer: git-send-email 2.7.3 X-Mailman-Approved-At: Tue, 22 Mar 2016 19:07:47 +0100 Subject: [dpdk-dev] [PATCH] mk: toolchain: gcc: query the compiler macros to obtain the gcc version X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Mar 2016 17:13:41 -0000 This is similar to what's being used in the Linux kernel. Querying the GCC macros directly gives more accurate results compared to -dumpversion which could vary across distributions. Signed-off-by: Markos Chandras --- In openSUSE Tumbleweed (and in any other SUSE distribution which uses (or will use) gcc >= 5), gcc -dumpversion returns '5'. This is on purpose as discussed in https://bugzilla.opensuse.org/show_bug.cgi?id=941428 As a result of which, the gcc-4.x comparison (40 against 5) does not work leading to tons of warnings and failures during build. This patch aims to change the way the gcc version is obtained by using the gcc macros directly. --- mk/toolchain/gcc/rte.toolchain-compat.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mk/toolchain/gcc/rte.toolchain-compat.mk b/mk/toolchain/gcc/rte.toolchain-compat.mk index e144216..6eed20c 100644 --- a/mk/toolchain/gcc/rte.toolchain-compat.mk +++ b/mk/toolchain/gcc/rte.toolchain-compat.mk @@ -38,7 +38,9 @@ #find out GCC version -GCC_VERSION = $(subst .,,$(shell $(CC) -dumpversion | cut -f1-2 -d.)) +GCC_MAJOR = $(shell echo __GNUC__ | $(CC) -E -x c - | tail -n 1) +GCC_MINOR = $(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1) +GCC_VERSION = $(GCC_MAJOR)$(GCC_MINOR) # if GCC is older than 4.x ifeq ($(shell test $(GCC_VERSION) -lt 40 && echo 1), 1) -- 2.7.3