]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-2936 please test on windows
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 11 May 2011 15:07:00 +0000 (10:07 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 11 May 2011 15:07:00 +0000 (10:07 -0500)
16 files changed:
Makefile.am
build/modmake.rules.in
configure.in
src/include/switch.h
src/mod/applications/mod_cidlookup/Makefile
src/mod/applications/mod_curl/Makefile
src/mod/applications/mod_memcache/Makefile
src/mod/event_handlers/mod_json_cdr/Makefile
src/mod/formats/mod_shout/Makefile
src/mod/formats/mod_shout/mod_shout.c
src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.c
src/mod/xml_int/mod_xml_cdr/Makefile
src/mod/xml_int/mod_xml_curl/Makefile
src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
src/switch_core.c

index 95c53dd1287392b627969524a66ce1b890705c66..343d98a2bdd9c64599c43580ca576484304c187b 100644 (file)
@@ -130,7 +130,7 @@ endif
 lib_LTLIBRARIES                 = libfreeswitch.la
 libfreeswitch_la_CFLAGS  = $(CORE_CFLAGS) $(AM_CFLAGS)
 libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_DEPLIBS)
-libfreeswitch_la_LIBADD  = $(CORE_LIBS)
+libfreeswitch_la_LIBADD  = $(CORE_LIBS) $(LIBCURL)
 libfreeswitch_la_DEPENDENCIES = $(BUILT_SOURCES)
 
 if HAVE_ODBC
@@ -180,7 +180,8 @@ library_include_HEADERS = \
        libs/libteletone/src/libteletone_generate.h \
        libs/libteletone/src/libteletone.h \
        src/include/switch_limit.h \
-       src/include/switch_odbc.h
+       src/include/switch_odbc.h \
+       src/include/switch_curl.h
 
 nodist_libfreeswitch_la_SOURCES = \
        src/include/switch_frame.h \
@@ -240,6 +241,7 @@ libfreeswitch_la_SOURCES = \
        src/switch_pcm.c \
        src/switch_profile.c \
        src/switch_json.c \
+       src/switch_curl.c \
        libs/stfu/stfu.c \
        libs/libteletone/src/libteletone_detect.c \
        libs/libteletone/src/libteletone_generate.c \
index 51923ec3dd7377e31ae7d07073a3443e5f69cf1a..f0db222f717c6c0d8b483e50cc62286a4626d827 100644 (file)
@@ -80,9 +80,9 @@ TOUCH_TARGET=@TOUCH_TARGET@
 MAKE_OPTS = `test -n "$(VERBOSE)" || echo -s`
 RECURSE_MODNAME=`pwd | sed -e 's|^.*/||'`
 RECURSE_SOURCEFILE=`if test -f "$$modname.cpp" -o  -f "$(MODDIR)/$$modname.cpp"; then echo "$$modname.cpp"; else echo "$$modname.c"; fi`
-RECURSE_OUR_DEPS=`test -z "$(WANT_CURL)" || if test ! -z "$(LIBCURL_DEPS)"; then echo $(CURLLA); fi `
-RECURSE_OUR_CFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL_CPPFLAGS) ; $(LOCAL_INSERT_CFLAGS) `
-RECURSE_OUR_LDFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL) ; $(LOCAL_INSERT_LDFLAGS) `
+RECURSE_OUR_DEPS=
+RECURSE_OUR_CFLAGS=`$(LOCAL_INSERT_CFLAGS)`
+RECURSE_OUR_LDFLAGS=`$(LOCAL_INSERT_LDFLAGS)`
 RECURSE_MODDIR=`if test -z $(MODDIR); then pwd | sed -e 's|$(switch_builddir)|$(switch_srcdir)|'; else echo $(MODDIR); fi`
 RECURSE_MAKE=+modname="$(RECURSE_MODNAME)" ; \
                sourcefile="$(RECURSE_SOURCEFILE)" ; \
index 389e4985b69ba7d0cc831ff2d225ceca3c20725e..50351d69d638daf5b32db8fb96b91d3804683bf7 100644 (file)
@@ -790,6 +790,11 @@ if test "$ac_cv_use_system_curl" != "yes" ; then
  LIBCURL_DEPS='${switch_builddir}/libs/curl/lib/libcurl.la'
  LIBCURL='${switch_builddir}/libs/curl/lib/libcurl.la'
  LIBCURL_CPPFLAGS='-I${switch_srcdir}/libs/curl/include'
