2
0

nconf-cfg.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0-only
  3. cflags=$1
  4. libs=$2
  5. PKG="ncursesw menuw panelw"
  6. PKG2="ncurses menu panel"
  7. if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then
  8. if ${HOSTPKG_CONFIG} --exists $PKG; then
  9. ${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags}
  10. ${HOSTPKG_CONFIG} --libs ${PKG} > ${libs}
  11. exit 0
  12. fi
  13. if ${HOSTPKG_CONFIG} --exists $PKG2; then
  14. ${HOSTPKG_CONFIG} --cflags ${PKG2} > ${cflags}
  15. ${HOSTPKG_CONFIG} --libs ${PKG2} > ${libs}
  16. exit 0
  17. fi
  18. fi
  19. # Check the default paths in case pkg-config is not installed.
  20. # (Even if it is installed, some distributions such as openSUSE cannot
  21. # find ncurses by pkg-config.)
  22. if [ -f /usr/include/ncursesw/ncurses.h ]; then
  23. echo -D_GNU_SOURCE -I/usr/include/ncursesw > ${cflags}
  24. echo -lncursesw -lmenuw -lpanelw > ${libs}
  25. exit 0
  26. fi
  27. if [ -f /usr/include/ncurses/ncurses.h ]; then
  28. echo -D_GNU_SOURCE -I/usr/include/ncurses > ${cflags}
  29. echo -lncurses -lmenu -lpanel > ${libs}
  30. exit 0
  31. fi
  32. if [ -f /usr/include/ncurses.h ]; then
  33. echo -D_GNU_SOURCE > ${cflags}
  34. echo -lncurses -lmenu -lpanel > ${libs}
  35. exit 0
  36. fi
  37. echo >&2 "*"
  38. echo >&2 "* Unable to find the ncurses package."
  39. echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
  40. echo >&2 "* depending on your distribution)."
  41. echo >&2 "*"
  42. echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the"
  43. echo >&2 "* ncurses installed in a non-default location."
  44. echo >&2 "*"
  45. exit 1