summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2015-03-08 09:56:51 +0100
committerSébastien Helleu <flashcode@flashtux.org>2015-03-08 09:56:51 +0100
commit148a571dced7e4677ea5154c4c3f2c7fbe358087 (patch)
treef5bd72bb7b267c17769c6874e38fc814a904605f /configure.ac
parent2120405a165c3259470980933af8d0d3b6c72828 (diff)
downloadweechat-148a571dced7e4677ea5154c4c3f2c7fbe358087.zip
javascript: add option "--disable-javascript" and V8 detection in autotools
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac63
1 files changed, 63 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index c4aeb34fd..66599e5ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,6 +119,7 @@ AH_VERBATIM([PLUGIN_RUBY], [#undef PLUGIN_RUBY])
AH_VERBATIM([PLUGIN_LUA], [#undef PLUGIN_LUA])
AH_VERBATIM([PLUGIN_TCL], [#undef PLUGIN_TCL])
AH_VERBATIM([PLUGIN_GUILE], [#undef PLUGIN_GUILE])
+AH_VERBATIM([PLUGIN_JAVASCRIPT], [#undef PLUGIN_JAVASCRIPT])
AH_VERBATIM([PLUGIN_TRIGGER], [#undef PLUGIN_TRIGGER])
AH_VERBATIM([PLUGIN_XFER], [#undef PLUGIN_XFER])
AH_VERBATIM([TESTS], [#undef TESTS])
@@ -150,6 +151,7 @@ AC_ARG_ENABLE(ruby, [ --disable-ruby turn off Ruby script plug
AC_ARG_ENABLE(lua, [ --disable-lua turn off Lua script plugin (default=compiled if found)],enable_lua=$enableval,enable_lua=yes)
AC_ARG_ENABLE(tcl, [ --disable-tcl turn off Tcl script plugin (default=compiled if found)],enable_tcl=$enableval,enable_tcl=yes)
AC_ARG_ENABLE(guile, [ --disable-guile turn off Guile (scheme) script plugin (default=compiled if found)],enable_guile=$enableval,enable_guile=yes)
+AC_ARG_ENABLE(javascript, [ --disable-javascript turn off Javascript script plugin (default=compiled if found)],enable_javascript=$enableval,enable_javascript=yes)
AC_ARG_ENABLE(trigger, [ --disable-trigger turn off Trigger plugin (default=compiled)],enable_trigger=$enableval,enable_trigger=yes)
AC_ARG_ENABLE(xfer, [ --disable-xfer turn off Xfer (file transfer) plugin (default=compiled if found)],enable_xfer=$enableval,enable_xfer=yes)
AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR directory containing tcl configuration (tclConfig.sh)],tclconfig=$withval,tclconfig='')
@@ -282,6 +284,7 @@ if test "x$enable_scripts" = "xno" ; then
enable_lua="no"
enable_tcl="no"
enable_guile="no"
+ enable_javascript="no"
fi
# ---------------------------------- alias -------------------------------------
@@ -848,6 +851,60 @@ if test "x$enable_guile" = "xyes" ; then
AC_DEFINE(PLUGIN_GUILE)
fi
+# ------------------------------ javascript -----------------------------------
+
+AC_LANG_PUSH([C++])
+
+if test "x$enable_javascript" = "xyes" ; then
+ enable_plugins="yes"
+
+ v8_found="no"
+ AC_CHECK_HEADER(v8.h,ac_found_v8_header="yes",ac_found_v8_header="no")
+ if test "x$ac_found_v8_header" = "xyes" ; then
+ #AC_CHECK_LIB(v8,v8,ac_found_v8_lib="yes",ac_found_v8_lib="no")
+ ac_save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -lv8"
+ AC_MSG_CHECKING(for v8 usability in programs)
+ AC_TRY_RUN([
+ #include <v8.h>
+ using namespace v8;
+ int main(int argc, char **argv) {
+ const char *version = V8::GetVersion();
+ return 0;
+ }],ac_found_v8_lib="yes", ac_found_v8_lib="no", ac_found_v8_lib="assume-yes")
+ LDFLAGS="$ac_save_LDFLAGS"
+ if test "x$ac_found_v8_lib" = "xyes" ; then
+ AC_MSG_RESULT(yes)
+ v8_found="yes"
+ V8_CFLAGS=""
+ V8_LFLAGS="-lv8"
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN([
+*** V8 library couldn't be found on your system.
+*** WeeChat will be built without Javascript support.])
+ enable_javascript="no"
+ not_found="$not_found javascript/v8"
+ fi
+ else
+ AC_MSG_WARN([
+*** V8 header files couldn't be found on your system.
+*** WeeChat will be built without Javascript support.])
+ enable_javascript="no"
+ not_found="$not_found javascript/v8"
+ fi
+else
+ not_asked="$not_asked javascript"
+fi
+
+if test "x$enable_javascript" = "xyes" ; then
+ AC_SUBST(V8_CFLAGS)
+ AC_SUBST(V8_LFLAGS)
+ AC_DEFINE(PLUGIN_JAVASCRIPT)
+fi
+
+AC_LANG_POP
+
# --------------------------------- trigger ------------------------------------
if test "x$enable_trigger" = "xyes" ; then
@@ -1192,6 +1249,7 @@ gnu*)
esac
CFLAGS="$CFLAGS -DWEECHAT_VERSION=\\\"$VERSION\\\" -DWEECHAT_LICENSE=\\\"$LICENSE\\\""
+CPPFLAGS="$CPPFLAGS -DWEECHAT_VERSION=\\\"$VERSION\\\" -DWEECHAT_LICENSE=\\\"$LICENSE\\\""
# ------------------------------------------------------------------------------
# output Makefiles
@@ -1216,6 +1274,7 @@ AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
AM_CONDITIONAL(PLUGIN_LUA, test "$enable_lua" = "yes")
AM_CONDITIONAL(PLUGIN_TCL, test "$enable_tcl" = "yes")
AM_CONDITIONAL(PLUGIN_GUILE, test "$enable_guile" = "yes")
+AM_CONDITIONAL(PLUGIN_JAVASCRIPT, test "$enable_javascript" = "yes")
AM_CONDITIONAL(PLUGIN_TRIGGER, test "$enable_trigger" = "yes")
AM_CONDITIONAL(PLUGIN_XFER, test "$enable_xfer" = "yes")
AM_CONDITIONAL(TESTS, test "$enable_tests" = "yes")
@@ -1250,6 +1309,7 @@ AC_OUTPUT([Makefile
src/plugins/lua/Makefile
src/plugins/tcl/Makefile
src/plugins/guile/Makefile
+ src/plugins/javascript/Makefile
src/plugins/trigger/Makefile
src/plugins/xfer/Makefile
src/gui/Makefile
@@ -1319,6 +1379,9 @@ fi
if test "x$enable_guile" = "xyes"; then
listplugins="$listplugins guile($GUILE_VERSION)"
fi
+if test "x$enable_javascript" = "xyes"; then
+ listplugins="$listplugins javascript/v8"
+fi
if test "x$enable_trigger" = "xyes"; then
listplugins="$listplugins trigger"
fi