From patchwork Tue Dec 31 00:04:30 2013 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: 3421171 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E97A5C02DC for ; Tue, 31 Dec 2013 00:05:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD31C200FE for ; Tue, 31 Dec 2013 00:05:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C294E200F2 for ; Tue, 31 Dec 2013 00:05:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932372Ab3LaAFA (ORCPT ); Mon, 30 Dec 2013 19:05:00 -0500 Received: from mail-la0-f52.google.com ([209.85.215.52]:58117 "EHLO mail-la0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932262Ab3LaAE7 (ORCPT ); Mon, 30 Dec 2013 19:04:59 -0500 Received: by mail-la0-f52.google.com with SMTP id y1so5869023lam.39 for ; Mon, 30 Dec 2013 16:04:58 -0800 (PST) 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=fJNbB+k4WuPY2dLejRWQ95mx51Jq5z4cqkQn0Dl1ID0=; b=H7CI1AMyEJ6tV1rwmUGRi3zMYZpBFymKt5mxhWtH/XIxCNRBjRJ5rqYulEWi2XT6L1 iSooDR3pXTtNlSK9TfIIFkdsTw2GgSLaWQuuqoUPt1uAOhltRHMkyZ9TYH5TpNNL1unt hew7mErwmLHuPhm89f0YNAWZIhlG9fvxaWroOrcSsfTipZZp0zTqMu38Y830Scz7RW7S 0FJ9GBNkffDlPSf3y3YLZQtrH5K5Z460YdMC+k3HrSeEsDyF1mPPqS7p6zZEitTDQ7Lv oD1vjrfHjwDBH4UCQklSzh9vJBrb4Zq+eYgjWPtq8W8wJjqcrx/ExnlWV3fjMsAlMQWY AolQ== X-Received: by 10.112.55.212 with SMTP id u20mr27247352lbp.4.1388448297970; Mon, 30 Dec 2013 16:04:57 -0800 (PST) Received: from localhost (172.36.202.84.customer.cdi.no. [84.202.36.172]) by mx.google.com with ESMTPSA id j1sm28875562lbl.10.2013.12.30.16.04.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Dec 2013 16:04:57 -0800 (PST) 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: Tue, 31 Dec 2013 01:04:30 +0100 Message-Id: <1388448270-28832-1-git-send-email-bjorn.forsman@gmail.com> X-Mailer: git-send-email 1.8.5.2 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=-6.9 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 check-lxdialog.sh has functions for finding ncurses linker and compiler flags; ldflags() and ccflags(). ldflags() tries to get linker flags from pkg-config and has a fallback if pkg-config fails. But ccflags() currently doesn't use pkg-config at all, instead it does manual checks like this: if [ -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 echo '-I/usr/include/ncurses -DCURSES_LOC=""' [...] This patch changes ccflags() so that it also tries pkg-config first, and only if pkg-config fails does it go back to the fallback/manual checks. This makes ldflags()/ccflags() symmetric (both try to use pkg-config before falling back to manual checks) and has the nice side-effect of making "make menuconfig" work on systems where ncurses is not installed in a standard location (such as on NixOS). 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