configure 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #! /bin/sh
  2. if which ncursesw6-config >/dev/null
  3. then
  4. echo 'using ncursesw6 autoconfiguration script…'
  5. NCURSES_FLAGS=$(ncursesw6-config --cflags)
  6. NCURSES_LIBS=$(ncursesw6-config --libs)
  7. elif which ncursesw5-config >/dev/null
  8. then
  9. echo 'using ncursesw5 autoconfiguration script…'
  10. NCURSES_FLAGS=$(ncursesw5-config --cflags)
  11. NCURSES_LIBS=$(ncursesw5-config --libs)
  12. elif which ncurses6-config >/dev/null
  13. then
  14. echo 'using ncurses6 autoconfiguration script…'
  15. NCURSES_FLAGS=$(ncurses6-config --cflags)
  16. NCURSES_LIBS=$(ncurses6-config --libs)
  17. elif which ncurses5-config >/dev/null
  18. then
  19. echo 'using ncurses5 autoconfiguration script…'
  20. NCURSES_FLAGS=$(ncurses5-config --cflags)
  21. NCURSES_LIBS=$(ncurses5-config --libs)
  22. elif which pkg-config >/dev/null
  23. then
  24. echo 'using pkg-config…'
  25. NCURSES_FLAGS=$(pkg-config ncursesw --cflags)
  26. NCURSES_LIBS=$(pkg-config ncursesw --libs)
  27. else
  28. echo 'can not configure! you will have to manually specify flags.'
  29. NCURSES_FLAGS='# manual configuration required'
  30. NCURSES_LIBS='# manual configuration required'
  31. fi
  32. if [ $(uname -s) == 'FreeBSD' ]
  33. then
  34. NCURSES_FLAGS="-I/usr/local/include $NCURSES_FLAGS"
  35. fi
  36. echo "# automatically generated build configuration
  37. NCURSES_FLAGS = $NCURSES_FLAGS
  38. NCURSES_LIBS = $NCURSES_LIBS
  39. CFLAGS += -std=c89 -pedantic -Wall -Wextra -Werror
  40. CPPFLAGS += -Iincs \$(NCURSES_FLAGS)
  41. LDFLAGS += \$(NCURSES_LIBS)
  42. CC ?= cc" > config.mk
  43. echo 'wrote config.mk.'