You need to sign in or sign up before continuing.
Newer
Older
# AST_GCC_ATTRIBUTE([attribute name])
AC_DEFUN([AST_GCC_ATTRIBUTE],
[
AC_MSG_CHECKING(checking for compiler 'attribute $1' support)
AC_COMPILE_IFELSE(
AC_LANG_PROGRAM([static int __attribute__(($1)) test(void) {}],
[]),
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]),
AC_MSG_RESULT(no))
])
Kevin P. Fleming
committed
# AST_EXT_LIB_SETUP([package symbol name], [package friendly name], [package option name], [additional help text])
Kevin P. Fleming
committed
Kevin P. Fleming
committed
AC_DEFUN([AST_EXT_LIB_SETUP],
Kevin P. Fleming
committed
[
Kevin P. Fleming
committed
$1_DESCRIP="$2"
$1_OPTION="$3"
AC_ARG_WITH([$3], AC_HELP_STRING([--with-$3=PATH],[use $2 files in PATH $4]),[
Kevin P. Fleming
committed
case ${withval} in
n|no)
Kevin P. Fleming
committed
USE_$1=no
Kevin P. Fleming
committed
;;
y|ye|yes)
Kevin P. Fleming
committed
$1_MANDATORY="yes"
Kevin P. Fleming
committed
;;
*)
Kevin P. Fleming
committed
$1_DIR="${withval}"
$1_MANDATORY="yes"
Kevin P. Fleming
committed
;;
esac
])
Kevin P. Fleming
committed
PBX_$1=0
AC_SUBST([$1_LIB])
AC_SUBST([$1_INCLUDE])
AC_SUBST([PBX_$1])
])
Kevin P. Fleming
committed
Kevin P. Fleming
committed
# AST_EXT_LIB_CHECK([package symbol name], [package library name], [function to check], [package header], [additional LIB data])
Kevin P. Fleming
committed
Kevin P. Fleming
committed
AC_DEFUN([AST_EXT_LIB_CHECK],
[
if test "${USE_$1}" != "no"; then
Russell Bryant
committed
pbxlibdir=""
Kevin P. Fleming
committed
if test "x${$1_DIR}" != "x"; then
if test -d ${$1_DIR}/lib; then
pbxlibdir="-L${$1_DIR}/lib"
else
pbxlibdir="-L${$1_DIR}"
fi
Kevin P. Fleming
committed
AC_CHECK_LIB([$2], [$3], [AST_$1_FOUND=yes], [AST_$1_FOUND=no], ${pbxlibdir} $5)
Kevin P. Fleming
committed
Kevin P. Fleming
committed
if test "${AST_$1_FOUND}" = "yes"; then
$1_LIB="-l$2 $5"
$1_HEADER_FOUND="1"
if test "x${$1_DIR}" != "x"; then
$1_LIB="${pbxlibdir} ${$1_LIB}"
$1_INCLUDE="-I${$1_DIR}/include"
if test "x$4" != "x" ; then
AC_CHECK_HEADER([${$1_DIR}/include/$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] )
Kevin P. Fleming
committed
fi
else
Kevin P. Fleming
committed
if test "x$4" != "x" ; then
AC_CHECK_HEADER([$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] )
Kevin P. Fleming
committed
fi
fi
Kevin P. Fleming
committed
if test "x${$1_HEADER_FOUND}" = "x0" ; then
if test ! -z "${$1_MANDATORY}" ;
Russell Bryant
committed
then
AC_MSG_NOTICE( ***)
AC_MSG_NOTICE( *** It appears that you do not have the $2 development package installed.)
AC_MSG_NOTICE( *** Please install it to include ${$1_DESCRIP} support, or re-run configure)
AC_MSG_NOTICE( *** without explicitly specifying --with-${$1_OPTION})
Russell Bryant
committed
exit 1
fi
Kevin P. Fleming
committed
$1_LIB=""
$1_INCLUDE=""
PBX_$1=0
Russell Bryant
committed
else
Kevin P. Fleming
committed
PBX_$1=1
AC_DEFINE_UNQUOTED([HAVE_$1], 1, [Define to indicate the ${$1_DESCRIP} library])
Kevin P. Fleming
committed
fi
Kevin P. Fleming
committed
elif test ! -z "${$1_MANDATORY}";
Kevin P. Fleming
committed
then
AC_MSG_NOTICE(***)
AC_MSG_NOTICE(*** The ${$1_DESCRIP} installation on this system appears to be broken.)
AC_MSG_NOTICE(*** Either correct the installation, or run configure)
AC_MSG_NOTICE(*** without explicitly specifying --with-${$1_OPTION})
Kevin P. Fleming
committed
exit 1
fi
fi
])
AC_DEFUN(
[AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK(for GNU make, GNU_MAKE,
Kevin P. Fleming
committed
GNU_MAKE='Not Found' ;
Russell Bryant
committed
GNU_MAKE_VERSION_MAJOR=0 ;
GNU_MAKE_VERSION_MINOR=0 ;
Kevin P. Fleming
committed
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 ;
GNU_MAKE_VERSION_MAJOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f3 -d' ' | cut -f1 -d'.'`
Russell Bryant
committed
GNU_MAKE_VERSION_MINOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2`
Kevin P. Fleming
committed
break;
fi
done ;
) ;
if test "x$GNU_MAKE" = "xNot Found" ; then
AC_MSG_ERROR( *** Please install GNU make. It is required to build Asterisk!)
Kevin P. Fleming
committed
exit 1
fi
AC_SUBST([GNU_MAKE])
Kevin P. Fleming
committed
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# AST_FUNC_FORK
# -------------
AN_FUNCTION([fork], [AST_FUNC_FORK])
AN_FUNCTION([vfork], [AST_FUNC_FORK])
AC_DEFUN([AST_FUNC_FORK],
[AC_REQUIRE([AC_TYPE_PID_T])dnl
AC_CHECK_HEADERS(vfork.h)
AC_CHECK_FUNCS(fork vfork)
if test "x$ac_cv_func_fork" = xyes; then
_AST_FUNC_FORK
else
ac_cv_func_fork_works=$ac_cv_func_fork
fi
if test "x$ac_cv_func_fork_works" = xcross; then
case $host in
*-*-amigaos* | *-*-msdosdjgpp* | *-*-uclinux* )
# Override, as these systems have only a dummy fork() stub
ac_cv_func_fork_works=no
;;
*)
ac_cv_func_fork_works=yes
;;
esac
AC_MSG_WARN([result $ac_cv_func_fork_works guessed because of cross compilation])
fi
ac_cv_func_vfork_works=$ac_cv_func_vfork
if test "x$ac_cv_func_vfork" = xyes; then
_AC_FUNC_VFORK
fi;
if test "x$ac_cv_func_fork_works" = xcross; then
ac_cv_func_vfork_works=$ac_cv_func_vfork
AC_MSG_WARN([result $ac_cv_func_vfork_works guessed because of cross compilation])
fi
if test "x$ac_cv_func_vfork_works" = xyes; then
AC_DEFINE(HAVE_WORKING_VFORK, 1, [Define to 1 if `vfork' works.])
else
AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.])
fi
if test "x$ac_cv_func_fork_works" = xyes; then
AC_DEFINE(HAVE_WORKING_FORK, 1, [Define to 1 if `fork' works.])
fi
])# AST_FUNC_FORK
# _AST_FUNC_FORK
# -------------
AC_DEFUN([_AST_FUNC_FORK],
[AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works,
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
[
/* By Ruediger Kuhlmann. */
return fork () < 0;
])],
[ac_cv_func_fork_works=yes],
[ac_cv_func_fork_works=no],
[ac_cv_func_fork_works=cross])])]
)# _AST_FUNC_FORK