You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by be...@apache.org on 2014/02/10 21:05:44 UTC

[44/50] couch commit: updated refs/remotes/origin/import to 09c6556

Check for configure settings to enable cURL


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/783326a9
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/783326a9
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/783326a9

Branch: refs/remotes/origin/import
Commit: 783326a985e0e3f59bf67dfb05a1d5d5fd12b5da
Parents: cee3471
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Feb 4 22:08:06 2014 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Feb 4 22:08:06 2014 -0600

----------------------------------------------------------------------
 rebar.config.script | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/783326a9/rebar.config.script
----------------------------------------------------------------------
diff --git a/rebar.config.script b/rebar.config.script
index 8e7c8e6..88483e8 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -19,6 +19,13 @@ end,
 CouchJSPath = filename:join(["priv", CouchJSName]),
 Version = string:strip(os:cmd("git describe --always"), right, $\n),
 
+CouchConfig = case filelib:is_file(os:getenv("COUCHDB_CONFIG")) of
+    true ->
+        {ok, Result} = file:consult(os:getenv("COUCHDB_CONFIG")),
+        Result;
+    false ->
+        []
+end.
 
 ConfigH = [
     {"SM185", ""},
@@ -35,15 +42,21 @@ ConfigH = [
 ConfigSrc = [["#define ", K, " ", V, $\n] || {K, V} <- ConfigH],
 ok = file:write_file("priv/couch_js/config.h", ConfigSrc),
 
-JS_LDFLAGS = "-lmozjs185 -DWITHOUTCURL",
+{JS_CFLAGS, JS_LDFLAGS} = case lists:keyfind(with_curl, 1, CouchConfig) of
+    {with_curl, true} ->
+        {"-DHAVE_CURL ", "-DHAVE_CURL -lmozjs185 -lcurl"};
+    _ ->
+        {"", "-lmozjs185"}
+end,
+
 CouchJSSrc = ["priv/couch_js/{help,http,main,utf8,util}.c"],
 
 BaseSpecs = [
         %% couchjs
-        {"darwin", CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", "-DXP_UNIX -I/usr/local/include/js"}, {"LDFLAGS", JS_LDFLAGS}]}]},
-        {"linux",  CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", "-DXP_UNIX -I/usr/include/js"}, {"LDFLAGS", JS_LDFLAGS ++ " -lm"}]}]},
-        {"unix",   CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", "-DXP_UNIX -I/usr/local/include/js}"}, {"LDFLAGS", JS_LDFLAGS ++ " -lm"}]}]},
-        {"win32",  CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", "-DXP_WIN -I/usr/include/js"}, {"LDFLAGS", JS_LDFLAGS}]}]},
+        {"darwin", CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ "-DXP_UNIX -I/usr/local/include/js"}, {"LDFLAGS", JS_LDFLAGS}]}]},
+        {"linux",  CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ "-DXP_UNIX -I/usr/include/js"}, {"LDFLAGS", JS_LDFLAGS ++ " -lm"}]}]},
+        {"unix",   CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ "-DXP_UNIX -I/usr/local/include/js}"}, {"LDFLAGS", JS_LDFLAGS ++ " -lm"}]}]},
+        {"win32",  CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ "-DXP_WIN -I/usr/include/js"}, {"LDFLAGS", JS_LDFLAGS}]}]},
         % ICU
         {"", "priv/couch_icu_driver.so", ["priv/icu_driver/*.c"], [{env, [
             {"DRV_CFLAGS",  "$DRV_CFLAGS -DPIC -O2 -fno-common"},