[asterisk-commits] rizzo: trunk r44467 - in /trunk: acinclude.m4
configure.ac
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Oct 5 08:42:15 MST 2006
Author: rizzo
Date: Thu Oct 5 10:42:14 2006
New Revision: 44467
URL: http://svn.digium.com/view/asterisk?rev=44467&view=rev
Log:
Basically, this commit only simplifies configure.ac and makes the
mechanism more flexible, but otherwise should not affect your build
even if you regenerate the "configure" script.
(Most likely you need to run bootstrap.sh as you really need to re-run
autoheader for reasons that i do not completely understand).
If you don't regenerate "configure", of course you will see no difference.
In detail:
- restructure the check for mandatory modules to remove some
redundant code blocks;
- extend the AST_EXT_LIB_CHECK so that it can used also for
checking headers;
- define the AST_C_DEFINE_CHECK macro to test for #defined symbols;
- for the two above macros, add a last argument that getscopied into
HAVE_$1_VERSION so the source can adapt to different versions of the
same libraries/header/etc
- document the above;
- document a problem that existed before and i did not manage to solve:
the 'description' argument to AC_DEFINE does not substiture shell variables
so you will not see the actual values in the comments (in autoconfig.h)..
Modified:
trunk/acinclude.m4
trunk/configure.ac
Modified: trunk/acinclude.m4
URL: http://svn.digium.com/view/asterisk/trunk/acinclude.m4?rev=44467&r1=44466&r2=44467&view=diff
==============================================================================
--- trunk/acinclude.m4 (original)
+++ trunk/acinclude.m4 Thu Oct 5 10:42:14 2006
@@ -23,11 +23,11 @@
USE_$1=no
;;
y|ye|yes)
- $1_MANDATORY="yes"
+ ac_mandatory_list="${ac_mandatory_list} $1"
;;
*)
$1_DIR="${withval}"
- $1_MANDATORY="yes"
+ ac_mandatory_list="${ac_mandatory_list} $1"
;;
esac
])
@@ -37,14 +37,68 @@
AC_SUBST([PBX_$1])
])
-# Check for existence of a given package ($1), looking up a function
+# Check whether any of the mandatory modules are not present, and
+# print error messages in case.
+
+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)
+])
+
+#-- The following two tests are only performed if PBX_$1 != 1,
+# so you can use multiple tests and stop at the first matching one.
+# On success, set PBX_$1 = 1, and also #define HAVE_$1 1
+# and #define HAVE_$1_VERSION ${last_argument} so you can tell which
+# test succeeded.
+# They should be called after AST_EXT_LIB_SETUP($1, ...)
+
+# Check if a given macro is defined in a certain header.
+
+# AST_C_DEFINE_CHECK([package symbol name], [macro name], [header file], [version])
+AC_DEFUN([AST_C_DEFINE_CHECK],
+[
+ if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; 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>], [int foo = $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.
-# Only check if PBX_$1 != 1, and set PBX_$1=1 and HAVE_$1 if found.
-# Should be called after AST_EXT_LIB_SETUP($1, ...)
-
-# AST_EXT_LIB_CHECK([package symbol name], [package library name], [function to check], [package header], [additional LIB data])
-
+
+# AST_EXT_LIB_CHECK([package symbol name], [package library name], [function to check], [package header], [additional LIB data], [version])
AC_DEFUN([AST_EXT_LIB_CHECK],
[
if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then
@@ -78,13 +132,6 @@
fi
fi
if test "x${$1_HEADER_FOUND}" = "x0" ; then
- if test ! -z "${$1_MANDATORY}" ; 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})
- exit 1
- fi
$1_LIB=""
$1_INCLUDE=""
else
@@ -92,14 +139,10 @@
$1_LIB=""
fi
PBX_$1=1
- AC_DEFINE_UNQUOTED([HAVE_$1], 1, [Define to indicate the ${$1_DESCRIP} library])
+ # 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], [$6], [Define to indicate the ${$1_DESCRIP} library version])
fi
- elif test ! -z "${$1_MANDATORY}"; 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})
- exit 1
fi
fi
])
Modified: trunk/configure.ac
URL: http://svn.digium.com/view/asterisk/trunk/configure.ac?rev=44467&r1=44466&r2=44467&view=diff
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Thu Oct 5 10:42:14 2006
@@ -6,7 +6,7 @@
# this file just have to remember to set the AC_PREREQ argument
# to something that suits their needs.
-AC_PREREQ(2.60)
+AC_PREREQ(2.59)
m4_define([PBX_VERSION],
m4_bpatsubst(m4_esyscmd([build_tools/make_version .]),
@@ -297,14 +297,7 @@
AC_MSG_RESULT(no)
)
-AC_MSG_CHECKING(for RTLD_NOLOAD)
-AC_LINK_IFELSE(
- AC_LANG_PROGRAM([#include <dlfcn.h>],
- [int foo = RTLD_NOLOAD;]),
- AC_MSG_RESULT(yes)
- AC_DEFINE([HAVE_RTLD_NOLOAD], 1, [Define to 1 if your system has a dynamic linker that supports RTLD_NOLOAD.]),
- AC_MSG_RESULT(no)
-)
+AST_C_DEFINE_CHECK([RTLD_NOLOAD], [RTLD_NOLOAD], [dlfcn.h])
AC_CHECK_HEADER([libkern/OSAtomic.h],
[AC_DEFINE_UNQUOTED([HAVE_OSX_ATOMICS], 1, [Define to 1 if OSX atomic operations are supported.])])
@@ -500,13 +493,6 @@
if test "${ac_cv_imap_tk2006}" = "yes"; then
AC_DEFINE([HAVE_IMAP_TK2006], 1, [Define if your system has the UW IMAP Toolkit c-client library version 2006 or greater.])
fi
- elif test ! -z "${IMAP_TK_MANDATORY}"; then
- AC_MSG_RESULT(no)
- AC_MSG_NOTICE(***)
- AC_MSG_NOTICE(*** The UW IMAP Toolkit installation on this system appears to be broken.)
- AC_MSG_NOTICE(*** Either correct the installation, or run configure)
- AC_MSG_NOTICE(*** including --without-imap.)
- exit 1
else
AC_MSG_RESULT(no)
fi
@@ -546,13 +532,6 @@
fi
PBX_KDE=1
AC_DEFINE([HAVE_LIBKDE], 1, [Define if your system has the KDE libraries.])
- elif test ! -z "${KDE_MANDATORY}"; then
- AC_MSG_RESULT(no)
- AC_MSG_NOTICE(***)
- AC_MSG_NOTICE(*** The KDE installation on this system appears to be broken.)
- AC_MSG_NOTICE(*** Either correct the installation, or run configure)
- AC_MSG_NOTICE(*** including --without-kde.)
- exit 1
else
AC_MSG_RESULT(no)
fi
@@ -606,13 +585,6 @@
PBX_NETSNMP=1
fi
fi
-if test ! -z "${NETSNMP_MANDATORY}" -a "x${PBX_NETSNMP}" != "x1" ; then
- AC_MSG_NOTICE(***)
- AC_MSG_NOTICE(*** The Net-SNMP installation on this system appears to be broken.)
- AC_MSG_NOTICE(*** Either correct the installation, or run configure)
- AC_MSG_NOTICE(*** including --without-netsnmp)
- exit 1
-fi
AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
@@ -656,13 +628,6 @@
PBX_PGSQL=1
fi
fi
-if test ! -z "${PGSQL_MANDATORY}" -a "x${PBX_PGSQL}" != "1" ; then
- AC_MSG_NOTICE(***)
- AC_MSG_NOTICE(*** The PostgreSQL installation on this system appears to be broken.)
- AC_MSG_NOTICE(*** Either correct the installation, or run configure)
- AC_MSG_NOTICE(*** including --without-postgres)
- exit 1
-fi
AST_EXT_LIB_CHECK([POPT], [popt], [poptStrerror], [popt.h])
@@ -687,14 +652,6 @@
[#include "ptlib.h"],
[BOOL q = PTime::IsDaylightSavings();])
fi
-fi
-
-if test "${USE_PWLIB}" != "no" -a "x${ac_cv_lib_PWLIB}" != "xyes" -a ! -z "${PWLIB_MANDATORY}"; then
- AC_MSG_NOTICE(***)
- AC_MSG_NOTICE(*** The PWLIB installation on this system appears to be broken.)
- AC_MSG_NOTICE(*** Either correct the installation, or run configure)
- AC_MSG_NOTICE(*** including --without-pwlib)
- exit 1
fi
if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
@@ -713,14 +670,6 @@
[H323EndPoint ep = H323EndPoint();],
[${PWLIB_INCLUDE}], [${PWLIB_LIB}])
fi
-if test "${USE_OPENH323}" != "no" -a "x${ac_cv_lib_OPENH323}" != "xyes" -a ! -z "${OPENH323_MANDATORY}"; then
- AC_MSG_NOTICE(***)
- AC_MSG_NOTICE(*** The PWLIB installation on this system appears to be broken.)
- AC_MSG_NOTICE(*** Either correct the installation, or run configure)
- AC_MSG_NOTICE(*** including --without-pwlib)
- exit 1
-fi
-
AC_LANG_PUSH(C++)
@@ -781,13 +730,6 @@
PBX_QT=1
AC_DEFINE([HAVE_QT], 1, [Define if your system has the Qt library])
AC_PATH_TOOL(QTMOC, moc, No)
- elif test ! -z "${QT_MANDATORY}";
- then
- AC_MSG_NOTICE(***)
- AC_MSG_NOTICE(*** The Qt installation on this system appears to be broken.)
- AC_MSG_NOTICE(*** Either correct the installation, or run configure)
- AC_MSG_NOTICE(*** including --without-qt.)
- exit 1
fi
fi
@@ -828,7 +770,10 @@
tonezone_extra="-lm"
fi
-AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel/tonezone.h], [${tonezone_extra}])
+# new tonezone, version 1.4.0
+AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel/tonezone.h], [${tonezone_extra}], [140])
+# other case, old tonezone (0.80)
+AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [zaptel/zaptel.h], [${tonezone_extra}], [80])
AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc])
@@ -871,12 +816,6 @@
fi
PBX_VPB=1
AC_DEFINE([HAVE_VPB], 1, [Define if your system has the VoiceTronix API libraries.])
- elif test ! -z "${VPB_MANDATORY}"; then
- AC_MSG_NOTICE(***)
- AC_MSG_NOTICE(*** The VoiceTronix (vpb) installation on this system appears to be broken.)
- AC_MSG_NOTICE(*** Either correct the installation, or run configure)
- AC_MSG_NOTICE(*** including --without-vpb.)
- exit 1
fi
fi
@@ -884,41 +823,10 @@
AST_EXT_LIB_CHECK([ZLIB], [z], [compress], [zlib.h])
-if test "${USE_ZAPTEL}" != "no"; then
- AC_MSG_CHECKING(for ZT_TONE_DTMF_BASE in zaptel.h)
- saved_cppflags="${CPPFLAGS}"
- if test "x${ZAPTEL_DIR}" != "x"; then
- CPPFLAGS="${CPPFLAGS} -I${ZAPTEL_DIR}/include"
- fi
- AC_COMPILE_IFELSE(
- [
- AC_LANG_PROGRAM(
- [#include <zaptel/zaptel.h>],
- [int foo = ZT_TONE_DTMF_BASE;])
- ],
- [ AC_MSG_RESULT(yes)
- ac_cv_zaptel_h="yes"
- ],
- [ AC_MSG_RESULT(no)
- ac_cv_zaptel_h="no"
- ]
- )
- CPPFLAGS="${saved_cppflags}"
- if test "${ac_cv_zaptel_h}" = "yes"; then
- if test "${ZAPTEL_DIR}" != ""; then
- ZAPTEL_INCLUDE="-I${ZAPTEL_DIR}/include"
- fi
- PBX_ZAPTEL=1
- AC_DEFINE([HAVE_ZAPTEL], 1, [Define if your system has the Zaptel headers.])
- elif test ! -z "${ZAPTEL_MANDATORY}";
- then
- AC_MSG_NOTICE(***)
- AC_MSG_NOTICE(*** The Zaptel installation on this system appears to be broken.)
- AC_MSG_NOTICE(*** Either correct the installation, or run configure)
- AC_MSG_NOTICE(*** including --without-zaptel.)
- exit 1
- fi
-fi
+# check for zaptel 1.4.0
+AST_C_DEFINE_CHECK([ZAPTEL], [ZT_TONE_DTMF_BASE], [zaptel/zaptel.h], [140])
+# or, try old zaptel (0.80 or so)
+AST_EXT_LIB_CHECK([ZAPTEL], [zaptel],, [zaptel.h],, [80])
EDITLINE_LIB=""
if test "x$TERMCAP_LIB" != "x" ; then
@@ -980,6 +888,8 @@
fi
AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
+AST_CHECK_MANDATORY
+
AC_OUTPUT
if test "x${silent}" != "xyes" ; then
More information about the asterisk-commits
mailing list