+else
+ AC_CHECK_LIB(curl, curl_global_init, have_curl=yes, have_curl=no)
+ if test "x$have_curl" = "xyes"  ; then
+  APR_ADDTO(SWITCH_AM_LDFLAGS, -lcurl)
+ fi
 fi
 
 AC_SUBST(LIBCURL_DEPS)
index de099f1b94293eb623b271f1194b899fde9078fb..268243e98999790e726687dc10202d5618663d69 100644 (file)
 #include "switch_odbc.h"
 #include "switch_json.h"
 #include "switch_limit.h"
+#ifndef WIN32
+#include "switch_curl.h"
+#endif
 
 #include <libteletone.h>
 
index 5ffe1d8476756d5bc197f1e6ef02e1fb68801aac..24790d0d397dcef8f05b456b9428fa7d80065589 100644 (file)
@@ -1,4 +1,3 @@
-WANT_CURL=yes
 BASE=../../../..
 include $(BASE)/build/modmake.rules
 
index b27663335548cd2061674cbf714cfb2fba71d04c..6cae5a85952be6382d16a4ef46dbf42e375adbe0 100644 (file)
@@ -1,6 +1,5 @@
 json-c=json-c-0.9
 BASE=../../../..
-WANT_CURL=yes
 
 JSON_DIR=$(switch_srcdir)/libs/$(json-c)
 JSON_BUILDDIR=$(switch_builddir)/libs/$(json-c)
index 80c1d2b93683cb534b6f15b9d62230d01603e4da..0f469ff9e263c86d970636aaefec35a058b62b18 100644 (file)
@@ -1,8 +1,6 @@
 MEMCACHED=libmemcached-0.32
 BASE=../../../..
 
-WANT_CURL=yes
-
 MEMCACHED_DIR=$(switch_srcdir)/libs/$(MEMCACHED)
 MEMCACHED_BUILDDIR=$(switch_builddir)/libs/$(MEMCACHED)
 
index d5043e017dda2cfef8a9a922ac7b6f7c265935ff..1819f0a4c37e5ec1489f9db4e52975b90bd8f465 100644 (file)
@@ -1,6 +1,5 @@
 json-c=json-c-0.9
 BASE=../../../..
-WANT_CURL=yes
 
 JSON_DIR=$(switch_srcdir)/libs/$(json-c)
 JSON_BUILDDIR=$(switch_builddir)/libs/$(json-c)
index 7388bc0c67c6b37896e9b96e3049b67faf5e1b0d..50dc9d5b3ae723abda87f5207f8e01a9f660e187 100644 (file)
@@ -3,8 +3,6 @@ SHOUT=libshout-2.2.2
 MPG123=mpg123-1.13.2
 BASE=../../../..
 
-WANT_CURL=yes
-
 LAME_DIR=$(switch_srcdir)/libs/$(LAME)
 SHOUT_DIR=$(switch_srcdir)/libs/$(SHOUT)
 MPG123_DIR=$(switch_srcdir)/libs/$(MPG123)
index 377cfe520c7dfdb0406371a2ce776d809ec83457..c506e18933992e85531ef02db8e196f5c0a8787d 100644 (file)
@@ -1480,8 +1480,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_shout_load)
        supported_formats[0] = "shout";
        supported_formats[1] = "mp3";
 
-       curl_global_init(CURL_GLOBAL_ALL);
-
        /* connect my internal structure to the blank pointer passed to me */
        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
        file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
@@ -1507,7 +1505,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_shout_load)
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_shout_shutdown)
 {
-       curl_global_cleanup();
        mpg123_exit();
        return SWITCH_STATUS_SUCCESS;
 }
