Discussion:
[PATCH] CF_NCURSES_CONFIG: use AC_CHECK_TOOLS instead of AC_PATH_PROGS for ncurses-config
Mike Frysinger
2011-11-16 16:27:57 UTC
Permalink
The AC_xxx_PROG helpers will only search for the literally named progs
that were specific. So in this case, it will only locate scripts like
"ncurses5-config". This is problematic when cross-compiling as that
script is almost always the host one and not the target one.

By switching to AC_xxx_TOOL helpers, autoconf will automatically search
for a tuple-prefixed config script before falling back to the default
value like before. So if you do something like:
./configure --host=arm-linux-gnu --build=x86_64-linux-gnu

The code will first search for arm-linux-gnu-ncurses5-config. This way
we can have it load the config script for the target toolchain. If we
aren't cross-compiling, then the behavior is unchanged.

Note: I can't really locate the canonical source of this macro. The
ncurses tree isn't clear as it has multiple copies. But it should be
trivial to manually apply this to all the right places, so I wrote this
particular patch against the dialog package (since I can test that).

Signed-off-by: Mike Frysinger <***@gentoo.org>
---
aclocal.m4 | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index b6899cd..609d3a2 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -2669,7 +2669,7 @@ printf("old\n");
,[$1=no])
])dnl
dnl ---------------------------------------------------------------------------
-dnl CF_NCURSES_CONFIG version: 8 updated: 2010/07/08 05:17:30
+dnl CF_NCURSES_CONFIG version: 9 updated: 2011/11/16 05:17:30
dnl -----------------
dnl Tie together the configure-script macros for ncurses.
dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis.
@@ -2681,7 +2681,7 @@ AC_DEFUN([CF_NCURSES_CONFIG],
cf_ncuconfig_root=ifelse($1,,ncurses,$1)

echo "Looking for ${cf_ncuconfig_root}-config"
-AC_PATH_PROGS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none)
+AC_CHECK_TOOLS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none)

if test "$NCURSES_CONFIG" != none ; then
--
1.7.6.1
Loading...