detect zlib in configure script; use it by default, if available

svn-id: r11544
This commit is contained in:
Max Horn 2003-12-10 00:15:20 +00:00
parent 0f7f124de2
commit bb760a5b73
4 changed files with 72 additions and 51 deletions

View file

@ -30,9 +30,9 @@ EXECUTABLE := scummvm$(EXEEXT)
include config.mak include config.mak
# Uncomment this for stricter compile time code verification # Uncomment this for stricter compile time code verification
# CXXFLAGS+= -Wshadow -Werror # CXXFLAGS+= -Werror
CXXFLAGS:= -O -Wall -Wuninitialized $(CXXFLAGS) CXXFLAGS:= -O -Wall -Wuninitialized $(CXXFLAGS)
CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas CXXFLAGS+= -Wno-long-long -Wno-multichar -Wno-unknown-pragmas
# Even more warnings... # Even more warnings...
CXXFLAGS+= -pedantic -Wpointer-arith -Wcast-qual -Wconversion CXXFLAGS+= -pedantic -Wpointer-arith -Wcast-qual -Wconversion
@ -79,6 +79,7 @@ scummvm-static: $(OBJS)
/sw/lib/libSDLmain.a /sw/lib/libSDL.a \ /sw/lib/libSDLmain.a /sw/lib/libSDL.a \
/sw/lib/libmad.a \ /sw/lib/libmad.a \
/sw/lib/libvorbisfile.a /sw/lib/libvorbis.a /sw/lib/libogg.a \ /sw/lib/libvorbisfile.a /sw/lib/libvorbis.a /sw/lib/libogg.a \
-lz \
-framework Cocoa -framework Carbon -framework IOKit \ -framework Cocoa -framework Carbon -framework IOKit \
-framework OpenGL -framework AGL -framework QuickTime \ -framework OpenGL -framework AGL -framework QuickTime \
-framework AudioUnit -framework AudioToolbox -framework AudioUnit -framework AudioToolbox

View file

@ -39,8 +39,8 @@ EXEEXT :=.exe
####################################################################### #######################################################################
# Uncomment this to activate the ZLIB lib for compressed save game files # Uncomment this to activate the ZLIB lib for compressed save game files
# DEFINES += -DUSE_ZLIB DEFINES += -DUSE_ZLIB
# LIBS += -lz LIBS += -lz
# Uncomment this to activate the MAD lib for compressed sound files # Uncomment this to activate the MAD lib for compressed sound files
DEFINES += -DUSE_MAD DEFINES += -DUSE_MAD

View file

@ -23,15 +23,6 @@
#include "common/util.h" #include "common/util.h"
#include "common/savefile.h" #include "common/savefile.h"
// FIXME HACK
// Enable this to activate transparent zlib compression of all savegames
// Note that doing that makes ScummVM produce savegames which can't trivially
// be read by non-zlib enabled versions. However, one can always decompress
// such a savegame by using gzip, so this shouldn't be a bad problem.
//#define USE_ZLIB
#ifdef USE_ZLIB #ifdef USE_ZLIB
#include <zlib.h> #include <zlib.h>
#endif #endif

105
configure vendored
View file

