diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2008-05-26 12:31:34 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2008-05-26 12:31:34 +0000 |
commit | 439a071297f20bba76caa63fca18f628d76bf139 (patch) | |
tree | aedf58ec07cd9ad3202ea21adc18e0deff3caf81 | |
parent | ae83d21858dc68cadc6ca0d86f260b88ed1ebfd6 (diff) |
update acinclude.m4 to match the one in Asterisk trunk, rebuild checks for libraries, and add mandatory check for DAHDI
git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@4361 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r-- | acinclude.m4 | 1144 | ||||
-rwxr-xr-x | configure | 1274 | ||||
-rw-r--r-- | configure.ac | 26 |
3 files changed, 1547 insertions, 897 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 57db604..1395241 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,89 +1,1115 @@ -# AST_EXT_LIB([NAME], [FUNCTION], [package header], [package symbol name], [package friendly name], [additional LIB data]) +# Various support functions for configure.ac in asterisk +# -AC_DEFUN([AST_EXT_LIB], +# Helper function to check for gcc attributes. +# AST_GCC_ATTRIBUTE([attribute name]) + +AC_DEFUN([AST_GCC_ATTRIBUTE], [ -AC_ARG_WITH([$1], AC_HELP_STRING([--with-$1=PATH],[use $5 files in PATH]),[ -case ${withval} in - n|no) - USE_$4=no - ;; - y|ye|yes) - $4_MANDATORY="yes" - ;; - *) - $4_DIR="${withval}" - $4_MANDATORY="yes" - ;; -esac +AC_MSG_CHECKING(for compiler 'attribute $1' support) +saved_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -Werror" +AC_COMPILE_IFELSE( + AC_LANG_PROGRAM([static void __attribute__(($1)) *test(void *muffin, ...) {}], + []), + 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)) +] +CFLAGS="$saved_CFLAGS" +) + +# Helper function to setup variables for a package. +# $1 -> the package name. Used in configure.ac and also as a prefix +# for the variables ($1_DIR, $1_INCLUDE, $1_LIB) in makeopts +# $3 -> option name, used in --with-$3 or --without-$3 when calling configure. +# $2 and $4 are just text describing the package (short and long form) + +# AST_EXT_LIB_SETUP([package], [short description], [configure option name], [long description]) + +AC_DEFUN([AST_EXT_LIB_SETUP], +[ + $1_DESCRIP="$2" + $1_OPTION="$3" + AC_ARG_WITH([$3], AC_HELP_STRING([--with-$3=PATH],[use $2 files in PATH $4]), + [ + case ${withval} in + n|no) + USE_$1=no + ;; + y|ye|yes) + ac_mandatory_list="${ac_mandatory_list} $1" + ;; + *) + $1_DIR="${withval}" + ac_mandatory_list="${ac_mandatory_list} $1" + ;; + esac + ]) + PBX_$1=0 + AC_SUBST([$1_LIB]) + AC_SUBST([$1_INCLUDE]) + AC_SUBST([$1_DIR]) + AC_SUBST([PBX_$1]) +]) + +# Check whether any of the mandatory modules are not present, and +# print error messages in case. The mandatory list is built using +# --with-* arguments when invoking configure. + +AC_DEFUN([AST_CHECK_MANDATORY], +[ + AC_MSG_CHECKING([for mandatory modules: ${ac_mandatory_list}]) + err=0; + for i in ${ac_mandatory_list}; do + eval "a=\${PBX_$i}" + if test "x${a}" = "x1" ; then continue; fi + if test ${err} = "0" ; then AC_MSG_RESULT(fail) ; fi + AC_MSG_RESULT() + eval "a=\${${i}_OPTION}" + AC_MSG_NOTICE([***]) + AC_MSG_NOTICE([*** The $i installation appears to be missing or broken.]) + AC_MSG_NOTICE([*** Either correct the installation, or run configure]) + AC_MSG_NOTICE([*** including --without-${a}.]) + err=1 + done + if test $err = 1 ; then exit 1; fi + AC_MSG_RESULT(ok) ]) -PBX_LIB$4=0 +# The next three functions check for the availability of a given package. +# AST_C_DEFINE_CHECK looks for the presence of a #define in a header file, +# AST_C_COMPILE_CHECK can be used for testing for various items in header files, +# AST_EXT_LIB_CHECK looks for a symbol in a given library, or at least +# for the presence of a header file. +# AST_EXT_TOOL_CHECK looks for a symbol in using $1-config to determine CFLAGS and LIBS +# +# They are only run if PBX_$1 != 1 (where $1 is the package), +# so you can call them multiple times and stop at the first matching one. +# On success, they both set PBX_$1 = 1, set $1_INCLUDE and $1_LIB as applicable, +# and also #define HAVE_$1 1 and #define HAVE_$1_VERSION ${last_argument} +# in autoconfig.h so you can tell which test succeeded. +# They should be called after AST_EXT_LIB_SETUP($1, ...) -if test "${USE_$4}" != "no"; then +# Check if a given macro is defined in a certain header. + +# AST_C_DEFINE_CHECK([package], [macro name], [header file], [version]) +AC_DEFUN([AST_C_DEFINE_CHECK], +[ + if test "x${PBX_$1}" != "x1"; then + AC_MSG_CHECKING([for $2 in $3]) + saved_cppflags="${CPPFLAGS}" + if test "x${$1_DIR}" != "x"; then + $1_INCLUDE="-I${$1_DIR}/include" + fi + CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}" + + AC_COMPILE_IFELSE( + [ AC_LANG_PROGRAM( [#include <$3>], + [#if defined($2) + int foo = 0; + #else + int foo = bar; + #endif + 0 + ])], + [ AC_MSG_RESULT(yes) + PBX_$1=1 + AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 headers.]) + AC_DEFINE([HAVE_$1_VERSION], $4, [Define $1 headers version]) + ], + [ AC_MSG_RESULT(no) ] + ) + CPPFLAGS="${saved_cppflags}" + fi + AC_SUBST(PBX_$1) +]) + + +# Check if a given expression will compile using a certain header. + +# AST_C_COMPILE_CHECK([package], [expression], [header file], [version]) +AC_DEFUN([AST_C_COMPILE_CHECK], +[ + if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then + AC_MSG_CHECKING([if "$2" compiles using $3]) + saved_cppflags="${CPPFLAGS}" + if test "x${$1_DIR}" != "x"; then + $1_INCLUDE="-I${$1_DIR}/include" + fi + CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}" + + AC_COMPILE_IFELSE( + [ AC_LANG_PROGRAM( [#include <$3>], + [ $2; ] + )], + [ AC_MSG_RESULT(yes) + PBX_$1=1 + AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 headers.]) + AC_DEFINE([HAVE_$1_VERSION], $4, [Define $1 headers version]) + ], + [ AC_MSG_RESULT(no) ] + ) + CPPFLAGS="${saved_cppflags}" + fi +]) + + +# Check for existence of a given package ($1), either looking up a function +# in a library, or, if no function is supplied, only check for the +# existence of the header files. + +# AST_EXT_LIB_CHECK([package], [library], [function], [header], +# [extra libs], [extra cflags], [version]) +AC_DEFUN([AST_EXT_LIB_CHECK], +[ +if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then pbxlibdir="" - if test "x${$4_DIR}" != "x"; then - pbxlibdir="-L${$1_DIR}/lib" - fi - AC_CHECK_LIB([$1], [$2], [AST_$4_FOUND=yes], [AST_$4_FOUND=no], ${pbxlibdir} $6) - - if test "${AST_$4_FOUND}" = "yes"; then - $4_LIB="-l$1 $6" - $4_HEADER_FOUND="1" - if test "x${$4_DIR}" != "x"; then - $4_LIB="${pbxlibdir} ${$4_LIB}" - $4_INCLUDE="-I${$4_DIR}/include" - if test "x$3" != "x" ; then - AC_CHECK_HEADER([${$4_DIR}/include/$3], [$4_HEADER_FOUND=1], [$4_HEADER_FOUND=0] ) - fi + # if --with-$1=DIR has been specified, use it. + if test "x${$1_DIR}" != "x"; then + if test -d ${$1_DIR}/lib; then + pbxlibdir="-L${$1_DIR}/lib" else - if test "x$3" != "x" ; then - AC_CHECK_HEADER([$3], [$4_HEADER_FOUND=1], [$4_HEADER_FOUND=0] ) - fi + pbxlibdir="-L${$1_DIR}" fi - if test "x${$4_HEADER_FOUND}" = "x0" ; then - if test ! -z "${$4_MANDATORY}" ; - then - AC_MSG_NOTICE(***) - AC_MSG_NOTICE(*** It appears that you do not have the $1 development package installed.) - AC_MSG_NOTICE(*** Please install it to include $5 support, or re-run configure) - AC_MSG_NOTICE(*** without explicitly specifying --with-$1) - exit 1 - fi - $4_LIB="" - $4_INCLUDE="" - PBX_LIB$4=0 + fi + pbxfuncname="$3" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_$1_FOUND=yes + else + AC_CHECK_LIB([$2], [${pbxfuncname}], [AST_$1_FOUND=yes], [AST_$1_FOUND=no], ${pbxlibdir} $5) + fi + + # now check for the header. + if test "${AST_$1_FOUND}" = "yes"; then + $1_LIB="${pbxlibdir} -l$2 $5" + # if --with-$1=DIR has been specified, use it. + if test "x${$1_DIR}" != "x"; then + $1_INCLUDE="-I${$1_DIR}/include" + fi + $1_INCLUDE="${$1_INCLUDE} $6" + if test "x$4" = "x" ; then # no header, assume found + $1_HEADER_FOUND="1" + else # check for the header + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE} $6" + AC_CHECK_HEADER([$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0]) + CPPFLAGS="${saved_cppflags}" + fi + if test "x${$1_HEADER_FOUND}" = "x0" ; then + $1_LIB="" + $1_INCLUDE="" else - PBX_LIB$4=1 - AC_DEFINE_UNQUOTED([HAVE_$4], 1, [Define to indicate the $5 library]) + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + $1_LIB="" + fi + PBX_$1=1 + # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED + AC_DEFINE_UNQUOTED([HAVE_$1], 1, [Define this to indicate the ${$1_DESCRIP} library]) + AC_DEFINE_UNQUOTED([HAVE_$1_VERSION], [$7], [Define to indicate the ${$1_DESCRIP} library version]) fi - elif test ! -z "${$4_MANDATORY}"; - then - AC_MSG_NOTICE(***) - AC_MSG_NOTICE(*** The $5 installation on this system appears to be broken.) - AC_MSG_NOTICE(*** Either correct the installation, or run configure) - AC_MSG_NOTICE(*** without explicity specifying --with-$1) - exit 1 fi fi -AC_SUBST([$4_LIB]) -AC_SUBST([$4_INCLUDE]) -AC_SUBST([PBX_LIB$4]) ]) +# Check for a package using $2-config. Similar to AST_EXT_LIB_CHECK, +# but use $2-config to determine cflags and libraries to use. +# $3 and $4 can be used to replace --cflags and --libs in the request + +# AST_EXT_TOOL_CHECK([package], [tool name], [--cflags], [--libs], [includes], [expression]) +AC_DEFUN([AST_EXT_TOOL_CHECK], +[ + if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then + PBX_$1=0 + AC_CHECK_TOOL(CONFIG_$1, $2-config, No) + if test ! "x${CONFIG_$1}" = xNo; then + if test x"$3" = x ; then A=--cflags ; else A="$3" ; fi + $1_INCLUDE=$(${CONFIG_$1} $A) + if test x"$4" = x ; then A=--libs ; else A="$4" ; fi + $1_LIB=$(${CONFIG_$1} $A) + if test x"$5" != x ; then + saved_cppflags="${CPPFLAGS}" + if test "x${$1_DIR}" != "x"; then + $1_INCLUDE="-I${$1_DIR}/include" + fi + CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}" + + saved_ldflags="${LDFLAGS}" + LDFLAGS="${$1_LIB}" + + AC_LINK_IFELSE( + [ AC_LANG_PROGRAM( [ $5 ], + [ $6; ] + )], + [ PBX_$1=1 + AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 headers.]) + ], + [] + ) + CPPFLAGS="${saved_cppflags}" + LDFLAGS="${saved_ldflags}" + else + PBX_$1=1 + AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 libraries.]) + fi + fi + fi +]) + AC_DEFUN( [AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK(for GNU make, GNU_MAKE, GNU_MAKE='Not Found' ; + GNU_MAKE_VERSION_MAJOR=0 ; + GNU_MAKE_VERSION_MINOR=0 ; 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'.'` + GNU_MAKE_VERSION_MINOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2` break; fi done ; ) ; if test "x$GNU_MAKE" = "xNot Found" ; then - AC_MSG_ERROR(*** Please install GNU make. It is required to build DAHDI tools!) + AC_MSG_ERROR( *** Please install GNU make. It is required to build Asterisk!) + exit 1 fi AC_SUBST([GNU_MAKE]) ]) + + +AC_DEFUN( +[AST_CHECK_PWLIB], [ +PWLIB_INCDIR= +PWLIB_LIBDIR= +AC_LANG_PUSH([C++]) +if test "${PWLIBDIR:-unset}" != "unset" ; then + AC_CHECK_HEADER(${PWLIBDIR}/version.h, HAS_PWLIB=1, ) +fi +if test "${HAS_PWLIB:-unset}" = "unset" ; then + if test "${OPENH323DIR:-unset}" != "unset"; then + AC_CHECK_HEADER(${OPENH323DIR}/../pwlib/version.h, HAS_PWLIB=1, ) + fi + if test "${HAS_PWLIB:-unset}" != "unset" ; then + PWLIBDIR="${OPENH323DIR}/../pwlib" + else + AC_CHECK_HEADER(${HOME}/pwlib/include/ptlib.h, HAS_PWLIB=1, ) + if test "${HAS_PWLIB:-unset}" != "unset" ; then + PWLIBDIR="${HOME}/pwlib" + else + AC_CHECK_HEADER(/usr/local/include/ptlib.h, HAS_PWLIB=1, ) + if test "${HAS_PWLIB:-unset}" != "unset" ; then + AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/local/bin) + if test "${PTLIB_CONFIG:-unset}" = "unset" ; then + AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/local/share/pwlib/make) + fi + PWLIB_INCDIR="/usr/local/include" + PWLIB_LIBDIR=`${PTLIB_CONFIG} --pwlibdir` + if test "${PWLIB_LIBDIR:-unset}" = "unset"; then + if test "x$LIB64" != "x"; then + PWLIB_LIBDIR="/usr/local/lib64" + else + PWLIB_LIBDIR="/usr/local/lib" + fi + fi + PWLIB_LIB=`${PTLIB_CONFIG} --ldflags --libs` + PWLIB_LIB="-L${PWLIB_LIBDIR} `echo ${PWLIB_LIB}`" + else + AC_CHECK_HEADER(/usr/include/ptlib.h, HAS_PWLIB=1, ) + if test "${HAS_PWLIB:-unset}" != "unset" ; then + AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/share/pwlib/make) + PWLIB_INCDIR="/usr/include" + PWLIB_LIBDIR=`${PTLIB_CONFIG} --pwlibdir` + if test "${PWLIB_LIBDIR:-unset}" = "unset"; then + if test "x$LIB64" != "x"; then + PWLIB_LIBDIR="/usr/lib64" + else + PWLIB_LIBDIR="/usr/lib" + fi + fi + PWLIB_LIB=`${PTLIB_CONFIG} --ldflags --libs` + PWLIB_LIB="-L${PWLIB_LIBDIR} `echo ${PWLIB_LIB}`" + fi + fi + fi + fi +fi + +#if test "${HAS_PWLIB:-unset}" = "unset" ; then +# echo "Cannot find pwlib - please install or set PWLIBDIR and try again" +# exit +#fi + +if test "${HAS_PWLIB:-unset}" != "unset" ; then + if test "${PWLIBDIR:-unset}" = "unset" ; then + if test "${PTLIB_CONFIG:-unset}" != "unset" ; then + PWLIBDIR=`$PTLIB_CONFIG --prefix` + else + echo "Cannot find ptlib-config - please install and try again" + exit + fi + fi + + if test "x$PWLIBDIR" = "x/usr" -o "x$PWLIBDIR" = "x/usr/"; then + PWLIBDIR="/usr/share/pwlib" + PWLIB_INCDIR="/usr/include" + if test "x$LIB64" != "x"; then + PWLIB_LIBDIR="/usr/lib64" + else + PWLIB_LIBDIR="/usr/lib" + fi + fi + if test "x$PWLIBDIR" = "x/usr/local" -o "x$PWLIBDIR" = "x/usr/"; then + PWLIBDIR="/usr/local/share/pwlib" + PWLIB_INCDIR="/usr/local/include" + if test "x$LIB64" != "x"; then + PWLIB_LIBDIR="/usr/local/lib64" + else + PWLIB_LIBDIR="/usr/local/lib" + fi + fi + + if test "${PWLIB_INCDIR:-unset}" = "unset"; then + PWLIB_INCDIR="${PWLIBDIR}/include" + fi + if test "${PWLIB_LIBDIR:-unset}" = "unset"; then + PWLIB_LIBDIR="${PWLIBDIR}/lib" + fi + + AC_SUBST([PWLIBDIR]) + AC_SUBST([PWLIB_INCDIR]) + AC_SUBST([PWLIB_LIBDIR]) +fi + AC_LANG_POP([C++]) +]) + + +AC_DEFUN( +[AST_CHECK_OPENH323_PLATFORM], [ +PWLIB_OSTYPE= +case "$host_os" in + linux*) PWLIB_OSTYPE=linux ; + ;; + freebsd* ) PWLIB_OSTYPE=FreeBSD ; + ;; + openbsd* ) PWLIB_OSTYPE=OpenBSD ; + ENDLDLIBS="-lossaudio" ; + ;; + netbsd* ) PWLIB_OSTYPE=NetBSD ; + ENDLDLIBS="-lossaudio" ; + ;; + solaris* | sunos* ) PWLIB_OSTYPE=solaris ; + ;; + darwin* ) PWLIB_OSTYPE=Darwin ; + ;; + beos*) PWLIB_OSTYPE=beos ; + STDCCFLAGS="$STDCCFLAGS -D__BEOS__" + ;; + cygwin*) PWLIB_OSTYPE=cygwin ; + ;; + mingw*) PWLIB_OSTYPE=mingw ; + STDCCFLAGS="$STDCCFLAGS -mms-bitfields" ; + ENDLDLIBS="-lwinmm -lwsock32 -lsnmpapi -lmpr -lcomdlg32 -lgdi32 -lavicap32" ; + ;; + * ) PWLIB_OSTYPE="$host_os" ; + AC_MSG_WARN("OS $PWLIB_OSTYPE not recognized - proceed with caution!") ; + ;; +esac + +PWLIB_MACHTYPE= +case "$host_cpu" in + x86 | i686 | i586 | i486 | i386 ) PWLIB_MACHTYPE=x86 + ;; + + x86_64) PWLIB_MACHTYPE=x86_64 ; + P_64BIT=1 ; + LIB64=1 ; + ;; + + alpha | alphaev56 | alphaev6 | alphaev67 | alphaev7) PWLIB_MACHTYPE=alpha ; + P_64BIT=1 ; + ;; + + sparc ) PWLIB_MACHTYPE=sparc ; + ;; + + powerpc ) PWLIB_MACHTYPE=ppc ; + ;; + + ppc ) PWLIB_MACHTYPE=ppc ; + ;; + + powerpc64 ) PWLIB_MACHTYPE=ppc64 ; + P_64BIT=1 ; + LIB64=1 ; + ;; + + ppc64 ) PWLIB_MACHTYPE=ppc64 ; + P_64BIT=1 ; + LIB64=1 ; + ;; + + ia64) PWLIB_MACHTYPE=ia64 ; + P_64BIT=1 ; + ;; + + s390x) PWLIB_MACHTYPE=s390x ; + P_64BIT=1 ; + LIB64=1 ; + ;; + + s390) PWLIB_MACHTYPE=s390 ; + ;; + + * ) PWLIB_MACHTYPE="$host_cpu"; + AC_MSG_WARN("CPU $PWLIB_MACHTYPE not recognized - proceed with caution!") ;; +esac + +PWLIB_PLATFORM="${PWLIB_OSTYPE}_${PWLIB_MACHTYPE}" + +AC_SUBST([PWLIB_PLATFORM]) +]) + + +AC_DEFUN( +[AST_CHECK_OPENH323], [ +OPENH323_INCDIR= +OPENH323_LIBDIR= +AC_LANG_PUSH([C++]) +if test "${OPENH323DIR:-unset}" != "unset" ; then + AC_CHECK_HEADER(${OPENH323DIR}/version.h, HAS_OPENH323=1, ) +fi +if test "${HAS_OPENH323:-unset}" = "unset" ; then + AC_CHECK_HEADER(${PWLIBDIR}/../openh323/version.h, OPENH323DIR="${PWLIBDIR}/../openh323"; HAS_OPENH323=1, ) + if test "${HAS_OPENH323:-unset}" != "unset" ; then + OPENH323DIR="${PWLIBDIR}/../openh323" + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} -I${PWLIB_INCDIR}/openh323 -I${PWLIB_INCDIR}" + AC_CHECK_HEADER(${OPENH323DIR}/include/h323.h, , OPENH323_INCDIR="${PWLIB_INCDIR}/openh323"; OPENH323_LIBDIR="${PWLIB_LIBDIR}", [#include <ptlib.h>]) + CPPFLAGS="${saved_cppflags}" + else + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} -I${HOME}/openh323/include -I${PWLIB_INCDIR}" + AC_CHECK_HEADER(${HOME}/openh323/include/h323.h, HAS_OPENH323=1, ) + CPPFLAGS="${saved_cppflags}" + if test "${HAS_OPENH323:-unset}" != "unset" ; then + OPENH323DIR="${HOME}/openh323" + else + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} -I/usr/local/include/openh323 -I${PWLIB_INCDIR}" + AC_CHECK_HEADER(/usr/local/include/openh323/h323.h, HAS_OPENH323=1, ) + CPPFLAGS="${saved_cppflags}" + if test "${HAS_OPENH323:-unset}" != "unset" ; then + OPENH323DIR="/usr/local/share/openh323" + OPENH323_INCDIR="/usr/local/include/openh323" + if test "x$LIB64" != "x"; then + OPENH323_LIBDIR="/usr/local/lib64" + else + OPENH323_LIBDIR="/usr/local/lib" + fi + else + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} -I/usr/include/openh323 -I${PWLIB_INCDIR}" + AC_CHECK_HEADER(/usr/include/openh323/h323.h, HAS_OPENH323=1, , [#include <ptlib.h>]) + CPPFLAGS="${saved_cppflags}" + if test "${HAS_OPENH323:-unset}" != "unset" ; then + OPENH323DIR="/usr/share/openh323" + OPENH323_INCDIR="/usr/include/openh323" + if test "x$LIB64" != "x"; then + OPENH323_LIBDIR="/usr/lib64" + else + OPENH323_LIBDIR="/usr/lib" + fi + fi + fi + fi + fi +fi + +if test "${HAS_OPENH323:-unset}" != "unset" ; then + if test "${OPENH323_INCDIR:-unset}" = "unset"; then + OPENH323_INCDIR="${OPENH323DIR}/include" + fi + if test "${OPENH323_LIBDIR:-unset}" = "unset"; then + OPENH323_LIBDIR="${OPENH323DIR}/lib" + fi + + OPENH323_LIBDIR="`cd ${OPENH323_LIBDIR}; pwd`" + OPENH323_INCDIR="`cd ${OPENH323_INCDIR}; pwd`" + OPENH323DIR="`cd ${OPENH323DIR}; pwd`" + + AC_SUBST([OPENH323DIR]) + AC_SUBST([OPENH323_INCDIR]) + AC_SUBST([OPENH323_LIBDIR]) +fi + AC_LANG_POP([C++]) +]) + + +AC_DEFUN( +[AST_CHECK_PWLIB_VERSION], [ + if test "${HAS_$2:-unset}" != "unset"; then + $2_VERSION=`grep "$2_VERSION" ${$2_INCDIR}/$3 | cut -f2 -d ' ' | sed -e 's/"//g'` + $2_MAJOR_VERSION=`echo ${$2_VERSION} | cut -f1 -d.` + $2_MINOR_VERSION=`echo ${$2_VERSION} | cut -f2 -d.` + $2_BUILD_NUMBER=`echo ${$2_VERSION} | cut -f3 -d.` + let $2_VER=${$2_MAJOR_VERSION}*10000+${$2_MINOR_VERSION}*100+${$2_BUILD_NUMBER} + let $2_REQ=$4*10000+$5*100+$6 + + AC_MSG_CHECKING(if $1 version ${$2_VERSION} is compatible with chan_h323) + if test ${$2_VER} -lt ${$2_REQ}; then + AC_MSG_RESULT(no) + unset HAS_$2 + else + AC_MSG_RESULT(yes) + fi + fi +]) + + +AC_DEFUN( +[AST_CHECK_PWLIB_BUILD], [ + if test "${HAS_$2:-unset}" != "unset"; then + AC_MSG_CHECKING($1 installation validity) + + saved_cppflags="${CPPFLAGS}" + saved_libs="${LIBS}" + if test "${$2_LIB:-unset}" != "unset"; then + LIBS="${LIBS} ${$2_LIB} $7" + else + LIBS="${LIBS} -L${$2_LIBDIR} -l${PLATFORM_$2} $7" + fi + CPPFLAGS="${CPPFLAGS} -I${$2_INCDIR} $6" + + AC_LANG_PUSH([C++]) + + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([$4],[$5])], + [ AC_MSG_RESULT(yes) + ac_cv_lib_$2="yes" + ], + [ AC_MSG_RESULT(no) + ac_cv_lib_$2="no" + ] + ) + + AC_LANG_POP([C++]) + + LIBS="${saved_libs}" + CPPFLAGS="${saved_cppflags}" + + if test "${ac_cv_lib_$2}" = "yes"; then + if test "${$2_LIB:-undef}" = "undef"; then + if test "${$2_LIBDIR}" != "" -a "${$2_LIBDIR}" != "/usr/lib"; then + $2_LIB="-L${$2_LIBDIR} -l${PLATFORM_$2}" + else + $2_LIB="-l${PLATFORM_$2}" + fi + fi + if test "${$2_INCDIR}" != "" -a "${$2_INCDIR}" != "/usr/include"; then + $2_INCLUDE="-I${$2_INCDIR}" + fi + PBX_$2=1 + AC_DEFINE([HAVE_$2], 1, [$3]) + fi + fi +]) + +AC_DEFUN( +[AST_CHECK_OPENH323_BUILD], [ + if test "${HAS_OPENH323:-unset}" != "unset"; then + AC_MSG_CHECKING(OpenH323 build option) + OPENH323_SUFFIX= + prefixes="h323_${PWLIB_PLATFORM}_ h323_ openh323" + for pfx in $prefixes; do + files=`ls -l ${OPENH323_LIBDIR}/lib${pfx}*.so* 2>/dev/null` + libfile= + if test -n "$files"; then + for f in $files; do + if test -f $f -a ! -L $f; then + libfile=`basename $f` + break; + fi + done + fi + if test -n "$libfile"; then + OPENH323_PREFIX=$pfx + break; + fi + done + if test "${libfile:-unset}" != "unset"; then + OPENH323_SUFFIX=`eval "echo ${libfile} | sed -e 's/lib${OPENH323_PREFIX}\(@<:@^.@:>@*\)\..*/\1/'"` + fi + case "${OPENH323_SUFFIX}" in + n) + OPENH323_BUILD="notrace";; + r) + OPENH323_BUILD="opt";; + d) + OPENH323_BUILD="debug";; + *) + if test "${OPENH323_PREFIX:-undef}" = "openh323"; then + notrace=`eval "grep NOTRACE ${OPENH323DIR}/openh323u.mak | grep = | sed -e 's/@<:@A-Z0-9_@:>@*@<:@ @:>@*=@<:@ @:>@*//'"` + if test "x$notrace" = "x"; then + notrace="0" + fi + if test "$notrace" -ne 0; then + OPENH323_BUILD="notrace" + else + OPENH323_BUILD="opt" + fi + OPENH323_LIB="-l${OPENH323_PREFIX}" + else + OPENH323_BUILD="notrace" + fi + ;; + esac + AC_MSG_RESULT(${OPENH323_BUILD}) + + AC_SUBST([OPENH323_SUFFIX]) + AC_SUBST([OPENH323_BUILD]) + fi +]) + + +# 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* | *-*-linux-uclibc* ) + # 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 + +# AST_PROG_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([AST_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no]) +AC_REQUIRE([AST_PROG_SED])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break + ;; + *) + test "$with_gnu_ld" != yes && break + ;; + esac + fi + done + IFS="$lt_save_ifs" +else + lt_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$lt_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AST_PROG_LD_GNU +])# AST_PROG_LD + + +# AST_PROG_LD_GNU +# -------------- +AC_DEFUN([AST_PROG_LD_GNU], +[AC_REQUIRE([AST_PROG_EGREP])dnl +AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 </dev/null` in +*GNU* | *'with BFD'*) + lt_cv_prog_gnu_ld=yes + ;; +*) + lt_cv_prog_gnu_ld=no + ;; +esac]) +with_gnu_ld=$lt_cv_prog_gnu_ld +])# AST_PROG_LD_GNU + +# AST_PROG_EGREP +# ------------- +m4_ifndef([AST_PROG_EGREP], [AC_DEFUN([AST_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) # AST_PROG_EGREP + +# AST_PROG_SED +# ----------- +# Check for a fully functional sed program that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([AST_PROG_SED], +[AC_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED, + [dnl ac_script should not contain more than 99 commands (for HP-UX sed), + dnl but more than about 7000 bytes, to catch a limit in Solaris 8 /usr/ucb/sed. + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" | sed 99q >conftest.sed + $as_unset ac_script || ac_script= + _AC_PATH_PROG_FEATURE_CHECK(SED, [sed gsed], + [_AC_FEATURE_CHECK_LENGTH([ac_path_SED], [ac_cv_path_SED], + ["$ac_path_SED" -f conftest.sed])])]) + SED="$ac_cv_path_SED" + AC_SUBST([SED])dnl + rm -f conftest.sed +])# AST_PROG_SED + +dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +dnl +dnl @summary figure out how to build C programs using POSIX threads +dnl +dnl This macro figures out how to build C programs using POSIX threads. +dnl It sets the PTHREAD_LIBS output variable to the threads library and +dnl linker flags, and the PTHREAD_CFLAGS output variable to any special +dnl C compiler flags that are needed. (The user can also force certain +dnl compiler flags/libs to be tested by setting these environment +dnl variables.) +dnl +dnl Also sets PTHREAD_CC to any special C compiler that is needed for +dnl multi-threaded programs (defaults to the value of CC otherwise). +dnl (This is necessary on AIX to use the special cc_r compiler alias.) +dnl +dnl NOTE: You are assumed to not only compile your program with these +dnl flags, but also link it with them as well. e.g. you should link +dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS +dnl $LIBS +dnl +dnl If you are only building threads programs, you may wish to use +dnl these variables in your default LIBS, CFLAGS, and CC: +dnl +dnl LIBS="$PTHREAD_LIBS $LIBS" +dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +dnl CC="$PTHREAD_CC" +dnl +dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute +dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to +dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +dnl +dnl ACTION-IF-FOUND is a list of shell commands to run if a threads +dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to +dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the +dnl default action will define HAVE_PTHREAD. +dnl +dnl Please let the authors know if this macro fails on any platform, or +dnl if you have any other suggestions or comments. This macro was based +dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with +dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros +dnl posted by Alejandro Forero Cuervo to the autoconf macro repository. +dnl We are also grateful for the helpful feedback of numerous users. +dnl +dnl @category InstalledPackages +dnl @author Steven G. Johnson <stevenj@alum.mit.edu> +dnl @version 2006-05-29 +dnl @license GPLWithACException + +AC_DEFUN([ACX_PTHREAD], +[ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_SAVE +AC_LANG_C +acx_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) + AC_MSG_RESULT($acx_pthread_ok) + if test x"$acx_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# ... -mt is also the pthreads flag for HP/aCC +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case "${host_cpu}-${host_os}" in + *solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthreads/-mt/ + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" + ;; +esac + +if test x"$acx_pthread_ok" = xno; then +for flag in $acx_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + pthread-config) + AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) + if test x"$acx_pthread_config" = xno; then continue; fi + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_TRY_LINK([#include <pthread.h>], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [acx_pthread_ok=yes]) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT($acx_pthread_ok) + if test "x$acx_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$acx_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_MSG_CHECKING([for joinable pthread attribute]) + attr_name=unknown + for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;], + [attr_name=$attr; break]) + done + AC_MSG_RESULT($attr_name) + if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then + AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case "${host_cpu}-${host_os}" in + *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; + *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; + esac + AC_MSG_RESULT(${flag}) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + # More AIX lossage: must compile with xlc_r or cc_r + if test x"$GCC" != xyes; then + AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) + else + PTHREAD_CC=$CC + fi +else + PTHREAD_CC="$CC" +fi + +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_CC) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$acx_pthread_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + : +else + acx_pthread_ok=no + $2 +fi +AC_LANG_RESTORE +])dnl ACX_PTHREAD @@ -675,19 +675,27 @@ LN WGET FETCH DOWNLOAD -EGREP CURSES_LIB CURSES_INCLUDE -PBX_LIBCURSES +CURSES_DIR +PBX_CURSES +DAHDI_LIB +DAHDI_INCLUDE +DAHDI_DIR +PBX_DAHDI NCURSES_LIB NCURSES_INCLUDE -PBX_LIBNCURSES +NCURSES_DIR +PBX_NCURSES NEWT_LIB NEWT_INCLUDE -PBX_LIBNEWT +NEWT_DIR +PBX_NEWT USB_LIB USB_INCLUDE -PBX_LIBUSB +USB_DIR +PBX_USB +EGREP USE_SELINUX ASCIIDOC PPPD_VERSION @@ -1272,11 +1280,12 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-curses=PATH use curses files in PATH + --with-dahdi=PATH use DAHDI files in PATH --with-ncurses=PATH use ncurses files in PATH --with-newt=PATH use newt files in PATH - --with-usb=PATH use libusb files in PATH + --with-usb=PATH use usb files in PATH --with-selinux enable (with) / disable (without) SELinux - --with-ppp=PATH Use ppp support from PATH + --with-ppp=PATH Use PPP support from PATH Some influential environment variables: CC C compiler command @@ -3017,10 +3026,14 @@ if test "${GNU_MAKE+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else GNU_MAKE='Not Found' ; + GNU_MAKE_VERSION_MAJOR=0 ; + GNU_MAKE_VERSION_MINOR=0 ; 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'.'` + GNU_MAKE_VERSION_MINOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2` break; fi done ; @@ -3029,9 +3042,10 @@ fi { echo "$as_me:$LINENO: result: $GNU_MAKE" >&5 echo "${ECHO_T}$GNU_MAKE" >&6; } ; if test "x$GNU_MAKE" = "xNot Found" ; then - { { echo "$as_me:$LINENO: error: *** Please install GNU make. It is required to build DAHDI tools!" >&5 -echo "$as_me: error: *** Please install GNU make. It is required to build DAHDI tools!" >&2;} + { { echo "$as_me:$LINENO: error: *** Please install GNU make. It is required to build Asterisk!" >&5 +echo "$as_me: error: *** Please install GNU make. It is required to build Asterisk!" >&2;} { (exit 1); exit 1; }; } + exit 1 fi @@ -3303,6 +3317,147 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + CURSES_DESCRIP="curses" + CURSES_OPTION="curses" + +# Check whether --with-curses was given. +if test "${with_curses+set}" = set; then + withval=$with_curses; + case ${withval} in + n|no) + USE_CURSES=no + ;; + y|ye|yes) + ac_mandatory_list="${ac_mandatory_list} CURSES" + ;; + *) + CURSES_DIR="${withval}" + ac_mandatory_list="${ac_mandatory_list} CURSES" + ;; + esac + +fi + + PBX_CURSES=0 + + + + + + + DAHDI_DESCRIP="DAHDI" + DAHDI_OPTION="dahdi" + +# Check whether --with-dahdi was given. +if test "${with_dahdi+set}" = set; then + withval=$with_dahdi; + case ${withval} in + n|no) + USE_DAHDI=no + ;; + y|ye|yes) + ac_mandatory_list="${ac_mandatory_list} DAHDI" + ;; + *) + DAHDI_DIR="${withval}" + ac_mandatory_list="${ac_mandatory_list} DAHDI" + ;; + esac + +fi + + PBX_DAHDI=0 + + + + + + + NCURSES_DESCRIP="ncurses" + NCURSES_OPTION="ncurses" + +# Check whether --with-ncurses was given. +if test "${with_ncurses+set}" = set; then + withval=$with_ncurses; + case ${withval} in + n|no) + USE_NCURSES=no + ;; + y|ye|yes) + ac_mandatory_list="${ac_mandatory_list} NCURSES" + ;; + *) + NCURSES_DIR="${withval}" + ac_mandatory_list="${ac_mandatory_list} NCURSES" + ;; + esac + +fi + + PBX_NCURSES=0 + + + + + + + NEWT_DESCRIP="newt" + NEWT_OPTION="newt" + +# Check whether --with-newt was given. +if test "${with_newt+set}" = set; then + withval=$with_newt; + case ${withval} in + n|no) + USE_NEWT=no + ;; + y|ye|yes) + ac_mandatory_list="${ac_mandatory_list} NEWT" + ;; + *) + NEWT_DIR="${withval}" + ac_mandatory_list="${ac_mandatory_list} NEWT" + ;; + esac + +fi + + PBX_NEWT=0 + + + + + + + USB_DESCRIP="usb" + USB_OPTION="usb" + +# Check whether --with-usb was given. +if test "${with_usb+set}" = set; then + withval=$with_usb; + case ${withval} in + n|no) + USE_USB=no + ;; + y|ye|yes) + ac_mandatory_list="${ac_mandatory_list} USB" + ;; + *) + USB_DIR="${withval}" + ac_mandatory_list="${ac_mandatory_list} USB" + ;; + esac + +fi + + PBX_USB=0 + + + + + + + { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then @@ -3709,36 +3864,24 @@ done - -# Check whether --with-curses was given. -if test "${with_curses+set}" = set; then - withval=$with_curses; -case ${withval} in - n|no) - USE_CURSES=no - ;; - y|ye|yes) - CURSES_MANDATORY="yes" - ;; - *) - CURSES_DIR="${withval}" - CURSES_MANDATORY="yes" - ;; -esac - -fi - - -PBX_LIBCURSES=0 - -if test "${USE_CURSES}" != "no"; then +if test "x${PBX_CURSES}" != "x1" -a "${USE_CURSES}" != "no"; then pbxlibdir="" + # if --with-CURSES=DIR has been specified, use it. if test "x${CURSES_DIR}" != "x"; then - pbxlibdir="-L${curses_DIR}/lib" + if test -d ${CURSES_DIR}/lib; then + pbxlibdir="-L${CURSES_DIR}/lib" + else + pbxlibdir="-L${CURSES_DIR}" + fi fi - { echo "$as_me:$LINENO: checking for initscr in -lcurses" >&5 -echo $ECHO_N "checking for initscr in -lcurses... $ECHO_C" >&6; } -if test "${ac_cv_lib_curses_initscr+set}" = set; then + pbxfuncname="initscr" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_CURSES_FOUND=yes + else + as_ac_Lib=`echo "ac_cv_lib_curses_${pbxfuncname}" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lcurses" >&5 +echo $ECHO_N "checking for ${pbxfuncname} in -lcurses... $ECHO_C" >&6; } +if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS @@ -3756,11 +3899,11 @@ cat >>conftest.$ac_ext <<_ACEOF #ifdef __cplusplus extern "C" #endif -char initscr (); +char ${pbxfuncname} (); int main () { -return initscr (); +return ${pbxfuncname} (); ; return 0; } @@ -3783,173 +3926,43 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_lib_curses_initscr=yes + eval "$as_ac_Lib=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_curses_initscr=no + eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_curses_initscr" >&5 -echo "${ECHO_T}$ac_cv_lib_curses_initscr" >&6; } -if test $ac_cv_lib_curses_initscr = yes; then +ac_res=`eval echo '${'$as_ac_Lib'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Lib'}'` = yes; then AST_CURSES_FOUND=yes else AST_CURSES_FOUND=no fi + fi + # now check for the header. if test "${AST_CURSES_FOUND}" = "yes"; then - CURSES_LIB="-lcurses " - CURSES_HEADER_FOUND="1" + CURSES_LIB="${pbxlibdir} -lcurses " + # if --with-CURSES=DIR has been specified, use it. if test "x${CURSES_DIR}" != "x"; then - CURSES_LIB="${pbxlibdir} ${CURSES_LIB}" CURSES_INCLUDE="-I${CURSES_DIR}/include" - if test "xcurses.h" != "x" ; then - as_ac_Header=`echo "ac_cv_header_${CURSES_DIR}/include/curses.h" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for ${CURSES_DIR}/include/curses.h" >&5 -echo $ECHO_N "checking for ${CURSES_DIR}/include/curses.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking ${CURSES_DIR}/include/curses.h usability" >&5 -echo $ECHO_N "checking ${CURSES_DIR}/include/curses.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <${CURSES_DIR}/include/curses.h> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking ${CURSES_DIR}/include/curses.h presence" >&5 -echo $ECHO_N "checking ${CURSES_DIR}/include/curses.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <${CURSES_DIR}/include/curses.h> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for ${CURSES_DIR}/include/curses.h" >&5 -echo $ECHO_N "checking for ${CURSES_DIR}/include/curses.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - CURSES_HEADER_FOUND=1 -else - CURSES_HEADER_FOUND=0 -fi - - - fi - else - if test "xcurses.h" != "x" ; then - if test "${ac_cv_header_curses_h+set}" = set; then + fi + CURSES_INCLUDE="${CURSES_INCLUDE} " + if test "xcurses.h" = "x" ; then # no header, assume found + CURSES_HEADER_FOUND="1" + else # check for the header + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} ${CURSES_INCLUDE} " + if test "${ac_cv_header_curses_h+set}" = set; then { echo "$as_me:$LINENO: checking for curses.h" >&5 echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; } if test "${ac_cv_header_curses_h+set}" = set; then @@ -4081,80 +4094,126 @@ else fi - fi + CPPFLAGS="${saved_cppflags}" fi if test "x${CURSES_HEADER_FOUND}" = "x0" ; then - if test ! -z "${CURSES_MANDATORY}" ; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** It appears that you do not have the curses development package installed." >&5 -echo "$as_me: *** It appears that you do not have the curses development package installed." >&6;} - { echo "$as_me:$LINENO: *** Please install it to include curses support" >&5 -echo "$as_me: *** Please install it to include curses support" >&or re-run configure;} - { echo "$as_me:$LINENO: *** without explicitly specifying --with-curses" >&5 -echo "$as_me: *** without explicitly specifying --with-curses" >&6;} - exit 1 - fi CURSES_LIB="" CURSES_INCLUDE="" - PBX_LIBCURSES=0 else - PBX_LIBCURSES=1 + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + CURSES_LIB="" + fi + PBX_CURSES=1 + # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED cat >>confdefs.h <<_ACEOF #define HAVE_CURSES 1 _ACEOF + +cat >>confdefs.h <<_ACEOF +#define HAVE_CURSES_VERSION +_ACEOF + fi - elif test ! -z "${CURSES_MANDATORY}"; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** The curses installation on this system appears to be broken." >&5 -echo "$as_me: *** The curses installation on this system appears to be broken." >&6;} - { echo "$as_me:$LINENO: *** Either correct the installation" >&5 -echo "$as_me: *** Either correct the installation" >&or run configure;} - { echo "$as_me:$LINENO: *** without explicity specifying --with-curses" >&5 -echo "$as_me: *** without explicity specifying --with-curses" >&6;} - exit 1 fi fi + if test "x${PBX_DAHDI}" != "x1"; then + { echo "$as_me:$LINENO: checking for DAHDI_CODE in dahdi/user.h" >&5 +echo $ECHO_N "checking for DAHDI_CODE in dahdi/user.h... $ECHO_C" >&6; } + saved_cppflags="${CPPFLAGS}" + if test "x${DAHDI_DIR}" != "x"; then + DAHDI_INCLUDE="-I${DAHDI_DIR}/include" + fi + CPPFLAGS="${CPPFLAGS} ${DAHDI_INCLUDE}" + cat >conftest.$ac_ext <<_ACEOF + /* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <dahdi/user.h> +int +main () +{ +#if defined(DAHDI_CODE) + int foo = 0; + #else + int foo = bar; + #endif + 0 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + PBX_DAHDI=1 +cat >>confdefs.h <<\_ACEOF +#define HAVE_DAHDI 1 +_ACEOF -# Check whether --with-ncurses was given. -if test "${with_ncurses+set}" = set; then - withval=$with_ncurses; -case ${withval} in - n|no) - USE_NCURSES=no - ;; - y|ye|yes) - NCURSES_MANDATORY="yes" - ;; - *) - NCURSES_DIR="${withval}" - NCURSES_MANDATORY="yes" - ;; -esac + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DAHDI_VERSION +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="${saved_cppflags}" + fi -PBX_LIBNCURSES=0 -if test "${USE_NCURSES}" != "no"; then + +if test "x${PBX_NCURSES}" != "x1" -a "${USE_NCURSES}" != "no"; then pbxlibdir="" + # if --with-NCURSES=DIR has been specified, use it. if test "x${NCURSES_DIR}" != "x"; then - pbxlibdir="-L${ncurses_DIR}/lib" + if test -d ${NCURSES_DIR}/lib; then + pbxlibdir="-L${NCURSES_DIR}/lib" + else + pbxlibdir="-L${NCURSES_DIR}" + fi fi - { echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5 -echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6; } -if test "${ac_cv_lib_ncurses_initscr+set}" = set; then + pbxfuncname="initscr" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_NCURSES_FOUND=yes + else + as_ac_Lib=`echo "ac_cv_lib_ncurses_${pbxfuncname}" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lncurses" >&5 +echo $ECHO_N "checking for ${pbxfuncname} in -lncurses... $ECHO_C" >&6; } +if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4172,11 +4231,11 @@ cat >>conftest.$ac_ext <<_ACEOF #ifdef __cplusplus extern "C" #endif -char initscr (); +char ${pbxfuncname} (); int main () { -return initscr (); +return ${pbxfuncname} (); ; return 0; } @@ -4199,173 +4258,43 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_lib_ncurses_initscr=yes + eval "$as_ac_Lib=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_ncurses_initscr=no + eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_initscr" >&5 -echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6; } -if test $ac_cv_lib_ncurses_initscr = yes; then +ac_res=`eval echo '${'$as_ac_Lib'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Lib'}'` = yes; then AST_NCURSES_FOUND=yes else AST_NCURSES_FOUND=no fi + fi + # now check for the header. if test "${AST_NCURSES_FOUND}" = "yes"; then - NCURSES_LIB="-lncurses " - NCURSES_HEADER_FOUND="1" + NCURSES_LIB="${pbxlibdir} -lncurses " + # if --with-NCURSES=DIR has been specified, use it. if test "x${NCURSES_DIR}" != "x"; then - NCURSES_LIB="${pbxlibdir} ${NCURSES_LIB}" NCURSES_INCLUDE="-I${NCURSES_DIR}/include" - if test "xcurses.h" != "x" ; then - as_ac_Header=`echo "ac_cv_header_${NCURSES_DIR}/include/curses.h" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for ${NCURSES_DIR}/include/curses.h" >&5 -echo $ECHO_N "checking for ${NCURSES_DIR}/include/curses.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking ${NCURSES_DIR}/include/curses.h usability" >&5 -echo $ECHO_N "checking ${NCURSES_DIR}/include/curses.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <${NCURSES_DIR}/include/curses.h> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking ${NCURSES_DIR}/include/curses.h presence" >&5 -echo $ECHO_N "checking ${NCURSES_DIR}/include/curses.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <${NCURSES_DIR}/include/curses.h> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for ${NCURSES_DIR}/include/curses.h" >&5 -echo $ECHO_N "checking for ${NCURSES_DIR}/include/curses.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - NCURSES_HEADER_FOUND=1 -else - NCURSES_HEADER_FOUND=0 -fi - - - fi - else - if test "xcurses.h" != "x" ; then - if test "${ac_cv_header_curses_h+set}" = set; then + fi + NCURSES_INCLUDE="${NCURSES_INCLUDE} " + if test "xcurses.h" = "x" ; then # no header, assume found + NCURSES_HEADER_FOUND="1" + else # check for the header + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} ${NCURSES_INCLUDE} " + if test "${ac_cv_header_curses_h+set}" = set; then { echo "$as_me:$LINENO: checking for curses.h" >&5 echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; } if test "${ac_cv_header_curses_h+set}" = set; then @@ -4497,80 +4426,50 @@ else fi - fi + CPPFLAGS="${saved_cppflags}" fi if test "x${NCURSES_HEADER_FOUND}" = "x0" ; then - if test ! -z "${NCURSES_MANDATORY}" ; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** It appears that you do not have the ncurses development package installed." >&5 -echo "$as_me: *** It appears that you do not have the ncurses development package installed." >&6;} - { echo "$as_me:$LINENO: *** Please install it to include ncurses support" >&5 -echo "$as_me: *** Please install it to include ncurses support" >&or re-run configure;} - { echo "$as_me:$LINENO: *** without explicitly specifying --with-ncurses" >&5 -echo "$as_me: *** without explicitly specifying --with-ncurses" >&6;} - exit 1 - fi NCURSES_LIB="" NCURSES_INCLUDE="" - PBX_LIBNCURSES=0 else - PBX_LIBNCURSES=1 + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + NCURSES_LIB="" + fi + PBX_NCURSES=1 + # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED cat >>confdefs.h <<_ACEOF #define HAVE_NCURSES 1 _ACEOF - fi - elif test ! -z "${NCURSES_MANDATORY}"; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** The ncurses installation on this system appears to be broken." >&5 -echo "$as_me: *** The ncurses installation on this system appears to be broken." >&6;} - { echo "$as_me:$LINENO: *** Either correct the installation" >&5 -echo "$as_me: *** Either correct the installation" >&or run configure;} - { echo "$as_me:$LINENO: *** without explicity specifying --with-ncurses" >&5 -echo "$as_me: *** without explicity specifying --with-ncurses" >&6;} - exit 1 - fi -fi - - - +cat >>confdefs.h <<_ACEOF +#define HAVE_NCURSES_VERSION +_ACEOF - -# Check whether --with-newt was given. -if test "${with_newt+set}" = set; then - withval=$with_newt; -case ${withval} in - n|no) - USE_NEWT=no - ;; - y|ye|yes) - NEWT_MANDATORY="yes" - ;; - *) - NEWT_DIR="${withval}" - NEWT_MANDATORY="yes" - ;; -esac - + fi + fi fi -PBX_LIBNEWT=0 - -if test "${USE_NEWT}" != "no"; then +if test "x${PBX_NEWT}" != "x1" -a "${USE_NEWT}" != "no"; then pbxlibdir="" + # if --with-NEWT=DIR has been specified, use it. if test "x${NEWT_DIR}" != "x"; then - pbxlibdir="-L${newt_DIR}/lib" + if test -d ${NEWT_DIR}/lib; then + pbxlibdir="-L${NEWT_DIR}/lib" + else + pbxlibdir="-L${NEWT_DIR}" + fi fi - { echo "$as_me:$LINENO: checking for newtBell in -lnewt" >&5 -echo $ECHO_N "checking for newtBell in -lnewt... $ECHO_C" >&6; } -if test "${ac_cv_lib_newt_newtBell+set}" = set; then + pbxfuncname="newtBell" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_NEWT_FOUND=yes + else + as_ac_Lib=`echo "ac_cv_lib_newt_${pbxfuncname}" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lnewt" >&5 +echo $ECHO_N "checking for ${pbxfuncname} in -lnewt... $ECHO_C" >&6; } +if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS @@ -4588,11 +4487,11 @@ cat >>conftest.$ac_ext <<_ACEOF #ifdef __cplusplus extern "C" #endif -char newtBell (); +char ${pbxfuncname} (); int main () { -return newtBell (); +return ${pbxfuncname} (); ; return 0; } @@ -4615,173 +4514,43 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_lib_newt_newtBell=yes + eval "$as_ac_Lib=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_newt_newtBell=no + eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_newt_newtBell" >&5 -echo "${ECHO_T}$ac_cv_lib_newt_newtBell" >&6; } -if test $ac_cv_lib_newt_newtBell = yes; then +ac_res=`eval echo '${'$as_ac_Lib'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Lib'}'` = yes; then AST_NEWT_FOUND=yes else AST_NEWT_FOUND=no fi + fi + # now check for the header. if test "${AST_NEWT_FOUND}" = "yes"; then - NEWT_LIB="-lnewt " - NEWT_HEADER_FOUND="1" + NEWT_LIB="${pbxlibdir} -lnewt " + # if --with-NEWT=DIR has been specified, use it. if test "x${NEWT_DIR}" != "x"; then - NEWT_LIB="${pbxlibdir} ${NEWT_LIB}" NEWT_INCLUDE="-I${NEWT_DIR}/include" - if test "xnewt.h" != "x" ; then - as_ac_Header=`echo "ac_cv_header_${NEWT_DIR}/include/newt.h" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for ${NEWT_DIR}/include/newt.h" >&5 -echo $ECHO_N "checking for ${NEWT_DIR}/include/newt.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking ${NEWT_DIR}/include/newt.h usability" >&5 -echo $ECHO_N "checking ${NEWT_DIR}/include/newt.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <${NEWT_DIR}/include/newt.h> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking ${NEWT_DIR}/include/newt.h presence" >&5 -echo $ECHO_N "checking ${NEWT_DIR}/include/newt.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <${NEWT_DIR}/include/newt.h> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for ${NEWT_DIR}/include/newt.h" >&5 -echo $ECHO_N "checking for ${NEWT_DIR}/include/newt.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - NEWT_HEADER_FOUND=1 -else - NEWT_HEADER_FOUND=0 -fi - - - fi - else - if test "xnewt.h" != "x" ; then - if test "${ac_cv_header_newt_h+set}" = set; then + fi + NEWT_INCLUDE="${NEWT_INCLUDE} " + if test "xnewt.h" = "x" ; then # no header, assume found + NEWT_HEADER_FOUND="1" + else # check for the header + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} ${NEWT_INCLUDE} " + if test "${ac_cv_header_newt_h+set}" = set; then { echo "$as_me:$LINENO: checking for newt.h" >&5 echo $ECHO_N "checking for newt.h... $ECHO_C" >&6; } if test "${ac_cv_header_newt_h+set}" = set; then @@ -4913,84 +4682,54 @@ else fi - fi + CPPFLAGS="${saved_cppflags}" fi if test "x${NEWT_HEADER_FOUND}" = "x0" ; then - if test ! -z "${NEWT_MANDATORY}" ; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** It appears that you do not have the newt development package installed." >&5 -echo "$as_me: *** It appears that you do not have the newt development package installed." >&6;} - { echo "$as_me:$LINENO: *** Please install it to include newt support" >&5 -echo "$as_me: *** Please install it to include newt support" >&or re-run configure;} - { echo "$as_me:$LINENO: *** without explicitly specifying --with-newt" >&5 -echo "$as_me: *** without explicitly specifying --with-newt" >&6;} - exit 1 - fi NEWT_LIB="" NEWT_INCLUDE="" - PBX_LIBNEWT=0 else - PBX_LIBNEWT=1 + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + NEWT_LIB="" + fi + PBX_NEWT=1 + # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED cat >>confdefs.h <<_ACEOF #define HAVE_NEWT 1 _ACEOF - fi - elif test ! -z "${NEWT_MANDATORY}"; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** The newt installation on this system appears to be broken." >&5 -echo "$as_me: *** The newt installation on this system appears to be broken." >&6;} - { echo "$as_me:$LINENO: *** Either correct the installation" >&5 -echo "$as_me: *** Either correct the installation" >&or run configure;} - { echo "$as_me:$LINENO: *** without explicity specifying --with-newt" >&5 -echo "$as_me: *** without explicity specifying --with-newt" >&6;} - exit 1 - fi -fi - - - +cat >>confdefs.h <<_ACEOF +#define HAVE_NEWT_VERSION +_ACEOF - -# Check whether --with-usb was given. -if test "${with_usb+set}" = set; then - withval=$with_usb; -case ${withval} in - n|no) - USE_USB=no - ;; - y|ye|yes) - USB_MANDATORY="yes" - ;; - *) - USB_DIR="${withval}" - USB_MANDATORY="yes" - ;; -esac - + fi + fi fi -PBX_LIBUSB=0 - -if test "${USE_USB}" != "no"; then +if test "x${PBX_USB}" != "x1" -a "${USE_USB}" != "no"; then pbxlibdir="" + # if --with-USB=DIR has been specified, use it. if test "x${USB_DIR}" != "x"; then - pbxlibdir="-L${usb_DIR}/lib" + if test -d ${USB_DIR}/lib; then + pbxlibdir="-L${USB_DIR}/lib" + else + pbxlibdir="-L${USB_DIR}" + fi fi - { echo "$as_me:$LINENO: checking for usb_init in -lusb" >&5 -echo $ECHO_N "checking for usb_init in -lusb... $ECHO_C" >&6; } -if test "${ac_cv_lib_usb_usb_init+set}" = set; then + pbxfuncname="usb_init" + if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers + AST_USB_FOUND=yes + else + as_ac_Lib=`echo "ac_cv_lib_libusb_${pbxfuncname}" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for ${pbxfuncname} in -llibusb" >&5 +echo $ECHO_N "checking for ${pbxfuncname} in -llibusb... $ECHO_C" >&6; } +if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lusb ${pbxlibdir} $LIBS" +LIBS="-llibusb ${pbxlibdir} $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5004,11 +4743,11 @@ cat >>conftest.$ac_ext <<_ACEOF #ifdef __cplusplus extern "C" #endif -char usb_init (); +char ${pbxfuncname} (); int main () { -return usb_init (); +return ${pbxfuncname} (); ; return 0; } @@ -5031,173 +4770,43 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then - ac_cv_lib_usb_usb_init=yes + eval "$as_ac_Lib=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_lib_usb_usb_init=no + eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_usb_usb_init" >&5 -echo "${ECHO_T}$ac_cv_lib_usb_usb_init" >&6; } -if test $ac_cv_lib_usb_usb_init = yes; then +ac_res=`eval echo '${'$as_ac_Lib'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Lib'}'` = yes; then AST_USB_FOUND=yes else AST_USB_FOUND=no fi + fi + # now check for the header. if test "${AST_USB_FOUND}" = "yes"; then - USB_LIB="-lusb " - USB_HEADER_FOUND="1" + USB_LIB="${pbxlibdir} -llibusb " + # if --with-USB=DIR has been specified, use it. if test "x${USB_DIR}" != "x"; then - USB_LIB="${pbxlibdir} ${USB_LIB}" USB_INCLUDE="-I${USB_DIR}/include" - if test "xusb.h" != "x" ; then - as_ac_Header=`echo "ac_cv_header_${USB_DIR}/include/usb.h" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for ${USB_DIR}/include/usb.h" >&5 -echo $ECHO_N "checking for ${USB_DIR}/include/usb.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking ${USB_DIR}/include/usb.h usability" >&5 -echo $ECHO_N "checking ${USB_DIR}/include/usb.h usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <${USB_DIR}/include/usb.h> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } - -# Is the header present? -{ echo "$as_me:$LINENO: checking ${USB_DIR}/include/usb.h presence" >&5 -echo $ECHO_N "checking ${USB_DIR}/include/usb.h presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <${USB_DIR}/include/usb.h> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi - -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: ${USB_DIR}/include/usb.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: ${USB_DIR}/include/usb.h: in the future, the compiler will take precedence" >&2;} - - ;; -esac -{ echo "$as_me:$LINENO: checking for ${USB_DIR}/include/usb.h" >&5 -echo $ECHO_N "checking for ${USB_DIR}/include/usb.h... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } - -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then - USB_HEADER_FOUND=1 -else - USB_HEADER_FOUND=0 -fi - - - fi - else - if test "xusb.h" != "x" ; then - if test "${ac_cv_header_usb_h+set}" = set; then + fi + USB_INCLUDE="${USB_INCLUDE} " + if test "xusb.h" = "x" ; then # no header, assume found + USB_HEADER_FOUND="1" + else # check for the header + saved_cppflags="${CPPFLAGS}" + CPPFLAGS="${CPPFLAGS} ${USB_INCLUDE} " + if test "${ac_cv_header_usb_h+set}" = set; then { echo "$as_me:$LINENO: checking for usb.h" >&5 echo $ECHO_N "checking for usb.h... $ECHO_C" >&6; } if test "${ac_cv_header_usb_h+set}" = set; then @@ -5329,51 +4938,33 @@ else fi - fi + CPPFLAGS="${saved_cppflags}" fi if test "x${USB_HEADER_FOUND}" = "x0" ; then - if test ! -z "${USB_MANDATORY}" ; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** It appears that you do not have the usb development package installed." >&5 -echo "$as_me: *** It appears that you do not have the usb development package installed." >&6;} - { echo "$as_me:$LINENO: *** Please install it to include libusb support" >&5 -echo "$as_me: *** Please install it to include libusb support" >&or re-run configure;} - { echo "$as_me:$LINENO: *** without explicitly specifying --with-usb" >&5 -echo "$as_me: *** without explicitly specifying --with-usb" >&6;} - exit 1 - fi USB_LIB="" USB_INCLUDE="" - PBX_LIBUSB=0 else - PBX_LIBUSB=1 + if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library + USB_LIB="" + fi + PBX_USB=1 + # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED cat >>confdefs.h <<_ACEOF #define HAVE_USB 1 _ACEOF + +cat >>confdefs.h <<_ACEOF +#define HAVE_USB_VERSION +_ACEOF + fi - elif test ! -z "${USB_MANDATORY}"; - then - { echo "$as_me:$LINENO: ***" >&5 -echo "$as_me: ***" >&6;} - { echo "$as_me:$LINENO: *** The libusb installation on this system appears to be broken." >&5 -echo "$as_me: *** The libusb installation on this system appears to be broken." >&6;} - { echo "$as_me:$LINENO: *** Either correct the installation" >&5 -echo "$as_me: *** Either correct the installation" >&or run configure;} - { echo "$as_me:$LINENO: *** without explicity specifying --with-usb" >&5 -echo "$as_me: *** without explicity specifying --with-usb" >&6;} - exit 1 fi fi - - - # Check whether --with-selinux was given. if test "${with_selinux+set}" = set; then withval=$with_selinux; USE_SELINUX=$withval @@ -5436,6 +5027,18 @@ echo "$as_me: error: failed to find pppd/patchlevel.h: no ppp support." >&2;} ;; esac +if test "x${PBX_DAHDI}" != "x1"; then + { echo "$as_me:$LINENO: ***" >&5 +echo "$as_me: ***" >&6;} + { echo "$as_me:$LINENO: *** Building this package requires DAHDI support. *** " >&5 +echo "$as_me: *** Building this package requires DAHDI support. *** " >&6;} + { echo "$as_me:$LINENO: *** Please install the dahdi-linux package. ***" >&5 +echo "$as_me: *** Please install the dahdi-linux package. ***" >&6;} + { echo "$as_me:$LINENO: ***" >&5 +echo "$as_me: ***" >&6;} + exit 1 +fi + ac_config_files="$ac_config_files build_tools/menuselect-deps makeopts" @@ -6128,19 +5731,27 @@ LN!$LN$ac_delim WGET!$WGET$ac_delim FETCH!$FETCH$ac_delim DOWNLOAD!$DOWNLOAD$ac_delim -EGREP!$EGREP$ac_delim CURSES_LIB!$CURSES_LIB$ac_delim CURSES_INCLUDE!$CURSES_INCLUDE$ac_delim -PBX_LIBCURSES!$PBX_LIBCURSES$ac_delim +CURSES_DIR!$CURSES_DIR$ac_delim +PBX_CURSES!$PBX_CURSES$ac_delim +DAHDI_LIB!$DAHDI_LIB$ac_delim +DAHDI_INCLUDE!$DAHDI_INCLUDE$ac_delim +DAHDI_DIR!$DAHDI_DIR$ac_delim +PBX_DAHDI!$PBX_DAHDI$ac_delim NCURSES_LIB!$NCURSES_LIB$ac_delim NCURSES_INCLUDE!$NCURSES_INCLUDE$ac_delim -PBX_LIBNCURSES!$PBX_LIBNCURSES$ac_delim +NCURSES_DIR!$NCURSES_DIR$ac_delim +PBX_NCURSES!$PBX_NCURSES$ac_delim NEWT_LIB!$NEWT_LIB$ac_delim NEWT_INCLUDE!$NEWT_INCLUDE$ac_delim -PBX_LIBNEWT!$PBX_LIBNEWT$ac_delim +NEWT_DIR!$NEWT_DIR$ac_delim +PBX_NEWT!$PBX_NEWT$ac_delim USB_LIB!$USB_LIB$ac_delim USB_INCLUDE!$USB_INCLUDE$ac_delim -PBX_LIBUSB!$PBX_LIBUSB$ac_delim +USB_DIR!$USB_DIR$ac_delim +PBX_USB!$PBX_USB$ac_delim +EGREP!$EGREP$ac_delim USE_SELINUX!$USE_SELINUX$ac_delim ASCIIDOC!$ASCIIDOC$ac_delim PPPD_VERSION!$PPPD_VERSION$ac_delim @@ -6148,7 +5759,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 76; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 84; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -6483,4 +6094,3 @@ fi { echo "$as_me:$LINENO: *** dahdi-tools build successfully configured ***" >&5 echo "$as_me: *** dahdi-tools build successfully configured ***" >&6;} - diff --git a/configure.ac b/configure.ac index fbf6e7a..1ac41e6 100644 --- a/configure.ac +++ b/configure.ac @@ -63,10 +63,17 @@ AC_SUBST(DOWNLOAD) AC_LANG(C) -AST_EXT_LIB([curses], [initscr], [curses.h], [CURSES], [curses], []) -AST_EXT_LIB([ncurses], [initscr], [curses.h], [NCURSES], [ncurses], []) -AST_EXT_LIB([newt], [newtBell], [newt.h], [NEWT], [newt]) -AST_EXT_LIB([usb], [usb_init], [usb.h], [USB], [libusb]) +AST_EXT_LIB_SETUP([CURSES], [curses], [curses]) +AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi]) +AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses]) +AST_EXT_LIB_SETUP([NEWT], [newt], [newt]) +AST_EXT_LIB_SETUP([USB], [usb], [usb]) + +AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h]) +AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h]) +AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h]) +AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h]) +AST_EXT_LIB_CHECK([USB], [libusb], [usb_init], [usb.h]) AC_ARG_WITH(selinux, [AS_HELP_STRING([--with-selinux], @@ -92,7 +99,7 @@ fi AC_SUBST(ASCIIDOC) AC_ARG_WITH(ppp, - [AS_HELP_STRING([--with-ppp=PATH],[Use ppp support from PATH])], + [AS_HELP_STRING([--with-ppp=PATH],[Use PPP support from PATH])], [], [with_ppp=check] ) @@ -122,10 +129,17 @@ case "$with_ppp" in ;; esac +if test "x${PBX_DAHDI}" != "x1"; then + AC_MSG_NOTICE([***]) + AC_MSG_NOTICE([*** Building this package requires DAHDI support. *** ]) + AC_MSG_NOTICE([*** Please install the dahdi-linux package. ***]) + AC_MSG_NOTICE([***]) + exit 1 +fi + AC_SUBST(PPPD_VERSION) AC_CONFIG_FILES([build_tools/menuselect-deps makeopts]) AC_OUTPUT AC_MSG_NOTICE(*** dahdi-tools build successfully configured ***) - |