From eee1aaf283a6a8c47006519f2e8e36006cddb824 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 10 Oct 2001 05:52:14 +0000 Subject: [PATCH] static plugins (--with-static-plugins to force on, --without-static-plugins to force off, defaults to off for *nix and on for win32). does not work yet due to lack of support in libs/util/plugin.c, but that's next. --- acconfig.h | 12 +++++++ configure.ac | 62 +++++++++++++++++++++++++++++++++ include/QF/plugin.h | 5 +++ libs/audio/Makefile.am | 4 +++ libs/audio/cd.c | 8 +++-- libs/audio/cd/Makefile.am | 1 + libs/audio/renderer/Makefile.am | 2 +- libs/audio/snd.c | 22 +++++++++--- libs/audio/targets/Makefile.am | 1 + 9 files changed, 110 insertions(+), 7 deletions(-) diff --git a/acconfig.h b/acconfig.h index f5e56c87f..63dc777c4 100644 --- a/acconfig.h +++ b/acconfig.h @@ -133,5 +133,17 @@ /* Define this if you want progs typechecking */ #undef TYPECHECK_PROGS +/* list of cd plugins and prototypes */ +#undef CD_PLUGIN_LIST +#undef CD_PLUGIN_PROTOS + +/* list of sound output plugins and prototypes */ +#undef SND_OUTPUT_LIST +#undef SND_OUTPUT_PROTOS + +/* list of sound render plugins and prototypes */ +#undef SND_RENDER_LIST +#undef SND_RENDER_PROTOS + @BOTTOM@ #endif // __config_h_ diff --git a/configure.ac b/configure.ac index 7e4b2bb0b..0ddbcc690 100644 --- a/configure.ac +++ b/configure.ac @@ -1544,12 +1544,74 @@ else SOUND_TYPES="" fi +CD_PLUGIN_STATIC="" +SND_PLUGIN_STATIC="" +SND_REND_STATIC="" + +AC_ARG_WITH(static-plugins, +[ --with-static-plugins build plugins into executable rather than separate], + static_plugins="$withval", static_plugins=auto) +if test "x$static_plugins" = xauto -a "x$SYSTYPE" = xWIN32; then + static_plugins=yes +fi +if test "x$static_plugins" = xyes; then + CD_PLUGIN_STATIC="$CD_PLUGIN_TARGETS" + CD_PLUGIN_TARGETS="" + SND_PLUGIN_STATIC="$SND_PLUGIN_TARGETS" + SND_PLUGIN_TARGETS="" + SND_REND_STATIC="$SND_REND_TARGETS" + SND_REND_TARGETS="" + if test -n "$SOUND_TYPES"; then + SOUND_TYPES="$SOUND_TYPES (static)" + CDTYPE="$CDTYPE (static)" + fi +fi +CD_PLUGIN_STATIC_LIBS="" +SND_PLUGIN_STATIC_LIBS="" +SND_REND_STATIC_LIBS="" +CD_PLUGIN_LIST="{0, 0}" +SND_OUTPUT_LIST="{0, 0}" +SND_RENDER_LIST="{0, 0}" +CD_PLUGIN_PROTOS="" +SND_OUTPUT_PROTOS="" +SND_RENDER_PROTOS="" +for l in $CD_PLUGIN_STATIC; do + CD_PLUGIN_STATIC_LIBS="$CD_PLUGIN_STATIC_LIBS cd/$l" + n="`echo $l | sed -e 's/lib\(.*\)\.la/\1/'`" + CD_PLUGIN_LIST='{"'"$n"'"'", ${n}_PluginInfo},$CD_PLUGIN_LIST" + CD_PLUGIN_PROTOS="$CD_PLUGIN_PROTOS extern QFPLUGIN plugin_t *${n}_PluginInfo (void);" +done +for l in $SND_PLUGIN_STATIC; do + SND_PLUGIN_STATIC_LIBS="$SND_PLUGIN_STATIC_LIBS targets/$l" + n="`echo $l | sed -e 's/lib\(.*\)\.la/\1/'`" + SND_OUTPUT_LIST='{"'"$n"'"'", ${n}_PluginInfo},$SND_OUTPUT_LIST" + SND_OUTPUT_PROTOS="$SND_OUTPUT_PROTOS extern QFPLUGIN plugin_t *${n}_PluginInfo (void);" +done +for l in $SND_REND_STATIC; do + SND_REND_STATIC_LIBS="$SND_REND_STATIC_LIBS renderer/$l" + n="`echo $l | sed -e 's/lib\(.*\)\.la/\1/'`" + SND_RENDER_LIST='{"'"$n"'"'", ${n}_PluginInfo},$SND_RENDER_LIST" + SND_RENDER_PROTOS="$SND_RENDER_PROTOS extern QFPLUGIN plugin_t *${n}_PluginInfo (void);" +done +AC_DEFINE_UNQUOTED(CD_PLUGIN_LIST, $CD_PLUGIN_LIST) +AC_DEFINE_UNQUOTED(CD_PLUGIN_PROTOS, $CD_PLUGIN_PROTOS) +AC_DEFINE_UNQUOTED(SND_OUTPUT_LIST, $SND_OUTPUT_LIST) +AC_DEFINE_UNQUOTED(SND_OUTPUT_PROTOS, $SND_OUTPUT_PROTOS) +AC_DEFINE_UNQUOTED(SND_RENDER_LIST, $SND_RENDER_LIST) +AC_DEFINE_UNQUOTED(SND_RENDER_PROTOS, $SND_RENDER_PROTOS) + AC_SUBST(NQ_TARGETS) AC_SUBST(QW_TARGETS) AC_SUBST(CD_PLUGIN_TARGETS) +AC_SUBST(CD_PLUGIN_STATIC) +AC_SUBST(CD_PLUGIN_STATIC_LIBS) AC_SUBST(CD_TARGETS) AC_SUBST(SND_PLUGIN_TARGETS) +AC_SUBST(SND_PLUGIN_STATIC) +AC_SUBST(SND_PLUGIN_STATIC_LIBS) AC_SUBST(SND_REND_TARGETS) +AC_SUBST(SND_REND_STATIC) +AC_SUBST(SND_REND_STATIC_LIBS) AC_SUBST(SND_TARGETS) AC_SUBST(VID_MODEL_TARGETS) AC_SUBST(VID_REND_TARGETS) diff --git a/include/QF/plugin.h b/include/QF/plugin.h index 6c5cd4d4d..80efd5ab8 100644 --- a/include/QF/plugin.h +++ b/include/QF/plugin.h @@ -92,6 +92,11 @@ typedef struct plugin_s { */ typedef plugin_t * (*P_PluginInfo) (void); +typedef struct plugin_list_s { + const char *name; + P_PluginInfo info; +} plugin_list_t; + /* Plugin system variables */ diff --git a/libs/audio/Makefile.am b/libs/audio/Makefile.am index a6f6fce8b..7e7c82e22 100644 --- a/libs/audio/Makefile.am +++ b/libs/audio/Makefile.am @@ -5,7 +5,11 @@ lib_LTLIBRARIES= @CD_TARGETS@ @SND_TARGETS@ EXTRA_LTLIBRARIES= libQFsound.la libQFcd.la libQFsound_la_LDFLAGS= -version-info 1:0:0 -rpath $(libdir) +libQFsound_la_LIBADD= @SND_PLUGIN_STATIC_LIBS@ @SND_REND_STATIC_LIBS@ libQFsound_la_SOURCES= snd.c +libQFsound_la_DEPENDENCIES= @SND_PLUGIN_STATIC_LIBS@ @SND_REND_STATIC_LIBS@ libQFcd_la_LDFLAGS= -version-info 1:0:0 -rpath $(libdir) +libQFcd_la_LIBADD= @CD_PLUGIN_STATIC_LIBS@ libQFcd_la_SOURCES= cd.c +libQFcd_la_DEPENDENCIES= @CD_PLUGIN_STATIC_LIBS@ diff --git a/libs/audio/cd.c b/libs/audio/cd.c index 281aef017..61b01ba06 100644 --- a/libs/audio/cd.c +++ b/libs/audio/cd.c @@ -40,9 +40,13 @@ static const char rcsid[] = #include "QF/qtypes.h" #include "QF/sys.h" -cvar_t *cd_plugin; -plugin_t *cdmodule = NULL; +cvar_t *cd_plugin; +plugin_t *cdmodule = NULL; +CD_PLUGIN_PROTOS +plugin_list_t cd_plugin_list[] = { + CD_PLUGIN_LIST +}; void CDAudio_Pause (void) diff --git a/libs/audio/cd/Makefile.am b/libs/audio/cd/Makefile.am index d7cfec30a..888377255 100644 --- a/libs/audio/cd/Makefile.am +++ b/libs/audio/cd/Makefile.am @@ -4,6 +4,7 @@ XMMS_LIBS = @XMMS_LIBS@ plugin_LTLIBRARIES= @CD_PLUGIN_TARGETS@ +noinst_LTLIBRARIES= @CD_PLUGIN_STATIC@ EXTRA_LTLIBRARIES= libcd_linux.la libcd_sdl.la libcd_sgi.la libcd_win.la libcd_null.la libcd_xmms.la libcd_linux_la_LDFLAGS= -version-info 1:0:0 -rpath $(plugindir) diff --git a/libs/audio/renderer/Makefile.am b/libs/audio/renderer/Makefile.am index b5f772148..e0b5441be 100644 --- a/libs/audio/renderer/Makefile.am +++ b/libs/audio/renderer/Makefile.am @@ -9,7 +9,7 @@ else asm= endif -noinst_LTLIBRARIES= $(asm) +noinst_LTLIBRARIES= $(asm) @SND_REND_STATIC@ libasm_la_SOURCES= snd_mixa.S diff --git a/libs/audio/snd.c b/libs/audio/snd.c index caf0a46bc..5fc60066b 100644 --- a/libs/audio/snd.c +++ b/libs/audio/snd.c @@ -29,6 +29,10 @@ static const char rcsid[] = "$Id$"; +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "QF/cvar.h" #include "QF/sound.h" #include "QF/model.h" @@ -50,10 +54,20 @@ cvar_t *bgmvolume; cvar_t *volume; cvar_t *snd_interp; -cvar_t *snd_output; -cvar_t *snd_render; -plugin_t *snd_render_module = NULL; -plugin_t *snd_output_module = NULL; +cvar_t *snd_output; +cvar_t *snd_render; +plugin_t *snd_render_module = NULL; +plugin_t *snd_output_module = NULL; + +SND_OUTPUT_PROTOS +plugin_list_t snd_output_list[] = { + SND_OUTPUT_LIST +}; + +SND_RENDER_PROTOS +plugin_list_t snd_render_list[] = { + SND_RENDER_LIST +}; // FIXME: ewwwies extern double host_frametime; // From host.h diff --git a/libs/audio/targets/Makefile.am b/libs/audio/targets/Makefile.am index 314bf75ec..f9ac1bc94 100644 --- a/libs/audio/targets/Makefile.am +++ b/libs/audio/targets/Makefile.am @@ -2,6 +2,7 @@ INCLUDES= -I$(top_srcdir)/include $(ALSA_CFLAGS) $(MME_CFLAGS) $(OSS_CFLAGS) $(S SDL_LIBS = @SDL_LIBS@ plugin_LTLIBRARIES = @SND_PLUGIN_TARGETS@ +noinst_LTLIBRARIES = @SND_PLUGIN_STATIC@ EXTRA_LTLIBRARIES = libsnd_output_sdl.la libsnd_output_alsa0_5.la libsnd_output_alsa0_9.la libsnd_output_oss.la libsnd_output_sgi.la libsnd_output_sun.la libsnd_output_win.la libsnd_output_null.la libsnd_output_disk.la libsnd_output_sdl_la_LDFLAGS= $(plugin_LDFLAGS) -version-info 1:0:0 -rpath $(plugindir)