@ -28,6 +28,7 @@ CXXFLAGS="$CXXFLAGS $CPPFLAGS"
_vorbis=auto _vorbis=auto
_mad=auto _mad=auto
_alsa=auto _alsa=auto
_zlib=auto
# default option behaviour yes/no # default option behaviour yes/no
_build_scumm=yes _build_scumm=yes
_build_simon=yes _build_simon=yes
@ -41,19 +42,19 @@ _ranlib=ranlib
_sdlconfig=sdl-config _sdlconfig=sdl-config
cc_check() { cc_check() {
echo >> "$TMPLOG" echo >> "$TMPLOG"
cat "$TMPC" >> "$TMPLOG" cat "$TMPC" >> "$TMPLOG"
echo >> "$TMPLOG" echo >> "$TMPLOG"
echo "$CXX $TMPC -o $TMPO $@" >> "$TMPLOG" echo "$CXX $TMPC -o $TMPO $@" >> "$TMPLOG"
rm -f "$TMPO" rm -f "$TMPO"
( $CXX "$TMPC" -o "$TMPO" "$@" ) >> "$TMPLOG" 2>&1 ( $CXX "$TMPC" -o "$TMPO" "$@" ) >> "$TMPLOG" 2>&1
TMP="$?" TMP="$?"
echo >> "$TMPLOG" echo >> "$TMPLOG"
return "$TMP" return "$TMP"
} }
echocheck () { echocheck () {
echo -n "Checking for $@... " echo -n "Checking for $@... "
} }
# #
@ -81,29 +82,28 @@ eval "$1 -o tmp_cxx_compiler tmp_cxx_compiler.cpp 2> /dev/null" && eval "./tmp_c
# TODO: small bit of code to test sdl useability # TODO: small bit of code to test sdl useability
find_sdlconfig() find_sdlconfig()
{ {
printf "Looking for sdl-config... " printf "Looking for sdl-config... "
sdlconfigs="$_sdlconfig:sdl-config:sdl11-config:sdl12-config" sdlconfigs="$_sdlconfig:sdl-config:sdl11-config:sdl12-config"
_sdlconfig= _sdlconfig=
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
for path_dir in $PATH; do for path_dir in $PATH; do
for sdlconfig in $sdlconfigs; do for sdlconfig in $sdlconfigs; do
if test -e "$path_dir/$sdlconfig" ; then if test -e "$path_dir/$sdlconfig" ; then
_sdlconfig=$sdlconfig _sdlconfig=$sdlconfig
echo $_sdlconfig echo $_sdlconfig
break break
fi fi
done done
done done
IFS="$ac_save_ifs" IFS="$ac_save_ifs"
if test -z "$_sdlconfig"; then if test -z "$_sdlconfig"; then
echo "none found!" echo "none found!"
exit 1 exit 1
fi fi
} }
# #
@ -184,6 +184,8 @@ Optional Libraries:
--disable-vorbis disable Ogg Vorbis support [autodetect] --disable-vorbis disable Ogg Vorbis support [autodetect]
--with-mad-prefix=PFX Prefix where libmad is installed (optional) --with-mad-prefix=PFX Prefix where libmad is installed (optional)
--disable-mad disable libmad (MP3) support [autodetect] --disable-mad disable libmad (MP3) support [autodetect]
--with-zlib-prefix=PFX Prefix where zlib is installed (optional)
--disable-zlib disable zlib (compression) support [autodetect]
EOF EOF
exit 0 exit 0
@ -198,33 +200,40 @@ for ac_option in $@; do
--disable-simon) _build_simon=no ;; --disable-simon) _build_simon=no ;;
--disable-sky) _build_sky=no ;; --disable-sky) _build_sky=no ;;
--disable-bs2) _build_bs2=no ;; --disable-bs2) _build_bs2=no ;;
--disable-queen) _build_queen=no ;; --disable-queen) _build_queen=no ;;
--enable-alsa) _alsa=yes ;; --enable-alsa) _alsa=yes ;;
--disable-alsa) _alsa=no ;; --disable-alsa) _alsa=no ;;
--enable-vorbis) _vorbis=yes ;; --enable-vorbis) _vorbis=yes ;;
--disable-vorbis) _vorbis=no ;; --disable-vorbis) _vorbis=no ;;
--enable-mad) _mad=yes ;; --enable-mad) _mad=yes ;;
--disable-mad) _mad=no ;; --disable-mad) _mad=no ;;
--enable-zlib) _zlib=yes ;;
--disable-zlib) _zlib=no ;;
--with-alsa-prefix=*) --with-alsa-prefix=*)
_prefix=`echo $ac_option | cut -d '=' -f 2` _prefix=`echo $ac_option | cut -d '=' -f 2`
ALSA_CFLAGS="-I$_prefix/include" ALSA_CFLAGS="-I$_prefix/include"
ALSA_LIBS="-L$_prefix/libs" ALSA_LIBS="-L$_prefix/libs"
;; ;;
--with-ogg-prefix=*) --with-ogg-prefix=*)
_prefix=`echo $ac_option | cut -d '=' -f 2` _prefix=`echo $ac_option | cut -d '=' -f 2`
OGG_CFLAGS="-I$_prefix/include" OGG_CFLAGS="-I$_prefix/include"
OGG_LIBS="-L$_prefix/lib" OGG_LIBS="-L$_prefix/lib"
;; ;;
--with-vorbis-prefix=*) --with-vorbis-prefix=*)
_prefix=`echo $ac_option | cut -d '=' -f 2` _prefix=`echo $ac_option | cut -d '=' -f 2`
VORBIS_CFLAGS="-I$_prefix/include" VORBIS_CFLAGS="-I$_prefix/include"
VORBIS_LIBS="-L$_prefix/lib" VORBIS_LIBS="-L$_prefix/lib"
;; ;;
--with-mad-prefix=*) --with-mad-prefix=*)
_prefix=`echo $ac_option | cut -d '=' -f 2` _prefix=`echo $ac_option | cut -d '=' -f 2`
MAD_CFLAGS="-I$_prefix/include" MAD_CFLAGS="-I$_prefix/include"
MAD_LIBS="-L$_prefix/lib" MAD_LIBS="-L$_prefix/lib"
;; ;;
--with-zlib-prefix=*)
_prefix=`echo $ac_option | cut -d '=' -f 2`
ZLIB_CFLAGS="-I$_prefix/include"
ZLIB_LIBS="-L$_prefix/lib"
;;
--backend=*) --backend=*)
_backend=`echo $ac_option | cut -d '=' -f 2` _backend=`echo $ac_option | cut -d '=' -f 2`
;; ;;
@ -521,6 +530,25 @@ else
fi fi
echo "$_alsa" echo "$_alsa"
echocheck "zlib"
if test "$_zlib" = auto ; then
_zlib=no
cat > $TMPC << EOF
#include <string.h>
#include <zlib.h>
int main(void) { return strcmp(ZLIB_VERSION, zlibVersion()); }
EOF
cc_check $LDFLAGS $CXXFLAGS $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
echo "$_zlib"
rm -f $TMPC $TMPO rm -f $TMPC $TMPO
@ -607,6 +635,7 @@ typedef signed $type_4_byte int32;
$_def_vorbis $_def_vorbis
$_def_mad $_def_mad
$_def_alsa $_def_alsa
$_def_zlib
#endif /* CONFIG_H */ #endif /* CONFIG_H */
EOF EOF