configure.ac 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. AC_PREREQ(2.59)
  2. m4_define([MENUSELECT_VERSION],
  3. m4_bpatsubst(m4_esyscmd([./make_version .]),
  4. [\([0-9.]*\)\(\w\|\W\)*],
  5. [\1]))
  6. AC_INIT(menuselect, MENUSELECT_VERSION, www.asterisk.org)
  7. # check existence of the package
  8. AC_CONFIG_SRCDIR([menuselect.c])
  9. # specify output header file
  10. AC_CONFIG_HEADER(autoconfig.h)
  11. AC_COPYRIGHT("Menuselect")
  12. AC_CANONICAL_HOST
  13. HOST_OS=${host_os}
  14. AC_SUBST(HOST_OS)
  15. case "${host_os}" in
  16. *dragonfly*)
  17. CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
  18. LDFLAGS="${LDFLAGS} -L/usr/local/lib"
  19. ;;
  20. *netbsd*)
  21. CPPFLAGS="${CPPFLAGS} -I/usr/pkg/include"
  22. LDFLAGS="${LDFLAGS} -L/usr/pkg/lib"
  23. ;;
  24. *bsd*)
  25. CPPFLAGS="${CPPFLAGS} -I/usr/local/include"
  26. LDFLAGS="${LDFLAGS} -L/usr/local/lib"
  27. ;;
  28. esac
  29. AH_TOP(
  30. #ifndef MENUSELECT_AUTOCONFIG_H
  31. #define MENUSELECT_AUTOCONFIG_H
  32. )
  33. AH_BOTTOM([#endif])
  34. # Checks for programs.
  35. AC_PROG_CC
  36. AST_CHECK_GNU_MAKE
  37. AC_LANG(C)
  38. AC_ARG_ENABLE([debug],
  39. [AS_HELP_STRING([--enable-debug], [Turn on debug mode])],
  40. [case "${enableval}" in
  41. y|ye|yes) MENUSELECT_DEBUG=yes ;;
  42. n|no) MENUSELECT_DEBUG=no ;;
  43. *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
  44. esac])
  45. AC_SUBST(MENUSELECT_DEBUG)
  46. AC_FUNC_ALLOCA
  47. AC_CHECK_FUNCS([asprintf getloadavg setenv strcasestr strndup strnlen strsep unsetenv vasprintf])
  48. # The frontend can use curses, ncurses, newt or GTK2 so check for all of them
  49. AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
  50. AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
  51. AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses])
  52. AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2])
  53. AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
  54. AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [ncurses.h])
  55. if test "${PBX_NCURSES}" != 1; then
  56. # some platforms have the header in a sub-directory, for example Solaris
  57. AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [ncurses/ncurses.h])
  58. if test "${PBX_NCURSES}" != 1; then
  59. AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
  60. else
  61. HAVE_NCURSES_SUBDIR=yes
  62. fi
  63. fi
  64. AC_SUBST(HAVE_NCURSES_SUBDIR)
  65. AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , ,
  66. [#include <libxml/tree.h>
  67. #include <libxml/parser.h>],
  68. [LIBXML_TEST_VERSION])
  69. if test "${PBX_LIBXML2}" != 1; then
  70. AC_MSG_ERROR([Could not find required 'Libxml2' development package])
  71. fi
  72. AST_PKG_CONFIG_CHECK([GTK2], [gtk+-2.0])
  73. AC_SUBST(PBX_GTK2)
  74. AC_SUBST(GTK2_INCLUDE)
  75. AC_SUBST(GTK2_LIB)
  76. test "$silent"=yes && ac_sub_configure_args="${ac_sub_configure_args} --silent"
  77. AC_CONFIG_FILES([makeopts])
  78. AC_OUTPUT
  79. AC_MSG_NOTICE(Menuselect build configuration successfully completed)