1
# Helper function to check for gcc attributes.
2
# AST_GCC_ATTRIBUTE([attribute name], [attribute syntax], [attribute scope], [makeopts flag])
4
AC_DEFUN([AST_GCC_ATTRIBUTE],
6
AC_MSG_CHECKING(checking for compiler 'attribute $1' support)
8
CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
14
AC_LANG_PROGRAM([$3 void __attribute__(($1)) *test(void *muffin, ...) {return (void *) 0;}],
18
AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
23
AC_LANG_PROGRAM([$3 void __attribute__(($2)) *test(void *muffin, ...) {return (void *) 0;}],
27
AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
32
m4_ifval([$4],[AC_SUBST($4)])
33
CFLAGS="$saved_CFLAGS"
36
# AST_EXT_LIB_SETUP([package symbol name], [package friendly name], [package option name], [additional help text])
38
AC_DEFUN([AST_EXT_LIB_SETUP],
42
AC_ARG_WITH([$3], AC_HELP_STRING([--with-$3=PATH],[use $2 files in PATH $4]),[
58
AC_SUBST([$1_INCLUDE])
62
# AST_EXT_LIB_CHECK([package symbol name], [package library name], [function to check], [package header], [additional LIB data])
64
AC_DEFUN([AST_EXT_LIB_CHECK],
66
if test "${USE_$1}" != "no"; then
68
if test "x${$1_DIR}" != "x"; then
69
if test -d ${$1_DIR}/lib; then
70
pbxlibdir="-L${$1_DIR}/lib"
72
pbxlibdir="-L${$1_DIR}"
75
AC_CHECK_LIB([$2], [$3], [AST_$1_FOUND=yes], [AST_$1_FOUND=no], ${pbxlibdir} $5)
77
if test "${AST_$1_FOUND}" = "yes"; then
80
if test "x${$1_DIR}" != "x"; then
81
$1_LIB="${pbxlibdir} ${$1_LIB}"
82
$1_INCLUDE="-I${$1_DIR}/include"
83
if test "x$4" != "x" ; then
84
AC_CHECK_HEADER([${$1_DIR}/include/$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] )
87
if test "x$4" != "x" ; then
88
AC_CHECK_HEADER([$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] )
91
if test "x${$1_HEADER_FOUND}" = "x0" ; then
92
if test ! -z "${$1_MANDATORY}" ;
95
AC_MSG_NOTICE( *** It appears that you do not have the $2 development package installed.)
96
AC_MSG_NOTICE( *** Please install it to include ${$1_DESCRIP} support, or re-run configure)
97
AC_MSG_NOTICE( *** without explicitly specifying --with-${$1_OPTION})
105
AC_DEFINE_UNQUOTED([HAVE_$1], 1, [Define to indicate the ${$1_DESCRIP} library])
107
elif test ! -z "${$1_MANDATORY}";
110
AC_MSG_NOTICE(*** The ${$1_DESCRIP} installation on this system appears to be broken.)
111
AC_MSG_NOTICE(*** Either correct the installation, or run configure)
112
AC_MSG_NOTICE(*** without explicitly specifying --with-${$1_OPTION})
120
[AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK([for GNU make], [ac_cv_GNU_MAKE],
121
ac_cv_GNU_MAKE='Not Found' ;
122
ac_cv_GNU_MAKE_VERSION_MAJOR=0 ;
123
ac_cv_GNU_MAKE_VERSION_MINOR=0 ;
124
for a in make gmake gnumake ; do
125
if test -z "$a" ; then continue ; fi ;
126
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
128
ac_cv_GNU_MAKE_VERSION_MAJOR=`$ac_cv_GNU_MAKE --version | grep "GNU Make" | cut -f3 -d' ' | cut -f1 -d'.'`
129
ac_cv_GNU_MAKE_VERSION_MINOR=`$ac_cv_GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2`
134
if test "x$ac_cv_GNU_MAKE" = "xNot Found" ; then
135
AC_MSG_ERROR( *** Please install GNU make. It is required to build Asterisk!)
138
AC_SUBST([GNU_MAKE], [$ac_cv_GNU_MAKE])
143
AN_FUNCTION([fork], [AST_FUNC_FORK])
144
AN_FUNCTION([vfork], [AST_FUNC_FORK])
145
AC_DEFUN([AST_FUNC_FORK],
146
[AC_REQUIRE([AC_TYPE_PID_T])dnl
147
AC_CHECK_HEADERS(vfork.h)
148
AC_CHECK_FUNCS(fork vfork)
149
if test "x$ac_cv_func_fork" = xyes; then
152
ac_cv_func_fork_works=$ac_cv_func_fork
154
if test "x$ac_cv_func_fork_works" = xcross; then
156
*-*-amigaos* | *-*-msdosdjgpp* | *-*-uclinux* | *-*-linux-uclibc* )
157
# Override, as these systems have only a dummy fork() stub
158
ac_cv_func_fork_works=no
161
ac_cv_func_fork_works=yes
164
AC_MSG_WARN([result $ac_cv_func_fork_works guessed because of cross compilation])
166
ac_cv_func_vfork_works=$ac_cv_func_vfork
167
if test "x$ac_cv_func_vfork" = xyes; then
170
if test "x$ac_cv_func_fork_works" = xcross; then
171
ac_cv_func_vfork_works=$ac_cv_func_vfork
172
AC_MSG_WARN([result $ac_cv_func_vfork_works guessed because of cross compilation])
175
if test "x$ac_cv_func_vfork_works" = xyes; then
176
AC_DEFINE(HAVE_WORKING_VFORK, 1, [Define to 1 if `vfork' works.])
178
AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.])
180
if test "x$ac_cv_func_fork_works" = xyes; then
181
AC_DEFINE(HAVE_WORKING_FORK, 1, [Define to 1 if `fork' works.])
188
AC_DEFUN([_AST_FUNC_FORK],
189
[AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works,
191
[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
193
/* By Ruediger Kuhlmann. */
196
[ac_cv_func_fork_works=yes],
197
[ac_cv_func_fork_works=no],
198
[ac_cv_func_fork_works=cross])])]