mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Added --enable-c-plugins to configure.ac
This commit is contained in:
parent
9588bb0eaf
commit
f1596e2957
30
Makefile.am
30
Makefile.am
@ -43,9 +43,7 @@ core_sources = \
|
||||
src/config/theme.c src/config/theme.h \
|
||||
src/plugins/plugins.h src/plugins/plugins.c \
|
||||
src/plugins/api.h src/plugins/api.c \
|
||||
src/plugins/callbacks.h src/plugins/callbacks.c \
|
||||
src/plugins/c_plugins.h src/plugins/c_plugins.c \
|
||||
src/plugins/c_api.h src/plugins/c_api.c
|
||||
src/plugins/callbacks.h src/plugins/callbacks.c
|
||||
|
||||
test_sources = \
|
||||
src/contact.c src/contact.h src/common.c \
|
||||
@ -71,8 +69,6 @@ test_sources = \
|
||||
src/plugins/plugins.h src/plugins/plugins.c \
|
||||
src/plugins/api.h src/plugins/api.c \
|
||||
src/plugins/callbacks.h src/plugins/callbacks.c \
|
||||
src/plugins/c_plugins.h src/plugins/c_plugins.c \
|
||||
src/plugins/c_api.h src/plugins/c_api.c \
|
||||
tests/xmpp/mock_xmpp.h tests/xmpp/mock_xmpp.c \
|
||||
tests/ui/mock_ui.h tests/ui/mock_ui.c \
|
||||
tests/config/mock_accounts.h tests/config/mock_accounts.c \
|
||||
@ -104,6 +100,10 @@ lua_sources = \
|
||||
src/plugins/lua_plugins.h src/plugins/lua_plugins.c \
|
||||
src/plugins/lua_api.h src/plugins/lua_api.c
|
||||
|
||||
c_sources = \
|
||||
src/plugins/c_plugins.h src/plugins/c_plugins.c \
|
||||
src/plugins/c_api.h src/plugins/c_api.c
|
||||
|
||||
git_sources = \
|
||||
src/gitversion.c
|
||||
|
||||
@ -131,23 +131,33 @@ with_lua_sources = $(with_ruby_sources)
|
||||
test_with_lua_sources = $(tests_with_ruby_sources)
|
||||
endif
|
||||
|
||||
if INCLUDE_GIT_VERSION
|
||||
with_git_sources = $(git_sources) $(with_lua_sources)
|
||||
tests_with_git_sources = $(git_sources) $(tests_with_lua_sources)
|
||||
if BUILD_C_API
|
||||
with_c_sources = $(with_lua_sources) $(c_sources)
|
||||
tests_with_c_sources = $(tests_with_lua_sources) $(c_sources)
|
||||
else
|
||||
with_git_sources = $(with_lua_sources)
|
||||
tests_with_git_sources = $(tests_with_lua_sources)
|
||||
with_c_sources = $(with_lua_sources)
|
||||
test_with_c_sources = $(tests_with_lua_sources)
|
||||
endif
|
||||
|
||||
if INCLUDE_GIT_VERSION
|
||||
with_git_sources = $(git_sources) $(with_c_sources)
|
||||
tests_with_git_sources = $(git_sources) $(tests_with_c_sources)
|
||||
else
|
||||
with_git_sources = $(with_c_sources)
|
||||
tests_with_git_sources = $(tests_with_c_sources)
|
||||
endif
|
||||
|
||||
bin_PROGRAMS = profanity
|
||||
profanity_SOURCES = $(with_git_sources) $(main_source)
|
||||
|
||||
if BUILD_C_API
|
||||
lib_LTLIBRARIES = libprofanity.la
|
||||
libprofanity_la_LDFLAGS=-module -avoid-version -shared
|
||||
libprofanity_la_SOURCES = src/plugins/profapi.c
|
||||
|
||||
library_includedir=$(includedir)
|
||||
library_include_HEADERS = src/plugins/profapi.h
|
||||
endif
|
||||
|
||||
TESTS = tests/testsuite
|
||||
check_PROGRAMS = tests/testsuite
|
||||
|
15
configure.ac
15
configure.ac
@ -36,6 +36,8 @@ AC_ARG_ENABLE([python-plugins],
|
||||
[AS_HELP_STRING([--enable-python-plugins], [enable Python plugins])])
|
||||
AC_ARG_ENABLE([lua-plugins],
|
||||
[AS_HELP_STRING([--enable-lua-plugins], [enable Lua plugins])])
|
||||
AC_ARG_ENABLE([c-plugins],
|
||||
[AS_HELP_STRING([--enable-c-plugins], [enable C plugins])])
|
||||
AC_ARG_WITH([libxml2],
|
||||
[AS_HELP_STRING([--with-libxml2], [link with libxml2 instead of expat])])
|
||||
AC_ARG_WITH([xscreensaver],
|
||||
@ -109,8 +111,17 @@ fi
|
||||
|
||||
# c
|
||||
LT_INIT
|
||||
AC_CHECK_LIB([dl], [main], [],
|
||||
[AC_MSG_ERROR([dl library needed to run C plugins])])
|
||||
if test "x$enable_c_plugins" != xno; then
|
||||
AC_CHECK_LIB([dl], [main],
|
||||
[AM_CONDITIONAL([BUILD_C_API], [true]) AC_DEFINE([HAVE_C], [1], [C support])],
|
||||
[AS_IF(
|
||||
[test "x$enable_c_plugins" = xyes],
|
||||
[AC_MSG_ERROR([dl library needed to run C plugins])],
|
||||
[AM_CONDITIONAL([BUILD_C_API], [false])])
|
||||
])
|
||||
else
|
||||
AM_CONDITIONAL([BUILD_C_API], [false])
|
||||
fi
|
||||
|
||||
### Select first existing xml library among expat and libxml2
|
||||
PARSER=""
|
||||
|
@ -45,8 +45,11 @@
|
||||
#include "plugins/lua_api.h"
|
||||
#endif
|
||||
|
||||
#ifdef PROF_HAVE_C
|
||||
#include "plugins/c_plugins.h"
|
||||
#include "plugins/c_api.h"
|
||||
|
||||
#endif
|
||||
#include "ui/ui.h"
|
||||
|
||||
static GSList* plugins;
|
||||
@ -65,7 +68,9 @@ plugins_init(void)
|
||||
#ifdef PROF_HAVE_LUA
|
||||
lua_env_init();
|
||||
#endif
|
||||
#ifdef PROF_HAVE_C
|
||||
c_env_init();
|
||||
#endif
|
||||
|
||||
// load plugins
|
||||
gchar **plugins_load = prefs_get_plugins();
|
||||
@ -102,6 +107,7 @@ plugins_init(void)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef PROF_HAVE_C
|
||||
if (g_str_has_suffix(filename, ".so")) {
|
||||
ProfPlugin *plugin = c_plugin_create(filename);
|
||||
if (plugin != NULL) {
|
||||
@ -109,6 +115,7 @@ plugins_init(void)
|
||||
loaded = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (loaded == TRUE) {
|
||||
log_info("Loaded plugin: %s", filename);
|
||||
}
|
||||
@ -356,25 +363,26 @@ plugins_shutdown(void)
|
||||
GSList *curr = plugins;
|
||||
|
||||
while (curr != NULL) {
|
||||
ProfPlugin *plugin = curr->data;
|
||||
#ifdef PROF_HAVE_PYTHON
|
||||
if (plugin->lang == LANG_PYTHON) {
|
||||
python_plugin_destroy(plugin);
|
||||
if (((ProfPlugin *)curr->data)->lang == LANG_PYTHON) {
|
||||
python_plugin_destroy(curr->data);
|
||||
}
|
||||
#endif
|
||||
#ifdef PROF_HAVE_RUBY
|
||||
if (plugin->lang == LANG_RUBY) {
|
||||
ruby_plugin_destroy(plugin);
|
||||
if (((ProfPlugin *)curr->data)->lang == LANG_RUBY) {
|
||||
ruby_plugin_destroy(curr->data);
|
||||
}
|
||||
#endif
|
||||
#ifdef PROF_HAVE_LUA
|
||||
if (plugin->lang == LANG_LUA) {
|
||||
lua_plugin_destroy(plugin);
|
||||
if (((ProfPlugin *)curr->data)->lang == LANG_LUA) {
|
||||
lua_plugin_destroy(curr->data);
|
||||
}
|
||||
#endif
|
||||
if (plugin->lang == LANG_C) {
|
||||
c_plugin_destroy(plugin);
|
||||
#ifdef PROF_HAVE_C
|
||||
if (((ProfPlugin *)curr->data)->lang == LANG_C) {
|
||||
c_plugin_destroy(curr->data);
|
||||
}
|
||||
#endif
|
||||
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
@ -387,7 +395,9 @@ plugins_shutdown(void)
|
||||
#ifdef PROF_HAVE_LUA
|
||||
lua_shutdown();
|
||||
#endif
|
||||
#ifdef PROF_HAVE_C
|
||||
c_shutdown();
|
||||
#endif
|
||||
}
|
||||
|
||||
gchar *
|
||||
|
Loading…
Reference in New Issue
Block a user