From f54272619e038f8c0c8edbd578865bceda55572d Mon Sep 17 00:00:00 2001 From: tilghman Date: Thu, 27 Aug 2009 21:47:49 +0000 Subject: Merged revisions 214518 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r214518 | tilghman | 2009-08-27 16:46:46 -0500 (Thu, 27 Aug 2009) | 14 lines Merged revisions 214517 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r214517 | tilghman | 2009-08-27 16:45:34 -0500 (Thu, 27 Aug 2009) | 7 lines 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.6.0@214519 f38db490-d61c-443f-a65b-d21fe96a405b --- configure | 475 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 401 insertions(+), 74 deletions(-) (limited to 'configure') diff --git a/configure b/configure index ef09ac5de..6c088da43 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 214153 . +# From configure.ac Revision: 214474 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for asterisk 1.6. # @@ -1006,7 +1006,7 @@ PBX_IXJUSER CONFIG_SDL CONFIG_GTK PKGCONFIG -CURL_CONFIG +_libcurl_config LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias @@ -1663,6 +1663,7 @@ Optional Packages: --with-vpb=PATH use Voicetronix API files in PATH --with-x11=PATH use X11 support files in PATH --with-z=PATH use zlib files in PATH + --with-libcurl=DIR look for the curl library in DIR Some influential environment variables: CC C compiler command @@ -38385,28 +38386,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 @@ -38414,32 +38511,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 @@ -38449,7 +38545,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 @@ -38460,45 +38556,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 - CURL_CONFIG="$ac_cv_path_CURL_CONFIG" + 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; } - 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) + _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse` + _libcurl_wanted=`echo 7.10.1 | $_libcurl_version_parse` - { 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 + 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 + + 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 $_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"} + + { 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 @@ -38508,20 +38658,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 @@ -38530,37 +38690,204 @@ 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 declares curl_free. + For example, HP-UX 11i 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 to if __STDC__ is defined, since + exists even on freestanding compilers. */ +#ifdef __STDC__ +# include +#else +# include +#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 + + + PBX_CURL=1 + + 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 + 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 + : + else + # This is the IF-YES path + : + fi + + unset _libcurl_with + ac_config_files="$ac_config_files build_tools/menuselect-deps makeopts channels/h323/Makefile" @@ -39719,7 +40046,7 @@ PBX_IXJUSER!$PBX_IXJUSER$ac_delim CONFIG_SDL!$CONFIG_SDL$ac_delim CONFIG_GTK!$CONFIG_GTK$ac_delim PKGCONFIG!$PKGCONFIG$ac_delim -CURL_CONFIG!$CURL_CONFIG$ac_delim +_libcurl_config!$_libcurl_config$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then -- cgit v1.2.3