configure.ac 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. # Process this file with autoconf to produce a configure script.
  2. AC_PREREQ(2.59)
  3. m4_define([MENUSELECT_VERSION],
  4. m4_bpatsubst(m4_esyscmd([./make_version .]),
  5. [\([0-9.]*\)\(\w\|\W\)*],
  6. [\1]))
  7. AC_INIT(menuselect, MENUSELECT_VERSION, www.asterisk.org)
  8. # check existence of the package
  9. AC_CONFIG_SRCDIR([menuselect.c])
  10. # specify output header file
  11. AC_CONFIG_HEADER(autoconfig.h)
  12. AC_COPYRIGHT("Menuselect")
  13. AC_REVISION($Revision$)
  14. AC_CANONICAL_BUILD
  15. AC_CANONICAL_HOST
  16. HOST_OS=${host_os}
  17. AC_SUBST(HOST_OS)
  18. PBX_WINARCH=0
  19. case "${host_os}" in
  20. freebsd*)
  21. OSARCH=FreeBSD
  22. ;;
  23. netbsd*)
  24. OSARCH=NetBSD
  25. ;;
  26. openbsd*)
  27. OSARCH=OpenBSD
  28. ;;
  29. solaris*)
  30. OSARCH=SunOS
  31. ;;
  32. mingw32)
  33. OSARCH=mingw32
  34. PBX_WINARCH=1
  35. ;;
  36. cygwin)
  37. OSARCH=cygwin
  38. PBX_WINARCH=1
  39. ;;
  40. linux-gnueabi)
  41. OSARCH=linux-gnu
  42. ;;
  43. *)
  44. OSARCH=${host_os}
  45. ;;
  46. esac
  47. AH_TOP(
  48. #ifndef MENUSELECT_AUTOCONFIG_H
  49. #define MENUSELECT_AUTOCONFIG_H
  50. #ifndef _REENTRANT
  51. #define _REENTRANT
  52. #endif
  53. )
  54. AH_BOTTOM(
  55. #endif
  56. )
  57. # Checks for programs.
  58. AC_PROG_CC
  59. AST_CHECK_GNU_MAKE
  60. AC_LANG(C)
  61. AC_ARG_ENABLE([debug],
  62. [AS_HELP_STRING([--enable-debug], [Turn on debug mode])],
  63. [case "${enableval}" in
  64. y|ye|yes) MENUSELECT_DEBUG=yes ;;
  65. n|no) MENUSELECT_DEBUG=no ;;
  66. *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
  67. esac])
  68. AC_SUBST(MENUSELECT_DEBUG)
  69. # Support weak symbols on a platform specific basis. The Mac OS X
  70. # (Darwin) support must be isolated from the other platforms because
  71. # it has caused other platforms to fail.
  72. #
  73. case "${OSARCH}" in
  74. darwin*)
  75. # Allow weak symbol support on Darwin platforms only because there
  76. # is active community support for it.
  77. # However, Darwin seems to break weak symbols for each new version.
  78. #
  79. AST_GCC_ATTRIBUTE(weak_import, [], [], PBX_WEAKREF)
  80. # Several other platforms including Linux have GCC versions that
  81. # define the weak attribute. However, this attribute is only
  82. # setup for use in the code by Darwin.
  83. AST_GCC_ATTRIBUTE(weak, [], [], PBX_WEAKREF)
  84. ;;
  85. linux-gnu)
  86. # Primarily support weak symbols on Linux platforms.
  87. #
  88. AST_GCC_ATTRIBUTE(weakref, [weakref("foo")], static, PBX_WEAKREF)
  89. ;;
  90. *)
  91. # Allow weak symbols on other platforms. However, any problems
  92. # with this feature on other platforms must be fixed by the
  93. # community.
  94. #
  95. AST_GCC_ATTRIBUTE(weakref, [weakref("foo")], static, PBX_WEAKREF)
  96. ;;
  97. esac
  98. AC_FUNC_ALLOCA
  99. AC_CHECK_FUNCS([asprintf getloadavg setenv strcasestr strndup strnlen strsep unsetenv vasprintf])
  100. # The frontend can use curses, ncurses, newt or GTK2 so check for all of them
  101. AST_EXT_LIB_SETUP([NEWT], [newt], [newt])
  102. AST_EXT_LIB_SETUP([CURSES], [curses], [curses])
  103. AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses])
  104. AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2])
  105. AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
  106. AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
  107. AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
  108. AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , ,
  109. [#include <libxml/tree.h>
  110. #include <libxml/parser.h>],
  111. [LIBXML_TEST_VERSION])
  112. if test "${PBX_LIBXML2}" != 1; then
  113. AC_MSG_ERROR([Could not find required 'Libxml2' development package])
  114. fi
  115. PBX_GTK2=0
  116. AC_CHECK_TOOL(PKGCONFIG, pkg-config, No)
  117. if test ! "x${PKGCONFIG}" = xNo; then
  118. GTK2_INCLUDE=$(${PKGCONFIG} gtk+-2.0 --cflags 2>/dev/null)
  119. GTK2_LIB=$(${PKGCONFIG} gtk+-2.0 --libs)
  120. PBX_GTK2=1
  121. AC_DEFINE([HAVE_GTK2], 1, [Define if your system has the GTK2 libraries.])
  122. fi
  123. AC_SUBST(PBX_GTK2)
  124. AC_SUBST(GTK2_INCLUDE)
  125. AC_SUBST(GTK2_LIB)
  126. test "$silent"=yes && ac_sub_configure_args="${ac_sub_configure_args} --silent"
  127. AC_CONFIG_FILES([makeopts])
  128. AC_OUTPUT
  129. AC_MSG_NOTICE(Menuselect build configuration successfully completed)