The --with-spidermonkey option no longer supports a DIR argument.
AFAICT, that argument was never documented anyway.

This commit also changes the SpiderMonkey version number in "checking"
messages from 1.5 RC3a to 1.8.5, which matches the actual checks.
---

Witek recently changed the master branch (ELinks 0.13.GIT) to
require SpiderMonkey 1.8.5.  The elinks-0.11 and elinks-0.12
branches do not support SpiderMonkey 1.8.5.  I'd like to be able
to build both branches, so I have installed SpiderMonkey 1.8.5 in
my home directory: ~/prefix/x86_64-unknown-linux-gnu/lib/ and
~/prefix/include/js/.  I had difficulty getting ELinks 0.13.GIT
to use SpiderMonkey from those directories, however.  Because
SpiderMonkey 1.8.5 also installs mozjs185.pc, which refers to the
correct directories, I'd like to make the configure script of
ELinks 0.13.GIT use that.  Then, only $PKG_CONFIG_PATH needs to
be set.

Please post if this patch would cause difficulty to you.
I will probably be offline for a day or two.

 configure.in |   90 ++++++++++++++++++++++++++++-----------------------------
 1 files changed, 44 insertions(+), 46 deletions(-)

diff --git a/configure.in b/configure.in
index 6055a0e..72be7f8 100644
--- a/configure.in
+++ b/configure.in
@@ -632,26 +632,25 @@ AC_ARG_WITH(xulrunner_libs, [  
--with-xulrunner_libs=OPTIONS
                           Linker options for xulrunner,
                           eg. --with-xulrunner_libs="-Wl,-R/usr/lib/xulrunner 
-L/usr/lib/xulrunner -lmozjs"],
             [xulrunner_libs="$withval"])
-AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey 
Mozilla JavaScript engine support],
-            [if test "$withval" = no; then disable_spidermonkey=yes; fi])
-
-AC_MSG_CHECKING([for SpiderMonkey (1.5 RC3a or later)])
+AC_ARG_WITH(spidermonkey, [  --without-spidermonkey  disable SpiderMonkey 
Mozilla JavaScript engine support])
 
+# features.conf is not supposed to define CONFIG_SPIDERMONKEY.
+CONFIG_SPIDERMONKEY=
 EL_SAVE_FLAGS
-cf_result=no
-
-if test -z "$disable_spidermonkey"; then
-       if test ! -d "$withval"; then
-               withval="";
-       fi
-       if test ! -z "$xulrunner_includes"; then
-               SPIDERMONKEY_LIBS="$xulrunner_libs"
-               SPIDERMONKEY_CFLAGS="-I$xulrunner_includes"
-               LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
-               CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
-               CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
 
-               AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define XP_UNIX
+if test "$with_spidermonkey" = "no"; then
+       AC_MSG_CHECKING([for SpiderMonkey])
+       AC_MSG_RESULT([disabled])
+       CONFIG_SPIDERMONKEY="no"
+elif test -n "$xulrunner_includes"; then
+       AC_MSG_CHECKING([for SpiderMonkey (1.8.5 or later) in xulrunner])
+       SPIDERMONKEY_LIBS="$xulrunner_libs"
+       SPIDERMONKEY_CFLAGS="-I$xulrunner_includes"
+       LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
+       CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
+       CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
+
+       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define XP_UNIX
                #include <jsapi.h>]], [[
                #ifndef JS_VERSION
                #error JS_VERSION
@@ -659,39 +658,38 @@ if test -z "$disable_spidermonkey"; then
                #if JS_VERSION < 185
                #error too old
                #endif]])],
-               [cf_result=yes],[cf_result=no])
+               [CONFIG_SPIDERMONKEY=yes],[CONFIG_SPIDERMONKEY=no])
+       AC_MSG_RESULT([$CONFIG_SPIDERMONKEY])
+else
+       AC_MSG_CHECKING([for mozjs185 (SpiderMonkey 1.8.5) in pkg-config])
+       # In pkg-config 0.25, pkg-config --exists mozjs185 returns 0 (success)
+       # even if mozjs185 depends on nspr, which has not been installed.
+       # However, pkg-config --cflags mozjs185 returns 1 then.
+       if pkg-config --cflags --libs mozjs185 > /dev/null 
2>&AS_MESSAGE_LOG_FD; then
+               SPIDERMONKEY_LIBS="$(pkg-config --libs mozjs185)"
+               SPIDERMONKEY_CFLAGS="$(pkg-config --cflags mozjs185)"
+               LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
+               CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
+               CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
+               AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define XP_UNIX
+                       #include <jsapi.h>]], [[
+                       #ifndef JS_VERSION
+                       #error JS_VERSION
+                       #endif
+                       #if JS_VERSION < 185
+                       #error too old
+                       #endif]])],
+                       [AC_MSG_RESULT([yes])
+                        CONFIG_SPIDERMONKEY=yes],
+                       [AC_MSG_RESULT([found but does not work])
+                        CONFIG_SPIDERMONKEY=no])
        else
-               for spidermonkeydir in "$withval" "" /usr /usr/local 
/opt/spidermonkey /opt/js; do
-                       for spidermonkeyinclude in "/include" "/include/js" 
"/include/smjs" "/include/mozjs"; do
-                               for spidermonkeylib in js smjs mozjs; do
-                                       if test "$cf_result" = no; then
-                                               
SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib -l$spidermonkeylib"
-                                               
SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
-
-                                               LIBS="$SPIDERMONKEY_LIBS 
$LIBS_X"
-                                               CFLAGS="$CFLAGS_X 
$SPIDERMONKEY_CFLAGS"
-                                               CPPFLAGS="$CPPFLAGS_X 
$SPIDERMONKEY_CFLAGS"
-
-                                               
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define XP_UNIX
-                                                       #define XP_UNIX
-                                                       #include <jsapi.h>]], [[
-                                                       #ifndef JS_VERSION
-                                                       #error JS_VERSION
-                                                       #endif
-                                                       #if JS_VERSION < 185
-                                                       #error too old
-                                                       #endif]])],
-                                                       
[cf_result=yes],[cf_result=no])
-                                       fi
-                               done
-                       done
-               done
+               AC_MSG_RESULT([no])
+               CONFIG_SPIDERMONKEY=no
        fi
 fi
 
-AC_MSG_RESULT($cf_result)
-CONFIG_SPIDERMONKEY="$cf_result"
-if test "$cf_result" = "yes"; then
+if test "$CONFIG_SPIDERMONKEY" = "yes"; then
        AC_CHECK_FUNCS([[JS_ReportAllocationOverflow]])
        AC_CHECK_FUNCS(JS_SetBranchCallback)
        AC_CHECK_FUNCS(JS_TriggerOperationCallback, 
HAVE_JS_TRIGGEROPERATIONCALLBACK=yes)
-- 
1.7.2.3

Attachment: pgp5XNNiY0iZm.pgp
Description: PGP signature

_______________________________________________
elinks-dev mailing list
elinks-dev@linuxfromscratch.org
http://linuxfromscratch.org/mailman/listinfo/elinks-dev

Reply via email to