From patchwork Thu Aug 10 21:05:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Li X-Patchwork-Id: 9894591 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5E45B60352 for ; Thu, 10 Aug 2017 21:05:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C7D328B4D for ; Thu, 10 Aug 2017 21:05:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DF0928B9F; Thu, 10 Aug 2017 21:05:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7EFB28B4D for ; Thu, 10 Aug 2017 21:05:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753126AbdHJVFa (ORCPT ); Thu, 10 Aug 2017 17:05:30 -0400 Received: from mail-yw0-f194.google.com ([209.85.161.194]:38524 "EHLO mail-yw0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753099AbdHJVF3 (ORCPT ); Thu, 10 Aug 2017 17:05:29 -0400 Received: by mail-yw0-f194.google.com with SMTP id p68so1174886ywg.5 for ; Thu, 10 Aug 2017 14:05:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to:cc; bh=KDpSAxOz9SY+PBcYuztZZDzj1olCXWTOV51J3lZ6Wa8=; b=i8Kd5O2bVM2Rel2h8B4vaDdn50WrJqyOkwGIMrLVMt370jIA8kNC2ped143D/rRuUw TyBnqWmE1sn1x6jAqiz3jO37azjPt4x+grCM9y/BX4u1B8MUt222y2d7PGe0XhZm/LNk CFmjNq7FRLd1nt7NWcnAwmBJWzOcoiEJT5XyNCOgxI3LrZ38ZaQR1ZL7kpzw6r+18CLe A/l6gZRWTUYyUvJhu0+9x6UVgOytjot83zLdBEfJ93M81g8es6AXSjggzA/EKRD7Ksai 0AvB31gAWr699xqypSwGUqJQulIyJrdd2cwrdF2NANgF/+Y54jt1rL0BNUEegCEj0FBA U6Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to:cc; bh=KDpSAxOz9SY+PBcYuztZZDzj1olCXWTOV51J3lZ6Wa8=; b=D55uUjs03s35EUCmK7JhgFrwcNuK8ksvmm1dTL7m+U6jd5KlsCSsAbcF2Ib+A/Fwnt LUvSDJUmf7xAGoACctzV/ifgDmiSE/6FPh0xTj5v41f3MF83Gkyif6ONKweprw4Qt7Lt 4bwmXqWoCsbAyaPGwVl5mFlEC9lK1Y4v6MD4siYEK7s+opc03R2toEsk0IJGLPE8chuE uNNz4BDErciYD4yBimkRvedC0szHMHrwPwM9bgnxyztSIUawN5K5JYpxUZCZa1uE7vLk PNJaDeYYbSGZzRsoF4/X3nSrNIuv04IFFmQUyeWbeSAvoZisFshJHqiWelf4L/5WbjYf l4xA== X-Gm-Message-State: AHYfb5g9Y3+ulHrG354y/ByO2iFwlgXF8bj/blz/oXvTv9RQzQ3HGcwF 8znLKZku6ukl+E9ZWWVi4K8OETPbRYL1 X-Received: by 10.129.229.4 with SMTP id s4mr10577600ywl.130.1502399128840; Thu, 10 Aug 2017 14:05:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.68.39 with HTTP; Thu, 10 Aug 2017 14:05:28 -0700 (PDT) From: Christopher Li Date: Thu, 10 Aug 2017 17:05:28 -0400 X-Google-Sender-Auth: WXciHjkT9epp7R_MJ-B7qZiP4bQ Message-ID: Subject: [PATCH 2/2] test-inspect: Detect gtk3 then gtk2 package To: Linux-Sparse Cc: Dibyendu Majumdar , Luc Van Oostenryck Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This fix a bug that test-inspect crash on Ubuntu 16.04 TLS updated vesion of gtk2. gtk3 does not seem to have this problem. Detect and use gtk3 if exists. Reported-by: Dibyendu Majumdar Signed-off-by: Christopher Li --- Makefile | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) LLVM_CONFIG:=llvm-config HAVE_LLVM:=$(shell $(LLVM_CONFIG) --version >/dev/null 2>&1 && echo 'yes') @@ -69,17 +76,17 @@ else $(warning Your system does not have libxml, disabling c2xml) endif -ifeq ($(HAVE_GTK2),yes) -GTK2_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk+-2.0) -GTK2_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0) +ifeq ($(HAVE_GTK),yes) +GTK_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk+-$(GTK_VERSION)) +GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-$(GTK_VERSION)) PROGRAMS += test-inspect INST_PROGRAMS += test-inspect test-inspect_EXTRA_DEPS := ast-model.o ast-view.o ast-inspect.o test-inspect_OBJS := test-inspect.o $(test-inspect_EXTRA_DEPS) -$(test-inspect_OBJS) $(test-inspect_OBJS:.o=.sc): CFLAGS += $(GTK2_CFLAGS) -test-inspect_EXTRA_OBJS := $(GTK2_LIBS) +$(test-inspect_OBJS) $(test-inspect_OBJS:.o=.sc): CFLAGS += $(GTK_CFLAGS) +test-inspect_EXTRA_OBJS := $(GTK_LIBS) else -$(warning Your system does not have libgtk2, disabling test-inspect) +$(warning Your system does not have gtk3/gtk2, disabling test-inspect) endif ifeq ($(HAVE_LLVM),yes) diff --git a/Makefile b/Makefile index c20ea2c..88d485b 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,14 @@ HAVE_LIBXML:=$(shell $(PKG_CONFIG) --exists libxml-2.0 2>/dev/null && echo 'yes' HAVE_GCC_DEP:=$(shell touch .gcc-test.c && \ $(CC) -c -Wp,-MD,.gcc-test.d .gcc-test.c 2>/dev/null && \ echo 'yes'; rm -f .gcc-test.d .gcc-test.o .gcc-test.c) -HAVE_GTK2:=$(shell $(PKG_CONFIG) --exists gtk+-2.0 2>/dev/null && echo 'yes') + +GTK_VERSION:=3.0 +HAVE_GTK:=$(shell $(PKG_CONFIG) --exists gtk+-$(GTK_VERSION) 2>/dev/null && echo 'yes') +ifneq ($(HAVE_GTK),yes) + GTK_VERSION:=2.0 + HAVE_GTK:=$(shell $(PKG_CONFIG) --exists gtk+-$(GTK_VERSION) 2>/dev/null && echo 'yes') +endif +