nconf-cfg.sh 1.3 KB

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