Skip to content
Browse files

Minor doc and configure fixes for old JS engines

Old, 1.7 series, versions of SpiderMonkey don't have the symbol
JSOPTION_ANONFUNFIX so don't perform the check for it unless building
with a newer version (1.8.5+).

And as long as 1.7 is still supported, don't say that 1.8 is required
in the INSTALL docs.

Fixes COUCHDB-1371
  • Loading branch information...
1 parent f599ba7 commit ee00d8183f9cff14e900897fed7a14f78bb7f617 @tilgovi tilgovi committed Dec 23, 2011
Showing with 19 additions and 21 deletions.
  1. +1 −1 INSTALL.Unix
  2. +1 −1 INSTALL.Windows
  3. +17 −19 configure.ac
View
2 INSTALL.Unix
@@ -28,7 +28,7 @@ You should have the following installed:
* Erlang OTP (>=R12B5) (http://erlang.org/)
* ICU (http://icu.sourceforge.net/)
* OpenSSL (http://www.openssl.org/)
- * Mozilla SpiderMonkey (1.8) (http://www.mozilla.org/js/spidermonkey/)
+ * Mozilla SpiderMonkey (1.7) (http://www.mozilla.org/js/spidermonkey/)
* GNU Make (http://www.gnu.org/software/make/)
* GNU Compiler Collection (http://gcc.gnu.org/)
* libcurl (http://curl.haxx.se/libcurl/)
View
2 INSTALL.Windows
@@ -28,7 +28,7 @@ You will need the following installed:
* Erlang OTP (=14B01) (http://erlang.org/)
* ICU (=4.4.*) (http://icu.sourceforge.net/)
* OpenSSL (http://www.openssl.org/)
- * Mozilla SpiderMonkey (1.8) (http://www.mozilla.org/js/spidermonkey/)
+ * Mozilla SpiderMonkey (1.7) (http://www.mozilla.org/js/spidermonkey/)
* libcurl (http://curl.haxx.se/libcurl/)
* Cygwin (http://www.cygwin.com/)
* Visual Studio 2008 (http://msdn.microsoft.com/en-gb/vstudio/default.aspx)
View
36 configure.ac
@@ -205,6 +205,8 @@ AM_CONDITIONAL([WINDOWS], [test x$IS_WINDOWS = xTRUE])
OLD_LIBS="$LIBS"
LIBS="$JS_LIBS $LIBS"
+OLD_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$JS_CFLAGS $CPPFLAGS"
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], [
@@ -218,6 +220,20 @@ Is the Mozilla SpiderMonkey library installed?])])])])])])])
# Figure out what version of SpiderMonkey to use
AC_CHECK_LIB([$JS_LIB_BASE], [JS_NewCompartmentAndGlobalObject],
+ # Prevent people from accidentally using SpiderMonkey's that are too new
+
+ if test "$use_js_trunk" = "no"; then
+ AC_CHECK_DECL([JSOPTION_ANONFUNFIX], [], [
+ AC_MSG_ERROR([Your SpiderMonkey library is too new.
+
+Versions of SpiderMonkey after the js185-1.0.0 release remove the optional
+enforcement of preventing anonymous functions in a statement context. This
+will most likely break your existing JavaScript code as well as render all
+example code invalid.
+
+If you wish to ignore this error pass --enable-js-trunk to ./configure.])],
+ [[#include <jsapi.h>]])
+ fi
AC_DEFINE([SM185], [1],
[Use SpiderMonkey 1.8.5]))
@@ -229,9 +245,7 @@ AC_CHECK_LIB([$JS_LIB_BASE], [JS_GetStringCharsAndLength],
AC_DEFINE([HAVE_JS_GET_STRING_CHARS_AND_LENGTH], [1],
[Use newer JS_GetCharsAndLength function.]))
-
# Else, hope that 1.7.0 works
-LIBS="$OLD_LIBS"
AC_DEFINE([COUCHJS_NAME], ["couchjs"], ["CouchJS executable name."])
@@ -284,8 +298,6 @@ fi
JS_LIBS="-l$JS_LIB_BASE -lm $JS_LIBS"
AC_SUBST(JS_LIBS)
-OLD_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$JS_CFLAGS $CPPFLAGS"
AC_CHECK_HEADER([jsapi.h], [], [
AC_CHECK_HEADER([js/jsapi.h],
[
@@ -297,21 +309,6 @@ AC_CHECK_HEADER([jsapi.h], [], [
Are the Mozilla SpiderMonkey headers installed?])
])])
-# Prevent people from accidentally using SpiderMonkey's that are too new
-
-if test "$use_js_trunk" = "no"; then
-AC_CHECK_DECL([JSOPTION_ANONFUNFIX], [], [
- AC_MSG_ERROR([Your SpiderMonkey library is too new.
-
-Versions of SpiderMonkey after the js185-1.0.0 release remove the optional
-enforcement of preventing anonymous functions in a statement context. This
-will most likely break your existing JavaScript code as well as render all
-example code invalid.
-
-If you wish to ignore this error pass --enable-js-trunk to ./configure.])],
- [[#include <jsapi.h>]])
-fi
-
# Deal with JSScript -> JSObject -> JSScript switcheroo
AC_CHECK_TYPE([JSScript*],
@@ -320,6 +317,7 @@ AC_CHECK_TYPE([JSScript*],
[[#include <jsapi.h>]]
)
+LIBS="$OLD_LIBS"
CPPFLAGS="$OLD_CPPFLAGS"

0 comments on commit ee00d81

Please sign in to comment.
Something went wrong with that request. Please try again.