From patchwork Wed May 25 20:37:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill Fischofer X-Patchwork-Id: 68638 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp50119qge; Wed, 25 May 2016 13:38:14 -0700 (PDT) X-Received: by 10.237.40.230 with SMTP id b93mr5745548qtd.23.1464208694792; Wed, 25 May 2016 13:38:14 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id n3si9849238qkf.8.2016.05.25.13.38.14; Wed, 25 May 2016 13:38:14 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 70B1B617DC; Wed, 25 May 2016 20:38:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 7A749617EA; Wed, 25 May 2016 20:37:15 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8DC41617DA; Wed, 25 May 2016 20:37:08 +0000 (UTC) Received: from mail-ob0-f180.google.com (mail-ob0-f180.google.com [209.85.214.180]) by lists.linaro.org (Postfix) with ESMTPS id 3D4FA617DA for ; Wed, 25 May 2016 20:37:07 +0000 (UTC) Received: by mail-ob0-f180.google.com with SMTP id v12so1079990obg.0 for ; Wed, 25 May 2016 13:37:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MonAgY4Rf8RLUCphGnFKBhQfH9tgtzGBHdIzsqolg9o=; b=llBG4JyQ9JHAbHF1WjHMGS/8LmP/fs468lJIaFcxkGqwgbOJDL+AWllsUMn88dWhxu VtR8nHlJsh2+49Tzz2153G7S5HyZICq8YV0PR0DHVCsnA2mxQ0WCn1XA5ODU/XkiDC38 7Plj6wWOd+TPwJ76cYNtLefcEYlmVZzKffdx32vnlS7bjlE7w3pE295GapLalGNpXltF itJM4doXFoP5QQS4WZxxo0BpKHx+okjp6AXo2lceQ5s1J7XUi4jPKGGCQLEwQvowOcBm +jJKIS51jwuJIVFxMz2rJC0k3nLqL+yLko3DblStunI2VuY2O1tc9+Kxfxb8uTJ8vBMg /LSQ== X-Gm-Message-State: ALyK8tJuwCzhKMv0XsfrtyIxS4OjzKZxg0BDd3msxMX2TpRFbhcPFCnDN9yQx0HiQtNl2kUvSzI= X-Received: by 10.202.4.88 with SMTP id 85mr3085816oie.47.1464208626547; Wed, 25 May 2016 13:37:06 -0700 (PDT) Received: from localhost.localdomain (cpe-66-68-129-43.austin.res.rr.com. [66.68.129.43]) by smtp.gmail.com with ESMTPSA id k125sm4752880oia.21.2016.05.25.13.37.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 May 2016 13:37:06 -0700 (PDT) From: Bill Fischofer To: lng-odp@lists.linaro.org Date: Wed, 25 May 2016 15:37:03 -0500 Message-Id: <1464208623-29531-2-git-send-email-bill.fischofer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1464208623-29531-1-git-send-email-bill.fischofer@linaro.org> References: <1464208623-29531-1-git-send-email-bill.fischofer@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 2/2] configure: add check for gcc version X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" GCC support for cmpxchng16 is buggy for older versions of GCC, so add a check for GCC version and don't enable this unless the GCC major version is 5 or higher. Note: The use of the AX_COMPILER_VERSION macro creates a dependency on the autoconf-archive package. Signed-off-by: Bill Fischofer --- DEPENDENCIES | 5 +++-- configure.ac | 33 ++++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/DEPENDENCIES b/DEPENDENCIES index a5266c9..e344826 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -8,13 +8,14 @@ Prerequisites for building the OpenDataPlane (ODP) API automake autoconf + autoconf-archive libtool On Debian/Ubuntu systems: - $ sudo apt-get install automake autoconf libtool + $ sudo apt-get install automake autoconf autoconf-archive libtool On CentOS/RedHat/Fedora systems: - $ sudo yum install automake autoconf libtool + $ sudo yum install automake autoconf autoconf-archive libtool 3. Required libraries diff --git a/configure.ac b/configure.ac index 5857893..842dc97 100644 --- a/configure.ac +++ b/configure.ac @@ -50,6 +50,17 @@ AC_TYPE_INT32_T AC_TYPE_UINT32_T AC_TYPE_UINT64_T +######################################################################### +# Get GCC version +######################################################################### + +AX_COMPILER_VERSION +GCC_VERSION=$ax_cv_c_compiler_version + +GCC_VERSION_MAJOR=$(echo $GCC_VERSION | cut -d'.' -f1) +GCC_VERSION_MINOR=$(echo $GCC_VERSION | cut -d'.' -f2) +GCC_VERSION_PATCH=$(echo $GCC_VERSION | cut -d'.' -f3) + ########################################################################## # Allow valgrind suite to run against the defined tests ########################################################################## @@ -212,15 +223,18 @@ ODP_CFLAGS="$ODP_CFLAGS $ODP_CFLAGS_EXTRA" ######################################################################### # Check if compiler supports cmpxchng16 ########################################################################## -my_save_cflags="$CFLAGS" -CFLAGS=-mcx16 -AC_MSG_CHECKING([whether CC supports -mcx16]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], - [AC_MSG_RESULT([yes])] - [ODP_CFLAGS="$ODP_CFLAGS -mcx16"], - [AC_MSG_RESULT([no])] -) -CFLAGS="$my_save_cflags" +if $GCC_VERSION_MAJOR >= 5; then + my_save_cflags="$CFLAGS" + + CFLAGS=-mcx16 + AC_MSG_CHECKING([whether CC supports -mcx16]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], + [AC_MSG_RESULT([yes])] + [ODP_CFLAGS="$ODP_CFLAGS $CFLAGS"], + [AC_MSG_RESULT([no])] + ) + CFLAGS="$my_save_cflags" +fi ########################################################################## # Default include setup @@ -266,6 +280,7 @@ AC_MSG_RESULT([ WITH_ARCH: ${WITH_ARCH} cc: ${CC} + gcc version: ${GCC_VERSION} cppflags: ${CPPFLAGS} am_cppflags: ${AM_CPPFLAGS} am_cxxflags: ${AM_CXXFLAGS}