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