aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-27 21:45:34 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-08-27 21:45:34 +0000
commit15404a50a1505789793fe3459587f76486dc864a (patch)
tree515236bc617d11cc01d7b69d1cec4f30e51b0548
parentc4f7c1e785b940766e7db42e669cf26d424a4722 (diff)
Use autoconf to detect libcurl, as this enables cross-compilation checks, something we didn't allow before.
(closes issue #15714) Reported by: pprindeville Patches: 20090813__issue15714.diff.txt uploaded by tilghman (license 14) Tested by: pprindeville git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@214517 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--autoconf/libcurl.m4243
-rwxr-xr-xconfigure481
-rw-r--r--configure.ac32
-rw-r--r--include/asterisk/autoconfig.h.in54
4 files changed, 705 insertions, 105 deletions
diff --git a/autoconf/libcurl.m4 b/autoconf/libcurl.m4
new file mode 100644
index 000000000..07e21c2c4
--- /dev/null
+++ b/autoconf/libcurl.m4
@@ -0,0 +1,243 @@
+# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION],
+# [ACTION-IF-YES], [ACTION-IF-NO])
+# ----------------------------------------------------------
+# David Shaw <dshaw@jabberwocky.com> May-09-2006
+#
+# Checks for libcurl. DEFAULT-ACTION is the string yes or no to
+# specify whether to default to --with-libcurl or --without-libcurl.
+# If not supplied, DEFAULT-ACTION is yes. MINIMUM-VERSION is the
+# minimum version of libcurl to accept. Pass the version as a regular
+# version number like 7.10.1. If not supplied, any version is
+# accepted. ACTION-IF-YES is a list of shell commands to run if
+# libcurl was successfully found and passed the various tests.
+# ACTION-IF-NO is a list of shell commands that are run otherwise.
+# Note that using --without-libcurl does run ACTION-IF-NO.
+#
+# This macro #defines HAVE_CURL if a working libcurl setup is
+# found, and sets @CURL_LIB@ and @CURL_INCLUDE@ to the necessary
+# values. Other useful defines are LIBCURL_FEATURE_xxx where xxx are
+# the various features supported by libcurl, and LIBCURL_PROTOCOL_yyy
+# where yyy are the various protocols supported by libcurl. Both xxx
+# and yyy are capitalized. See the list of AH_TEMPLATEs at the top of
+# the macro for the complete list of possible defines. Shell
+# variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also
+# defined to 'yes' for those features and protocols that were found.
+# Note that xxx and yyy keep the same capitalization as in the
+# curl-config list (e.g. it's "HTTP" and not "http").
+#
+# Users may override the detected values by doing something like:
+# CURL_LIB="-lcurl" CURL_INCLUDE="-I/usr/myinclude" ./configure
+#
+# For the sake of sanity, this macro assumes that any libcurl that is
+# found is after version 7.7.2, the first version that included the
+# curl-config script. Note that it is very important for people
+# packaging binary versions of libcurl to include this script!
+# Without curl-config, we can only guess what protocols are available,
+# or use curl_version_info to figure it out at runtime.
+
+AC_DEFUN([AST_LIBCURL_CHECK_CONFIG],
+[
+ AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL])
+ AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4])
+ AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6])
+ AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz])
+ AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS])
+ AH_TEMPLATE([LIBCURL_FEATURE_IDN],[Defined if libcurl supports IDN])
+ AH_TEMPLATE([LIBCURL_FEATURE_SSPI],[Defined if libcurl supports SSPI])
+ AH_TEMPLATE([LIBCURL_FEATURE_NTLM],[Defined if libcurl supports NTLM])
+
+ AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT])
+ AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP])
+
+ AC_ARG_WITH(libcurl,
+ AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]),
+ [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])])
+
+ if test "$_libcurl_with" != "no" ; then
+
+ AC_PROG_AWK
+
+ _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'"
+
+ _libcurl_try_link=yes
+
+ if test -d "$_libcurl_with" ; then
+ CURL_INCLUDE="-I$withval/include"
+ _libcurl_ldflags="-L$withval/lib"
+ AC_PATH_PROG([_libcurl_config],[curl-config],["$withval/bin"],
+ ["$withval/bin"])
+ else
+ AC_PATH_PROG([_libcurl_config],[curl-config])
+ fi
+
+ if test x$_libcurl_config != "x" ; then
+ AC_CACHE_CHECK([for the version of libcurl],
+ [libcurl_cv_lib_curl_version],
+ [libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`])
+
+ _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse`
+ _libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse`
+
+ if test $_libcurl_wanted -gt 0 ; then
+ AC_CACHE_CHECK([for libcurl >= version $2],
+ [libcurl_cv_lib_version_ok],
+ [
+ if test $_libcurl_version -ge $_libcurl_wanted ; then
+ libcurl_cv_lib_version_ok=yes
+ else
+ libcurl_cv_lib_version_ok=no
+ fi
+ ])
+ fi
+
+ if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then
+ if test x"$CURL_INCLUDE" = "x" ; then
+ CURL_INCLUDE=`$_libcurl_config --cflags`
+ fi
+ if test x"$CURL_LIB" = "x" ; then
+ CURL_LIB=`$_libcurl_config --libs`
+
+ # This is so silly, but Apple actually has a bug in their
+ # curl-config script. Fixed in Tiger, but there are still
+ # lots of Panther installs around.
+ case "${host}" in
+ powerpc-apple-darwin7*)
+ CURL_LIB=`echo $CURL_LIB | sed -e 's|-arch i386||g'`
+ ;;
+ esac
+ fi
+
+ # All curl-config scripts support --feature
+ _libcurl_features=`$_libcurl_config --feature`
+
+ # Is it modern enough to have --protocols? (7.12.4)
+ if test $_libcurl_version -ge 461828 ; then
+ _libcurl_protocols=`$_libcurl_config --protocols`
+ fi
+ else
+ _libcurl_try_link=no
+ fi
+
+ unset _libcurl_wanted
+ fi
+
+ if test $_libcurl_try_link = yes ; then
+
+ # we didn't find curl-config, so let's see if the user-supplied
+ # link line (or failing that, "-lcurl") is enough.
+ CURL_LIB=${CURL_LIB-"$_libcurl_ldflags -lcurl"}
+
+ AC_CACHE_CHECK([whether libcurl is usable],
+ [libcurl_cv_lib_curl_usable],
+ [
+ _libcurl_save_cppflags=$CPPFLAGS
+ CPPFLAGS="$CURL_INCLUDE $CPPFLAGS"
+ _libcurl_save_libs=$LIBS
+ LIBS="$CURL_LIB $LIBS"
+
+ AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <curl/curl.h>],[
+/* Try and use a few common options to force a failure if we are
+ missing symbols or can't link. */
+int x;
+curl_easy_setopt(NULL,CURLOPT_URL,NULL);
+x=CURL_ERROR_SIZE;
+x=CURLOPT_WRITEFUNCTION;
+x=CURLOPT_FILE;
+x=CURLOPT_ERRORBUFFER;
+x=CURLOPT_STDERR;
+x=CURLOPT_VERBOSE;
+]),libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no)
+
+ CPPFLAGS=$_libcurl_save_cppflags
+ LIBS=$_libcurl_save_libs
+ unset _libcurl_save_cppflags
+ unset _libcurl_save_libs
+ ])
+
+ if test $libcurl_cv_lib_curl_usable = yes ; then
+
+ # Does curl_free() exist in this version of libcurl?
+ # If not, fake it with free()
+
+ _libcurl_save_cppflags=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS $CURL_INCLUDE"
+ _libcurl_save_libs=$LIBS
+ LIBS="$LIBS $CURL_LIB"
+
+ AC_CHECK_FUNC(curl_free,,
+ AC_DEFINE(curl_free,free,
+ [Define curl_free() as free() if our version of curl lacks curl_free.]))
+
+ CPPFLAGS=$_libcurl_save_cppflags
+ LIBS=$_libcurl_save_libs
+ unset _libcurl_save_cppflags
+ unset _libcurl_save_libs
+
+ AC_DEFINE(HAVE_CURL,1,
+ [Define to 1 if you have a functional curl library.])
+ AC_SUBST(CURL_INCLUDE)
+ AC_SUBST(CURL_LIB)
+ PBX_CURL=1
+
+ for _libcurl_feature in $_libcurl_features ; do
+ AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1])
+ eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes
+ done
+
+ if test "x$_libcurl_protocols" = "x" ; then
+
+ # We don't have --protocols, so just assume that all
+ # protocols are available
+ _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT"
+
+ if test x$libcurl_feature_SSL = xyes ; then
+ _libcurl_protocols="$_libcurl_protocols HTTPS"
+
+ # FTPS wasn't standards-compliant until version
+ # 7.11.0
+ if test $_libcurl_version -ge 461568; then
+ _libcurl_protocols="$_libcurl_protocols FTPS"
+ fi
+ fi
+ fi
+
+ for _libcurl_protocol in $_libcurl_protocols ; do
+ AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1])
+ eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes
+ done
+ else
+ unset CURL_LIB
+ unset CURL_INCLUDE
+ PBX_CURL=0
+ fi
+ fi
+
+ unset _libcurl_try_link
+ unset _libcurl_version_parse
+ unset _libcurl_config
+ unset _libcurl_feature
+ unset _libcurl_features
+ unset _libcurl_protocol
+ unset _libcurl_protocols
+ unset _libcurl_version
+ unset _libcurl_ldflags
+ fi
+
+ if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then
+ # This is the IF-NO path
+ ifelse([$4],,:,[$4])
+ else
+ # This is the IF-YES path
+ ifelse([$3],,:,[$3])
+ fi
+
+ unset _libcurl_with
+])dnl
+
diff --git a/configure b/configure
index a1a81b60a..b0cdd1fa1 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.ac Revision: 210066 .
+# From configure.ac Revision: 214436 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for asterisk 1.4.
#
@@ -930,7 +930,7 @@ PKGCONFIG
PBX_GTK2
GTK2_INCLUDE
GTK2_LIB
-CURL_CONFIG
+_libcurl_config
LTLIBOBJS'
ac_subst_files=''
ac_precious_vars='build_alias
@@ -1569,6 +1569,7 @@ Optional Packages:
--with-vpb=PATH use Voicetronix API files in PATH
--with-z=PATH use zlib files in PATH
--with-zaptel=PATH use Zaptel files in PATH
+ --with-libcurl=DIR look for the curl library in DIR
Some influential environment variables:
CC C compiler command
@@ -31887,28 +31888,124 @@ fi
-if test "${USE_CURL}" != "no"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}curl-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}curl-config; ac_word=$2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-libcurl was given.
+if test "${with_libcurl+set}" = set; then
+ withval=$with_libcurl; _libcurl_with=$withval
+else
+ _libcurl_with=yes
+fi
+
+
+ if test "$_libcurl_with" != "no" ; then
+
+ for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AWK="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+
+ _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[1]+256*A[2]+A[3]; print X;}'"
+
+ _libcurl_try_link=yes
+
+ if test -d "$_libcurl_with" ; then
+ CURL_INCLUDE="-I$withval/include"
+ _libcurl_ldflags="-L$withval/lib"
+ # Extract the first word of "curl-config", so it can be a program name with args.
+set dummy curl-config; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_CURL_CONFIG+set}" = set; then
+if test "${ac_cv_path__libcurl_config+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- case $CURL_CONFIG in
+ case $_libcurl_config in
[\\/]* | ?:[\\/]*)
- ac_cv_path_CURL_CONFIG="$CURL_CONFIG" # Let the user override the test with a path.
+ ac_cv_path__libcurl_config="$_libcurl_config" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
+for as_dir in "$withval/bin"
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_CURL_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ ac_cv_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -31916,32 +32013,31 @@ done
done
IFS=$as_save_IFS
+ test -z "$ac_cv_path__libcurl_config" && ac_cv_path__libcurl_config=""$withval/bin""
;;
esac
fi
-CURL_CONFIG=$ac_cv_path_CURL_CONFIG
-if test -n "$CURL_CONFIG"; then
- { echo "$as_me:$LINENO: result: $CURL_CONFIG" >&5
-echo "${ECHO_T}$CURL_CONFIG" >&6; }
+_libcurl_config=$ac_cv_path__libcurl_config
+if test -n "$_libcurl_config"; then
+ { echo "$as_me:$LINENO: result: $_libcurl_config" >&5
+echo "${ECHO_T}$_libcurl_config" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
-fi
-if test -z "$ac_cv_path_CURL_CONFIG"; then
- ac_pt_CURL_CONFIG=$CURL_CONFIG
- # Extract the first word of "curl-config", so it can be a program name with args.
+ else
+ # Extract the first word of "curl-config", so it can be a program name with args.
set dummy curl-config; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_path_ac_pt_CURL_CONFIG+set}" = set; then
+if test "${ac_cv_path__libcurl_config+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- case $ac_pt_CURL_CONFIG in
+ case $_libcurl_config in
[\\/]* | ?:[\\/]*)
- ac_cv_path_ac_pt_CURL_CONFIG="$ac_pt_CURL_CONFIG" # Let the user override the test with a path.
+ ac_cv_path__libcurl_config="$_libcurl_config" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -31951,7 +32047,7 @@ do
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_ac_pt_CURL_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ ac_cv_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
@@ -31962,45 +32058,99 @@ IFS=$as_save_IFS
;;
esac
fi
-ac_pt_CURL_CONFIG=$ac_cv_path_ac_pt_CURL_CONFIG
-if test -n "$ac_pt_CURL_CONFIG"; then
- { echo "$as_me:$LINENO: result: $ac_pt_CURL_CONFIG" >&5
-echo "${ECHO_T}$ac_pt_CURL_CONFIG" >&6; }
+_libcurl_config=$ac_cv_path__libcurl_config
+if test -n "$_libcurl_config"; then
+ { echo "$as_me:$LINENO: result: $_libcurl_config" >&5
+echo "${ECHO_T}$_libcurl_config" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi
- if test "x$ac_pt_CURL_CONFIG" = x; then
- CURL_CONFIG="No"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- CURL_CONFIG=$ac_pt_CURL_CONFIG
- fi
+
+ fi
+
+ if test x$_libcurl_config != "x" ; then
+ { echo "$as_me:$LINENO: checking for the version of libcurl" >&5
+echo $ECHO_N "checking for the version of libcurl... $ECHO_C" >&6; }
+if test "${libcurl_cv_lib_curl_version+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $2}'`
+fi
+{ echo "$as_me:$LINENO: result: $libcurl_cv_lib_curl_version" >&5
+echo "${ECHO_T}$libcurl_cv_lib_curl_version" >&6; }
+
+ _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse`
+ _libcurl_wanted=`echo 7.10.1 | $_libcurl_version_parse`
+
+ if test $_libcurl_wanted -gt 0 ; then
+ { echo "$as_me:$LINENO: checking for libcurl >= version 7.10.1" >&5
+echo $ECHO_N "checking for libcurl >= version 7.10.1... $ECHO_C" >&6; }
+if test "${libcurl_cv_lib_version_ok+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- CURL_CONFIG="$ac_cv_path_CURL_CONFIG"
+
+ if test $_libcurl_version -ge $_libcurl_wanted ; then
+ libcurl_cv_lib_version_ok=yes
+ else
+ libcurl_cv_lib_version_ok=no
+ fi
+
fi
+{ echo "$as_me:$LINENO: result: $libcurl_cv_lib_version_ok" >&5
+echo "${ECHO_T}$libcurl_cv_lib_version_ok" >&6; }
+ fi
+
+ if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then
+ if test x"$CURL_INCLUDE" = "x" ; then
+ CURL_INCLUDE=`$_libcurl_config --cflags`
+ fi
+ if test x"$CURL_LIB" = "x" ; then
+ CURL_LIB=`$_libcurl_config --libs`
+
+ # This is so silly, but Apple actually has a bug in their
+ # curl-config script. Fixed in Tiger, but there are still
+ # lots of Panther installs around.
+ case "${host}" in
+ powerpc-apple-darwin7*)
+ CURL_LIB=`echo $CURL_LIB | sed -e 's|-arch i386||g'`
+ ;;
+ esac
+ fi
+
+ # All curl-config scripts support --feature
+ _libcurl_features=`$_libcurl_config --feature`
+
+ # Is it modern enough to have --protocols? (7.12.4)
+ if test $_libcurl_version -ge 461828 ; then
+ _libcurl_protocols=`$_libcurl_config --protocols`
+ fi
+ else
+ _libcurl_try_link=no
+ fi
+
+ unset _libcurl_wanted
+ fi
- if test ! x"${CURL_CONFIG}" = xNo; then
- # check for version
- if test $(printf "%d" 0x$(${CURL_CONFIG} --vernum)) -ge $(printf "%d" 0x070907); then
- CURL_INCLUDE=$(${CURL_CONFIG} --cflags)
- CURL_LIB=$(${CURL_CONFIG} --libs)
+ if test $_libcurl_try_link = yes ; then
- { echo "$as_me:$LINENO: checking for curl_version() in curl/curl.h" >&5
-echo $ECHO_N "checking for curl_version() in curl/curl.h... $ECHO_C" >&6; }
- saved_cppflags="${CPPFLAGS}"
- CPPFLAGS="${CPPFLAGS} ${CURL_INCLUDE}"
- cat >conftest.$ac_ext <<_ACEOF
+ # we didn't find curl-config, so let's see if the user-supplied
+ # link line (or failing that, "-lcurl") is enough.
+ CURL_LIB=${CURL_LIB-"$_libcurl_ldflags -lcurl"}
+
+ { echo "$as_me:$LINENO: checking whether libcurl is usable" >&5
+echo $ECHO_N "checking whether libcurl is usable... $ECHO_C" >&6; }
+if test "${libcurl_cv_lib_curl_usable+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+ _libcurl_save_cppflags=$CPPFLAGS
+ CPPFLAGS="$CURL_INCLUDE $CPPFLAGS"
+ _libcurl_save_libs=$LIBS
+ LIBS="$CURL_LIB $LIBS"
+
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -32010,20 +32160,30 @@ cat >>conftest.$ac_ext <<_ACEOF
int
main ()
{
-curl_version();
+
+/* Try and use a few common options to force a failure if we are
+ missing symbols or can't link. */
+int x;
+curl_easy_setopt(NULL,CURLOPT_URL,NULL);
+x=CURL_ERROR_SIZE;
+x=CURLOPT_WRITEFUNCTION;
+x=CURLOPT_FILE;
+x=CURLOPT_ERRORBUFFER;
+x=CURLOPT_STDERR;
+x=CURLOPT_VERBOSE;
+
;
return 0;
}
-
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
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
+ (eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
@@ -32032,37 +32192,210 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ libcurl_cv_lib_curl_usable=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
- { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
- ac_cv_curl_h="yes"
+ libcurl_cv_lib_curl_usable=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+
+ CPPFLAGS=$_libcurl_save_cppflags
+ LIBS=$_libcurl_save_libs
+ unset _libcurl_save_cppflags
+ unset _libcurl_save_libs
+
+fi
+{ echo "$as_me:$LINENO: result: $libcurl_cv_lib_curl_usable" >&5
+echo "${ECHO_T}$libcurl_cv_lib_curl_usable" >&6; }
+ if test $libcurl_cv_lib_curl_usable = yes ; then
+
+ # Does curl_free() exist in this version of libcurl?
+ # If not, fake it with free()
+
+ _libcurl_save_cppflags=$CPPFLAGS
+ CPPFLAGS="$CPPFLAGS $CURL_INCLUDE"
+ _libcurl_save_libs=$LIBS
+ LIBS="$LIBS $CURL_LIB"
+
+ { echo "$as_me:$LINENO: checking for curl_free" >&5
+echo $ECHO_N "checking for curl_free... $ECHO_C" >&6; }
+if test "${ac_cv_func_curl_free+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define curl_free to an innocuous variant, in case <limits.h> declares curl_free.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define curl_free innocuous_curl_free
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char curl_free (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef curl_free
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char curl_free ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_curl_free || defined __stub___curl_free
+choke me
+#endif
+
+int
+main ()
+{
+return curl_free ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+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_link") 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_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_func_curl_free=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
+ ac_cv_func_curl_free=no
+fi
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
- ac_cv_curl_h="no"
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_curl_free" >&5
+echo "${ECHO_T}$ac_cv_func_curl_free" >&6; }
+if test $ac_cv_func_curl_free = yes; then
+ :
+else
+cat >>confdefs.h <<\_ACEOF
+#define curl_free free
+_ACEOF
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- CPPFLAGS="${saved_cppflags}"
- if test "${ac_cv_curl_h}" = "yes"; then
- PBX_CURL=1
+
+ CPPFLAGS=$_libcurl_save_cppflags
+ LIBS=$_libcurl_save_libs
+ unset _libcurl_save_cppflags
+ unset _libcurl_save_libs
+
cat >>confdefs.h <<\_ACEOF
#define HAVE_CURL 1
_ACEOF
- fi
- fi
- fi
-fi
+
+
+
+ for _libcurl_feature in $_libcurl_features ; do
+ cat >>confdefs.h <<_ACEOF
+#define `echo "libcurl_feature_$_libcurl_feature" | $as_tr_cpp` 1
+_ACEOF
+
+ eval `echo "libcurl_feature_$_libcurl_feature" | $as_tr_sh`=yes
+ done
+
+ if test "x$_libcurl_protocols" = "x" ; then
+
+ # We don't have --protocols, so just assume that all
+ # protocols are available
+ _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT"
+
+ if test x$libcurl_feature_SSL = xyes ; then
+ _libcurl_protocols="$_libcurl_protocols HTTPS"
+
+ # FTPS wasn't standards-compliant until version
+ # 7.11.0
+ if test $_libcurl_version -ge 461568; then
+ _libcurl_protocols="$_libcurl_protocols FTPS"
+ fi
+ fi
+ fi
+
+ for _libcurl_protocol in $_libcurl_protocols ; do
+ cat >>confdefs.h <<_ACEOF
+#define `echo "libcurl_protocol_$_libcurl_protocol" | $as_tr_cpp` 1
+_ACEOF
+
+ eval `echo "libcurl_protocol_$_libcurl_protocol" | $as_tr_sh`=yes
+ done
+ else
+ unset CURL_LIB
+ unset CURL_INCLUDE
+ fi
+ fi
+
+ unset _libcurl_try_link
+ unset _libcurl_version_parse
+ unset _libcurl_config
+ unset _libcurl_feature
+ unset _libcurl_features
+ unset _libcurl_protocol
+ unset _libcurl_protocols
+ unset _libcurl_version
+ unset _libcurl_ldflags
+ fi
+
+ if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then
+ # This is the IF-NO path
+ PBX_CURL=0
+ else
+ # This is the IF-YES path
+ PBX_CURL=1
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_CURL 1
+_ACEOF
+
+
+
+
+ fi
+
+ unset _libcurl_with
+
ac_config_files="$ac_config_files build_tools/menuselect-deps makeopts channels/h323/Makefile"
@@ -33118,7 +33451,7 @@ PKGCONFIG!$PKGCONFIG$ac_delim
PBX_GTK2!$PBX_GTK2$ac_delim
GTK2_INCLUDE!$GTK2_INCLUDE$ac_delim
GTK2_LIB!$GTK2_LIB$ac_delim
-CURL_CONFIG!$CURL_CONFIG$ac_delim
+_libcurl_config!$_libcurl_config$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
diff --git a/configure.ac b/configure.ac
index 4bf815fd1..46281d57b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1650,37 +1650,7 @@ AC_SUBST(PBX_GTK2)
AC_SUBST(GTK2_INCLUDE)
AC_SUBST(GTK2_LIB)
-if test "${USE_CURL}" != "no"; then
- AC_PATH_TOOL([CURL_CONFIG], [curl-config], No)
- if test ! x"${CURL_CONFIG}" = xNo; then
- # check for version
- if test $(printf "%d" 0x$(${CURL_CONFIG} --vernum)) -ge $(printf "%d" 0x070907); then
- CURL_INCLUDE=$(${CURL_CONFIG} --cflags)
- CURL_LIB=$(${CURL_CONFIG} --libs)
-
- AC_MSG_CHECKING(for curl_version() in curl/curl.h)
- saved_cppflags="${CPPFLAGS}"
- CPPFLAGS="${CPPFLAGS} ${CURL_INCLUDE}"
- AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [#include <curl/curl.h>],
- [curl_version();])
- ],[
- AC_MSG_RESULT(yes)
- ac_cv_curl_h="yes"
- ],[
- AC_MSG_RESULT(no)
- ac_cv_curl_h="no"
- ]
- )
- CPPFLAGS="${saved_cppflags}"
- if test "${ac_cv_curl_h}" = "yes"; then
- PBX_CURL=1
- AC_DEFINE([HAVE_CURL], 1, [Define if your system has the curl libraries.])
- fi
- fi
- fi
-fi
+AST_LIBCURL_CHECK_CONFIG([], [7.10.1])
AC_CONFIG_FILES([build_tools/menuselect-deps makeopts channels/h323/Makefile])
AC_OUTPUT
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index f22758fdc..af6f19a29 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -576,6 +576,57 @@
/* Define to 1 if the system has the type `_Bool'. */
#undef HAVE__BOOL
+/* Defined if libcurl supports AsynchDNS */
+#undef LIBCURL_FEATURE_ASYNCHDNS
+
+/* Defined if libcurl supports IDN */
+#undef LIBCURL_FEATURE_IDN
+
+/* Defined if libcurl supports IPv6 */
+#undef LIBCURL_FEATURE_IPV6
+
+/* Defined if libcurl supports KRB4 */
+#undef LIBCURL_FEATURE_KRB4
+
+/* Defined if libcurl supports libz */
+#undef LIBCURL_FEATURE_LIBZ
+
+/* Defined if libcurl supports NTLM */
+#undef LIBCURL_FEATURE_NTLM
+
+/* Defined if libcurl supports SSL */
+#undef LIBCURL_FEATURE_SSL
+
+/* Defined if libcurl supports SSPI */
+#undef LIBCURL_FEATURE_SSPI
+
+/* Defined if libcurl supports DICT */
+#undef LIBCURL_PROTOCOL_DICT
+
+/* Defined if libcurl supports FILE */
+#undef LIBCURL_PROTOCOL_FILE
+
+/* Defined if libcurl supports FTP */
+#undef LIBCURL_PROTOCOL_FTP
+
+/* Defined if libcurl supports FTPS */
+#undef LIBCURL_PROTOCOL_FTPS
+
+/* Defined if libcurl supports HTTP */
+#undef LIBCURL_PROTOCOL_HTTP
+
+/* Defined if libcurl supports HTTPS */
+#undef LIBCURL_PROTOCOL_HTTPS
+
+/* Defined if libcurl supports LDAP */
+#undef LIBCURL_PROTOCOL_LDAP
+
+/* Defined if libcurl supports TELNET */
+#undef LIBCURL_PROTOCOL_TELNET
+
+/* Defined if libcurl supports TFTP */
+#undef LIBCURL_PROTOCOL_TFTP
+
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
@@ -690,6 +741,9 @@
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
+/* Define curl_free() as free() if our version of curl lacks curl_free. */
+#undef curl_free
+
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t