res_pjsip: Fail global load if debug or default_from_user are empty
[asterisk/asterisk.git] / autoconf / ast_check_osptk.m4
1 dnl 
2 dnl @synopsis AST_CHECK_OSPTK([REQ_VER_MAJOR],[REQ_VER_MINOR],[REQ_VER_BUGFIX])
3 dnl
4 dnl @summary check for existence of OSP Toolkit package
5 dnl
6 dnl This macro check for existence of OSP Toolkit package by checking osp/osp.h
7 dnl header file, OSPPInit function and OSP Toolkit version.
8 dnl
9 AC_DEFUN([AST_CHECK_OSPTK],
10 [
11         # if OSPTK has not been checked and is not excluded
12         if test "x${PBX_OSPTK}" != "x1" -a "${USE_OSPTK}" != "no"; then
13                 # if --with-osptk=DIR has been specified, use it.
14                 if test "x${OSPTK_DIR}" != "x"; then
15                         osptk_cflags="-I${OSPTK_DIR}/include"
16                         osptk_ldflags="-L${OSPTK_DIR}/lib"
17                 else
18                         osptk_cflags=""
19                         osptk_ldflags=""
20                 fi
21
22                 # check for the header
23                 osptk_saved_cppflags="${CPPFLAGS}"
24                 CPPFLAGS="${CPPFLAGS} ${osptk_cflags}"
25                 AC_CHECK_HEADER([osp/osp.h], [osptk_header_found=yes], [osptk_header_found=no])
26                 CPPFLAGS="${osptk_saved_cppflags}"
27
28                 # check for the library
29                 if test "${osptk_header_found}" = "yes"; then
30                         osptk_extralibs="-lssl -lcrypto"
31
32                         AC_CHECK_LIB([osptk], [OSPPInit], [osptk_library_found=yes], [osptk_library_found=no], ${osptk_ldflags} ${osptk_extralibs})
33
34                         # check OSP Toolkit version
35                         if test "${osptk_library_found}" = "yes"; then
36                                 AC_MSG_CHECKING(if OSP Toolkit version is compatible with app_osplookup)
37
38                                 osptk_saved_cppflags="${CPPFLAGS}"
39                                 CPPFLAGS="${CPPFLAGS} ${osptk_cflags}"
40                                 AC_RUN_IFELSE(
41                                         [AC_LANG_SOURCE([[
42                                                 #include <osp/osp.h>
43                                                 int main(void) {
44                                                         int ver = OSP_CLIENT_TOOLKIT_VERSION_MAJOR * 10000 + OSP_CLIENT_TOOLKIT_VERSION_MINOR * 100 + OSP_CLIENT_TOOLKIT_VERSION_BUGFIX;
45                                                         int req = $1 * 10000 + $2 * 100 + $3;
46                                                         return (ver < req) ? 1 : 0;
47                                                 }
48                                         ]])],
49                                         [osptk_compatible=yes],
50                                         [osptk_compatible=no]
51                                 )
52                                 CPPFLAGS="${osptk_saved_cppflags}"
53
54                                 if test "${osptk_compatible}" = "yes"; then
55                                         AC_MSG_RESULT(yes)
56                                         PBX_OSPTK=1
57                                         OSPTK_INCLUDE="${osptk_cflags}"
58                                         OSPTK_LIB="${osptk_ldflags} -losptk ${osptk_extralibs}"
59                                         AC_DEFINE_UNQUOTED([HAVE_OSPTK], 1, [Define this to indicate the ${OSPTK_DESCRIP} library])
60                                 else
61                                         AC_MSG_RESULT(no)
62                                 fi
63                         fi
64                 fi
65         fi
66 ])
67