index 7341a2b1e19bfad4dedb92a8d0223f8b85ea4d5f..30ec8789d66df611dea57d3d9ace87748b3bab60 100644 (file)
@@ -2551,7 +2551,6 @@ static JSBool js_fetchurl_file(JSContext * cx, JSObject * obj, uintN argc, jsval
                url = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
                filename = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
 
-               curl_global_init(CURL_GLOBAL_ALL);
                curl_handle = curl_easy_init();
                if (!strncasecmp(url, "https", 5)) {
                        curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
@@ -2600,7 +2599,6 @@ static JSBool js_fetchurl(JSContext * cx, JSObject * obj, uintN argc, jsval * ar
                        JS_ValueToInt32(cx, argv[1], &buffer_size);
                }
 
-               curl_global_init(CURL_GLOBAL_ALL);
                curl_handle = curl_easy_init();
                if (!strncasecmp(url, "https", 5)) {
                        curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
@@ -3803,8 +3801,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spidermonkey_load)
        SWITCH_ADD_APP(app_interface, "javascript", "Launch JS ivr", "Run a javascript ivr on a channel", js_dp_function, "<script> [additional_vars [...]]",
                                   SAF_SUPPORT_NOMEDIA);
 
-       curl_global_init(CURL_GLOBAL_ALL);
-
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_NOUNLOAD;
 }
@@ -3814,8 +3810,6 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spidermonkey_shutdown)
        // this causes a crash
        //JS_DestroyRuntime(globals.rt);
 
-       curl_global_cleanup();
-
        switch_core_hash_destroy(&module_manager.mod_hash);
        switch_core_hash_destroy(&module_manager.load_hash);
        return SWITCH_STATUS_SUCCESS;
index 5fb7b7f0bef3814ed48e1da8c03b649b8d0356a8..09a1f0ee8c89a1a024721880e746e6dfc629706d 100644 (file)
@@ -242,7 +242,6 @@ const sm_module_interface_t curl_module_interface = {
 
 SWITCH_MOD_DECLARE_NONSTD(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
 {
-       curl_global_init(CURL_GLOBAL_ALL);
        *module_interface = &curl_module_interface;
        return SWITCH_STATUS_SUCCESS;
 }
index c762c5353da23522a51613313248c54cf90c93aa..c2baec83cd6d513b72557d5454cf170d62040ed1 100644 (file)
@@ -1,2 +1 @@
-WANT_CURL=yes
 include ../../../../build/modmake.rules
index c762c5353da23522a51613313248c54cf90c93aa..c2baec83cd6d513b72557d5454cf170d62040ed1 100644 (file)
@@ -1,2 +1 @@
-WANT_CURL=yes
 include ../../../../build/modmake.rules
index 6aa899babb0407d837d10222aa8cff1f2d3e6e58..e509fdfd0ea05534ee58a8a887696b4ce7b65ff2 100644 (file)
@@ -547,9 +547,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_curl_load)
        globals.hash_root = NULL;
        globals.hash_tail = NULL;
 
-       if (do_config() == SWITCH_STATUS_SUCCESS) {
-               curl_global_init(CURL_GLOBAL_ALL);
-       } else {
+       if (do_config() != SWITCH_STATUS_SUCCESS) {
                return SWITCH_STATUS_FALSE;
        }
 
@@ -573,7 +571,6 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_curl_shutdown)
        }
 
        switch_xml_unbind_search_function_ptr(xml_url_fetch);
-       curl_global_cleanup();
        return SWITCH_STATUS_SUCCESS;
 }
 
index e340a26ffcb41a842ef0b2eaa669062f1bd77a4d..538dffdb7440fa53d336e9749886e38d554a2e7c 100644 (file)
@@ -1300,6 +1300,7 @@ static void switch_core_set_serial(void)
        switch_core_set_variable("switch_serial", buf);
 }
 
+
 SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switch_bool_t console, const char **err)
 {
        switch_uuid_t uuid;
@@ -1445,6 +1446,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
        switch_uuid_get(&uuid);
        switch_uuid_format(runtime.uuid_str, &uuid);
 
+#ifndef WIN32
+       switch_curl_init(runtime.memory_pool);
+#endif
+
        return SWITCH_STATUS_SUCCESS;
 }
 
@@ -2115,6 +2120,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Clean up modules.\n");
 
        switch_loadable_module_shutdown();
+#ifndef WIN32
+       switch_curl_destroy();
+#endif
 
        if (switch_test_flag((&runtime), SCF_USE_SQL)) {
                switch_core_sqldb_stop();