From patchwork Sun Sep 14 10:57:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Bj=C3=B8rn_Forsman?= X-Patchwork-Id: 4901131 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 62EAA9F2EC for ; Sun, 14 Sep 2014 10:55:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 53E8620220 for ; Sun, 14 Sep 2014 10:58:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3EC2320219 for ; Sun, 14 Sep 2014 10:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752493AbaINK6s (ORCPT ); Sun, 14 Sep 2014 06:58:48 -0400 Received: from mail-lb0-f176.google.com ([209.85.217.176]:50689 "EHLO mail-lb0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752477AbaINK6s (ORCPT ); Sun, 14 Sep 2014 06:58:48 -0400 Received: by mail-lb0-f176.google.com with SMTP id z11so3030614lbi.7 for ; Sun, 14 Sep 2014 03:58:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=c34z2kIXtoZGXZzvRgnFjsVmhsV+LgXyGGjCYdpfbyY=; b=COIpIdFzybg1mDL04zPgpMHDTV2i2EzuC1VxQfGNULhIDmiqcmWyqZ6ZlDSR3whnf4 e8cn5IicKb2lgebxpPvx16GnVwaSGjxMmh4QgMj2/2B5SeAdUgZRlFCBezHJ7SZ1L+xP qRoQxxP1npMnm9mRMIfPnTgtScX0S/DampXhFeiB/j4SrYfV2NqkMp4nq6d+XYM/N1E9 +UQBKfJ7dEXedO7JoTer9uHOUN//APEle8wx8tzuIRPKrPMP8Zu5lBjsJfsncXYjv40Y z3rTxorzQ2EtrbzahBt5EwWHO7jVadHxYihQUMrIiFkN1Bu8G+CnMhE0HIJazRMCsihi Kajw== X-Received: by 10.113.3.139 with SMTP id bw11mr1109798lbd.98.1410692326260; Sun, 14 Sep 2014 03:58:46 -0700 (PDT) Received: from localhost (110.38.202.84.customer.cdi.no. [84.202.38.110]) by mx.google.com with ESMTPSA id my10sm3195450lbb.9.2014.09.14.03.58.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Sep 2014 03:58:45 -0700 (PDT) From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= To: yann.morin.1998@free.fr Cc: linux-kbuild@vger.kernel.org, =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Subject: [PATCH] kconfig/lxdialog: get ncurses CFLAGS with pkg-config Date: Sun, 14 Sep 2014 12:57:50 +0200 Message-Id: <1410692270-3225-1-git-send-email-bjorn.forsman@gmail.com> X-Mailer: git-send-email 2.1.0 MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This makes "make menuconfig" also work on systems where ncurses is not installed in a standard location (such as on NixOS). This patch changes ccflags() so that it tries pkg-config first, and only if pkg-config fails does it go back to the fallback/manual checks. This is the same algorithm that ldflags() already uses. Signed-off-by: Bjørn Forsman --- scripts/kconfig/lxdialog/check-lxdialog.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh index 9d2a4c5..5075ebf 100644 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh @@ -21,7 +21,11 @@ ldflags() # Where is ncurses.h? ccflags() { - if [ -f /usr/include/ncursesw/curses.h ]; then + if pkg-config --cflags ncursesw 2>/dev/null; then + echo '-DCURSES_LOC="" -DNCURSES_WIDECHAR=1' + elif pkg-config --cflags ncurses 2>/dev/null; then + echo '-DCURSES_LOC=""' + elif [ -f /usr/include/ncursesw/curses.h ]; then echo '-I/usr/include/ncursesw -DCURSES_LOC=""' echo ' -DNCURSES_WIDECHAR=1' elif [ -f /usr/include/ncurses/ncurses.h ]; then