Permalink
Browse files

Revert "Remove SpiderMonkey 1.8.5 compatibility"

This reverts commit 5b558c8.
  • Loading branch information...
1 parent 4818fdd commit a628a43b58c7f85e228b148cea5d74a8b24bff70 @rnewson rnewson committed Oct 6, 2011
View
@@ -109,13 +109,15 @@ esac
AM_CONDITIONAL([WINDOWS], [test x$IS_WINDOWS = xTRUE])
-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_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.
-Is the Mozilla SpiderMonkey library installed?])])])])])
+Is the Mozilla SpiderMonkey library installed?])])])])])])])
AC_SUBST(JS_LIB_BASE)
@@ -178,16 +180,19 @@ Are the Mozilla SpiderMonkey headers installed?])
AC_SUBST(JSLIB)
AC_LANG_PUSH(C)
-OLD_CFLAGS="$CFLAGS"
-CFLAGS="-Werror-implicit-function-declaration"
-AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <jsapi.h>]],
- [[JS_SetOperationCallback(0, 0);]]
- )],
- AC_DEFINE([USE_JS_SETOPCB], [], [Use new JS_SetOperationCallback])
-)
-CFLAGS="$OLD_CFLAGS"
+
+AC_CHECK_LIB([$JS_LIB_BASE], [JS_NewCompartmentAndGlobalObject],
+ AC_DEFINE([SM185], [1],
+ [Use SpiderMonkey 1.8.5]))
+
+AC_CHECK_LIB([$JS_LIB_BASE], [JS_ThrowStopIteration],
+ AC_DEFINE([SM180], [1],
+ [Use SpiderMonkey 1.8.0]))
+
+AC_CHECK_LIB([$JS_LIB_BASE], [JS_GetStringCharsAndLength],
+ AC_DEFINE([HAVE_JS_GET_STRING_CHARS_AND_LENGTH], [1],
+ [Use newer JS_GetCharsAndLength function.]))
+
AC_LANG_POP(C)
AC_ARG_WITH([win32-icu-binaries], [AC_HELP_STRING([--with-win32-icu-binaries=PATH],
@@ -229,10 +234,10 @@ case "$(uname -s)" in
CPPFLAGS="-D_XOPEN_SOURCE $CPPFLAGS"
;;
FreeBSD)
- LIBS="$LIBS -lcrypt"
+ LIBS="$LIBS -lm -lcrypt"
;;
OpenBSD)
- LIBS="$LIBS -lcrypto"
+ LIBS="$LIBS -lm -lcrypto"
;;
esac
@@ -97,7 +97,7 @@ var Mimeparse = (function() {
if ((type == targetType || type == "*" || targetType == "*") &&
(subtype == targetSubtype || subtype == "*" || targetSubtype == "*")) {
var matchCount = 0;
- for (param in targetParams) {
+ for (var param in targetParams) {
if (param != 'q' && params[param] && params[param] == targetParams[param]) {
matchCount += 1;
}
View
@@ -63,6 +63,11 @@ var Couch = {
},
compileFunction : function(source, ddoc) {
if (!source) throw(["error","not_found","missing function"]);
+ // Some newer SpiderMonkey's appear to not like evaluating
+ // an anonymous function at global scope. Simple fix just
+ // wraps the source with parens so the function object is
+ // returned correctly.
+ source = "(" + source + ")";
try {
if (sandbox) {
if (ddoc) {
@@ -414,9 +414,22 @@ function waitForSuccess(fun, tag) {
function waitForRestart() {
var waiting = true;
- while (waiting) {
+ // Wait for the server to go down but don't
+ // wait too long because we might miss the
+ // unavailable period.
+ var count = 25;
+ while (waiting && count > 0) {
+ count--;
try {
CouchDB.request("GET", "/");
+ } catch(e) {
+ waiting = false;
+ }
+ }
+ // Wait for it to come back up
+ waiting = true;
+ while (waiting) {
+ try {
CouchDB.request("GET", "/");
waiting = false;
} catch(e) {
@@ -20,7 +20,10 @@ endif
EXTRA_DIST = \
spawnkillable/couchspawnkillable.sh \
- stat_descriptions.cfg.in
+ stat_descriptions.cfg.in \
+ couch_js/sm170.c \
+ couch_js/sm180.c \
+ couch_js/sm185.c
CLEANFILES = $(dist_man1_MANS) stat_descriptions.cfg
@@ -47,12 +50,14 @@ COUCHJS_SRCS = \
couch_js/http.h \
couch_js/main.c \
couch_js/utf8.c \
- couch_js/utf8.h
+ couch_js/utf8.h \
+ couch_js/util.h \
+ couch_js/util.c
locallibbin_PROGRAMS = couchjs
couchjs_SOURCES = $(COUCHJS_SRCS)
couchjs_LDFLAGS = $(CURL_LDFLAGS)
-couchjs_CFLAGS = -D_BSD_SOURCE $(CURL_CFLAGS)
+couchjs_CFLAGS = -g -Wall -Werror -D_BSD_SOURCE $(CURL_CFLAGS)
couchjs_LDADD = $(CURL_LDFLAGS) @JSLIB@
couchpriv_DATA = stat_descriptions.cfg
Oops, something went wrong.

0 comments on commit a628a43

Please sign in to comment.