Add new object for VoicemailUserEntry
[asterisk/asterisk.git] / autoconf / ast_c_compile_check.m4
1 # Check if a given expression will compile using a certain header.
2
3 # AST_C_COMPILE_CHECK([package], [expression], [header file], [version], [description])
4 AC_DEFUN([AST_C_COMPILE_CHECK],
5 [
6     if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
7         AC_MSG_CHECKING(m4_ifval([$5],[for $5],[if "$2" compiles using $3]))
8         saved_cppflags="${CPPFLAGS}"
9         if test "x${$1_DIR}" != "x"; then
10             $1_INCLUDE="-I${$1_DIR}/include"
11         fi
12         CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}"
13
14         AC_COMPILE_IFELSE(
15             [ AC_LANG_PROGRAM( [#include <$3>],
16                                [ $2; ]
17                                )],
18             [   AC_MSG_RESULT(yes)
19                 PBX_$1=1
20                 AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 headers.])
21                 m4_ifval([$4], [AC_DEFINE([HAVE_$1_VERSION], $4, [Define $1 headers version])])
22             ],
23             [       AC_MSG_RESULT(no) ] 
24         )
25         CPPFLAGS="${saved_cppflags}"
26     fi
27 ])