# HG changeset patch # User Sam Lantinga # Date 1263369992 0 # Node ID 336f3df1578dee44f4be6f964ebfa0e31c75b3ae # Parent 1cd9f7117b98e8732c5a25d6cedce2c7e71b7ec8 Allow configure to override assertion settings, but by default this comes from the build optimization level. diff -r 1cd9f7117b98 -r 336f3df1578d configure.in --- a/configure.in Wed Jan 13 07:52:53 2010 +0000 +++ b/configure.in Wed Jan 13 08:06:32 2010 +0000 @@ -137,28 +137,27 @@ dnl See whether we want assertions for debugging/sanity checking SDL itself. AC_ARG_ENABLE(assertions, AC_HELP_STRING([--enable-assertions], - [Enable internal sanity checks (yes/no/release/paranoid) [[default=release]]]), - , enable_assertions=release) -sdl_valid_assertion_level=no -if test x$enable_assertions = xno; then - sdl_valid_assertion_level=yes - AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0) -fi -if test x$enable_assertions = xrelease; then - sdl_valid_assertion_level=yes - AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1) -fi -if test x$enable_assertions = xyes; then - sdl_valid_assertion_level=yes - AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2) -fi -if test x$enable_assertions = xparanoid; then - sdl_valid_assertion_level=yes - AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3) -fi -if test x$sdl_valid_assertion_level = xno; then - AC_MSG_ERROR([*** unknown assertion level. stop.]) -fi + [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]), + , enable_assertions=auto) +case "$enable_assertions" in + auto) # Use optimization settings to determine assertion level + ;; + disabled) + AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0) + ;; + release) + AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1) + ;; + enabled) + AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2) + ;; + paranoid) + AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3) + ;; + *) + AC_MSG_ERROR([*** unknown assertion level. stop.]) + ;; +esac dnl See whether we can use gcc style dependency tracking AC_ARG_ENABLE(dependency-tracking, diff -r 1cd9f7117b98 -r 336f3df1578d include/SDL_assert.h --- a/include/SDL_assert.h Wed Jan 13 07:52:53 2010 +0000 +++ b/include/SDL_assert.h Wed Jan 13 08:06:32 2010 +0000 @@ -25,8 +25,10 @@ #define _SDL_assert_h #ifndef SDL_ASSERT_LEVEL -#if defined(_DEBUG) || defined(DEBUG) || \ - (defined(__GNUC__) && !defined(__OPTIMIZE__)) +#ifdef SDL_DEFAULT_ASSERT_LEVEL +#define SDL_ASSERT_LEVEL SDL_DEFAULT_ASSERT_LEVEL +#elif defined(_DEBUG) || defined(DEBUG) || \ + (defined(__GNUC__) && !defined(__OPTIMIZE__)) #define SDL_ASSERT_LEVEL 2 #else #define SDL_ASSERT_LEVEL 1 diff -r 1cd9f7117b98 -r 336f3df1578d include/SDL_config_iphoneos.h --- a/include/SDL_config_iphoneos.h Wed Jan 13 07:52:53 2010 +0000 +++ b/include/SDL_config_iphoneos.h Wed Jan 13 08:06:32 2010 +0000 @@ -25,9 +25,6 @@ #include "SDL_platform.h" -/* SDL internal assertion support */ -#define SDL_DEFAULT_ASSERT_LEVEL 1 - #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) typedef signed char int8_t; typedef unsigned char uint8_t; diff -r 1cd9f7117b98 -r 336f3df1578d include/SDL_config_macosx.h --- a/include/SDL_config_macosx.h Wed Jan 13 07:52:53 2010 +0000 +++ b/include/SDL_config_macosx.h Wed Jan 13 08:06:32 2010 +0000 @@ -28,9 +28,6 @@ /* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */ #include -/* SDL internal assertion support */ -#define SDL_DEFAULT_ASSERT_LEVEL 1 - /* This is a set of defines to configure the SDL features */ #ifdef __LP64__ diff -r 1cd9f7117b98 -r 336f3df1578d include/SDL_config_minimal.h --- a/include/SDL_config_minimal.h Wed Jan 13 07:52:53 2010 +0000 +++ b/include/SDL_config_minimal.h Wed Jan 13 08:06:32 2010 +0000 @@ -33,9 +33,6 @@ #include -/* SDL internal assertion support */ -#define SDL_DEFAULT_ASSERT_LEVEL 1 - #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) typedef signed char int8_t; typedef unsigned char uint8_t; diff -r 1cd9f7117b98 -r 336f3df1578d include/SDL_config_nintendods.h --- a/include/SDL_config_nintendods.h Wed Jan 13 07:52:53 2010 +0000 +++ b/include/SDL_config_nintendods.h Wed Jan 13 08:06:32 2010 +0000 @@ -27,9 +27,6 @@ /* This is a set of defines to configure the SDL features */ -/* SDL internal assertion support */ -#define SDL_DEFAULT_ASSERT_LEVEL 1 - #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) typedef signed char int8_t; typedef unsigned char uint8_t; diff -r 1cd9f7117b98 -r 336f3df1578d include/SDL_config_pandora.h --- a/include/SDL_config_pandora.h Wed Jan 13 07:52:53 2010 +0000 +++ b/include/SDL_config_pandora.h Wed Jan 13 08:06:32 2010 +0000 @@ -28,9 +28,6 @@ /* General platform specific identifiers */ #include "SDL_platform.h" -/* SDL internal assertion support */ -#define SDL_DEFAULT_ASSERT_LEVEL 1 - #define SDL_HAS_64BIT_TYPE 1 #define SDL_BYTEORDER 1234 diff -r 1cd9f7117b98 -r 336f3df1578d include/SDL_config_win32.h --- a/include/SDL_config_win32.h Wed Jan 13 07:52:53 2010 +0000 +++ b/include/SDL_config_win32.h Wed Jan 13 08:06:32 2010 +0000 @@ -27,9 +27,6 @@ /* This is a set of defines to configure the SDL features */ -/* SDL internal assertion support */ -#define SDL_DEFAULT_ASSERT_LEVEL 1 - #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) #if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) #define HAVE_STDINT_H 1 diff -r 1cd9f7117b98 -r 336f3df1578d include/SDL_config_wiz.h --- a/include/SDL_config_wiz.h Wed Jan 13 07:52:53 2010 +0000 +++ b/include/SDL_config_wiz.h Wed Jan 13 08:06:32 2010 +0000 @@ -28,9 +28,6 @@ /* General platform specific identifiers */ #include "SDL_platform.h" -/* SDL internal assertion support */ -#define SDL_DEFAULT_ASSERT_LEVEL 1 - /* Make sure that this isn't included by Visual C++ */ #ifdef _MSC_VER #error You should copy include/SDL_config.h.default to include/SDL_config.h