check-lxdialog.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/sh
  2. # Check ncurses compatibility
  3. # What library to link
  4. ldflags()
  5. {
  6. if [ `uname` == SunOS ]; then
  7. echo '-lcurses'
  8. else
  9. echo '-lncurses'
  10. fi
  11. }
  12. # Where is ncurses.h?
  13. ccflags()
  14. {
  15. if [ -f /usr/include/ncurses/ncurses.h ]; then
  16. echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
  17. elif [ -f /usr/include/ncurses/curses.h ]; then
  18. echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
  19. elif [ -f /usr/include/ncurses.h ]; then
  20. echo '-DCURSES_LOC="<ncurses.h>"'
  21. else
  22. echo '-DCURSES_LOC="<curses.h>"'
  23. fi
  24. }
  25. compiler=""
  26. # Check if we can link to ncurses
  27. check() {
  28. echo "main() {}" | $compiler -xc -
  29. if [ $? != 0 ]; then
  30. echo " *** Unable to find the ncurses libraries." 1>&2
  31. echo " *** make menuconfig require the ncurses libraries" 1>&2
  32. echo " *** " 1>&2
  33. echo " *** Install ncurses (ncurses-devel) and try again" 1>&2
  34. echo " *** " 1>&2
  35. exit 1
  36. fi
  37. }
  38. usage() {
  39. printf "Usage: $0 [-check compiler options|-header|-library]\n"
  40. }
  41. if [ $# == 0 ]; then
  42. usage
  43. exit 1
  44. fi
  45. case "$1" in
  46. "-check")
  47. shift
  48. compiler="$@"
  49. check
  50. ;;
  51. "-ccflags")
  52. ccflags
  53. ;;
  54. "-ldflags")
  55. ldflags
  56. ;;
  57. "*")
  58. usage
  59. exit 1
  60. ;;
  61. esac