aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--Makefile.mingw4
-rw-r--r--common/savefile.cpp9
-rwxr-xr-xconfigure105
4 files changed, 72 insertions, 51 deletions
diff --git a/Makefile b/Makefile
index 26de1e6c3c..609a049264 100644
--- a/Makefile
+++ b/Makefile
@@ -30,9 +30,9 @@ EXECUTABLE := scummvm$(EXEEXT)
include config.mak
# 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
# Even more warnings...
CXXFLAGS+= -pedantic -Wpointer-arith -Wcast-qual -Wconversion
@@ -79,6 +79,7 @@ scummvm-static: $(OBJS)
/sw/lib/libSDLmain.a /sw/lib/libSDL.a \
/sw/lib/libmad.a \
/sw/lib/libvorbisfile.a /sw/lib/libvorbis.a /sw/lib/libogg.a \
+ -lz \
-framework Cocoa -framework Carbon -framework IOKit \
-framework OpenGL -framework AGL -framework QuickTime \
-framework AudioUnit -framework AudioToolbox
diff --git a/Makefile.mingw b/Makefile.mingw
index 86763ece5b..a5b166f268 100644
--- a/Makefile.mingw
+++ b/Makefile.mingw
@@ -39,8 +39,8 @@ EXEEXT :=.exe
#######################################################################
# Uncomment this to activate the ZLIB lib for compressed save game files
-# DEFINES += -DUSE_ZLIB
-# LIBS += -lz
+DEFINES += -DUSE_ZLIB
+LIBS += -lz
# Uncomment this to activate the MAD lib for compressed sound files
DEFINES += -DUSE_MAD
diff --git a/common/savefile.cpp b/common/savefile.cpp
index 01185b6527..5333e367ae 100644
--- a/common/savefile.cpp
+++ b/common/savefile.cpp
@@ -23,15 +23,6 @@
#include "common/util.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
#include <zlib.h>
#endif
diff --git a/configure b/configure
index cf3db368f4..b4574f2f9b 100755
--- a/configure
+++ b/configure
@@ -28,6 +28,7 @@ CXXFLAGS="$CXXFLAGS $CPPFLAGS"
_vorbis=auto
_mad=auto
_alsa=auto
+_zlib=auto
# default option behaviour yes/no
_build_scumm=yes
_build_simon=yes
@@ -41,19 +42,19 @@ _ranlib=ranlib
_sdlconfig=sdl-config
cc_check() {
- echo >> "$TMPLOG"
- cat "$TMPC" >> "$TMPLOG"
- echo >> "$TMPLOG"
- echo "$CXX $TMPC -o $TMPO $@" >> "$TMPLOG"
- rm -f "$TMPO"
- ( $CXX "$TMPC" -o "$TMPO" "$@" ) >> "$TMPLOG" 2>&1
- TMP="$?"
- echo >> "$TMPLOG"
- return "$TMP"
+ echo >> "$TMPLOG"
+ cat "$TMPC" >> "$TMPLOG"
+ echo >> "$TMPLOG"
+ echo "$CXX $TMPC -o $TMPO $@" >> "$TMPLOG"
+ rm -f "$TMPO"
+ ( $CXX "$TMPC" -o "$TMPO" "$@" ) >> "$TMPLOG" 2>&1
+ TMP="$?"
+ echo >> "$TMPLOG"
+ return "$TMP"
}
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
find_sdlconfig()
{
-printf "Looking for sdl-config... "
-sdlconfigs="$_sdlconfig:sdl-config:sdl11-config:sdl12-config"
-_sdlconfig=
-
-IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
-
-for path_dir in $PATH; do
- for sdlconfig in $sdlconfigs; do
- if test -e "$path_dir/$sdlconfig" ; then
- _sdlconfig=$sdlconfig
- echo $_sdlconfig
- break
- fi
- done
-done
-
-IFS="$ac_save_ifs"
-
-if test -z "$_sdlconfig"; then
- echo "none found!"
- exit 1
-fi
-
+ printf "Looking for sdl-config... "
+ sdlconfigs="$_sdlconfig:sdl-config:sdl11-config:sdl12-config"
+ _sdlconfig=
+
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+
+ for path_dir in $PATH; do
+ for sdlconfig in $sdlconfigs; do
+ if test -e "$path_dir/$sdlconfig" ; then
+ _sdlconfig=$sdlconfig
+ echo $_sdlconfig
+ break
+ fi
+ done
+ done
+
+ IFS="$ac_save_ifs"
+
+ if test -z "$_sdlconfig"; then
+ echo "none found!"
+ exit 1
+ fi
}
#
@@ -184,6 +184,8 @@ Optional Libraries:
--disable-vorbis disable Ogg Vorbis support [autodetect]
--with-mad-prefix=PFX Prefix where libmad is installed (optional)
--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
exit 0
@@ -198,33 +200,40 @@ for ac_option in $@; do
--disable-simon) _build_simon=no ;;
--disable-sky) _build_sky=no ;;
--disable-bs2) _build_bs2=no ;;
- --disable-queen) _build_queen=no ;;
+ --disable-queen) _build_queen=no ;;
--enable-alsa) _alsa=yes ;;
--disable-alsa) _alsa=no ;;
--enable-vorbis) _vorbis=yes ;;
--disable-vorbis) _vorbis=no ;;
--enable-mad) _mad=yes ;;
--disable-mad) _mad=no ;;
+ --enable-zlib) _zlib=yes ;;
+ --disable-zlib) _zlib=no ;;
--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_LIBS="-L$_prefix/libs"
;;
--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_LIBS="-L$_prefix/lib"
;;
--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_LIBS="-L$_prefix/lib"
;;
--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_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=`echo $ac_option | cut -d '=' -f 2`
;;
@@ -521,6 +530,25 @@ else
fi
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
@@ -607,6 +635,7 @@ typedef signed $type_4_byte int32;
$_def_vorbis
$_def_mad
$_def_alsa
+$_def_zlib
#endif /* CONFIG_H */
EOF