summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Joseph Davis <davisp@apache.org>2011-10-18 16:18:01 -0500
committerPaul Joseph Davis <davisp@apache.org>2011-10-18 16:28:19 -0500
commit7ce9e103e50678a38c78607f2441340cd6d688da (patch)
tree4abdcdde9884799abb77988682fe92006950372f
parent1e1d07a916f22a29ccc2fff98f44746851b287ff (diff)
Prevent linking against too new of a SpiderMonkey
Versions of SpiderMonkey newer than js185-1.0.0 have removed the JSOPTION_ANONFUNFIX which basically invalidates all CouchDB JavaScript functions ever written. This configure patch prevents the accidental linking to a library that has this new behavior while allowing people to forcefully override the check.
-rw-r--r--configure.ac21
1 files changed, 21 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 5124b8b1..6f9327d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -81,6 +81,12 @@ AC_ARG_WITH([js-lib], [AC_HELP_STRING([--with-js-lib=PATH],
])
AC_SUBST(JS_LIB_DIR)
+use_js_trunk=no
+AC_ARG_ENABLE([js-trunk], [AC_HELP_STRING([--enable-js-trunk],
+ [allow use of SpiderMonkey versions newer than js185-1.0.0])], [
+ 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])
@@ -177,6 +183,21 @@ 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
+
AC_SUBST(JSLIB)
AC_LANG_PUSH(C)