add ExtenSpy variant of ChanSpy
[asterisk-bristuff.git] / acinclude.m4
blobdde2f5de8d9327466aa4f9bd1699ada6e7d519ff
1 # AST_EXT_LIB_SETUP([package symbol name], [package friendly name], [package option name], [additional help text])
3 AC_DEFUN([AST_EXT_LIB_SETUP],
5 $1_DESCRIP="$2"
6 $1_OPTION="$3"
7 AC_ARG_WITH([$3], AC_HELP_STRING([--with-$3=PATH],[use $2 files in PATH $4]),[
8 case ${withval} in
9      n|no)
10      USE_$1=no
11      ;;
12      y|ye|yes)
13      $1_MANDATORY="yes"
14      ;;
15      *)
16      $1_DIR="${withval}"
17      $1_MANDATORY="yes"
18      ;;
19 esac
21 PBX_$1=0
22 AC_SUBST([$1_LIB])
23 AC_SUBST([$1_INCLUDE])
24 AC_SUBST([PBX_$1])
27 # AST_EXT_LIB_CHECK([package symbol name], [package library name], [function to check], [package header], [additional LIB data])
29 AC_DEFUN([AST_EXT_LIB_CHECK],
31 if test "${USE_$1}" != "no"; then
32    pbxlibdir=""
33    if test "x${$1_DIR}" != "x"; then
34       if test -d ${$1_DIR}/lib; then
35          pbxlibdir="-L${$1_DIR}/lib"
36       else
37          pbxlibdir="-L${$1_DIR}"
38       fi
39    fi
40    AC_CHECK_LIB([$2], [$3], [AST_$1_FOUND=yes], [AST_$1_FOUND=no], ${pbxlibdir} $5)
42    if test "${AST_$1_FOUND}" = "yes"; then
43       $1_LIB="-l$2 $5"
44       $1_HEADER_FOUND="1"
45       if test "x${$1_DIR}" != "x"; then
46          $1_LIB="${pbxlibdir} ${$1_LIB}"
47          $1_INCLUDE="-I${$1_DIR}/include"
48          if test "x$4" != "x" ; then
49             AC_CHECK_HEADER([${$1_DIR}/include/$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] )
50          fi
51       else
52          if test "x$4" != "x" ; then
53             AC_CHECK_HEADER([$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] )
54          fi
55       fi
56       if test "x${$1_HEADER_FOUND}" = "x0" ; then
57          if test ! -z "${$1_MANDATORY}" ;
58          then
59             echo " ***"
60             echo " *** It appears that you do not have the $2 development package installed."
61             echo " *** Please install it to include ${$1_DESCRIP} support, or re-run configure"
62             echo " *** without explicitly specifying --with-${$1_OPTION}"
63             exit 1
64          fi
65          $1_LIB=""
66          $1_INCLUDE=""
67          PBX_$1=0
68       else
69          PBX_$1=1
70          AC_DEFINE_UNQUOTED([HAVE_$1], 1, [Define to indicate the ${$1_DESCRIP} library])
71       fi
72    elif test ! -z "${$1_MANDATORY}";
73    then
74       echo "***"
75       echo "*** The ${$1_DESCRIP} installation on this system appears to be broken."
76       echo "*** Either correct the installation, or run configure"
77       echo "*** without explicitly specifying --with-${$1_OPTION}"
78       exit 1
79    fi
84 AC_DEFUN(
85 [AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK(for GNU make, GNU_MAKE,
86    GNU_MAKE='Not Found' ;
87    for a in make gmake gnumake ; do
88       if test -z "$a" ; then continue ; fi ;
89       if ( sh -c "$a --version" 2> /dev/null | grep GNU  2>&1 > /dev/null ) ;  then
90          GNU_MAKE=$a ;
91          break;
92       fi
93    done ;
94 ) ;
95 if test  "x$GNU_MAKE" = "xNot Found"  ; then
96    echo " *** Please install GNU make.  It is required to build Asterisk!"
97    exit 1
99 AC_SUBST([GNU_MAKE])