From patchwork Fri Jul 11 15:34:54 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: 4535381 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 927CBBEEAA for ; Fri, 11 Jul 2014 15:35:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A841320260 for ; Fri, 11 Jul 2014 15:35:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE69E2025B for ; Fri, 11 Jul 2014 15:35:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754409AbaGKPfG (ORCPT ); Fri, 11 Jul 2014 11:35:06 -0400 Received: from mail-lb0-f181.google.com ([209.85.217.181]:44188 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753421AbaGKPfC (ORCPT ); Fri, 11 Jul 2014 11:35:02 -0400 Received: by mail-lb0-f181.google.com with SMTP id p9so1041910lbv.12 for ; Fri, 11 Jul 2014 08:35:00 -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=8bfkZXKnS7vJPR9YCbFi5c3xuGrowaIxDu10R/UAdW4=; b=hlkXiJk8F3hbtMIPt0H2CXrDYjfYjKUNbdF6GKLeUQRggnk/DEepfirgOfXhhHWUM3 ffenVNc3h6lXjDajhC3Xi1Qq5Yt20zLhF5r7zRE9AQU1fnyZZclxJPhpZEIDKDQzYbT3 rHL4QJU/0M2jIb3W+MN03wJaPIIS9yRGS3lZK9YRt1Brt5hMoOjmfBIQQnSxmjhbZAkf Co6BanYJsCKO0AHmzH+mAB7XRuQMZF0vw6lbbMejw5MNAYvuRTI1+2B7Iq+ccXmvO/QY 8ltFjoFjX8DKYzNcy/y763yz0uBxjZ4hhSnsg+Zn8zJ2XL8Iqp9AnoCObfrxsENzFG9G 5Lvw== X-Received: by 10.152.37.71 with SMTP id w7mr2803920laj.90.1405092900019; Fri, 11 Jul 2014 08:35:00 -0700 (PDT) Received: from localhost (ip-23-4-179-93.dialup.ice.net. [93.179.4.23]) by mx.google.com with ESMTPSA id zn1sm3622065lbb.17.2014.07.11.08.34.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Jul 2014 08:34:59 -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: Fri, 11 Jul 2014 17:34:54 +0200 Message-Id: <1405092894-21030-1-git-send-email-bjorn.forsman@gmail.com> X-Mailer: git-send-email 2.0.1 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 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