From f85be6ffa11c05b9cf20c4fc214f7f3a601db733 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 14 Mar 2007 18:59:25 +0000 Subject: [PATCH] add detection of system libcurl, and if it is available use that instead of in tree curl build. Implemented just in mod_shout so far git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4592 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- Makefile.in | 7 +- acsite.m4 | 1 + build/modmake.rules.in | 23 +- configure | 564 +++++++++++++++++++++++++++-- configure.in | 3 + src/include/switch_private.h.in | 57 +++ src/mod/Makefile.in | 5 + src/mod/formats/mod_shout/Makefile | 12 +- 8 files changed, 634 insertions(+), 38 deletions(-) diff --git a/Makefile.in b/Makefile.in index 99feecc24c..5cd3907a38 100644 --- a/Makefile.in +++ b/Makefile.in @@ -62,6 +62,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/build/config/ac_gcc_archflag.m4 \ $(top_srcdir)/build/config/ac_gcc_x86_cpuid.m4 \ $(top_srcdir)/libs/apr/build/apr_common.m4 \ + $(top_srcdir)/libs/curl/docs/libcurl/libcurl.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -196,6 +197,9 @@ ISLINUX_TRUE = @ISLINUX_TRUE@ ISMAC_FALSE = @ISMAC_FALSE@ ISMAC_TRUE = @ISMAC_TRUE@ LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBCURL_DEPS = @LIBCURL_DEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = $(switch_builddir)/libtool @@ -225,6 +229,7 @@ WANT_DEBUG_FALSE = @WANT_DEBUG_FALSE@ WANT_DEBUG_TRUE = @WANT_DEBUG_TRUE@ WGET = @WGET@ ZCAT = @ZCAT@ +_libcurl_config = @_libcurl_config@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ @@ -824,7 +829,7 @@ distclean-tags: distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) - $(mkdir_p) $(distdir)/build $(distdir)/build/config $(distdir)/libs/apr/build $(distdir)/src/include + $(mkdir_p) $(distdir)/build $(distdir)/build/config $(distdir)/libs/apr/build $(distdir)/libs/curl/docs/libcurl $(distdir)/src/include @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ list='$(DISTFILES)'; for file in $$list; do \ diff --git a/acsite.m4 b/acsite.m4 index 56b41940d6..8eebc8e202 100644 --- a/acsite.m4 +++ b/acsite.m4 @@ -5,3 +5,4 @@ m4_include([build/config/ax_check_compiler_flags.m4]) m4_include([build/config/ac_gcc_archflag.m4]) m4_include([build/config/ac_gcc_x86_cpuid.m4]) m4_include([libs/apr/build/apr_common.m4]) +m4_include([libs/curl/docs/libcurl/libcurl.m4]) diff --git a/build/modmake.rules.in b/build/modmake.rules.in index d64b0a26fd..ee49152771 100644 --- a/build/modmake.rules.in +++ b/build/modmake.rules.in @@ -15,7 +15,17 @@ LTUNINSTALL=$(LIBTOOL) --mode=uninstall rm -f CCLD = $(CC) CXXLD = $(CXX) -LDFLAGS=@SWITCH_AM_LDFLAGS@ @LDFLAGS@ +LIBCURL_DEPS=@LIBCURL_DEPS@ +LIBCURL=@LIBCURL@ +LIBCURL_CPPFLAGS=@LIBCURL_CPPFLAGS@ +CURL_DIR=$(switch_srcdir)/libs/curl +CURLLA=$(CURL_DIR)/lib/libcurl.la + +OUR_CFLAGS=$(shell test -z "$(WANT_CURL)" || echo $(LIBCURL_CPPFLAGS)) +OUR_LDFLAGS=$(shell test -z "$(WANT_CURL)" || echo $(LIBCURL)) +OUR_DEPS=$(shell test -z "$(WANT_CURL)" || if test ! -z "$(LIBCURL_DEPS)"; then echo $(CURLLA); fi) + +LDFLAGS=@SWITCH_AM_LDFLAGS@ @LDFLAGS@ $(OUR_LDFLAGS) LIBS=$(switch_builddir)/libfreeswitch.la DEFS=@DEFS@ PREFIX = @prefix@ @@ -26,8 +36,8 @@ OSARCH=$(shell uname -s) DYNAMIC_LIB_EXTEN = @DYNAMIC_LIB_EXTEN@ SOLINK = @SOLINK@ -ALL_CFLAGS = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CFLAGS@ @CFLAGS@ -D_GNU_SOURCE -ALL_CXXFLAGS = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CXXFLAGS@ @CXXFLAGS@ -D_GNU_SOURC +ALL_CFLAGS = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CFLAGS@ @CFLAGS@ -D_GNU_SOURCE $(OUR_CFLAGS) +ALL_CXXFLAGS = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CXXFLAGS@ @CXXFLAGS@ -D_GNU_SOURC $(OUR_CFLAGS) COMPILE = $(CC) $(ALL_CFLAGS) $(DEFS) LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(COMPILE) @@ -57,7 +67,10 @@ Makefile: echo include $$rulesdir/build/modmake.rules >> Makefile ; \ fi ; -$(MODNAME).$(DYNAMIC_LIB_EXTEN): $(LOCAL_LIBADD) $(LOCAL_OBJS) $(SOURCEFILE) $(MODNAME).o +$(CURLLA): + cd $(CURL_DIR) && $(MAKE) + +$(MODNAME).$(DYNAMIC_LIB_EXTEN): $(LOCAL_LIBADD) $(OUR_DEPS) $(LOCAL_OBJS) $(SOURCEFILE) $(MODNAME).o @if test -f $(CSOURCEFILE); then \ echo $(LINK) $(SOLINK) $(MODNAME).o -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(LOCAL_LIBADD); \ $(LINK) $(SOLINK) $(MODNAME).o -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(LOCAL_LIBADD); \ @@ -66,6 +79,8 @@ $(MODNAME).$(DYNAMIC_LIB_EXTEN): $(LOCAL_LIBADD) $(LOCAL_OBJS) $(SOURCEFILE) $(M $(CXXLINK) $(SOLINK) $(MODNAME).o -o $(MODNAME).$(DYNAMIC_LIB_EXTEN) $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(LOCAL_LIBADD); \ fi; + + mod_clean: rm -fr *.$(DYNAMIC_LIB_EXTEN) *.o *~ .libs diff --git a/configure b/configure index d4d5e2d362..7414839629 100755 --- a/configure +++ b/configure @@ -490,7 +490,7 @@ ac_subdirs_all="$ac_subdirs_all libs/sofia-sip" ac_subdirs_all="$ac_subdirs_all libs/speex" ac_subdirs_all="$ac_subdirs_all libs/xmlrpc-c" ac_subdirs_all="$ac_subdirs_all libs/portaudio" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar switch_srcdir switch_builddir moddir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PRTDIAG WANT_DEBUG_TRUE WANT_DEBUG_FALSE SWITCH_AM_CFLAGS SWITCH_AM_CXXFLAGS SWITCH_AM_LDFLAGS SOLINK DYNAMIC_LIB_EXTEN LIBOBJS voidp_size short_value int_value long_value int64_value size_t_value ssize_t_value int64_t_fmt uint64_t_fmt ssize_t_fmt size_t_fmt ZCAT TAR WGET CURL GETLIB CRASHPROT_TRUE CRASHPROT_FALSE ISLINUX_TRUE ISLINUX_FALSE ISMAC_TRUE ISMAC_FALSE IS64BITLINUX_TRUE IS64BITLINUX_FALSE subdirs LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar switch_srcdir switch_builddir moddir CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PRTDIAG WANT_DEBUG_TRUE WANT_DEBUG_FALSE SWITCH_AM_CFLAGS SWITCH_AM_CXXFLAGS SWITCH_AM_LDFLAGS SOLINK DYNAMIC_LIB_EXTEN LIBOBJS voidp_size short_value int_value long_value int64_value size_t_value ssize_t_value int64_t_fmt uint64_t_fmt ssize_t_fmt size_t_fmt ZCAT TAR WGET CURL GETLIB _libcurl_config LIBCURL_CPPFLAGS LIBCURL LIBCURL_DEPS CRASHPROT_TRUE CRASHPROT_FALSE ISLINUX_TRUE ISLINUX_FALSE ISMAC_TRUE ISMAC_FALSE IS64BITLINUX_TRUE IS64BITLINUX_FALSE subdirs LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1079,6 +1079,7 @@ Optional Packages: include additional configurations [automatic] --with-gcc-arch= use architecture for gcc -march/-mtune, instead of guessing + --with-libcurl=DIR look for the curl library in DIR Some influential environment variables: CC C compiler command @@ -3879,7 +3880,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3882 "configure"' > conftest.$ac_ext + echo '#line 3883 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5478,7 +5479,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5481:" \ +echo "$as_me:5482:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6541,11 +6542,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6544: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6545: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6548: \$? = $ac_status" >&5 + echo "$as_me:6549: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6809,11 +6810,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6812: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6813: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6816: \$? = $ac_status" >&5 + echo "$as_me:6817: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6913,11 +6914,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6916: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6917: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6920: \$? = $ac_status" >&5 + echo "$as_me:6921: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9258,7 +9259,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:11702: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11705: \$? = $ac_status" >&5 + echo "$as_me:11706: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -11802,11 +11803,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11805: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11806: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11809: \$? = $ac_status" >&5 + echo "$as_me:11810: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -13372,11 +13373,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13375: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13376: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13379: \$? = $ac_status" >&5 + echo "$as_me:13380: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13476,11 +13477,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13479: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13480: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13483: \$? = $ac_status" >&5 + echo "$as_me:13484: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15679,11 +15680,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15682: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15683: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15686: \$? = $ac_status" >&5 + echo "$as_me:15687: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -15947,11 +15948,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15950: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15951: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15954: \$? = $ac_status" >&5 + echo "$as_me:15955: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16051,11 +16052,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16054: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16055: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16058: \$? = $ac_status" >&5 + echo "$as_me:16059: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -25240,6 +25241,515 @@ GETLIB="cd $switch_srcdir/libs && ${SHELL} $switch_srcdir/build/getlib.sh" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# Check whether --with-libcurl or --without-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 $as_executable_p "$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 + +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 + LIBCURL_CPPFLAGS="-I$withval/include" + _libcurl_ldflags="-L$withval/lib" + # Extract the first word of ""$withval/bin/curl-config"", so it can be a program name with args. +set dummy "$withval/bin/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__libcurl_config+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $_libcurl_config in + [\\/]* | ?:[\\/]*) + 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 +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + 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 +done +done + + ;; +esac +fi +_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 + + 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__libcurl_config+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $_libcurl_config in + [\\/]* | ?:[\\/]*) + 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 +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + 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 +done +done + + ;; +esac +fi +_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 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.13.0 | $_libcurl_version_parse` + + if test $_libcurl_wanted -gt 0 ; then + echo "$as_me:$LINENO: checking for libcurl >= version 7.13.0" >&5 +echo $ECHO_N "checking for libcurl >= version 7.13.0... $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"$LIBCURL_CPPFLAGS" = "x" ; then + LIBCURL_CPPFLAGS=`$_libcurl_config --cflags` + fi + if test x"$LIBCURL" = "x" ; then + LIBCURL=`$_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*) + LIBCURL=`echo $LIBCURL | 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. + LIBCURL=${LIBCURL-"$_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="$LIBCURL_CPPFLAGS $CPPFLAGS" + _libcurl_save_libs=$LIBS + LIBS="$LIBCURL $LIBS" + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ + +/* 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 conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + libcurl_cv_lib_curl_usable=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +libcurl_cv_lib_curl_usable=no +fi +rm -f conftest.err conftest.$ac_objext \ + 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 $LIBCURL_CPPFLAGS" + _libcurl_save_libs=$LIBS + LIBS="$LIBS $LIBCURL" + + 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 gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +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 +#else +char (*f) () = curl_free; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != curl_free; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; 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 +rm -f conftest.err conftest.$ac_objext \ + 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 + + + CPPFLAGS=$_libcurl_save_cppflags + LIBS=$_libcurl_save_libs + unset _libcurl_save_cppflags + unset _libcurl_save_libs + + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBCURL 1 +_ACEOF + + + + + 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 LIBCURL + unset LIBCURL_CPPFLAGS + 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 + LIBCURL_DEPS='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL_CPPFLAGS='-I${switch_srcdir}/libs/curl/include' + else + # This is the IF-YES path + LIBCURL_DEPS='' + fi + + unset _libcurl_with + + + # Check whether --enable-crash-protection or --disable-crash-protection was given. if test "${enable_crash_protection+set}" = set; then enableval="$enable_crash_protection" @@ -26167,6 +26677,10 @@ s,@TAR@,$TAR,;t t s,@WGET@,$WGET,;t t s,@CURL@,$CURL,;t t s,@GETLIB@,$GETLIB,;t t +s,@_libcurl_config@,$_libcurl_config,;t t +s,@LIBCURL_CPPFLAGS@,$LIBCURL_CPPFLAGS,;t t +s,@LIBCURL@,$LIBCURL,;t t +s,@LIBCURL_DEPS@,$LIBCURL_DEPS,;t t s,@CRASHPROT_TRUE@,$CRASHPROT_TRUE,;t t s,@CRASHPROT_FALSE@,$CRASHPROT_FALSE,;t t s,@ISLINUX_TRUE@,$ISLINUX_TRUE,;t t diff --git a/configure.in b/configure.in index 7dac9ab158..ee8d08e83d 100644 --- a/configure.in +++ b/configure.in @@ -282,6 +282,9 @@ GETLIB="cd $switch_srcdir/libs && ${SHELL} $switch_srcdir/build/getlib.sh" AC_SUBST(GETLIB) +LIBCURL_CHECK_CONFIG([yes], [7.13.0], [LIBCURL_DEPS=''], [LIBCURL_DEPS='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL_CPPFLAGS='-I${switch_srcdir}/libs/curl/include']) +AC_SUBST(LIBCURL_DEPS) + AC_ARG_ENABLE(crash-protection, [ --enable-crash-protection Compile with CRASH Protection],,[enable_crash_prot="no"]) diff --git a/src/include/switch_private.h.in b/src/include/switch_private.h.in index 3f31a26591..07dd146b40 100644 --- a/src/include/switch_private.h.in +++ b/src/include/switch_private.h.in @@ -16,6 +16,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H +/* Define to 1 if you have a functional curl library. */ +#undef HAVE_LIBCURL + /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC @@ -73,6 +76,57 @@ /* Define to 1 if you have the `vasprintf' function. */ #undef HAVE_VASPRINTF +/* 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 + /* Enable Optimization. */ #undef OPTIMZER @@ -139,6 +193,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 `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus diff --git a/src/mod/Makefile.in b/src/mod/Makefile.in index 08894c9563..4e0c9c40ba 100644 --- a/src/mod/Makefile.in +++ b/src/mod/Makefile.in @@ -46,6 +46,7 @@ am__aclocal_m4_deps = \ $(top_srcdir)/build/config/ac_gcc_archflag.m4 \ $(top_srcdir)/build/config/ac_gcc_x86_cpuid.m4 \ $(top_srcdir)/libs/apr/build/apr_common.m4 \ + $(top_srcdir)/libs/curl/docs/libcurl/libcurl.m4 \ $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) @@ -100,6 +101,9 @@ ISLINUX_TRUE = @ISLINUX_TRUE@ ISMAC_FALSE = @ISMAC_FALSE@ ISMAC_TRUE = @ISMAC_TRUE@ LDFLAGS = @LDFLAGS@ +LIBCURL = @LIBCURL@ +LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ +LIBCURL_DEPS = @LIBCURL_DEPS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ @@ -129,6 +133,7 @@ WANT_DEBUG_FALSE = @WANT_DEBUG_FALSE@ WANT_DEBUG_TRUE = @WANT_DEBUG_TRUE@ WGET = @WGET@ ZCAT = @ZCAT@ +_libcurl_config = @_libcurl_config@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ diff --git a/src/mod/formats/mod_shout/Makefile b/src/mod/formats/mod_shout/Makefile index 1a4a364e2f..e9297fa0c0 100644 --- a/src/mod/formats/mod_shout/Makefile +++ b/src/mod/formats/mod_shout/Makefile @@ -1,19 +1,18 @@ -BASE=../../../.. MODNAME=mod_shout LAME=lame-3.97 SHOUT=libshout-2.2.2 switch_srcdir=../../../.. +WANT_CURL=yes + LAME_DIR=$(switch_srcdir)/libs/$(LAME) SHOUT_DIR=$(switch_srcdir)/libs/$(SHOUT) -CURL_DIR=$(switch_srcdir)/libs/curl LAMELA=$(LAME_DIR)/libmp3lame/libmp3lame.la SHOUTLA=$(SHOUT_DIR)/src/libshout.la -CURLLA=$(CURL_DIR)/lib/libcurl.la -LOCAL_CFLAGS=-I$(CURL_DIR)/include -I$(SHOUT_DIR)/include -I$(LAME_DIR)/include -LOCAL_LIBADD=$(LAMELA) $(SHOUTLA) -lcurl +LOCAL_CFLAGS=-I$(SHOUT_DIR)/include -I$(LAME_DIR)/include +LOCAL_LIBADD=$(LAMELA) $(SHOUTLA) MP3OBJS=common.o dct64_i386.o decode_ntom.o layer3.o tabinit.o interface.o LOCAL_OBJS=$(MP3OBJS) @@ -36,9 +35,6 @@ $(SHOUT_DIR)/Makefile: $(SHOUTLA): $(SHOUT_DIR)/Makefile cd $(SHOUT_DIR) && $(MAKE) -$(CURLLA): - cd $(CURL_DIR) && $(MAKE) -