couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject git commit: COUCHDB-1426 Ensure use of specified SpiderMonkey
Date Thu, 15 Mar 2012 00:44:25 GMT
Updated Branches:
  refs/heads/COUCHDB-1426 64a163472 -> 0150670af (forced update)


COUCHDB-1426 Ensure use of specified SpiderMonkey

There were a few bugs in configuration settings when users specified
--with-js-include and --with-js-lib for custom SpiderMonkey
installations when a SpiderMonkey library is installed globally. This
patch addresses this by reordering configuration checks to use the
specified variables without adding information from pkg-config checks or
from default settings.

There is also a new setting --with-js-lib-name which is required due to
SpiderMonkey having so many names for its libraries. If configuration or
building fails the most likely scenario is that it picked up an older
installed SpiderMonkey in the library search path. To fix you should
only need to add --with-js-lib-name with the value that should be passed
to the linker. Ie, -lfoo would be set as "--with-js-lib-name=foo".


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

Branch: refs/heads/COUCHDB-1426
Commit: 0150670afa3dda957fd4ce9ab3b58495106f62f2
Parents: 589a923
Author: Paul Joseph Davis <davisp@apache.org>
Authored: Tue Mar 13 20:44:45 2012 -0500
Committer: Paul Joseph Davis <davisp@apache.org>
Committed: Wed Mar 14 19:44:10 2012 -0500

----------------------------------------------------------------------
 configure.ac                 |  120 ++++++++++++++++++++++---------------
 src/couchdb/priv/Makefile.am |    1 +
 2 files changed, 73 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/0150670a/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 30a1d65..20bc36d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,6 +112,20 @@ else
     AC_MSG_RESULT([no])
 fi
 
