From 38a8aa516e0fa315e318801e5399f82e51efa8df Mon Sep 17 00:00:00 2001 From: Jordi Vilalta Prat Date: Tue, 6 May 2008 03:00:26 +0000 Subject: Allow static and dynamic plugins to be used at the same time svn-id: r31888 --- configure | 139 +++++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 105 insertions(+), 34 deletions(-) (limited to 'configure') diff --git a/configure b/configure index aecd15d95e..4e6101a2b0 100755 --- a/configure +++ b/configure @@ -106,6 +106,7 @@ _endian=unknown _need_memalign=no _have_x86=no _build_plugins=no +_plugins_default=static _nasm=auto # more defaults @@ -363,21 +364,33 @@ get_engine_sub() { # Enable the given engine engine_enable() { - engine=`echo $1 | sed 's/-/_/g'` - if test "`get_engine_build ${engine}`" = "no" ; then - eval _engine_${engine}_build=yes + # Get the parameter + if ( echo $1 | grep '=' ) 2> /dev/null > /dev/null ; then + eng=`echo $1 | cut -d '=' -f 1` + opt=`echo $1 | cut -d '=' -f 2` + else + eng=$1 + opt=yes + fi + engine=`echo $eng | sed 's/-/_/g'` + if test "$opt" == "static" -o "$opt" == "dynamic" -o "$opt" == "yes" ; then + if test "`get_engine_build ${engine}`" != "$opt" ; then + eval _engine_${engine}_build=$opt + else + option_error + fi else - option_error --enable-$1 + option_error fi } # Disable the given engine engine_disable() { engine=`echo $1 | sed 's/-/_/g'` - if test "`get_engine_build $engine`" = "yes" ; then + if test "`get_engine_build $engine`" != "no" ; then eval _engine_${engine}_build=no else - option_error --disable-$1 + option_error fi } @@ -420,27 +433,35 @@ show_subengine_help() { # Prepare the strings about the engines to build prepare_engine_build_strings() { - string_yes=`get_engine_build_string $1 yes` - if test -n "$string_yes" ; then - _engines_built="${_engines_built}#$string_yes@" + string=`get_engine_build_string $1 static` + if test -n "$string" ; then + _engines_built_static="${_engines_built_static}#$string@" fi - string_no=`get_engine_build_string $1 no` - if test -n "$string_no" ; then - _engines_skipped="${_engines_skipped}#$string_no@" + string=`get_engine_build_string $1 dynamic` + if test -n "$string" ; then + _engines_built_dynamic="${_engines_built_dynamic}#$string@" + fi + + string=`get_engine_build_string $1 no` + if test -n "$string" ; then + _engines_skipped="${_engines_skipped}#$string@" fi } # Get the string about building an engine get_engine_build_string() { engine_string="" - if test `get_engine_build $1` = no ; then + engine_build=`get_engine_build $1` + if test $engine_build = no ; then + # The engine is disabled if test $2 = no ; then engine_string=`get_engine_name $1` else engine_string="" fi else + # The engine is enabled, get the custom string build_string_func=get_${1}_build_string if ( type $build_string_func | grep function ) 2> /dev/null > /dev/null ; then engine_string=`$build_string_func $1 $2` @@ -448,12 +469,16 @@ get_engine_build_string() { engine_string=`get_subengines_build_string $1 $2` fi - if test $2 = yes ; then - engine_string="`get_engine_name $1` $engine_string" - else + if test $2 = no ; then if test -n "$engine_string" ; then engine_string="`get_engine_name $1` $engine_string" fi + else + if test $2 = $engine_build ; then + engine_string="`get_engine_name $1` $engine_string" + else + engine_string="" + fi fi fi @@ -471,7 +496,7 @@ get_subengines_build_string() { all=no fi done - if test $2 = yes ; then + if test $2 != no ; then if test -n "$subengine_string" ; then if test $all = yes ; then subengine_string="[all games]" @@ -484,7 +509,7 @@ get_subengines_build_string() { # Engine specific build strings get_sword1_build_string() { - if test $2 = yes ; then + if test $2 != no ; then if test "$_mpeg2" = yes ; then echo "(w/ mpeg2 cutscenes)" else @@ -498,7 +523,7 @@ get_sword2_build_string() { } get_scumm_build_string() { - if test $2 = yes ; then + if test $2 != no ; then base="[v0-v6 games]" fi get_subengines_build_string $1 $2 "$base" @@ -551,8 +576,8 @@ Optional Features: --disable-debug disable building with debugging symbols --enable-Werror treat warnings as errors $engines_help - --enable-plugins build engines as loadable modules instead of - static linking them + --enable-plugins enable the support for dynamic plugins + --default-dynamic make plugins dynamic by default --disable-mt32emu don't enable the integrated MT-32 emulator --disable-hq-scalers exclude HQ2x and HQ3x scalers --disable-scalers exclude scalers @@ -630,6 +655,7 @@ for ac_option in $@; do --disable-mpeg2) _mpeg2=no ;; --disable-fluidsynth) _fluidsynth=no ;; --enable-plugins) _build_plugins=yes ;; + --default-dynamic) _plugins_default=dynamic ;; --enable-mt32emu) _mt32emu=yes ;; --disable-mt32emu) _mt32emu=no ;; --with-fluidsynth-prefix=*) @@ -725,7 +751,7 @@ for ac_option in $@; do engine_disable `echo $ac_option | cut -d '-' -f 4-` ;; *) - option_error $ac_option + option_error ;; esac; done; @@ -897,12 +923,6 @@ if test "$_cxx_major" -ge "3" ; then add_line_to_config_mk 'HAVE_GCC3 = 1' fi; -# -# Engine selection -# -for engine in $_engines; do - add_to_config_mk_if_no `get_engine_build $engine` "DISABLE_`echo $engine | tr [a-z] [A-Z]` = 1" -done add_to_config_mk_if_no $_build_hq_scalers 'DISABLE_HQ_SCALERS = 1' add_to_config_mk_if_no $_build_scalers 'DISABLE_SCALERS = 1' @@ -1532,22 +1552,73 @@ DEFINES="$DEFINES -DPLUGIN_DIRECTORY=\\\"$_libdir/scummvm\\\"" # -# Show which engines ("frontends") are to be built +# Engine selection # - -_engines_built="" +_engines_built_static="" +_engines_built_dynamic="" _engines_skipped="" for engine in $_engines; do if test "`get_engine_sub $engine`" = "no" ; then + # It's a main engine + if test `get_engine_build $engine` = no ; then + isbuilt=no + else + # If dynamic plugins aren't supported, mark + # all the engines as static + if test $_build_plugins = no ; then + eval _engine_${engine}_build=static + else + # If it wasn't explicitly marked as static or + # dynamic, use the configured default + if test `get_engine_build $engine` = yes ; then + eval _engine_${engine}_build=${_plugins_default} + fi + fi + + # Prepare the defines + if test `get_engine_build $engine` = dynamic ; then + isbuilt=DYNAMIC_PLUGIN + else + eval _engine_${engine}_build=static + isbuilt=STATIC_PLUGIN + fi + fi + + # Prepare the information to be shown prepare_engine_build_strings $engine + else + # It's a subengine, just say yes or no + if test "`get_engine_build $engine`" = "no" ; then + isbuilt=no + else + isbuilt=1 + fi + fi + + # Save the settings + defname="ENABLE_`echo $engine | tr [a-z] [A-Z]`" + if test "$isbuilt" = "no" ; then + add_line_to_config_mk "# $defname" + else + add_line_to_config_mk "$defname = $isbuilt" fi done +# +# Show which engines ("frontends") are to be built +# echo -if test -n "$_engines_built" ; then - echo "Engines:" - echo $_engines_built | sed 's/@/\ +if test -n "$_engines_built_static" ; then + echo "Engines (builtin):" + echo $_engines_built_static | sed 's/@/\ +/g +s/#/ /g' +fi + +if test -n "$_engines_built_dynamic" ; then + echo "Engines (plugins):" + echo $_engines_built_dynamic | sed 's/@/\ /g s/#/ /g' fi -- cgit v1.2.3