Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # SPDX-License-Identifier: GPL-2.0
0003 
0004 PKG="ncursesw"
0005 PKG2="ncurses"
0006 
0007 if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then
0008         if ${HOSTPKG_CONFIG} --exists $PKG; then
0009                 echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG)\"
0010                 echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG)\"
0011                 exit 0
0012         fi
0013 
0014         if ${HOSTPKG_CONFIG} --exists $PKG2; then
0015                 echo cflags=\"$(${HOSTPKG_CONFIG} --cflags $PKG2)\"
0016                 echo libs=\"$(${HOSTPKG_CONFIG} --libs $PKG2)\"
0017                 exit 0
0018         fi
0019 fi
0020 
0021 # Check the default paths in case pkg-config is not installed.
0022 # (Even if it is installed, some distributions such as openSUSE cannot
0023 # find ncurses by pkg-config.)
0024 if [ -f /usr/include/ncursesw/ncurses.h ]; then
0025         echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\"
0026         echo libs=\"-lncursesw\"
0027         exit 0
0028 fi
0029 
0030 if [ -f /usr/include/ncurses/ncurses.h ]; then
0031         echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncurses\"
0032         echo libs=\"-lncurses\"
0033         exit 0
0034 fi
0035 
0036 # As a final fallback before giving up, check if $HOSTCC knows of a default
0037 # ncurses installation (e.g. from a vendor-specific sysroot).
0038 if echo '#include <ncurses.h>' | ${HOSTCC} -E - >/dev/null 2>&1; then
0039         echo cflags=\"-D_GNU_SOURCE\"
0040         echo libs=\"-lncurses\"
0041         exit 0
0042 fi
0043 
0044 echo >&2 "*"
0045 echo >&2 "* Unable to find the ncurses package."
0046 echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
0047 echo >&2 "* depending on your distribution)."
0048 echo >&2 "*"
0049 echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the"
0050 echo >&2 "* ncurses installed in a non-default location."
0051 echo >&2 "*"
0052 exit 1