2018-05-22 07:22:21 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
2022-12-11 02:54:48 +00:00
|
|
|
cflags=$1
|
|
|
|
libs=$2
|
|
|
|
|
2018-05-22 07:22:21 +00:00
|
|
|
PKG="ncursesw"
|
|
|
|
PKG2="ncurses"
|
|
|
|
|
2022-04-01 23:18:02 +00:00
|
|
|
if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then
|
|
|
|
if ${HOSTPKG_CONFIG} --exists $PKG; then
|
2022-12-11 02:54:48 +00:00
|
|
|
${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags}
|
|
|
|
${HOSTPKG_CONFIG} --libs ${PKG} > ${libs}
|
kconfig: do not require pkg-config on make {menu,n}config
Meelis Roos reported a {menu,n}config regression:
"I have libncurses devel package installed in the default system
location (as do 99%+ on actual developers probably) and in this
case, pkg-config is useless. pkg-config is needed only when
libraries and headers are installed in non-default locations but
it is bad to require installation of pkg-config on all the machines
where make menuconfig would be possibly run."
For {menu,n}config, do not use pkg-config if it is not installed.
For {g,x}config, keep checking pkg-config since we really rely on it
for finding the installation paths of the required packages.
Fixes: 4ab3b80159d4 ("kconfig: check for pkg-config on make {menu,n,g,x}config")
Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Meelis Roos <mroos@linux.ee>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2018-08-31 09:34:55 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
2018-05-22 07:22:21 +00:00
|
|
|
|
2022-12-11 02:54:48 +00:00
|
|
|
if ${HOSTPKG_CONFIG} --exists ${PKG2}; then
|
|
|
|
${HOSTPKG_CONFIG} --cflags ${PKG2} > ${cflags}
|
|
|
|
${HOSTPKG_CONFIG} --libs ${PKG2} > ${libs}
|
kconfig: do not require pkg-config on make {menu,n}config
Meelis Roos reported a {menu,n}config regression:
"I have libncurses devel package installed in the default system
location (as do 99%+ on actual developers probably) and in this
case, pkg-config is useless. pkg-config is needed only when
libraries and headers are installed in non-default locations but
it is bad to require installation of pkg-config on all the machines
where make menuconfig would be possibly run."
For {menu,n}config, do not use pkg-config if it is not installed.
For {g,x}config, keep checking pkg-config since we really rely on it
for finding the installation paths of the required packages.
Fixes: 4ab3b80159d4 ("kconfig: check for pkg-config on make {menu,n,g,x}config")
Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Meelis Roos <mroos@linux.ee>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2018-08-31 09:34:55 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
2018-05-22 07:22:21 +00:00
|
|
|
fi
|
|
|
|
|
kconfig: do not require pkg-config on make {menu,n}config
Meelis Roos reported a {menu,n}config regression:
"I have libncurses devel package installed in the default system
location (as do 99%+ on actual developers probably) and in this
case, pkg-config is useless. pkg-config is needed only when
libraries and headers are installed in non-default locations but
it is bad to require installation of pkg-config on all the machines
where make menuconfig would be possibly run."
For {menu,n}config, do not use pkg-config if it is not installed.
For {g,x}config, keep checking pkg-config since we really rely on it
for finding the installation paths of the required packages.
Fixes: 4ab3b80159d4 ("kconfig: check for pkg-config on make {menu,n,g,x}config")
Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Meelis Roos <mroos@linux.ee>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
2018-08-31 09:34:55 +00:00
|
|
|
# Check the default paths in case pkg-config is not installed.
|
|
|
|
# (Even if it is installed, some distributions such as openSUSE cannot
|
|
|
|
# find ncurses by pkg-config.)
|
2018-05-22 07:22:21 +00:00
|
|
|
if [ -f /usr/include/ncursesw/ncurses.h ]; then
|
2022-12-11 02:54:48 +00:00
|
|
|
echo -D_GNU_SOURCE -I/usr/include/ncursesw > ${cflags}
|
|
|
|
echo -lncursesw > ${libs}
|
2018-05-22 07:22:21 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f /usr/include/ncurses/ncurses.h ]; then
|
2022-12-11 02:54:48 +00:00
|
|
|
echo -D_GNU_SOURCE -I/usr/include/ncurses > ${cflags}
|
|
|
|
echo -lncurses > ${libs}
|
2018-05-22 07:22:21 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2020-12-23 05:04:23 +00:00
|
|
|
# As a final fallback before giving up, check if $HOSTCC knows of a default
|
|
|
|
# ncurses installation (e.g. from a vendor-specific sysroot).
|
2021-01-14 10:02:16 +00:00
|
|
|
if echo '#include <ncurses.h>' | ${HOSTCC} -E - >/dev/null 2>&1; then
|
2022-12-11 02:54:48 +00:00
|
|
|
echo -D_GNU_SOURCE > ${cflags}
|
|
|
|
echo -lncurses > ${libs}
|
2018-05-22 07:22:21 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo >&2 "*"
|
|
|
|
echo >&2 "* Unable to find the ncurses package."
|
|
|
|
echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
|
|
|
|
echo >&2 "* depending on your distribution)."
|
|
|
|
echo >&2 "*"
|
2022-04-01 23:18:02 +00:00
|
|
|
echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the"
|
2019-11-05 15:07:36 +00:00
|
|
|
echo >&2 "* ncurses installed in a non-default location."
|
|
|
|
echo >&2 "*"
|
2018-05-22 07:22:21 +00:00
|
|
|
exit 1
|