ecore-con - followup commit to curl dynamic load - support win and osx names
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Thu, 10 Oct 2013 23:13:35 +0000 (08:13 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Thu, 10 Oct 2013 23:13:35 +0000 (08:13 +0900)
src/lib/ecore_con/ecore_con_url.c

index 959ca94..4e4c19d 100644 (file)
@@ -247,9 +247,26 @@ _c_init(void)
    if (_c_fail) return EINA_FALSE;
    _c = calloc(1, sizeof(Ecore_Con_Curl));
    if (!_c) goto error;
-   _c->mod = eina_module_new("libcurl.so.4");
+
+#define LOAD(x) \
+   if (!_c->mod) { \
+      if ((_c->mod = eina_module_new(x))) { \
+         if (!eina_module_load(_c->mod)) { \
+            eina_module_free(_c->mod); \
+            _c->mod = NULL; \
+         } \
+      } \
+   }
+#if defined(_WIN32) || defined(__CYGWIN__)
+   LOAD("libcurl.dll"); // try 1
+   LOAD("curllib.dll"); // if fail try 2
+#elif defined(__APPLE__) && defined(__MACH__)
+   LOAD("libcurl.4.dylib"); // try 1
+   LOAD("libcurl.so.4"); // if fail try 2
+#else   
+   LOAD("libcurl.so.4"); // try only
+#endif   
    if (!_c->mod) goto error;
-   if (!eina_module_load(_c->mod)) goto error;
 
 #define SYM(x) if (!(_c->x = eina_module_symbol_get(_c->mod, #x))) goto error
    SYM(curl_global_init);