Add:Core:Added support for pluginless mode
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 3 Jan 2008 11:13:38 +0000 (11:13 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Thu, 3 Jan 2008 11:13:38 +0000 (11:13 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit@693 ffa7fe5e-494d-0410-b361-a75ebd5db220

38 files changed:
configure.in
src/Makefile.am
src/binding/python/Makefile.am
src/data/binfile/Makefile.am
src/data/binfile/binfile.c
src/data/garmin/Makefile.am
src/data/garmin/garmin.c
src/data/garmin_img/Makefile.am
src/data/garmin_img/garmin_img.c
src/data/mg/Makefile.am
src/data/mg/map.c
src/data/poi_geodownload/Makefile.am
src/data/poi_geodownload/poi_geodownload.c
src/data/textfile/Makefile.am
src/data/textfile/textfile.c
src/debug.h
src/graphics/gtk_drawing_area/Makefile.am
src/graphics/null/Makefile.am
src/graphics/null/graphics_null.c
src/graphics/opengl/Makefile.am
src/gui/gtk/Makefile.am
src/gui/gtk/gui_gtk_window.c
src/gui/sdl/Makefile.am
src/main.c
src/osd/core/Makefile.am
src/osd/core/osd_core.c
src/plugin.c
src/plugin.h
src/plugins/poi_geodownload/poi.c
src/profile.h
src/speech/cmdline/Makefile.am
src/speech/cmdline/speech_cmdline.c
src/speech/speech_dispatcher/Makefile.am
src/vehicle/demo/Makefile.am
src/vehicle/demo/vehicle_demo.c
src/vehicle/file/Makefile.am
src/vehicle/file/vehicle_file.c
src/vehicle/gpsd/Makefile.am

index ff6068c..f90310e 100644 (file)
@@ -24,15 +24,17 @@ AC_ARG_ENABLE(plugins,      [  --disable-plugins          disable plugins],
                        [
                                AC_DISABLE_SHARED
                                AC_ENABLE_STATIC
+                               plugins=$enableval
                        ],
                        [
                                AC_ENABLE_SHARED
                                AC_DISABLE_STATIC
                                AC_DEFINE(
-                                       [HAVE_PLUGIN],
+                                       [USE_PLUGINS],
                                        [],
                                        Define to 1 if you have plugins.
                                )
+                               plugins=yes
                        ]
 )
 AC_PROG_LIBTOOL
@@ -90,6 +92,7 @@ AC_SUBST(GTK2_CFLAGS)
 AC_SUBST(GTK2_LIBS)
 AM_CONDITIONAL(GUI_GTK, [test "x$gtk2_pkgconfig" = "xyes"])
 AM_CONDITIONAL(GRAPHICS_GTK_DRAWING_AREA, [test "x$gtk2_pkgconfig" = "xyes"])
+AM_CONDITIONAL(PLUGINS, [test "x$plugins" = "xyes"])
 
 PKG_CHECK_MODULES(FREETYPE2, [freetype2], [freetype2_pkgconfig=yes], [freetype2_pkgconfig=no])
 if test "x$freetype2_pkgconfig" = "xyes"; then
index a437b31..fedae9b 100644 (file)
@@ -5,7 +5,7 @@ if BUILD_SAMPLEMAP
   SUBDIRS += maps
 endif
 
-AM_CPPFLAGS = -I$(top_srcdir)/src/fib-1.1 @NAVIT_CFLAGS@ -DPREFIX=\"@prefix@\" -DMODULE=\"navit\"
+AM_CPPFLAGS = -I$(top_srcdir)/src/fib-1.1 @NAVIT_CFLAGS@ -DPREFIX=\"@prefix@\" -DMODULE=navit
 BUILT_SOURCES=osm2navit
 bin_PROGRAMS = navit osm2navit
 
@@ -28,4 +28,16 @@ osm2navit_SOURCES = osm2navit.c item.c debug.c zipfile.h
 
 navit_LDADD = @NAVIT_LIBS@ @ZLIB_LIBS@ -Lfib-1.1 -lfib
 
+if !PLUGINS
+  navit_SOURCES += builtin.c
+  navit_LDADD += $(wildcard $(top_builddir)/src/*/*/*.la)
+endif
+
+builtin.c:
+       ls $(top_builddir)/src/*/*/*.la | sed -e "s/.la/_init(void);/" -e "s/.*lib/extern void /" >builtin.c
+       echo "extern void builtin_init(void);" >>builtin.c
+       echo "void builtin_init(void) {" >>builtin.c
+       ls $(top_builddir)/src/*/*/*.la | sed -e "s/.la/_init();/" -e "s/.*lib/ module_/" >>builtin.c
+       echo "}" >>builtin.c
+
 osm2navit_LDADD = @NAVIT_LIBS@  @ZLIB_LIBS@
index 704fc7d..6374920 100644 (file)
@@ -1,5 +1,5 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ @PYTHON_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"binding_python\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ @PYTHON_CFLAGS@ -I$(top_srcdir)/src -DMODULE=binding_python
 modulebinding_LTLIBRARIES = libbinding_python.la
 libbinding_python_la_SOURCES = binding_python.c
 libbinding_python_la_LIBADD = @PYTHON_LIBS@
index fbc4783..69e26f5 100644 (file)
@@ -1,4 +1,4 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"data_binfile\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=data_binfile
 moduledata_LTLIBRARIES = libdata_binfile.la
 libdata_binfile_la_SOURCES = binfile.c
index 3537afe..50c8a9d 100644 (file)
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
+#include "config.h"
 #include "debug.h"
 #include "plugin.h"
 #include "projection.h"
index 036f77d..e177ba5 100644 (file)
@@ -1,5 +1,5 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@   -I$(top_srcdir)/src -DMODULE=\"data_garmin\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@   -I$(top_srcdir)/src -DMODULE=data_garmin
 AM_CPPFLAGS+= @LIBGARMIN_CFLAGS@
 INCLUDES=-I$(top_srcdir)/src/data/garmin/libgarmin
 AM_CPPFLAGS+=-I$(top_srcdir)/src/data/garmin/libgarmin
index 7fad256..9b66149 100644 (file)
@@ -28,6 +28,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include "config.h"
 #include "plugin.h"
 #include "data.h"
 #include "projection.h"
index d54e510..c48ea39 100644 (file)
@@ -1,4 +1,4 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"data_garmin_img\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=data_garmin_img
 moduledata_LTLIBRARIES = libdata_garmin_img.la
 libdata_garmin_img_la_SOURCES = garmin_img.c
index 0ba74f8..d735b02 100644 (file)
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
+#include "config.h"
 #include "plugin.h"
 #include "data.h"
 #include "projection.h"
index 27889da..04d92b0 100644 (file)
@@ -1,4 +1,4 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"data_mg\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=data_mg
 moduledata_LTLIBRARIES = libdata_mg.la
 libdata_mg_la_SOURCES = map.c block.c town.c tree.c poly.c street.c mg.h
index 34a6852..5a38563 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <string.h>
+#include "config.h"
 #include "debug.h"
 #include "plugin.h"
 #include "maptype.h"
index f58a0f0..6c329b8 100644 (file)
@@ -1,6 +1,6 @@
 SUBDIRS=libmdb
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -I$(srcdir)/libmdb/include -DMODULE=\"data_poi_geodownload\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -I$(srcdir)/libmdb/include -DMODULE=data_poi_geodownload
 moduledata_LTLIBRARIES = libdata_poi_geodownload.la
 libdata_poi_geodownload_la_SOURCES = poi_geodownload.c
 libdata_poi_geodownload_la_LIBADD = -Llibmdb -lmdb
index a182424..229457b 100644 (file)
@@ -1,4 +1,5 @@
 #include <mdbtools.h>
+#include "config.h"
 #include "debug.h"
 #include "coord.h"
 #include "projection.h"
index 63d2e23..afbc47d 100644 (file)
@@ -1,4 +1,4 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"data_textfile\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=data_textfile
 moduledata_LTLIBRARIES = libdata_textfile.la
 libdata_textfile_la_SOURCES = textfile.c textfile.h
index 397885e..fc53e52 100644 (file)
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
+#include "config.h"
 #include "debug.h"
 #include "plugin.h"
 #include "projection.h"
index 3fa0437..38c4031 100644 (file)
@@ -7,7 +7,10 @@ extern "C" {
 
 #include <stdarg.h>
 extern int debug_level;
-#define dbg(level,fmt...) ({ if (debug_level >= level) debug_printf(level,MODULE,__PRETTY_FUNCTION__,1,fmt); })
+#define dbg_str2(x) #x
+#define dbg_str1(x) dbg_str2(x)
+#define dbg_module dbg_str1(MODULE)
+#define dbg(level,fmt...) ({ if (debug_level >= level) debug_printf(level,dbg_module,__PRETTY_FUNCTION__,1,fmt); })
 
 /* prototypes */
 void debug_init(void);
index 4b468a3..3c6b353 100644 (file)
@@ -1,5 +1,5 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @GTK2_CFLAGS@ @FREETYPE2_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"graphics_gtk_drawing_area\"
+AM_CPPFLAGS = @GTK2_CFLAGS@ @FREETYPE2_CFLAGS@ -I$(top_srcdir)/src -DMODULE=graphics_gtk_drawing_area
 modulegraphics_LTLIBRARIES = libgraphics_gtk_drawing_area.la
 libgraphics_gtk_drawing_area_la_SOURCES = graphics_gtk_drawing_area.c
 libgraphics_gtk_drawing_area_la_LDFLAGS = @GTK2_LIBS@
index 647ca2e..c1e93de 100644 (file)
@@ -1,4 +1,4 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"graphics_null\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=graphics_null
 modulegraphics_LTLIBRARIES = libgraphics_null.la
 libgraphics_null_la_SOURCES = graphics_null.c
index 748a5bc..30e4653 100644 (file)
@@ -1,4 +1,5 @@
 #include <glib.h>
+#include "config.h"
 #include "point.h"
 #include "graphics.h"
 #include "color.h"
index b6f7592..a445357 100644 (file)
@@ -1,5 +1,5 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ @OPENGL_CFLAGS@ @GLC_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"graphics_opengl\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ @OPENGL_CFLAGS@ @GLC_CFLAGS@ -I$(top_srcdir)/src -DMODULE=graphics_opengl
 modulegraphics_LTLIBRARIES = libgraphics_opengl.la
 libgraphics_opengl_la_SOURCES = graphics_opengl.c
 libgraphics_opengl_la_LIBADD = @OPENGL_LIBS@ @GLC_LIBS@
index 84a39c4..128a3fb 100644 (file)
@@ -1,5 +1,5 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = -I$(top_srcdir)/src @NAVIT_CFLAGS@ @GTK2_CFLAGS@ -DMODULE=\"gui_gtk\"
+AM_CPPFLAGS = -I$(top_srcdir)/src @NAVIT_CFLAGS@ @GTK2_CFLAGS@ -DMODULE=gui_gtk
 modulegui_LTLIBRARIES = libgui_gtk.la
 libgui_gtk_la_SOURCES = datawindow.c destination.c gui_gtk_statusbar.c gui_gtk_action.c gui_gtk_window.c gui_gtk.h
 libgui_gtk_la_LIBADD = @GTK2_LIBS@
index d0e408d..94e94d0 100644 (file)
@@ -6,6 +6,7 @@
 #endif
 #include <libintl.h>
 #include <gtk/gtk.h>
+#include "config.h"
 #include "navit.h"
 #include "debug.h"
 #include "gui.h"
index c349424..795e35e 100644 (file)
@@ -1,6 +1,6 @@
 include $(top_srcdir)/Makefile.inc
 SUBDIRS=datafiles
-AM_CPPFLAGS = @NAVIT_CFLAGS@ @CEGUI_CFLAGS@ @GLC_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"gui_sdl\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ @CEGUI_CFLAGS@ @GLC_CFLAGS@ -I$(top_srcdir)/src -DMODULE=gui_sdl
 modulegui_LTLIBRARIES = libgui_sdl.la
 libgui_sdl_la_SOURCES = gui_sdl_window.cpp sdl_events.cpp gui_sdl.h sdl_events.h wmcontrol.c wmcontrol.h cegui_keyboard.cpp cegui_keyboard.h
 libgui_sdl_la_LIBADD = @SDL_LIBS@ @CEGUI_LIBS@ @OPENGL_LIBS@ @GLC_LIBS@
index 49805cc..60a490f 100644 (file)
 #ifdef USE_GTK_MAIN_LOOP
 #include <gtk/gtk.h>
 #endif
+#include "config.h"
 #include "file.h"
 #include "debug.h"
 #include "main.h"
 #include "navit.h"
 #include "gui.h"
-#include "plugin.h"
 #include "xmlconfig.h"
 
 #define _(STRING)    gettext(STRING)
@@ -128,6 +128,10 @@ int main(int argc, char **argv)
        textdomain( "navit" );
 
        debug_init();
+#ifndef USE_PLUGINS
+       extern void builtin_init(void);
+       builtin_init();
+#endif
 #if 0
        /* handled in gui/gtk */
        gtk_set_locale();
index de7f629..cacb417 100644 (file)
@@ -1,4 +1,4 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"osd_core\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=osd_core
 moduleosd_LTLIBRARIES = libosd_core.la
 libosd_core_la_SOURCES = osd_core.c
index 27c5650..2c5f9d3 100644 (file)
@@ -1,6 +1,7 @@
 #include <math.h>
 #include <stdio.h>
 #include <glib.h>
+#include "config.h"
 #include "item.h"
 #include "point.h"
 #include "coord.h"
index 9d81e99..7f52301 100644 (file)
@@ -1,5 +1,6 @@
 #include <glib.h>
 #include <gmodule.h>
+#include "config.h"
 #include "plugin.h"
 #include "file.h"
 #define PLUGIN_C
@@ -144,6 +145,7 @@ plugins_add_path(struct plugins *pls, const char *path, int active, int lazy)
 void
 plugins_init(struct plugins *pls)
 {
+#ifdef USE_PLUGINS
        struct plugin *pl;
        GList *l;
 
@@ -162,6 +164,7 @@ plugins_init(struct plugins *pls)
                        plugin_call_init(pl);
                l=g_list_next(l);
        }
+#endif
 }
 
 void
index 9614b19..bdd0e5d 100644 (file)
@@ -104,7 +104,15 @@ void *plugin_get_##type##_type(const char *name);
 
 #include "plugin_def.h"
 
+#ifndef USE_PLUGINS
+#define plugin_module_cat3(pre,mod,post) pre##mod##post
+#define plugin_module_cat2(pre,mod,post) plugin_module_cat3(pre,mod,post)
+#define plugin_module_cat(pre,post) plugin_module_cat2(pre,MODULE,post)
+#define plugin_init plugin_module_cat(module_,_init)
+#endif
+
 void plugin_init(void);
+
 /* prototypes */
 struct plugin *plugin_new(char *plugin);
 int plugin_load(struct plugin *pl);
index de37afd..b21cc1e 100644 (file)
@@ -1,4 +1,5 @@
 #include <mdbtools.h>
+#include "config.h"
 #include "display.h"
 #include "container.h"
 #include "coord.h"
index f5e853e..4afa16a 100644 (file)
@@ -4,7 +4,10 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-#define profile(level,fmt...) profile_timer(level,MODULE,__PRETTY_FUNCTION__,fmt)
+#define profile_str2(x) #x
+#define profile_str1(x) profile_str2(x)
+#define profile_module profile_str1(MODULE)
+#define profile(level,fmt...) profile_timer(level,profile_module,__PRETTY_FUNCTION__,fmt)
 void profile_timer(int level, const char *module, const char *function, const char *fmt, ...);
 #ifdef __cplusplus
 }
index 875ab26..592990c 100644 (file)
@@ -1,4 +1,4 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"speech_cmdline\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=speech_cmdline
 modulespeech_LTLIBRARIES = libspeech_cmdline.la
 libspeech_cmdline_la_SOURCES = speech_cmdline.c
index 936f372..df3b9f1 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <glib.h>
+#include "config.h"
 #include "plugin.h"
 #include "speech.h"
 
index baf1fb5..00ea5ed 100644 (file)
@@ -1,4 +1,4 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"speech_speech_dispatcher\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=speech_speech_dispatcher
 modulespeech_LTLIBRARIES = libspeech_speech_dispatcher.la
 libspeech_speech_dispatcher_la_SOURCES = speech_speech_dispatcher.c
index 1d66f32..3f2f4f3 100644 (file)
@@ -1,4 +1,4 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"vehicle_demo\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=vehicle_demo
 modulevehicle_LTLIBRARIES = libvehicle_demo.la
 libvehicle_demo_la_SOURCES = vehicle_demo.c
index b53b06a..d224c6a 100644 (file)
@@ -1,4 +1,5 @@
 #include <glib.h>
+#include "config.h"
 #include "debug.h"
 #include "coord.h"
 #include "item.h"
index 8bee569..f46da84 100644 (file)
@@ -1,4 +1,4 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"vehicle_file\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=vehicle_file
 modulevehicle_LTLIBRARIES = libvehicle_file.la
 libvehicle_file_la_SOURCES = vehicle_file.c
index ce9d41f..05a3e11 100644 (file)
@@ -6,6 +6,7 @@
 #include <sys/stat.h>
 #include <termios.h>
 #include <math.h>
+#include "config.h"
 #include "debug.h"
 #include "callback.h"
 #include "plugin.h"
index c4222e3..db7a686 100644 (file)
@@ -1,5 +1,5 @@
 include $(top_srcdir)/Makefile.inc
-AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=\"vehicle_gpsd\"
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=vehicle_gpsd
 modulevehicle_LTLIBRARIES = libvehicle_gpsd.la
 libvehicle_gpsd_la_SOURCES = vehicle_gpsd.c
 libvehicle_gpsd_la_LIBADD = @GPSD_LIBS@