1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

Use AX_PYTHON_DEVEL and AX_RUBY_DEVEL

This commit is contained in:
James Booth 2013-09-14 02:38:40 +01:00
parent 77a2deeda2
commit 228f9b4293
3 changed files with 49 additions and 41 deletions

View File

@ -27,8 +27,6 @@ core_sources = \
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/ruby_plugins.h src/plugins/ruby_plugins.c \
src/plugins/ruby_api.h src/plugins/ruby_api.c \
src/plugins/c_api.h src/plugins/c_api.c
main_source = src/main.c
@ -37,19 +35,29 @@ python_sources = \
src/plugins/python_plugins.h src/plugins/python_plugins.c \
src/plugins/python_api.h src/plugins/python_api.c
ruby_sources = \
src/plugins/ruby_plugins.h src/plugins/ruby_plugins.c \
src/plugins/ruby_api.h src/plugins/ruby_api.c
test_sources = \
tests/test_roster.c tests/test_common.c tests/test_history.c \
tests/test_autocomplete.c tests/testsuite.c tests/test_parser.c \
tests/test_jid.c
if BUILD_PYTHON_API
all_sources = $(core_sources) $(python_sources)
with_python_sources = $(core_sources) $(python_sources)
else
all_sources = $(core_sources)
with_python_sources = $(core_sources)
endif
if BUILD_RUBY_API
with_ruby_sources = $(with_python_sources) $(ruby_sources)
else
with_ruby_sources = $(with_python_sources)
endif
bin_PROGRAMS = profanity
profanity_SOURCES = $(main_source) $(all_sources)
profanity_SOURCES = $(main_source) $(with_ruby_sources)
lib_LTLIBRARIES = libprofanity.la
libprofanity_la_LDFLAGS=-module -avoid-version -shared
@ -60,7 +68,7 @@ library_include_HEADERS = src/plugins/profapi.h
TESTS = tests/testsuite
check_PROGRAMS = tests/testsuite
tests_testsuite_SOURCES = $(all_sources) $(test_sources)
tests_testsuite_SOURCES = $(with_ruby_sources) $(test_sources)
tests_testsuite_LDADD = -lheadunit -lstdc++
man_MANS = docs/profanity.1

View File

@ -12,6 +12,18 @@ AC_CONFIG_HEADERS([src/config.h])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AX_PREFIX_CONFIG_H([src/prof_config.h], [PROF], [src/config.h])
AC_DEFUN([AX_WITH_RUBY],[
AX_WITH_PROG(RUBY,ruby,$1,$2)
])
AX_RUBY_DEVEL
AM_CONDITIONAL([BUILD_RUBY_API], [true])
AC_DEFINE([HAVE_RUBY], [1], [Ruby support])
AX_PYTHON_DEVEL
AM_CONDITIONAL([BUILD_PYTHON_API], [true])
AC_DEFINE([HAVE_PYTHON], [1], [Python support])
#AC_CHECK_PROG(PYTHON_CONFIG, python-config, yes, no)
# Checks for programs.
AC_PROG_CC
@ -76,23 +88,6 @@ AC_CHECK_LIB([headunit], [main], [],
AC_CHECK_LIB([dl], [main], [],
[AC_MSG_ERROR([dl library needed to run C plugins])])
# check for python development, for python plugin support
AC_CHECK_PROG(PYTHON_CONFIG, python-config, yes, no)
if test $PYTHON_CONFIG = yes; then
AC_MSG_NOTICE([Python supported.])
AC_DEFINE([HAVE_PYTHON], [1], [Python])
PYTHON_CFLAGS=`python-config --cflags`
AC_MSG_NOTICE([Python CFLAGS=$PYTHON_CFLAGS])
PYTHON_LIBS=`python-config --libs`
AC_MSG_NOTICE([Python LIBS=$PYTHON_LIBS])
PYTHON_LDFLAGS=`python-config --ldflags`
AC_MSG_NOTICE([Python LDFLAGS=$PYTHON_LDFLAGS])
AM_CONDITIONAL([BUILD_PYTHON_API], [true])
else
AC_MSG_NOTICE([Python not supported])
AM_CONDITIONAL([BUILD_PYTHON_API], [false])
fi
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h])
@ -111,20 +106,14 @@ fi
# Default parameters
AM_CFLAGS="-Wall -export-dynamic"
# TODO use another method to get flags for system
RUBY_CFLAGS="-I/usr/lib/ruby/1.8/x86_64-linux -L/usr/lib/ruby/1.8/x86_64-linux"
RUBY_LIBS="-lruby1.8"
AM_CFLAGS="$AM_CFLAGS $PYTHON_CFLAGS $RUBY_CFLAGS"
if test "x$PACKAGE_STATUS" = xdevelopment; then
# AM_CFLAGS="$AM_CFLAGS -Wunused -Werror"
AM_CFLAGS="$AM_CFLAGS -Wunused"
fi
LIBS="$LIBS $DEPS_LIBS $NOTIFY_LIBS $PYTHON_LIBS $RUBY_LIBS"
AM_LDFLAGS="$AM_LDFLAGS $PYTHON_LDFLAGS"
AM_CPPFLAGS="$DEPS_CFLAGS $NOTIFY_CFLAGS"
LIBS="$LIBS $DEPS_LIBS $NOTIFY_LIBS"
AM_LDFLAGS="$AM_LDFLAGS $PYTHON_LDFLAGS $RUBY_LDFLAGS"
AM_CPPFLAGS="$DEPS_CFLAGS $NOTIFY_CFLAGS $PYTHON_CPPFLAGS $RUBY_CPPFLAGS"
AC_SUBST(AM_LDFLAGS)
AC_SUBST(AM_CFLAGS)

