1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-21 00:25:37 +00:00

Make ECMAScript browser scripting configurable

Either set CONFIG_SM_SCRIPTING in features.conf or pass to ./configure the
option --disable-sm-scripting. Now scripting is also enabled when needed
and not only if some other scripting backend is enabled.

Remove some remnants of SEE scripting backend.
This commit is contained in:
Jonas Fonseca 2005-12-25 02:23:54 +01:00 committed by Jonas Fonseca
parent a186c75bd6
commit 61185ff34e
4 changed files with 93 additions and 63 deletions

View File

@ -76,7 +76,6 @@ PYTHON_LIBS = @PYTHON_LIBS@
RANLIB = @RANLIB@
RUBY_CFLAGS = @RUBY_CFLAGS@
RUBY_LIBS = @RUBY_LIBS@
SEE_CFLAGS = @SEE_CFLAGS@
SPARSE = @SPARSE@
SPIDERMONKEY_CFLAGS = @SPIDERMONKEY_CFLAGS@
SPIDERMONKEY_LIBS = @SPIDERMONKEY_LIBS@
@ -134,10 +133,10 @@ CONFIG_RISCOS = @CONFIG_RISCOS@
CONFIG_RUBY = @CONFIG_RUBY@
CONFIG_SCANNER = @CONFIG_SCANNER@
CONFIG_SCRIPTING = @CONFIG_SCRIPTING@
CONFIG_SEE = @CONFIG_SEE@
CONFIG_SHA1 = @CONFIG_SHA1@
CONFIG_SMALL = @CONFIG_SMALL@
CONFIG_SMB = @CONFIG_SMB@
CONFIG_SM_SCRIPTING = @CONFIG_SM_SCRIPTING@
CONFIG_SPIDERMONKEY = @CONFIG_SPIDERMONKEY@
CONFIG_SSL = @CONFIG_SSL@
CONFIG_SYSMOUSE = @CONFIG_SYSMOUSE@

View File

