Browse files

Try to get plugin suffix from libtool and fallback to it.

If it is possible to get plugin suffix from libtool after the configure,
ekg2 will use that suffix to load plugins if it fails to find/load
the .la file. This should help on systems with thoughtless .la removal
mania.
  • Loading branch information...
1 parent 44acbcd commit a0b0cc1a4818d195120455b336773519c8f181c8 @mgorny mgorny committed Feb 6, 2012
Showing with 32 additions and 0 deletions.
  1. +4 −0 configure.ac
  2. +28 −0 ekg/plugins.c
View
4 configure.ac
@@ -344,6 +344,10 @@ CPPFLAGS=
AC_CONFIG_COMMANDS_PRE([
AM_CONDITIONAL([ENABLE_GCH], [test "x$enable_dependency_tracking" = "xno"])
+ AS_IF([test "x$shrext_cmds" != "x"], [
+ AC_DEFINE_UNQUOTED([PLUGIN_SUFFIX], ["$shrext_cmds"],
+ [set to plugin suffix if known])
+ ])
])
AC_CONFIG_HEADERS([ekg2-config.h])
AC_CONFIG_FILES([Makefile po/Makefile.in])
View
28 ekg/plugins.c
@@ -221,6 +221,34 @@ int plugin_load(const char *name, int prio, int quiet)
}
g_free(libname);
+
+#ifdef PLUGIN_SUFFIX
+ /* no .la found? try the standard suffix as well */
+ if (!plugin) {
+ libname = g_strdup_printf("%s" PLUGIN_SUFFIX, name);
+
+ if ((env_ekg_plugins_path = g_getenv("EKG_PLUGINS_PATH"))) {
+ lib = g_build_filename(env_ekg_plugins_path, libname, NULL);
+ plugin = ekg2_dlopen(lib);
+ g_free(lib);
+
+ if (!plugin) {
+ lib = g_build_filename(env_ekg_plugins_path, name, libname, NULL);
+ plugin = ekg2_dlopen(lib);
+ g_free(lib);
+ }
+ }
+
+ if (!plugin) {
+ lib = g_build_filename(PLUGINDIR, libname, NULL);
+ plugin = ekg2_dlopen(lib);
+ g_free(lib);
+ }
+
+ g_free(libname);
+ }
+#endif
+
/* prefer shared plugins */
if (plugin) {
init = g_strdup_printf("%s_plugin_init", name);

0 comments on commit a0b0cc1

Please sign in to comment.