View File

@ -35,10 +35,13 @@
#include "plugins/python_api.h"
#endif
#include "plugins/c_plugins.h"
#include "plugins/c_api.h"
#ifdef PROF_HAVE_RUBY
#include "plugins/ruby_plugins.h"
#include "plugins/ruby_api.h"
#endif
#include "plugins/c_plugins.h"
#include "plugins/c_api.h"
#include "ui/ui.h"
static GSList* plugins;
@ -51,7 +54,9 @@ plugins_init(void)
#ifdef PROF_HAVE_PYTHON
python_env_init();
#endif
#ifdef PROF_HAVE_RUBY
ruby_env_init();
#endif
c_env_init();
// load plugins
@ -71,15 +76,17 @@ plugins_init(void)
}
}
#endif
if (g_str_has_suffix(filename, ".so")) {
ProfPlugin *plugin = c_plugin_create(filename);
#ifdef PROF_HAVE_RUBY
if (g_str_has_suffix(filename, ".rb")) {
ProfPlugin *plugin = ruby_plugin_create(filename);
if (plugin != NULL) {
plugins = g_slist_append(plugins, plugin);
loaded = TRUE;
}
}
if (g_str_has_suffix(filename, ".rb")) {
ProfPlugin *plugin = ruby_plugin_create(filename);
#endif
if (g_str_has_suffix(filename, ".so")) {
ProfPlugin *plugin = c_plugin_create(filename);
if (plugin != NULL) {
plugins = g_slist_append(plugins, plugin);
loaded = TRUE;
@ -310,24 +317,28 @@ plugins_shutdown(void)
while (curr != NULL) {
ProfPlugin *plugin = curr->data;
if (plugin->lang == LANG_C) {
c_plugin_destroy(plugin);
}
#ifdef PROF_HAVE_PYTHON
if (plugin->lang == LANG_PYTHON) {
python_plugin_destroy(plugin);
}
#endif
#ifdef PROF_HAVE_RUBY
if (plugin->lang == LANG_RUBY) {
ruby_plugin_destroy(plugin);
}
#endif
if (plugin->lang == LANG_C) {
c_plugin_destroy(plugin);
}
curr = g_slist_next(curr);
}
#ifdef PROF_HAVE_PYTHON
python_shutdown();
#endif
#ifdef PROF_HAVE_RUBY
ruby_shutdown();
#endif
c_shutdown();
}