| 1 |
AC_PREREQ(2.59) |
| 2 |
|
| 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 |
|
| 9 |
# check existence of the package |
| 10 |
AC_CONFIG_SRCDIR([menuselect.c]) |
| 11 |
|
| 12 |
# specify output header file |
| 13 |
AC_CONFIG_HEADERS([autoconfig.h]) |
| 14 |
|
| 15 |
AC_COPYRIGHT("Menuselect") |
| 16 |
|
| 17 |
AC_CANONICAL_HOST |
| 18 |
|
| 19 |
HOST_OS=${host_os} |
| 20 |
AC_SUBST(HOST_OS) |
| 21 |
|
| 22 |
case "${host_os}" in |
| 23 |
*dragonfly*) |
| 24 |
CPPFLAGS="${CPPFLAGS} -I/usr/local/include" |
| 25 |
LDFLAGS="${LDFLAGS} -L/usr/local/lib" |
| 26 |
;; |
| 27 |
*netbsd*) |
| 28 |
CPPFLAGS="${CPPFLAGS} -I/usr/pkg/include" |
| 29 |
LDFLAGS="${LDFLAGS} -L/usr/pkg/lib" |
| 30 |
;; |
| 31 |
*bsd*) |
| 32 |
CPPFLAGS="${CPPFLAGS} -I/usr/local/include" |
| 33 |
LDFLAGS="${LDFLAGS} -L/usr/local/lib" |
| 34 |
;; |
| 35 |
esac |
| 36 |
|
| 37 |
AH_TOP( |
| 38 |
#ifndef MENUSELECT_AUTOCONFIG_H |
| 39 |
#define MENUSELECT_AUTOCONFIG_H |
| 40 |
) |
| 41 |
|
| 42 |
AH_BOTTOM([#endif]) |
| 43 |
|
| 44 |
# Checks for programs. |
| 45 |
AC_PROG_CC |
| 46 |
AST_CHECK_GNU_MAKE |
| 47 |
|
| 48 |
PKG_PROG_PKG_CONFIG |
| 49 |
|
| 50 |
AC_LANG(C) |
| 51 |
AC_ARG_ENABLE([debug], |
| 52 |
[AS_HELP_STRING([--enable-debug], [Turn on debug mode])], |
| 53 |
[case "${enableval}" in |
| 54 |
y|ye|yes) MENUSELECT_DEBUG=yes ;; |
| 55 |
n|no) MENUSELECT_DEBUG=no ;; |
| 56 |
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; |
| 57 |
esac]) |
| 58 |
AC_SUBST(MENUSELECT_DEBUG) |
| 59 |
|
| 60 |
AC_FUNC_ALLOCA |
| 61 |
AC_CHECK_FUNCS([asprintf getloadavg setenv strcasestr strndup strnlen strsep unsetenv vasprintf]) |
| 62 |
|
| 63 |
# The frontend can use curses, ncurses, newt or GTK2 so check for all of them |
| 64 |
|
| 65 |
AST_EXT_LIB_SETUP([NEWT], [newt], [newt]) |
| 66 |
AST_EXT_LIB_SETUP([CURSES], [curses], [curses]) |
| 67 |
AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses]) |
| 68 |
AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2]) |
| 69 |
AST_EXT_LIB_SETUP([TINFO], [terminfo], [libtinfo]) |
| 70 |
|
| 71 |
AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h]) |
| 72 |
AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [ncurses.h]) |
| 73 |
if test "${PBX_NCURSES}" != 1; then |
| 74 |
# some platforms have the header in a sub-directory, for example Solaris |
| 75 |
AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [ncurses/ncurses.h]) |
| 76 |
if test "${PBX_NCURSES}" != 1; then |
| 77 |
AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h]) |
| 78 |
else |
| 79 |
HAVE_NCURSES_SUBDIR=yes |
| 80 |
fi |
| 81 |
fi |
| 82 |
AC_SUBST(HAVE_NCURSES_SUBDIR) |
| 83 |
|
| 84 |
if test "${PBX_NCURSES}" = 1; then |
| 85 |
if test "${HAVE_NCURSES_SUBDIR}" = "yes"; then |
| 86 |
AST_EXT_LIB_CHECK([TINFO], [tinfo], [keypad], [ncurses/ncurses.h]) |
| 87 |
else |
| 88 |
AST_EXT_LIB_CHECK([TINFO], [tinfo], [keypad], [ncurses.h]) |
| 89 |
fi |
| 90 |
else |
| 91 |
AST_EXT_LIB_CHECK([TINFO], [tinfo], [keypad], [curses.h]) |
| 92 |
fi |
| 93 |
|
| 94 |
AST_PKG_CONFIG_CHECK([LIBXML2], [libxml-2.0]) |
| 95 |
AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , , |
| 96 |
[#include <libxml/tree.h> |
| 97 |
#include <libxml/parser.h>], |
| 98 |
[LIBXML_TEST_VERSION]) |
| 99 |
|
| 100 |
if test "${PBX_LIBXML2}" != 1; then |
| 101 |
AC_MSG_ERROR([Could not find required 'Libxml2' development package]) |
| 102 |
fi |
| 103 |
|
| 104 |
AST_PKG_CONFIG_CHECK([GTK2], [gtk+-2.0]) |
| 105 |
AC_SUBST(PBX_GTK2) |
| 106 |
AC_SUBST(GTK2_INCLUDE) |
| 107 |
AC_SUBST(GTK2_LIB) |
| 108 |
|
| 109 |
test "$silent"=yes && ac_sub_configure_args="${ac_sub_configure_args} --silent" |
| 110 |
|
| 111 |
AC_CONFIG_FILES([makeopts]) |
| 112 |
AC_OUTPUT |
| 113 |
|
| 114 |
AC_MSG_NOTICE(Menuselect build configuration successfully completed) |