diff options
author | Max Horn | 2010-07-20 08:24:48 +0000 |
---|---|---|
committer | Max Horn | 2010-07-20 08:24:48 +0000 |
commit | e527ad162f3fb69508947f7229d7b98f8aceafed (patch) | |
tree | 294f5915ee171202a8928e5ae9bba1c45dd19654 | |
parent | 211fcfe7bab49ceeb5e81f4dcb1be7e73c58d7c9 (diff) | |
download | scummvm-rg350-e527ad162f3fb69508947f7229d7b98f8aceafed.tar.gz scummvm-rg350-e527ad162f3fb69508947f7229d7b98f8aceafed.tar.bz2 scummvm-rg350-e527ad162f3fb69508947f7229d7b98f8aceafed.zip |
BUILD: Enhance configure code, add (unfinished) USE_SEQ_MIDI support
* Remove unused add_to_config_mk_if_no()
* Add two new functions: define_in_config_h_if_yes() and
define_in_config_if_yes(). These make it much more convenient
to #define something in config.h, or in both config.h and config.mk
simultaneously.
* Convert configure code to use the two new functions, were appropriate.
* Add preliminary USE_SEQ_MIDI support, as discussed on scummvm-devel.
This is incomplete as it does not actually detect anything, it just
allows turning off _seq support.
svn-id: r51054
-rwxr-xr-x | configure | 166 |
1 files changed, 65 insertions, 101 deletions
@@ -119,6 +119,7 @@ _tremor=auto _flac=auto _mad=auto _alsa=auto +_seq=auto _zlib=auto _mpeg2=no _fluidsynth=auto @@ -267,6 +268,10 @@ add_line_to_config_h() { '"$1" } +# Conditionally add a line of data to config.h. Takes two parameters: +# The first one can be set to 'no' to "comment out" the line, i.e. +# make it ineffective, use 'yes' otherwise. +# The second param is the line to insert. add_to_config_h_if_yes() { if test "$1" = yes ; then add_line_to_config_h "$2" @@ -287,15 +292,28 @@ add_to_config_mk_if_yes() { fi } -# Conditionally add a line of data to config.mk. Takes two parameters: -# The first one can be set to 'yes' to "comment out" the line, i.e. -# make it ineffective, use 'no' otherwise. -# The second param is the line to insert. -add_to_config_mk_if_no() { - if test "$1" = no ; then - add_line_to_config_mk "$2" +# Conditionally add a '#define' line to config.h. Takes two parameters: +# The first one can be set to 'yes' or 'no'. If 'yes' is used, then +# the line "#define $2" is added to config.h, otherwise "#undef $2". +define_in_config_h_if_yes() { + if test "$1" = yes ; then + add_line_to_config_h "#define $2" else - add_line_to_config_mk "# $2" + add_line_to_config_h "#undef $2" + fi +} + +# Conditionally add definitions to config.h and config.mk. Takes two parameters: +# The first one can be set to 'yes' or 'no'. If 'yes' is used, then +# the line "#define $2" is added to config.h and "$2 = 1" to config.mk. +# Otherwise "#undef $2" is added to config.h and "# $2 = 1" to config.mk +define_in_config_if_yes() { + if test "$1" = yes ; then + add_line_to_config_h "#define $2" + add_line_to_config_mk "$2 = 1" + else + add_line_to_config_h "#undef $2" + add_line_to_config_mk "# $2 = 1" fi } @@ -740,6 +758,8 @@ for ac_option in $@; do --disable-hq-scalers) _build_hq_scalers=no ;; --enable-alsa) _alsa=yes ;; --disable-alsa) _alsa=no ;; + --enable-seq-midi) _seq=yes ;; + --disable-seq-midi) _seq=no ;; --enable-vorbis) _vorbis=yes ;; --disable-vorbis) _vorbis=no ;; --enable-tremor) _tremor=yes ;; @@ -1768,21 +1788,21 @@ esac # case $_endian in big) - add_line_to_config_h '/* #define SCUMM_LITTLE_ENDIAN */' + add_line_to_config_h '#undef SCUMM_LITTLE_ENDIAN' add_line_to_config_h '#define SCUMM_BIG_ENDIAN' ;; little) add_line_to_config_h '#define SCUMM_LITTLE_ENDIAN' - add_line_to_config_h '/* #define SCUMM_BIG_ENDIAN */' + add_line_to_config_h '#undef SCUMM_BIG_ENDIAN' ;; *) exit 1 ;; esac -add_to_config_h_if_yes $_have_x86 '#define HAVE_X86' +define_in_config_h_if_yes $_have_x86 'HAVE_X86' -add_to_config_h_if_yes $_need_memalign '#define SCUMM_NEED_ALIGNMENT' +define_in_config_h_if_yes $_need_memalign 'SCUMM_NEED_ALIGNMENT' # # Check whether to enable a verbose build @@ -1934,40 +1954,22 @@ fi # # Check whether integrated MT-32 emulator support is requested # -if test "$_mt32emu" = no ; then - _def_mt32emu='#undef USE_MT32EMU' -else - _def_mt32emu='#define USE_MT32EMU' -fi -add_to_config_mk_if_yes "$_mt32emu" 'USE_MT32EMU = 1' +define_in_config_if_yes "$_mt32emu" 'USE_MT32EMU' # # Check whether 16bit color support is requested # -if test "$_16bit" = no ; then - _def_16bit='#undef USE_RGB_COLOR' -else - _def_16bit='#define USE_RGB_COLOR' -fi -add_to_config_mk_if_yes "$_16bit" 'USE_RGB_COLOR = 1' +define_in_config_if_yes "$_16bit" 'USE_RGB_COLOR' # # Check whether to enable the (hq) scalers # if test "$_build_scalers" = no ; then _build_hq_scalers=no - _def_scalers='#undef USE_SCALERS' -else - _def_scalers='#define USE_SCALERS' fi -add_to_config_mk_if_yes "$_build_scalers" 'USE_SCALERS = 1' +define_in_config_if_yes "$_build_scalers" 'USE_SCALERS' -if test "$_build_hq_scalers" = no ; then - _def_hq_scalers='#undef USE_HQ_SCALERS' -else - _def_hq_scalers='#define USE_HQ_SCALERS' -fi -add_to_config_mk_if_yes "$_build_hq_scalers" 'USE_HQ_SCALERS = 1' +define_in_config_if_yes "$_build_hq_scalers" 'USE_HQ_SCALERS' # # Check whether to compile the Indeo3 decoder @@ -1980,12 +1982,7 @@ if test "$_indeo3" = auto ; then _indeo3="no" fi fi -if test "$_indeo3" = no ; then - _def_indeo3='#undef USE_INDEO3' -else - _def_indeo3='#define USE_INDEO3' -fi -add_to_config_mk_if_yes "$_indeo3" 'USE_INDEO3 = 1' +define_in_config_if_yes "$_indeo3" 'USE_INDEO3' # # Check for math lib @@ -2009,13 +2006,10 @@ EOF -lvorbisfile -lvorbis -logg && _vorbis=yes fi if test "$_vorbis" = yes ; then - _def_vorbis='#define USE_VORBIS' LIBS="$LIBS $OGG_LIBS $VORBIS_LIBS -lvorbisfile -lvorbis -logg" INCLUDES="$INCLUDES $OGG_CFLAGS $VORBIS_CFLAGS" -else - _def_vorbis='#undef USE_VORBIS' fi -add_to_config_mk_if_yes "$_vorbis" 'USE_VORBIS = 1' +define_in_config_if_yes "$_vorbis" 'USE_VORBIS' echo "$_vorbis" # @@ -2032,15 +2026,15 @@ EOF _tremor=yes fi if test "$_tremor" = yes && test "$_vorbis" = no; then - _def_tremor='#define USE_TREMOR' - _def_vorbis='#define USE_VORBIS' + add_line_to_config_h '#define USE_TREMOR' + add_line_to_config_h '#define USE_VORBIS' LIBS="$LIBS $TREMOR_LIBS -lvorbisidec" INCLUDES="$INCLUDES $TREMOR_CFLAGS" else if test "$_vorbis" = yes; then _tremor="no (Ogg Vorbis/Tremor support is mutually exclusive)" fi - _def_tremor='#undef USE_TREMOR' + add_line_to_config_h '#undef USE_TREMOR' fi add_to_config_mk_if_yes "$_tremor" 'USE_TREMOR = 1' echo "$_tremor" @@ -2064,17 +2058,14 @@ EOF fi fi if test "$_flac" = yes ; then - _def_flac='#define USE_FLAC' if test "$_vorbis" = yes ; then LIBS="$LIBS $FLAC_LIBS $OGG_LIBS -lFLAC -logg" else LIBS="$LIBS $FLAC_LIBS -lFLAC" fi INCLUDES="$INCLUDES $FLAC_CFLAGS" -else - _def_flac='#undef USE_FLAC' fi -add_to_config_mk_if_yes "$_flac" 'USE_FLAC = 1' +define_in_config_if_yes "$_flac" 'USE_FLAC' echo "$_flac" # @@ -2090,13 +2081,10 @@ EOF cc_check $MAD_CFLAGS $MAD_LIBS -lmad && _mad=yes fi if test "$_mad" = yes ; then - _def_mad='#define USE_MAD' LIBS="$LIBS $MAD_LIBS -lmad" INCLUDES="$INCLUDES $MAD_CFLAGS" -else - _def_mad='#undef USE_MAD' fi -add_to_config_mk_if_yes "$_mad" 'USE_MAD = 1' +define_in_config_if_yes "$_mad" 'USE_MAD' echo "$_mad" # @@ -2112,15 +2100,26 @@ EOF cc_check $ALSA_CFLAGS $ALSA_LIBS -lasound && _alsa=yes fi if test "$_alsa" = yes ; then - _def_alsa='#define USE_ALSA' LIBS="$LIBS $ALSA_LIBS -lasound" INCLUDES="$INCLUDES $ALSA_CFLAGS" -else - _def_alsa='#undef USE_ALSA' fi +define_in_config_h_if_yes "$_alsa" 'USE_ALSA' echo "$_alsa" # +# Check for SEQ MIDI +# +echocheck "SEQ MIDI" +if test "$_seq" = auto ; then + _seq=no + # TODO: Test for /dev/sequencer presence? Or maybe just for /dev ? + # Or maybe imitate the old check? Here it is: + # #if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__) && !defined(__MINT__) && !defined(__ANDROID__) +fi +define_in_config_h_if_yes "$_seq" 'USE_SEQ_MIDI' +echo "$_seq" + +# # Check for ZLib # echocheck "zlib" @@ -2134,13 +2133,10 @@ EOF cc_check $ZLIB_CFLAGS $ZLIB_LIBS -lz && _zlib=yes fi if test "$_zlib" = yes ; then - _def_zlib='#define USE_ZLIB' LIBS="$LIBS $ZLIB_LIBS -lz" INCLUDES="$INCLUDES $ZLIB_CFLAGS" -else - _def_zlib='#undef USE_ZLIB' fi -add_to_config_mk_if_yes "$_zlib" 'USE_ZLIB = 1' +define_in_config_if_yes "$_zlib" 'USE_ZLIB' echo "$_zlib" # @@ -2180,13 +2176,10 @@ EOF fi fi if test "$_mpeg2" = yes ; then - _def_mpeg2='#define USE_MPEG2' INCLUDES="$INCLUDES $MPEG2_CFLAGS" LIBS="$LIBS $MPEG2_LIBS -lmpeg2" -else - _def_mpeg2='#undef USE_MPEG2' fi -add_to_config_mk_if_yes "$_mpeg2" 'USE_MPEG2 = 1' +define_in_config_if_yes "$_mpeg2" 'USE_MPEG2' echo "$_mpeg2" # @@ -2202,7 +2195,6 @@ EOF cc_check $FLUIDSYNTH_CFLAGS $FLUIDSYNTH_LIBS -lfluidsynth && _fluidsynth=yes fi if test "$_fluidsynth" = yes ; then - _def_fluidsynth='#define USE_FLUIDSYNTH' case $_host_os in mingw*) LIBS="$LIBS $FLUIDSYNTH_LIBS -lfluidsynth -ldsound -lwinmm" @@ -2212,9 +2204,8 @@ if test "$_fluidsynth" = yes ; then ;; esac INCLUDES="$INCLUDES $FLUIDSYNTH_CFLAGS" -else - _def_fluidsynth='#undef USE_FLUIDSYNTH' fi +define_in_config_h_if_yes "$_fluidsynth" 'USE_FLUIDSYNTH' echo "$_fluidsynth" # @@ -2247,18 +2238,12 @@ else fi if test "$_readline" = yes ; then - _def_readline='#define USE_READLINE' LIBS="$LIBS $READLINE_LIBS $_READLINE_LIBS" INCLUDES="$INCLUDES $READLINE_CFLAGS" -else - _def_readline='#undef USE_READLINE' fi +define_in_config_h_if_yes "$_readline" 'USE_READLINE' -if test "$_text_console" = yes ; then - _def_text_console='#define USE_TEXT_CONSOLE' -else - _def_text_console='#undef USE_TEXT_CONSOLE' -fi +define_in_config_h_if_yes "$_text_console" 'USE_TEXT_CONSOLE' # # Check for nasm @@ -2316,8 +2301,7 @@ if test "$_have_x86" = yes ; then fi fi -add_to_config_h_if_yes $_nasm '#define USE_NASM' -add_to_config_mk_if_yes $_nasm 'USE_NASM = 1' +define_in_config_if_yes $_nasm 'USE_NASM' # # Enable vkeybd / keymapper @@ -2332,8 +2316,7 @@ fi # Check whether to build translation support # echo_n "Building translation support... " -add_to_config_mk_if_yes $_translation 'USE_TRANSLATION = 1' -add_to_config_h_if_yes $_translation '#define USE_TRANSLATION' +define_in_config_if_yes $_translation 'USE_TRANSLATION' if test "$_translation" = no ; then echo "no" else @@ -2346,7 +2329,7 @@ EOF _detectlang=no cc_check $LDFLAGS $CXXFLAGS && _detectlang=yes - add_to_config_h_if_yes $_detectlang '#define USE_DETECTLANG' + define_in_config_h_if_yes $_detectlang 'USE_DETECTLANG' if test "$_detectlang" = yes ; then echo "with runtime language detection)" else @@ -2675,25 +2658,6 @@ typedef signed $type_1_byte int8; typedef signed $type_2_byte int16; typedef signed $type_4_byte int32; -/* Libs */ -$_def_vorbis -$_def_tremor -$_def_flac -$_def_mad -$_def_alsa -$_def_zlib -$_def_mpeg2 -$_def_fluidsynth -$_def_readline - -/* Options */ -$_def_text_console -$_def_mt32emu -$_def_indeo3 -$_def_16bit -$_def_scalers -$_def_hq_scalers - /* Plugin settings */ $_def_plugin |