scripts/rebuild.sh: Use SDL2 by default.

This patch modifies the build to use SDL2 instead of SDL1 by
default. The new --use-sdl1 option can be used to link to
the previous version of the library.
diff --git a/archive/SDL2-2.0.3.tar.gz b/archive/SDL2-2.0.3.tar.gz
new file mode 100644
index 0000000..8be403d
--- /dev/null
+++ b/archive/SDL2-2.0.3.tar.gz
Binary files differ
diff --git a/scripts/build-defaults.shi b/scripts/build-defaults.shi
index 90e3e4e..384cce2 100644
--- a/scripts/build-defaults.shi
+++ b/scripts/build-defaults.shi
@@ -24,6 +24,7 @@
 pixman-0.32.4.tar.gz \
 pkg-config-0.28.tar.gz \
 SDL-1.2.15.tar.gz \
+SDL2-2.0.3.tar.gz \
 zlib-1.2.8.tar.gz \
 "
 
diff --git a/scripts/rebuild.sh b/scripts/rebuild.sh
index 29525ff..7fa4bee 100755
--- a/scripts/rebuild.sh
+++ b/scripts/rebuild.sh
@@ -40,6 +40,7 @@
 OPT_NO_CCACHE=
 OPT_NUM_JOBS=
 OPT_SYSTEM=
+OPT_USE_SDL1=
 
 for OPT; do
     OPTARG=$(expr "x$OPT" : "x[^=]*=\\(.*\\)" || true)
@@ -68,6 +69,9 @@
         --system=*)
             OPT_SYSTEM=$OPTARG
             ;;
+        --use-sdl1)
+            OPT_USE_SDL1=true
+            ;;
         --verbose)
             increment_verbosity
             ;;
@@ -115,6 +119,7 @@
     --no-ccache         Don't try to probe and use ccache during build.
     -j<count>           Run <count> parallel build jobs.
     --jobs=<count>      Same as -j<count>.
+    --use-sdl1          Use SDL 1.x instead of SDL 2.x.
 
 EOF
     exit 0
@@ -627,33 +632,47 @@
         --disable-gtk \
         --disable-libpng
 
-    EXTRA_SDL_FLAGS=
-    case $BUILD_OS in
-        darwin)
-            EXTRA_SDL_FLAGS="--disable-video-x11"
-            ;;
-    esac
-    do_autotools_package SDL \
-        --disable-audio \
-        --disable-joystick \
-        --disable-cdrom \
-        --disable-file \
-        --disable-threads \
-        $EXTRA_SDL_FLAGS
+    if [ "$OPT_USE_SDL1" ]; then
+        EXTRA_SDL_FLAGS=
+        case $BUILD_OS in
+            darwin)
+                EXTRA_SDL_FLAGS="--disable-video-x11"
+                ;;
+        esac
+        do_autotools_package SDL \
+            --disable-audio \
+            --disable-joystick \
+            --disable-cdrom \
+            --disable-file \
+            --disable-threads \
+            $EXTRA_SDL_FLAGS
 
-    # The SDL build script install a buggy sdl.pc when cross-compiling for
-    # Windows as a static library. I.e. it lacks many of the required
-    # libraries, that are part of --static-libs. Patch it directly
-    # instead.
-    case $1 in
-        windows-*)
-            sed -i -e 's|^Libs: -L\${libdir}  -lmingw32 -lSDLmain -lSDL  -mwindows|Libs: -lmingw32 -lSDLmain -lSDL  -mwindows -lm -luser32 -lgdi32 -lwinmm -ldxguid|g' $PREFIX/lib/pkgconfig/sdl.pc
-            ;;
-    esac
+        # The SDL build script install a buggy sdl.pc when cross-compiling for
+        # Windows as a static library. I.e. it lacks many of the required
+        # libraries, that are part of --static-libs. Patch it directly
+        # instead.
+        case $1 in
+            windows-*)
+                sed -i -e 's|^Libs: -L\${libdir}  -lmingw32 -lSDLmain -lSDL  -mwindows|Libs: -lmingw32 -lSDLmain -lSDL  -mwindows -lm -luser32 -lgdi32 -lwinmm -ldxguid|g' $PREFIX/lib/pkgconfig/sdl.pc
+                ;;
+        esac
 
-    SDL_CONFIG=$PREFIX/bin/sdl-config
+        SDL_CONFIG=$PREFIX/bin/sdl-config
+
+    else  # !OPT_USE_SDL1
+
+        do_autotools_package SDL2 \
+            --disable-audio \
+            --disable-joystick \
+            --disable-cdrom \
+            --disable-file \
+            --disable-threads
+
+        SDL_CONFIG=$PREFIX/bin/sdl2-config
+
+    fi  # !OPT_USE_SDL1
+
     PKG_CONFIG_LIBDIR=$PREFIX/lib/pkgconfig
-
     case $1 in
         windows-*)
             # Use the host version, or the build will freeze.