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


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

Branch: refs/heads/COUCHDB-1342
Commit: ee00d8183f9cff14e900897fed7a14f78bb7f617
Parents: f599ba7
Author: Randall Leeds <rand...@apache.org>
Authored: Fri Dec 23 01:17:28 2011 -0800
Committer: Randall Leeds <rand...@apache.org>
Committed: Wed Dec 28 23:58:56 2011 -0500

----------------------------------------------------------------------
 INSTALL.Unix    |    2 +-
 INSTALL.Windows |    2 +-
 configure.ac    |   36 +++++++++++++++++-------------------
 3 files changed, 19 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/ee00d818/INSTALL.Unix
----------------------------------------------------------------------
diff --git a/INSTALL.Unix b/INSTALL.Unix
index fdcdfcf..0836f6b 100644
--- a/INSTALL.Unix
+++ b/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/)

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ee00d818/INSTALL.Windows
----------------------------------------------------------------------
diff --git a/INSTALL.Windows b/INSTALL.Windows
index 97f6176..b75b80a 100644
--- a/INSTALL.Windows
+++ b/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)

http://git-wip-us.apache.org/repos/asf/couchdb/blob/ee00d818/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index e2f2265..5eb2e69 100644
--- a/configure.ac
+++ b/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"
 
 

Reply via email to