mconf-cfg.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0
  3. PKG="ncursesw"
  4. PKG2="ncurses"
  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\"
  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\"
  28. exit 0
  29. fi
  30. if [ -f /usr/include/ncurses.h ]; then
  31. echo cflags=\"-D_GNU_SOURCE\"
  32. echo libs=\"-lncurses\"
  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. exit 1