+AC_ARG_VAR([ERLC_FLAGS], [general flags to prepend to ERLC_FLAGS])
+AC_ARG_VAR([FLAGS], [general flags to prepend to LDFLAGS and CPPFLAGS])
+AS_CASE([$(uname -s)],
+    [CYGWIN*], [] ,
+    [*], [
+    CPPFLAGS="$CPPFLAGS -I/opt/local/include"
+    CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+    CPPFLAGS="$CPPFLAGS -I/usr/include"
+    LDFLAGS="$LDFLAGS -L/opt/local/lib"
+    LDFLAGS="$LDFLAGS -L/usr/local/lib"
+])
+CPPFLAGS="$CPPFLAGS $FLAGS"
+LDFLAGS="$LDFLAGS $FLAGS"
+
 AC_PATH_PROG([ERL], [erl])
 AS_IF([test x${ERL} = x], [
     AC_MSG_ERROR([Could not find the `erl' executable. Is Erlang installed?])
@@ -137,33 +151,45 @@ AC_ARG_WITH([erlang], [AC_HELP_STRING([--with-erlang=PATH],
 ])
 AC_SUBST(ERLANG_FLAGS)
 
-PKG_CHECK_MODULES([JS], [mozjs185], [
-    JS_LIB_DIR="$(${PKG_CONFIG} --variable=libdir mozjs185)"
+AC_ARG_WITH([js-lib], [AC_HELP_STRING([--with-js-lib=PATH],
+            [set PATH to the SpiderMonkey library directory])],
+    [
+    JS_LIB_DIR=$withval
 ], [
-    PKG_CHECK_MODULES([JS], [mozilla-js >= 1.7], [
-        JS_LIB_DIR="$(${PKG_CONFIG} --variable=sdkdir mozilla-js)/lib"
+    PKG_CHECK_MODULES([JS185], [mozjs185], [
+    JS_LIB_DIR="$(${PKG_CONFIG} --variable=libdir mozjs185)"
     ], [
-        JS_LIB_DIR="${libdir}"
-        JS_CFLAGS="-I/usr/include"
-        JS_CFLAGS="$JS_CFLAGS -I/usr/include/js"
-        JS_CFLAGS="$JS_CFLAGS -I/usr/include/mozjs"
-        JS_CFLAGS="$JS_CFLAGS -I/usr/local/include/js"
-        JS_CFLAGS="$JS_CFLAGS -I/opt/local/include/js"
+        PKG_CHECK_MODULES([JS], [mozilla-js >= 1.7], [
+            JS_LIB_DIR="$(${PKG_CONFIG} --variable=sdkdir mozilla-js)/lib"
+        ], [
+            JS_LIB_DIR="${libdir}"
+        ])
     ])
 ])
+JS_LDFLAGS="-L$JS_LIB_DIR $LDFLAGS"
+
 
 AC_ARG_WITH([js-include], [AC_HELP_STRING([--with-js-include=PATH],
     [set PATH to the SpiderMonkey include directory])], [
     JS_INCLUDE="$withval"
     JS_CFLAGS="-I$JS_INCLUDE"
-], [])
-
-AC_ARG_WITH([js-lib], [AC_HELP_STRING([--with-js-lib=PATH],
-    [set PATH to the SpiderMonkey library directory])],
-    [
-    JS_LIB_DIR=$withval
-    JS_LIBS="-L$withval"
-], [])
+    JS_CFLAGS="$JS_CFLAGS -I$JS_INCLUDE/js"
+    JS_CFLAGS="$JS_CFLAGS -I$JS_INCLUDE/mozjs"
+], [
+    PKG_CHECK_MODULES([JS185], [mozjs185], [
+        JS_CFLAGS="$(${PKG_CONFIG} --cflags mozjs185)"
+    ], [
+        PKG_CHECK_MODULES([JS], [mozilla-js >= 1.7], [
+            JS_CFLAGS="$(${PKG_CONFIG} --cflags mozilla-js)"
+        ], [
+            JS_CFLAGS="-I/usr/include"
+            JS_CFLAGS="$JS_CFLAGS -I/usr/include/js"
+            JS_CFLAGS="$JS_CFLAGS -I/usr/include/mozjs"
+            JS_CFLAGS="$JS_CFLAGS -I/usr/local/include/js"
+            JS_CFLAGS="$JS_CFLAGS -I/opt/local/include/js"
+        ])
+    ])
+])
 
 use_js_trunk=no
 AC_ARG_ENABLE([js-trunk], [AC_HELP_STRING([--enable-js-trunk],
@@ -171,23 +197,6 @@ AC_ARG_ENABLE([js-trunk], [AC_HELP_STRING([--enable-js-trunk],
     use_js_trunk=$enableval
 ], [])
 
-AC_ARG_VAR([ERLC_FLAGS], [general flags to prepend to ERLC_FLAGS])
-AC_ARG_VAR([FLAGS], [general flags to prepend to LDFLAGS and CPPFLAGS])
-AS_CASE([$(uname -s)],
-    [CYGWIN*], [] ,
-    [*], [
-    CPPFLAGS="$CPPFLAGS -I/opt/local/include"
-    CPPFLAGS="$CPPFLAGS -I/opt/local/include/js"
-    CPPFLAGS="$CPPFLAGS -I/usr/local/include"
-    CPPFLAGS="$CPPFLAGS -I/usr/local/include/js"
-    CPPFLAGS="$CPPFLAGS -I/usr/include"
-    CPPFLAGS="$CPPFLAGS -I/usr/include/js"
-    LDFLAGS="$LDFLAGS -L/opt/local/lib"
-    LDFLAGS="$LDFLAGS -L/usr/local/lib"
-])
-CPPFLAGS="$CPPFLAGS $FLAGS"
-LDFLAGS="$LDFLAGS $FLAGS"
-
 # The erlang cc.sh/ld.sh scripts will convert a -O option
 # into the same optimization flags erlang itself uses.
 CFLAGS="-O2 $CFLAGS"
@@ -206,10 +215,12 @@ AS_CASE([$(uname -s)],
 
 AM_CONDITIONAL([WINDOWS], [test x$IS_WINDOWS = xTRUE])
 
-OLD_LIBS="$LIBS"
-LIBS="$JS_LIBS $LIBS"
 OLD_CPPFLAGS="$CPPFLAGS"
+OLD_LDFLAGS="$LDFLAGS"
+OLD_LIBS="$LIBS"
 CPPFLAGS="$JS_CFLAGS $CPPFLAGS"
+LDFLAGS="$JS_LDFLAGS"
+LIBS="$JS_LIBS $LIBS"
 
 AC_CHECK_HEADER([jsapi.h], [], [
     AC_CHECK_HEADER([js/jsapi.h],
@@ -222,15 +233,24 @@ AC_CHECK_HEADER([jsapi.h], [], [
 Are the Mozilla SpiderMonkey headers installed?])
         ])])
 
-AC_CHECK_LIB([mozjs185], [JS_NewContext], [JS_LIB_BASE=mozjs185], [
-    AC_CHECK_LIB([mozjs185-1.0], [JS_NewContext], [JS_LIB_BASE=mozjs185-1.0], [
-        AC_CHECK_LIB([mozjs], [JS_NewContext], [JS_LIB_BASE=mozjs], [
-            AC_CHECK_LIB([js], [JS_NewContext], [JS_LIB_BASE=js], [
-                AC_CHECK_LIB([js3250], [JS_NewContext], [JS_LIB_BASE=js3250], [
-                    AC_CHECK_LIB([js32], [JS_NewContext], [JS_LIB_BASE=js32], [
-                        AC_MSG_ERROR([Could not find the js library.
+AC_ARG_WITH([js-lib-name], [AC_HELP_STRING([--with-js-lib-name=NAME],
+    [set Spidermonkey library NAME])], [
+    JS_LIB_BASE="$withval"
+    AC_CHECK_LIB([$JS_LIB_BASE], JS_NewObject, [], [
+        AC_MSG_ERROR([Could not find the Spidermonkey library.
+
+Did you specify the correct library name?])])
+    ], [
+    AC_CHECK_LIB(mozjs, [JS_NewObject], [JS_LIB_BASE=mozjs], [
+        AC_CHECK_LIB(js, [JS_NewObject], [JS_LIB_BASE=js], [
+            AC_CHECK_LIB([js3250], [JS_NewObject], [JS_LIB_BASE=js3250], [
+                AC_CHECK_LIB([js32], [JS_NewObject], [JS_LIB_BASE=js32], [
+                    AC_CHECK_LIB([mozjs185-1.0], [JS_NewObject], [JS_LIB_BASE=mozjs185-1.0],
[
+                        AC_CHECK_LIB(mozjs185, [JS_NewObject], [JS_LIB_BASE=mozjs185], [
+                            AC_MSG_ERROR([Could not find the js library.
 
 Is the Mozilla SpiderMonkey library installed?])])])])])])])
+])
 
 # Figure out what version of SpiderMonkey to use
 
@@ -318,12 +338,16 @@ if test x${IS_WINDOWS} = xTRUE; then
     fi
 fi
 
-JS_LIBS="-l$JS_LIB_BASE -lm $JS_LIBS"
-AC_SUBST(JS_LIBS)
-
-LIBS="$OLD_LIBS"
+JS_CFLAGS="$CPPFLAGS"
+JS_LDFLAGS="$LDFLAGS"
+JS_LIBS="-l$JS_LIB_BASE -lm $LIBS"
 CPPFLAGS="$OLD_CPPFLAGS"
+LDFLAGS="$OLD_LDFLAGS"
+LIBS="$OLD_LIBS"
 
+AC_SUBST(JS_CFLAGS)
+AC_SUBST(JS_LDFLAGS)
+AC_SUBST(JS_LIBS)
 
 AC_ARG_WITH([win32-icu-binaries], [AC_HELP_STRING([--with-win32-icu-binaries=PATH],
     [set PATH to the Win32 native ICU binaries directory])], [

http://git-wip-us.apache.org/repos/asf/couchdb/blob/0150670a/src/couchdb/priv/Makefile.am
----------------------------------------------------------------------
diff --git a/src/couchdb/priv/Makefile.am b/src/couchdb/priv/Makefile.am
index 704e870..ac02791 100644
--- a/src/couchdb/priv/Makefile.am
+++ b/src/couchdb/priv/Makefile.am
@@ -61,6 +61,7 @@ COUCHJS_SRCS = \
 locallibbin_PROGRAMS = couchjs
 couchjs_SOURCES = $(COUCHJS_SRCS)
 couchjs_CFLAGS = -g -Wall -Werror -D_BSD_SOURCE $(CURL_CFLAGS) $(JS_CFLAGS)
+couchjs_LDFLAGS = $(JS_LDFLAGS)
 couchjs_LDADD = $(CURL_LIBS) $(JS_LIBS)
 
 couchpriv_DATA = stat_descriptions.cfg


Mime
View raw message