Sdl.m4 patch for c++ compatibility

In the current sdl.m4, there’s a bug where if your configure.ac, you
have AC_LANG(C++) specified, it won’t properly compile and link the SDL
test program when you run the configure script. This is because only the
default CFLAGS is overriden in sdl.m4, and in the patch below, I’ve
fixed it so it overrides CXXFLAGS as well, allowing it to work with g++.

PATCH FOLLOWS
Version: 1.2.8

— sdl.m4.orig 2004-02-18 12:21:55.000000000 -0500
+++ sdl.m4 2005-08-06 21:43:54.000000000 -0400
@@ -53,8 +53,10 @@
if test “x$enable_sdltest” = “xyes” ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"

  •  ac_save_CXXFLAGS="$CXXFLAGS"
     CFLAGS="$CFLAGS $SDL_CFLAGS"
     LIBS="$LIBS $SDL_LIBS"
    
  •  CXXFLAGS="$CFLAGS"
    

dnl
dnl Now check if the installed SDL is sufficiently new. (Also sanity
dnl checks the results of sdl-config to some extent
@@ -120,6 +122,7 @@
], no_sdl=yes,[echo $ac_n “cross compiling; assumed OK… $ac_c”])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"

  •   CXXFLAGS="$ac_save_CXXFLAGS"
    fi
    
    fi
    if test “x$no_sdl” = x ; then
    @@ -139,6 +142,7 @@
    echo “*** Could not run SDL test program, checking why…“
    CFLAGS=”$CFLAGS $SDL_CFLAGS"
    LIBS=”$LIBS $SDL_LIBS"
  • CXXFLAGS = "$CFLAGS"
         AC_TRY_LINK([
    

#include <stdio.h>
#include “SDL.h”
@@ -163,10 +167,12 @@
echo “*** may want to edit the sdl-config script: $SDL_CONFIG” ])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"

  • CXXFLAGS="$ac_save_CXXFLAGS"
      fi
    fi
    SDL_CFLAGS=""
    SDL_LIBS=""
    
  • SDL_CXXFLAGS=""
    ifelse([$3], , :, [$3])
    
    fi
    AC_SUBST(SDL_CFLAGS)