1 # AST_GCC_ATTRIBUTE([attribute name])
3 AC_DEFUN([AST_GCC_ATTRIBUTE],
5 AC_MSG_CHECKING(for compiler 'attribute $1' support)
7 AC_LANG_PROGRAM([static int __attribute__(($1)) test(void) {}],
10 AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
14 # AST_EXT_LIB_SETUP([package symbol name], [package friendly name], [package option name], [additional help text])
16 AC_DEFUN([AST_EXT_LIB_SETUP],
20 AC_ARG_WITH([$3], AC_HELP_STRING([--with-$3=PATH],[use $2 files in PATH $4]),[
36 AC_SUBST([$1_INCLUDE])
40 # AST_EXT_LIB_CHECK([package symbol name], [package library name], [function to check], [package header], [additional LIB data])
42 AC_DEFUN([AST_EXT_LIB_CHECK],
44 if test "${USE_$1}" != "no"; then
46 if test "x${$1_DIR}" != "x"; then
47 if test -d ${$1_DIR}/lib; then
48 pbxlibdir="-L${$1_DIR}/lib"
50 pbxlibdir="-L${$1_DIR}"
53 AC_CHECK_LIB([$2], [$3], [AST_$1_FOUND=yes], [AST_$1_FOUND=no], ${pbxlibdir} $5)
55 if test "${AST_$1_FOUND}" = "yes"; then
58 if test "x${$1_DIR}" != "x"; then
59 $1_LIB="${pbxlibdir} ${$1_LIB}"
60 $1_INCLUDE="-I${$1_DIR}/include"
61 if test "x$4" != "x" ; then
62 AC_CHECK_HEADER([${$1_DIR}/include/$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] )
65 if test "x$4" != "x" ; then
66 AC_CHECK_HEADER([$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] )
69 if test "x${$1_HEADER_FOUND}" = "x0" ; then
70 if test ! -z "${$1_MANDATORY}" ;
73 AC_MSG_NOTICE( *** It appears that you do not have the $2 development package installed.)
74 AC_MSG_NOTICE( *** Please install it to include ${$1_DESCRIP} support, or re-run configure)
75 AC_MSG_NOTICE( *** without explicitly specifying --with-${$1_OPTION})
83 AC_DEFINE_UNQUOTED([HAVE_$1], 1, [Define to indicate the ${$1_DESCRIP} library])
85 elif test ! -z "${$1_MANDATORY}";
88 AC_MSG_NOTICE(*** The ${$1_DESCRIP} installation on this system appears to be broken.)
89 AC_MSG_NOTICE(*** Either correct the installation, or run configure)
90 AC_MSG_NOTICE(*** without explicitly specifying --with-${$1_OPTION})
98 [AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK(for GNU make, GNU_MAKE,
99 GNU_MAKE='Not Found' ;
100 GNU_MAKE_VERSION_MAJOR=0 ;
101 GNU_MAKE_VERSION_MINOR=0 ;
102 for a in make gmake gnumake ; do
103 if test -z "$a" ; then continue ; fi ;
104 if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
106 GNU_MAKE_VERSION_MAJOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f3 -d' ' | cut -f1 -d'.'`
107 GNU_MAKE_VERSION_MINOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2`
112 if test "x$GNU_MAKE" = "xNot Found" ; then
113 AC_MSG_ERROR( *** Please install GNU make. It is required to build Asterisk!)
121 AN_FUNCTION([fork], [AST_FUNC_FORK])
122 AN_FUNCTION([vfork], [AST_FUNC_FORK])
123 AC_DEFUN([AST_FUNC_FORK],
124 [AC_REQUIRE([AC_TYPE_PID_T])dnl
125 AC_CHECK_HEADERS(vfork.h)
126 AC_CHECK_FUNCS(fork vfork)
127 if test "x$ac_cv_func_fork" = xyes; then
130 ac_cv_func_fork_works=$ac_cv_func_fork
132 if test "x$ac_cv_func_fork_works" = xcross; then
134 *-*-amigaos* | *-*-msdosdjgpp* | *-*-uclinux* )
135 # Override, as these systems have only a dummy fork() stub
136 ac_cv_func_fork_works=no
139 ac_cv_func_fork_works=yes
142 AC_MSG_WARN([result $ac_cv_func_fork_works guessed because of cross compilation])
144 ac_cv_func_vfork_works=$ac_cv_func_vfork
145 if test "x$ac_cv_func_vfork" = xyes; then
148 if test "x$ac_cv_func_fork_works" = xcross; then
149 ac_cv_func_vfork_works=$ac_cv_func_vfork
150 AC_MSG_WARN([result $ac_cv_func_vfork_works guessed because of cross compilation])
153 if test "x$ac_cv_func_vfork_works" = xyes; then
154 AC_DEFINE(HAVE_WORKING_VFORK, 1, [Define to 1 if `vfork' works.])
156 AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.])
158 if test "x$ac_cv_func_fork_works" = xyes; then
159 AC_DEFINE(HAVE_WORKING_FORK, 1, [Define to 1 if `fork' works.])
166 AC_DEFUN([_AST_FUNC_FORK],
167 [AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works,
169 [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
171 /* By Ruediger Kuhlmann. */
174 [ac_cv_func_fork_works=yes],
175 [ac_cv_func_fork_works=no],
176 [ac_cv_func_fork_works=cross])])]