if test "x${gmodule}" = "xyes"; then
AC_DEFINE(HAVE_GMODULE, 1, [Define to 1 if you have gmodule])
else
- plugins="no"; plugins_reason="package gmodule missing"
+ AC_CHECK_LIB(dl, dlopen,
+ [plugins_reason="default, via dlopen";GMODULE_LIBS="-ldl";AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if you have dlopen])],
+ [plugins="no"; plugins_reason="package gmodule and dlopen missing"]
+ )
fi
# plugins
AC_ARG_ENABLE(plugins, [ --disable-plugins disable plugins], [ plugins=$enableval;plugin_reason="configure parameter" ])
echo " gpsd: $vehicle_gpsd ($vehicle_gpsd_reason)"
echo " gypsy: $vehicle_gypsy ($vehicle_gypsy_reason)"
-if [ test x"$gtk2_pkgconfig" != xyes ] && [ test x"$sdl" != xyes ] && [ test x"$directfb_pkgconfig" != xyes ] && [ test x"$gui_win32" != xyes ]
+if test "x${gtk2_pkgconfig}" != "xyes" -a "x${sdl}" != "xyes" -a "x${directfb_pkgconfig}" != "xyes" -a "x${gui_win32}" != "xyes" -a "x${gui_internal}" != "xyes"
then
echo ""
echo ""
#include <glib.h>
#include "config.h"
#ifdef USE_PLUGINS
+#ifdef HAVE_GMODULE
#include <gmodule.h>
+#else
+#include <dlfcn.h>
+#endif
#endif
#include "plugin.h"
#include "file.h"
#include "item.h"
#include "debug.h"
+#ifndef HAVE_GMODULE
+typedef void * GModule;
+#define G_MODULE_BIND_LOCAL 1
+#define G_MODULE_BIND_LAZY 2
+static int
+g_module_supported(void)
+{
+ return 1;
+}
+
+static void *
+g_module_open(char *name, int flags)
+{
+ return dlopen(name,
+ (flags & G_MODULE_BIND_LAZY ? RTLD_LAZY : RTLD_NOW) |
+ (flags & G_MODULE_BIND_LOCAL ? RTLD_LOCAL : RTLD_GLOBAL));
+}
+
+static char *
+g_module_error(void)
+{
+ return dlerror();
+}
+
+static int
+g_module_symbol(GModule *handle, char *symbol, gpointer *addr)
+{
+ *addr=dlsym(handle, symbol);
+ return (*addr != NULL);
+}
+
+static void
+g_module_close(GModule *handle)
+{
+ dlclose(handle);
+}
+
+#endif
+
struct plugin {
int active;
int lazy;