aboutsummaryrefslogtreecommitdiffstats
path: root/acinclude.m4
blob: 7ab203300266abc61ff4beb6edebb3dd470506d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# AST_EXT_LIB([NAME], [FUNCTION], [package header], [package symbol name], [package friendly name], [additional LIB data])

AC_DEFUN([AST_EXT_LIB],
[
AC_ARG_WITH([$1], AC_HELP_STRING([--with-$1=PATH],[use $5 files in PATH]),[
case ${withval} in
     n|no)
     USE_$1=no
     ;;
     y|ye|yes)
     $1_MANDATORY="yes"
     ;;
     *)
     $1_DIR="${withval}"
     $1_MANDATORY="yes"
     ;;
esac
])

PBX_LIB$1=0

if test "${USE_$1}" != "no"; then
   pbxlibdir=""
   if test "x${$1_DIR}" != "x"; then
      pbxlibdir="-L${$1_DIR}/lib"
   fi
   AC_CHECK_LIB([$1], [$2], [:], [], ${pbxlibdir} $6)

   if test "${ac_cv_lib_$1_$2}" = "yes"; then
      $1_LIB="-l$1 $6"
      $4_HEADER_FOUND="1"
      if test "x${$1_DIR}" != "x"; then
         $1_LIB="${pbxlibdir} ${$1_LIB}"
	 $1_INCLUDE="-I${$1_DIR}/include"
	 if test "x$3" != "x" ; then
	    AC_CHECK_HEADER([${$1_DIR}/include/$3], [$4_HEADER_FOUND=1], [$4_HEADER_FOUND=0] )
	 fi
      else
	 if test "x$3" != "x" ; then
            AC_CHECK_HEADER([$3], [$4_HEADER_FOUND=1], [$4_HEADER_FOUND=0] )
	 fi
      fi
      if test "x${$4_HEADER_FOUND}" = "x0" ; then
         if test ! -z "${$1_MANDATORY}" ;
         then
            echo " ***"
            echo " *** It appears that you do not have the $1 development package installed."
            echo " *** Please install it to include $5 support, or re-run configure"
            echo " *** without explicitly specifying --with-$1"
            exit 1
         fi
         $1_LIB=""
         $1_INCLUDE=""
         PBX_LIB$1=0
      else
         PBX_LIB$1=1
         AC_DEFINE_UNQUOTED([HAVE_$4], 1, [Define to indicate the $5 library])
      fi
   elif test ! -z "${$1_MANDATORY}";
   then
      echo "***"
      echo "*** The $5 installation on this system appears to be broken."
      echo "*** Either correct the installation, or run configure"
      echo "*** without explicity specifying --with-$1"
      exit 1
   fi
fi
AC_SUBST([$1_LIB])
AC_SUBST([$1_INCLUDE])
AC_SUBST([PBX_LIB$1])
])


AC_DEFUN(
[AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK(for GNU make, GNU_MAKE,
   GNU_MAKE='Not Found' ;
   for a in make gmake gnumake ; do
      if test -z "$a" ; then continue ; fi ;
      if ( sh -c "$a --version" 2> /dev/null | grep GNU  2>&1 > /dev/null ) ;  then
         GNU_MAKE=$a ;
         break;
      fi
   done ;
) ;
if test  "x$GNU_MAKE" = "xNot Found"  ; then
   echo " *** Please install GNU make.  It is required to build Asterisk!"
   exit 1
fi
AC_SUBST([GNU_MAKE])
])