@ -496,6 +496,63 @@ if test "$CONFIG_WIN32" = yes; then
EL_CONFIG_WIN32
fi
dnl ===================================================================
dnl Check for SpiderMonkey, optional even if installed.
dnl ===================================================================
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])
EL_SAVE_FLAGS
cf_result=no
if test -z "$disable_spidermonkey"; then
if test ! -d "$withval"; then
withval="";
fi
for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
for spidermonkeyinclude in "/include" "/include/js" "/include/smjs"; do
for spidermonkeylib in js smjs; do
if test "$cf_result" = no; then
SPIDERMONKEY_LIBS="-l$spidermonkeylib"
if test ! -z "$spidermonkeydir"; then
SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
fi
LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
AC_TRY_LINK([#define XP_UNIX
#include <jsapi.h>],
[JS_GetImplementationVersion()],
cf_result=yes, cf_result=no)
fi
done
done
done
fi
AC_MSG_RESULT($cf_result)
if test "$cf_result" != yes; then
EL_RESTORE_FLAGS
else
EL_CONFIG(CONFIG_SPIDERMONKEY, [SpiderMonkey])
CFLAGS="$CFLAGS_X"
AC_SUBST(SPIDERMONKEY_LIBS)
AC_SUBST(SPIDERMONKEY_CFLAGS)
fi
AC_SUBST(CONFIG_SPIDERMONKEY)
EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_SPIDERMONKEY], [ECMAScript (JavaScript)])
dnl ===================================================================
dnl Check for Guile, optional even if installed.
dnl ===================================================================
@ -724,77 +781,36 @@ dnl ===================================================================
EL_CONFIG_RUBY
dnl ===================================================================
dnl Optional Spidermonkey-based ECMAScript browser scripting
dnl ===================================================================
AC_ARG_ENABLE(sm-scripting,
[ --disable-sm-scripting ECMAScript browser scripting (requires Spidermonkey)],
[if test "$enableval" != no; then enableval="yes"; fi
CONFIG_SM_SCRIPTING="$enableval";])
if test "x$CONFIG_SPIDERMONKEY" = xyes &&
test "x$CONFIG_SM_SCRIPTING" = xyes; then
EL_CONFIG(CONFIG_SM_SCRIPTING, [SpiderMonkey])
else
CONFIG_SM_SCRIPTING=no
fi
dnl ===================================================================
dnl Setup global scripting
dnl ===================================================================
EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_GUILE CONFIG_LUA CONFIG_PERL CONFIG_PYTHON CONFIG_RUBY CONFIG_SEE], [Scripting])
EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_GUILE CONFIG_LUA CONFIG_PERL CONFIG_PYTHON CONFIG_RUBY CONFIG_SM_SCRIPTING], [Browser scripting])
AC_SUBST(CONFIG_GUILE)
AC_SUBST(CONFIG_LUA)
AC_SUBST(CONFIG_PERL)
AC_SUBST(CONFIG_PYTHON)
AC_SUBST(CONFIG_RUBY)
AC_SUBST(CONFIG_SEE)
AC_SUBST(CONFIG_SM_SCRIPTING)
AC_SUBST(CONFIG_SCRIPTING)
dnl ===================================================================
dnl Check for SpiderMonkey, optional even if installed.
dnl ===================================================================
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])
EL_SAVE_FLAGS
cf_result=no
if test -z "$disable_spidermonkey"; then
if test ! -d "$withval"; then
withval="";
fi
for spidermonkeydir in "$withval" "" /usr /usr/local /opt/spidermonkey /opt/js; do
for spidermonkeyinclude in "/include" "/include/js" "/include/smjs"; do
for spidermonkeylib in js smjs; do
if test "$cf_result" = no; then
SPIDERMONKEY_LIBS="-l$spidermonkeylib"
if test ! -z "$spidermonkeydir"; then
SPIDERMONKEY_LIBS="-L$spidermonkeydir/lib $SPIDERMONKEY_LIBS"
SPIDERMONKEY_CFLAGS="-I$spidermonkeydir$spidermonkeyinclude"
fi
LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
CFLAGS="$CFLAGS_X $SPIDERMONKEY_CFLAGS"
CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
AC_TRY_LINK([#define XP_UNIX
#include <jsapi.h>],
[JS_GetImplementationVersion()],
cf_result=yes, cf_result=no)
fi
done
done
done
fi
AC_MSG_RESULT($cf_result)
if test "$cf_result" != yes; then
EL_RESTORE_FLAGS
else
EL_CONFIG(CONFIG_SPIDERMONKEY, [SpiderMonkey])
CFLAGS="$CFLAGS_X"
AC_SUBST(SPIDERMONKEY_LIBS)
AC_SUBST(SPIDERMONKEY_CFLAGS)
fi
AC_SUBST(CONFIG_SPIDERMONKEY)
EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_SPIDERMONKEY], [ECMAScript (JavaScript)])
dnl ===================================================================
dnl Check for SSL support.
dnl ===================================================================

View File

@ -395,6 +395,22 @@ CONFIG_CSS=yes
CONFIG_HTML_HIGHLIGHT=no
### ECMAScript (JavaScript) Browser Scripting
#
# By enabling this feature, certain parts of ELinks, such as the goto URL
# dialog, may be extended using ECMAScript (aka. JavaScript) scripts. This can
# be useful to optimise your usage of ELinks.
#
# For example you can define shortcuts (or abbreviations) for URLs of sites you
# often visit by having a goto URL hook expand them. This can also be achieved
# with the URI rewrite feature (CONFIG_URI_REWRITE), however it is not as
# powerful as doing it with scripting.
#
# Default: enabled if Spidermonkey is found
CONFIG_SM_SCRIPTING=yes
### Mouse Support
#
# ELinks may be controlled not only by keyboard, but also by mouse to quite some

View File

@ -6,8 +6,7 @@ SUBDIRS-$(CONFIG_LUA) += lua
SUBDIRS-$(CONFIG_PERL) += perl
SUBDIRS-$(CONFIG_PYTHON) += python
SUBDIRS-$(CONFIG_RUBY) += ruby
SUBDIRS-$(CONFIG_SEE) += see
SUBDIRS-$(CONFIG_SPIDERMONKEY) += smjs
SUBDIRS-$(CONFIG_SM_SCRIPTING) += smjs
OBJS = scripting.o