Merge branch 'upstream' into tizen submit/tizen/20160811.010655 submit/tizen/20160811.043126
authorhuiyu.eun <huiyu.eun@samsung.com>
Wed, 10 Aug 2016 14:11:25 +0000 (23:11 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Wed, 10 Aug 2016 14:12:28 +0000 (23:12 +0900)
Conflicts:
BUGS.txt
CMakeLists.txt
COPYING.txt
CREDITS.txt
INSTALL.txt
README-SDL.txt
README.txt
TODO.txt
VisualC-WinRT/SDL2-WinRT.nuspec
VisualC-WinRT/SDL2-WinRT.targets
VisualC-WinRT/SDL2main-WinRT-NonXAML.nuspec
VisualC-WinRT/SDL2main-WinRT-NonXAML.targets
VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj
VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters
VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj
VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters
VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj
VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters
VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.sln
VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj
VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters
VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj
VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters
VisualC-WinRT/tests/loopwave/Package.appxmanifest
VisualC-WinRT/tests/loopwave/loopwave_VS2012.vcxproj
VisualC-WinRT/tests/testthread/Package.appxmanifest
VisualC-WinRT/tests/testthread/testthread_VS2012.vcxproj
VisualC/SDL.sln
VisualC/SDL/SDL.vcxproj.filters
VisualC/SDL/SDL_VS2008.vcproj
VisualC/SDL_VS2008.sln
VisualC/SDLmain/SDLmain_VS2008.vcproj
VisualC/SDLtest/SDLtest.vcxproj
VisualC/SDLtest/SDLtest_VS2008.vcproj
VisualC/tests/checkkeys/checkkeys.vcxproj
VisualC/tests/checkkeys/checkkeys_VS2008.vcproj
VisualC/tests/controllermap/controllermap.vcxproj
VisualC/tests/controllermap/controllermap_VS2008.vcproj
VisualC/tests/loopwave/loopwave.vcxproj
VisualC/tests/loopwave/loopwave_VS2008.vcproj
VisualC/tests/testatomic/testatomic.vcxproj
VisualC/tests/testatomic/testatomic_VS2008.vcproj
VisualC/tests/testautomation/testautomation.vcxproj
VisualC/tests/testautomation/testautomation_VS2008.vcproj
VisualC/tests/testdraw2/testdraw2.vcxproj
VisualC/tests/testdraw2/testdraw2_VS2008.vcproj
VisualC/tests/testfile/testfile.vcxproj
VisualC/tests/testfile/testfile_VS2008.vcproj
VisualC/tests/testgamecontroller/testgamecontroller.vcxproj
VisualC/tests/testgamecontroller/testgamecontroller_VS2008.vcproj
VisualC/tests/testgesture/testgesture.vcxproj
VisualC/tests/testgesture/testgesture_VS2008.vcproj
VisualC/tests/testgl2/testgl2.vcxproj
VisualC/tests/testgl2/testgl2_VS2008.vcproj
VisualC/tests/testgles2/testgles2.vcxproj
VisualC/tests/testgles2/testgles2_VS2008.vcproj
VisualC/tests/testjoystick/testjoystick.vcxproj
VisualC/tests/testjoystick/testjoystick_VS2008.vcproj
VisualC/tests/testoverlay2/testoverlay2.vcxproj
VisualC/tests/testoverlay2/testoverlay2_VS2008.vcproj
VisualC/tests/testplatform/testplatform.vcxproj
VisualC/tests/testplatform/testplatform_VS2008.vcproj
VisualC/tests/testpower/testpower.vcxproj
VisualC/tests/testpower/testpower_VS2008.vcproj
VisualC/tests/testrendertarget/testrendertarget.vcxproj
VisualC/tests/testrendertarget/testrendertarget_VS2008.vcproj
VisualC/tests/testrumble/testrumble.vcxproj
VisualC/tests/testrumble/testrumble_VS2008.vcproj
VisualC/tests/testscale/testscale.vcxproj
VisualC/tests/testscale/testscale_VS2008.vcproj
VisualC/tests/testshape/testshape.vcxproj
VisualC/tests/testshape/testshape_VS2008.vcproj
VisualC/tests/testsprite2/testsprite2.vcxproj
VisualC/tests/testsprite2/testsprite2_VS2008.vcproj
VisualC/visualtest/unittest/testquit/testquit_VS2012.vcxproj
VisualC/visualtest/visualtest_VS2012.vcxproj
WhatsNew.txt
build-scripts/windows-buildbot-zipper.bat
build-scripts/winrtbuild.bat
build-scripts/winrtbuild.ps1
cmake/sdlchecks.cmake
configure
configure.in
docs/README-android.md
docs/README-cmake.md
docs/README-directfb.md
docs/README-gesture.md
docs/README-hg.md
docs/README-ios.md
docs/README-macosx.md
docs/README-pandora.md
docs/README-porting.md
docs/README-psp.md
docs/README-raspberrypi.md
docs/README-touch.md
docs/README-wince.md
include/SDL_config.h.cmake
include/SDL_config.h.in
include/SDL_config_pandora.h
include/SDL_events.h
include/SDL_main.h
include/SDL_platform.h
include/SDL_syswm.h
include/SDL_test_harness.h
include/SDL_video.h
src/SDL.c
src/SDL_log.c
src/dynapi/SDL_dynapi_overrides.h
src/dynapi/SDL_dynapi_procs.h
src/events/SDL_events.c
src/main/windows/version.rc
src/stdlib/SDL_stdlib.c
src/test/SDL_test_harness.c
src/test/SDL_test_log.c
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/wayland/SDL_waylanddyn.c
src/video/wayland/SDL_waylanddyn.h
src/video/wayland/SDL_waylandevents.c
src/video/wayland/SDL_waylandsym.h
src/video/wayland/SDL_waylandvideo.c
src/video/wayland/SDL_waylandvideo.h
src/video/wayland/SDL_waylandwindow.c
src/video/wayland/SDL_waylandwindow.h
src/video/x11/SDL_x11video.c
test/configure
test/loopwave.c
test/loopwavequeue.c
test/testatomic.c
test/testaudiohotplug.c
test/testaudioinfo.c
test/testautomation.c
test/testautomation_audio.c
test/testautomation_clipboard.c
test/testautomation_events.c
test/testautomation_hints.c
test/testautomation_keyboard.c
test/testautomation_main.c
test/testautomation_mouse.c
test/testautomation_pixels.c
test/testautomation_platform.c
test/testautomation_rect.c
test/testautomation_render.c
test/testautomation_rwops.c
test/testautomation_sdltest.c
test/testautomation_stdlib.c
test/testautomation_suites.h
test/testautomation_surface.c
test/testautomation_syswm.c
test/testautomation_timer.c
test/testautomation_video.c
test/testdisplayinfo.c
test/testdraw2.c
test/testdrawchessboard.c
test/testdropfile.c
test/testerror.c
test/testfile.c
test/testfilesystem.c
test/testgles.c
test/testgles2.c
test/testhittesting.c
test/testiconv.c
test/testime.c
test/testintersections.c
test/testkeys.c
test/testloadso.c
test/testlock.c
test/testmessage.c
test/testmultiaudio.c
test/testoverlay2.c
test/testplatform.c
test/testrelative.c
test/testrendercopyex.c
test/testrendertarget.c
test/testresample.c
test/testscale.c
test/testsem.c
test/testshader.c
test/testshape.c
test/testsprite2.c
test/testspriteminimal.c
test/teststreaming.c
test/testthread.c
test/testtimer.c
test/testver.c
test/testviewport.c
test/torturethread.c

181 files changed:
CMakeLists.txt
cmake/sdlchecks.cmake
configure
configure.in
include/SDL_config.h.cmake
include/SDL_config.h.in
include/SDL_config_pandora.h
include/SDL_events.h
include/SDL_main.h
include/SDL_platform.h
include/SDL_syswm.h
include/SDL_test_harness.h
include/SDL_video.h
packaging/SDL2.manifest [new file with mode: 0644]
packaging/SDL2.spec [new file with mode: 0644]
src/SDL.c
src/SDL_log.c
src/core/tizen/SDL_tizen.c [new file with mode: 0644]
src/core/tizen/SDL_tizen.h [new file with mode: 0644]
src/dynapi/SDL_dynapi_overrides.h
src/dynapi/SDL_dynapi_procs.h
src/events/SDL_events.c
src/main/tizen/SDL_tizen_main.c [new file with mode: 0644]
src/test/SDL_test_harness.c
src/test/SDL_test_log.c [changed mode: 0644->0755]
src/video/SDL_sysvideo.h
src/video/SDL_video.c
src/video/tizen/SDL_tizenevents.c [new file with mode: 0644]
src/video/tizen/SDL_tizenevents_c.h [new file with mode: 0644]
src/video/tizen/SDL_tizenkeyboard.c [new file with mode: 0644]
src/video/tizen/SDL_tizenkeyboard.h [new file with mode: 0644]
src/video/tizen/SDL_tizenmouse.c [new file with mode: 0755]
src/video/tizen/SDL_tizenmouse.h [new file with mode: 0755]
src/video/tizen/SDL_tizenopengles.c [new file with mode: 0644]
src/video/tizen/SDL_tizenopengles.h [new file with mode: 0644]
src/video/tizen/SDL_tizentouch.c [new file with mode: 0644]
src/video/tizen/SDL_tizentouch.h [new file with mode: 0644]
src/video/tizen/SDL_tizenvideo.c [new file with mode: 0644]
src/video/tizen/SDL_tizenvideo.h [new file with mode: 0644]
src/video/tizen/SDL_tizenvulkan.c [new file with mode: 0644]
src/video/tizen/SDL_tizenvulkan.h [new file with mode: 0644]
src/video/tizen/SDL_tizenwindow.c [new file with mode: 0644]
src/video/tizen/SDL_tizenwindow.h [new file with mode: 0644]
src/video/wayland/SDL_waylanddyn.c
src/video/wayland/SDL_waylanddyn.h
src/video/wayland/SDL_waylandevents.c
src/video/wayland/SDL_waylandsym.h
src/video/wayland/SDL_waylandvideo.c
src/video/wayland/SDL_waylandvideo.h
src/video/wayland/SDL_waylandvulkan.c [new file with mode: 0644]
src/video/wayland/SDL_waylandvulkan.h [new file with mode: 0644]
src/video/wayland/SDL_waylandwindow.c
src/video/wayland/SDL_waylandwindow.h
src/video/x11/SDL_x11video.c
src/video/x11/SDL_x11vulkan.c [new file with mode: 0644]
src/video/x11/SDL_x11vulkan.h [new file with mode: 0644]
test/CMakeLists.txt [new file with mode: 0755]
test/SDL_gles2funcs.h [new file with mode: 0755]
test/configure
test/loopwave.c [changed mode: 0644->0755]
test/loopwavequeue.c [changed mode: 0644->0755]
test/packaging/sdl_test.spec [new file with mode: 0755]
test/res/AutomationNotify.bmp [new file with mode: 0755]
test/res/AutomationTest.bmp [new file with mode: 0755]
test/res/InteractiveTest.bmp [new file with mode: 0755]
test/res/axis.bmp [new file with mode: 0755]
test/res/bg.bmp [new file with mode: 0755]
test/res/button.bmp [new file with mode: 0755]
test/res/controllermap.bmp [new file with mode: 0755]
test/res/icon.bmp [new file with mode: 0755]
test/res/libSDL2-2.0.so [new file with mode: 0755]
test/res/loopwave.bmp [new file with mode: 0755]
test/res/loopwavequeue.bmp [new file with mode: 0755]
test/res/moose.dat [new file with mode: 0755]
test/res/sample.bmp [new file with mode: 0755]
test/res/sample.wav [new file with mode: 0755]
test/res/test.bmp [new file with mode: 0755]
test/res/testadded.bmp [new file with mode: 0755]
test/res/testatomic.bmp [new file with mode: 0755]
test/res/testaudiohotplug.bmp [new file with mode: 0755]
test/res/testaudioinfo.bmp [new file with mode: 0755]
test/res/testchessboard.bmp [new file with mode: 0755]
test/res/testdisplayinfo.bmp [new file with mode: 0755]
test/res/testdraw2.bmp [new file with mode: 0755]
test/res/testdropfile.bmp [new file with mode: 0755]
test/res/testerror.bmp [new file with mode: 0755]
test/res/testfile.bmp [new file with mode: 0755]
test/res/testfilesystem.bmp [new file with mode: 0755]
test/res/testgles.bmp [new file with mode: 0755]
test/res/testgles2.bmp [new file with mode: 0755]
test/res/testhit.bmp [new file with mode: 0755]
test/res/testiconv.bmp [new file with mode: 0755]
test/res/testime.bmp [new file with mode: 0755]
test/res/testintersection.bmp [new file with mode: 0755]
test/res/testkeys.bmp [new file with mode: 0755]
test/res/testloadso.bmp [new file with mode: 0755]
test/res/testlock.bmp [new file with mode: 0755]
test/res/testmultiaudio.bmp [new file with mode: 0755]
test/res/testoverlay2.bmp [new file with mode: 0755]
test/res/testplatform.bmp [new file with mode: 0755]
test/res/testrelative.bmp [new file with mode: 0755]
test/res/testrendercopyex.bmp [new file with mode: 0755]
test/res/testrendertarget.bmp [new file with mode: 0755]
test/res/testresample.bmp [new file with mode: 0755]
test/res/testscale.bmp [new file with mode: 0755]
test/res/testsem.bmp [new file with mode: 0755]
test/res/testshader.bmp [new file with mode: 0755]
test/res/testsprite2.bmp [new file with mode: 0755]
test/res/testspriteminimal.bmp [new file with mode: 0755]
test/res/teststreaming.bmp [new file with mode: 0755]
test/res/testthread.bmp [new file with mode: 0755]
test/res/testtimer.bmp [new file with mode: 0755]
test/res/testtoturethread.bmp [new file with mode: 0755]
test/res/testver.bmp [new file with mode: 0755]
test/res/testviewport.bmp [new file with mode: 0755]
test/res/tobeadded.bmp [new file with mode: 0755]
test/res/toturethread.bmp [new file with mode: 0755]
test/res/utf8.txt [new file with mode: 0755]
test/testatomic.c [changed mode: 0644->0755]
test/testaudiohotplug.c [changed mode: 0644->0755]
test/testaudioinfo.c [changed mode: 0644->0755]
test/testautomation.c [changed mode: 0644->0755]
test/testautomation_audio.c [changed mode: 0644->0755]
test/testautomation_clipboard.c [changed mode: 0644->0755]
test/testautomation_events.c [changed mode: 0644->0755]
test/testautomation_hints.c [changed mode: 0644->0755]
test/testautomation_keyboard.c [changed mode: 0644->0755]
test/testautomation_main.c [changed mode: 0644->0755]
test/testautomation_mouse.c [changed mode: 0644->0755]
test/testautomation_pixels.c [changed mode: 0644->0755]
test/testautomation_platform.c [changed mode: 0644->0755]
test/testautomation_rect.c [changed mode: 0644->0755]
test/testautomation_render.c [changed mode: 0644->0755]
test/testautomation_rwops.c [changed mode: 0644->0755]
test/testautomation_sdltest.c [changed mode: 0644->0755]
test/testautomation_stdlib.c [changed mode: 0644->0755]
test/testautomation_suites.h [changed mode: 0644->0755]
test/testautomation_surface.c [changed mode: 0644->0755]
test/testautomation_syswm.c [changed mode: 0644->0755]
test/testautomation_timer.c [changed mode: 0644->0755]
test/testautomation_video.c [changed mode: 0644->0755]
test/testdisplayinfo.c [changed mode: 0644->0755]
test/testdraw2.c [changed mode: 0644->0755]
test/testdrawchessboard.c [changed mode: 0644->0755]
test/testdropfile.c [changed mode: 0644->0755]
test/testerror.c [changed mode: 0644->0755]
test/testfile.c [changed mode: 0644->0755]
test/testfilesystem.c [changed mode: 0644->0755]
test/testgles.c [changed mode: 0644->0755]
test/testgles2.c [changed mode: 0644->0755]
test/testhittesting.c [changed mode: 0644->0755]
test/testiconv.c [changed mode: 0644->0755]
test/testime.c [changed mode: 0644->0755]
test/testintersections.c [changed mode: 0644->0755]
test/testkeys.c [changed mode: 0644->0755]
test/testloadso.c [changed mode: 0644->0755]
test/testlock.c [changed mode: 0644->0755]
test/testmain.c [new file with mode: 0755]
test/testmain.h [new file with mode: 0755]
test/testmessage.c [changed mode: 0644->0755]
test/testmultiaudio.c [changed mode: 0644->0755]
test/testoverlay2.c [changed mode: 0644->0755]
test/testpicture.c [new file with mode: 0755]
test/testplatform.c [changed mode: 0644->0755]
test/testrelative.c [changed mode: 0644->0755]
test/testrendercopyex.c [changed mode: 0644->0755]
test/testrendertarget.c [changed mode: 0644->0755]
test/testresample.c [changed mode: 0644->0755]
test/testscale.c [changed mode: 0644->0755]
test/testsem.c [changed mode: 0644->0755]
test/testshader.c [changed mode: 0644->0755]
test/testshape.c [changed mode: 0644->0755]
test/testsprite2.c [changed mode: 0644->0755]
test/testspriteminimal.c [changed mode: 0644->0755]
test/teststreaming.c [changed mode: 0644->0755]
test/testthread.c [changed mode: 0644->0755]
test/testtimer.c [changed mode: 0644->0755]
test/testver.c [changed mode: 0644->0755]
test/testviewport.c [changed mode: 0644->0755]
test/torturethread.c [changed mode: 0644->0755]
test/utf8.txt [changed mode: 0644->0755]

index 74356b6..0218ba4 100755 (executable)
@@ -258,6 +258,7 @@ dep_option(FUSIONSOUND_SHARED  "Dynamically load fusionsound audio support" ON "
 set_option(VIDEO_DUMMY         "Use dummy video driver" ON)
 set_option(VIDEO_OPENGL        "Include OpenGL support" ON)
 set_option(VIDEO_OPENGLES      "Include OpenGL ES support" ON)
+set_option(VIDEO_VULKAN        "Include vulkan support" ON)
 set_option(PTHREADS            "Use POSIX threads for multi-threading" ${SDL_PTHREADS_ENABLED_BY_DEFAULT})
 dep_option(PTHREADS_SEM        "Use pthread semaphores" ON "PTHREADS" OFF)
 set_option(SDL_DLOPEN          "Use dlopen for shared object loading" ${SDL_DLOPEN_ENABLED_BY_DEFAULT})
@@ -284,6 +285,8 @@ set_option(VIDEO_MIR           "Use Mir video driver" ${UNIX_SYS})
 dep_option(MIR_SHARED          "Dynamically load Mir support" ON "VIDEO_MIR" OFF)
 set_option(VIDEO_RPI           "Use Raspberry Pi video driver" ${UNIX_SYS})
 dep_option(X11_SHARED          "Dynamically load X11 support" ON "VIDEO_X11" OFF)
+set_option(VIDEO_TIZEN       "Use Tizen video driver" ${UNIX_SYS})
+dep_option(TIZEN_SHARED      "Dynamically load Tizen support" ON "VIDEO_TIZEN" OFF)
 set(SDL_X11_OPTIONS Xcursor Xinerama XInput Xrandr Xscrnsaver XShape Xvm)
 foreach(_SUB ${SDL_X11_OPTIONS})
   string(TOUPPER "VIDEO_X11_${_SUB}" _OPT)
@@ -1287,6 +1290,15 @@ elseif(HAIKU)
   endif()
 
   CheckPTHREAD()
+elseif(TIZEN)
+  if(SDL_VIDEO)
+    if(VIDEO_VULKAN)
+      set(SDL_VIDEO_VULKAN 1)
+      set(HAVE_VIDEO_VULKAN TRUE)
+      set(SDL_CFLAGS "${SDL_CFLAGS} -I/usr/include")
+      list(APPEND SDL_LIBS "-lvulkan")
+    endif()
+  endif()
 endif()
 
 # Dummies
index 7ff0985..f232c65 100644 (file)
@@ -545,7 +545,7 @@ endmacro()
 # - HAVE_DLOPEN opt
 macro(CheckWayland)
   if(VIDEO_WAYLAND)
-    pkg_check_modules(WAYLAND wayland-client wayland-cursor wayland-egl egl xkbcommon)
+    pkg_check_modules(WAYLAND wayland-client wayland-cursor wayland-egl egl xkbcommon xdg-shell-client text-client tizen-extension-client)
     if(WAYLAND_FOUND)
       link_directories(
           ${WAYLAND_LIBRARY_DIRS}
@@ -571,10 +571,16 @@ macro(CheckWayland)
           FindLibraryAndSONAME(wayland-egl)
           FindLibraryAndSONAME(wayland-cursor)
           FindLibraryAndSONAME(xkbcommon)
+          FindLibraryAndSONAME(xdg-shell-client)
+          FindLibraryAndSONAME(text-client)
+          FindLibraryAndSONAME(tizen-extension-client)
           set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "\"${WAYLAND_CLIENT_LIB_SONAME}\"")
           set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL "\"${WAYLAND_EGL_LIB_SONAME}\"")
           set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR "\"${WAYLAND_CURSOR_LIB_SONAME}\"")
           set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "\"${XKBCOMMON_LIB_SONAME}\"")
+          set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XDGSHELLCLIENT "\"${XDGSHELLCLIENT_LIB_SONAME}\"")
+          set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TEXTCLIENT "\"${TEXTCLIENT_LIB_SONAME}\"")
+          set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TIZENEXTENSIONCLIENT "\"${TIZENEXTENSIONCLIENT_LIB_SONAME}\"")
           set(HAVE_WAYLAND_SHARED TRUE)
         endif()
       else()
@@ -586,6 +592,53 @@ macro(CheckWayland)
   endif()
 endmacro()
 
+macro(CheckTizen)
+  if(VIDEO_TIZEN)
+    pkg_check_modules(TIZEN wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-appfw-application dlog ecore-imf)
+    if(TIZEN_FOUND)
+      link_directories(
+          ${TIZEN_LIBRARY_DIRS}
+      )
+      include_directories(
+          ${TIZEN_INCLUDE_DIRS}
+      )
+      set(HAVE_VIDEO_TIZEN TRUE)
+      set(HAVE_SDL_VIDEO TRUE)
+
+      file(GLOB TIZEN_SOURCES ${SDL2_SOURCE_DIR}/src/video/tizen/*.c)
+      set(SOURCE_FILES ${SOURCE_FILES} ${TIZEN_SOURCES})
+
+      if(TIZEN_SHARED)
+        if(NOT HAVE_DLOPEN)
+          message_warn("You must have SDL_LoadObject() support for dynamic Tizen loading")
+        else()
+          FindLibraryAndSONAME(wayland-client)
+          FindLibraryAndSONAME(wayland-egl)
+          FindLibraryAndSONAME(ecore)
+          FindLibraryAndSONAME(ecore-wayland)
+          FindLibraryAndSONAME(eina)
+          FindLibraryAndSONAME(capi-appfw-application)
+          FindLibraryAndSONAME(capi-system-system-settings)
+          FindLibraryAndSONAME(dlog)
+          set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC "\"${WAYLAND_CLIENT_LIB_SONAME}\"")
+          set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_EGL "\"${WAYLAND_EGL_LIB_SONAME}\"")
+          set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_ECORE "\"${ECORE_LIB_SONAME}\"")
+          set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_ECORE_WAYLAND "\"${ECORE_WAYLAND_LIB_SONAME}\"")
+          set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_EVAS "\"${EVAS_LIB_SONAME}\"")
+          set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_EINA "\"${EINA_LIB_SONAME}\"")
+          set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_APPCORE_EFL "\"${APPCORE_EFL_LIB_SONAME}\"")
+          set(SDL_VIDEO_DRIVER_TIZEN_DYNAMIC_DLOG "\"${DLOG_LIB_SONAME}\"")
+          set(HAVE_TIZEN_SHARED TRUE)
+        endif()
+      else()
+        set(EXTRA_LIBS ${TIZEN_LIBRARIES} ${EXTRA_LIBS})
+      endif()
+
+      set(SDL_VIDEO_DRIVER_TIZEN 1)
+    endif()
+  endif()
+endmacro()
+
 # Requires:
 # - n/a
 #
@@ -717,6 +770,21 @@ macro(CheckOpenGLESX11)
   endif()
 endmacro()
 
+macro(CheckVulkan)
+  if(VIDEO_VULKAN)
+    check_c_source_compiles("
+       #include <vulkan/vulkan.h>
+      int main (int argc, char** argv) {}" HAVE_VIDEO_VULKAN)
+    if(HAVE_VIDEO_VULKAN)
+        set(SDL_VIDEO_VULKAN 1)
+        set(VULKAN_LDFLAGS "-lvulkan")
+        list(APPEND EXTRA_LDFLAGS ${VULKAN_LDFLAGS})
+        list(APPEND SDL_LIBS ${VULKAN_LDFLAGS})
+    endif()
+
+  endif()
+endmacro()
+
 # Requires:
 # - nada
 # Optional:
index a41f025..ac20884 100755 (executable)
--- a/configure
+++ b/configure
@@ -820,6 +820,7 @@ enable_dummyaudio
 enable_video_wayland
 enable_video_wayland_qt_touch
 enable_wayland_shared
+enable_video_tizen
 enable_video_mir
 enable_mir_shared
 enable_video_x11
@@ -844,6 +845,7 @@ enable_video_opengl
 enable_video_opengles
 enable_video_opengles1
 enable_video_opengles2
+enable_video_vulkan
 enable_libudev
 enable_dbus
 enable_ibus
@@ -1546,6 +1548,7 @@ Optional Features:
                           QtWayland server support for Wayland video driver
                           [[default=yes]]
   --enable-wayland-shared dynamically load Wayland support [[default=maybe]]
+  --enable-video-tizen    use tizen video driver [[default=yes]]
   --enable-video-mir      use Mir video driver [[default=yes]]
   --enable-mir-shared     dynamically load Mir support [[default=maybe]]
   --enable-video-x11      use X11 video driver [[default=yes]]
@@ -1582,6 +1585,7 @@ Optional Features:
                           include OpenGL ES 1.1 support [[default=yes]]
   --enable-video-opengles2
                           include OpenGL ES 2.0 support [[default=yes]]
+  --enable-video-vulkan   include Vulkan support [[default=yes]]
   --enable-libudev        enable libudev support [[default=yes]]
   --enable-dbus           enable D-Bus support [[default=yes]]
   --enable-ibus           enable IBus support [[default=yes]]
@@ -18767,9 +18771,9 @@ $as_echo_n "checking for Wayland support... " >&6; }
         if  test x$PKG_CONFIG != xno && \
             test x$video_opengl_egl = xyes && \
             test x$video_opengles_v2 = xyes; then
-            if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
-                WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
-                WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
+            if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon xdg-shell-client text-client tizen-extension-client ; then
+                WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon xdg-shell-client text-client tizen-extension-client`
+                WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon xdg-shell-client text-client tizen-extension-client`
                 video_wayland=yes
             fi
         fi
@@ -18804,6 +18808,9 @@ fi
                     fi
                     wayland_cursor_lib=`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
                     xkbcommon_lib=`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
+                    xdg_shell_client_lib=`find_lib "libxdg-shell-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
+                    text_client_lib=`find_lib "libtext-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
+                    tizen_extension_client_lib=`find_lib "libtizen-extension-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`
                     ;;
             esac
 
@@ -18821,11 +18828,17 @@ $as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic Wa
                test x$wayland_client_lib != x && \
                test x$wayland_egl_lib != x && \
                test x$wayland_cursor_lib != x && \
+               test x$xdg_shell_client_lib != x && \
+               test x$text_client_lib != x && \
+               test x$tizen_extension_client_lib != x && \
                test x$xkbcommon_lib != x; then
                 echo "-- dynamic libwayland-client -> $wayland_client_lib"
                 echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
                 echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
                 echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
+                echo "-- dynamic libxdg_shell_client -> $xdg_shell_client_lib"
+                echo "-- dynamic libtext_client -> $xtext_client_lib"
+                echo "-- dynamic libtizen_extension_client -> $xtizen_extension_client_lib"
 
 cat >>confdefs.h <<_ACEOF
 #define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC "$wayland_client_lib"
@@ -18846,6 +18859,21 @@ cat >>confdefs.h <<_ACEOF
 #define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON "$xkbcommon_lib"
 _ACEOF
 
+
+cat >>confdefs.h <<_ACEOF
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XDGSHELLCLIENT "$xdg_shell_client_lib"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TEXTCLIENT "$text_client_lib"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TIZENEXTENSIONCLIENT "$tizen_extension_client_lib"
+_ACEOF
+
                 SUMMARY_video="${SUMMARY_video} wayland(dynamic)"
             else
                 enable_wayland_shared=no
@@ -18857,6 +18885,93 @@ _ACEOF
     fi
 }
 
+CheckTizen()
+{
+    # Check whether --enable-video-tizen was given.
+if test "${enable_video_tizen+set}" = set; then :
+  enableval=$enable_video_tizen;
+else
+  enable_video_tizen=yes
+fi
+
+
+    if test x$enable_video = xyes -a x$enable_video_tizen = xyes; then
+        # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tizen support" >&5
+$as_echo_n "checking for Tizen support... " >&6; }
+        video_tizen=no
+        if  test x$PKG_CONFIG != xno && \
+            test x$video_opengl_egl = xyes && \
+            test x$video_opengles_v2 = xyes; then
+            if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf; then
+                TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf`
+                TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf`
+                video_tizen=yes
+            fi
+        fi
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_tizen" >&5
+$as_echo "$video_tizen" >&6; }
+
+        if test x$video_tizen = xyes; then
+
+$as_echo "#define SDL_VIDEO_DRIVER_TIZEN 1" >>confdefs.h
+
+            SOURCES="$SOURCES $srcdir/src/video/tizen/*.c"
+            SOURCES="$SOURCES $srcdir/src/core/tizen/*.c"
+            SDLMAIN_SOURCES="$srcdir/src/main/tizen/*.c"
+
+            SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
+            SDL_LIBS="-lSDL2main $SDL_LIBS"
+
+            EXTRA_CFLAGS="$EXTRA_CFLAGS $TIZEN_CFLAGS -DTIZEN"
+            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $TIZEN_LIBS"
+            SUMMARY_video="${SUMMARY_video} tizen"
+            have_video=yes
+        fi
+    fi
+}
+
 CheckMir()
 {
     # Check whether --enable-video-mir was given.
@@ -21108,6 +21223,14 @@ else
   enable_video_opengles2=yes
 fi
 
+# Check whether --enable-video-vulkan was given.
+if test "${enable_video_vulkan+set}" = set; then :
+  enableval=$enable_video_vulkan;
+else
+  enable_video_vulkan=yes
+fi
+
+
 
 CheckOpenGLESX11()
 {
@@ -21425,6 +21548,44 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
     fi
 }
 
+CheckVulkanTizen()
+{
+    if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Vulkan support" >&5
+$as_echo_n "checking for Vulkan support... " >&6; }
+        video_vulkan=no
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+         #include <vulkan/vulkan.h>
+
+int
+main ()
+{
+
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+        video_vulkan=yes
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $video_vulkan" >&5
+$as_echo "$video_vulkan" >&6; }
+        if test x$video_vulkan = xyes; then
+
+$as_echo "#define SDL_VIDEO_VULKAN 1" >>confdefs.h
+
+            SUMMARY_video="${SUMMARY_video} vulkan"
+            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvulkan"
+        fi
+    fi
+}
+
 CheckInputEvents()
 {
             { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux 2.4 unified input interface" >&5
@@ -22978,8 +23139,10 @@ case "$host" in
         CheckFusionSound
         CheckOpenGLX11
         CheckOpenGLESX11
+        CheckVulkanTizen
         CheckMir
         CheckWayland
+        CheckTizen
         CheckLibUDev
         CheckDBus
         CheckIBus
index f585d01..5ad20f9 100644 (file)
@@ -1177,9 +1177,9 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for
         if  test x$PKG_CONFIG != xno && \
             test x$video_opengl_egl = xyes && \
             test x$video_opengles_v2 = xyes; then
-            if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
-                WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
-                WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
+            if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon xdg-shell-client text-client tizen-extension-client ; then
+                WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon xdg-shell-client text-client tizen-extension-client`
+                WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon xdg-shell-client text-client tizen-extension-client`
                 video_wayland=yes
             fi
         fi
@@ -1207,6 +1207,9 @@ AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[de
                     fi
                     wayland_cursor_lib=[`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
                     xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
+                    xdg_shell_client_lib=[`find_lib "libxdg-shell-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
+                    text_client_lib=[`find_lib "libtext-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
+                    tizen_extension_client_lib=[`find_lib "libtizen-extension-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
                     ;;
             esac
 
@@ -1223,15 +1226,24 @@ AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[de
                test x$wayland_client_lib != x && \
                test x$wayland_egl_lib != x && \
                test x$wayland_cursor_lib != x && \
+               test x$xdg_shell_client_lib != x && \
+               test x$text_client_lib != x && \
+               test x$tizen_extension_client_lib != x && \
                test x$xkbcommon_lib != x; then
                 echo "-- dynamic libwayland-client -> $wayland_client_lib"
                 echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
                 echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
                 echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
+                echo "-- dynamic libxdg_shell_client -> $xdg_shell_client_lib"
+                echo "-- dynamic libtext_client -> $xtext_client_lib"
+                echo "-- dynamic libtizen_extension_client -> $xtizen_extension_client_lib"
                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC, "$wayland_client_lib", [ ])
                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL, "$wayland_egl_lib", [ ])
                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR, "$wayland_cursor_lib", [ ])
                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
+                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XDGSHELLCLIENT, "$xdg_shell_client_lib", [ ])
+                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TEXTCLIENT, "$text_client_lib", [ ])
+                AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TIZENEXTENSIONCLIENT, "$tizen_extension_client_lib", [ ])
                 SUMMARY_video="${SUMMARY_video} wayland(dynamic)"
             else
                 enable_wayland_shared=no
@@ -1243,6 +1255,46 @@ AC_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [[de
     fi
 }
 
+dnl Check for Tizen
+CheckTizen()
+{
+    AC_ARG_ENABLE(video-tizen,
+                               AC_HELP_STRING([--enable-video-tizen], [use tizen video driver [[default=yes]]]),
+                               ,enable_video_tizen=yes)
+
+    if test x$enable_video = xyes -a x$enable_video_tizen = xyes; then
+        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+        AC_MSG_CHECKING(for Tizen support)
+        video_tizen=no
+        if  test x$PKG_CONFIG != xno && \
+            test x$video_opengl_egl = xyes && \
+            test x$video_opengles_v2 = xyes; then
+            if $PKG_CONFIG --exists wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf; then
+                TIZEN_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf`
+                TIZEN_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl ecore ecore-wayland eina capi-appfw-application capi-system-system-settings ecore-input dlog ecore-imf`
+                video_tizen=yes
+            fi
+        fi
+
+        AC_MSG_RESULT($video_tizen)
+
+        if test x$video_tizen = xyes; then
+            AC_DEFINE(SDL_VIDEO_DRIVER_TIZEN, 1, [ ])
+            SOURCES="$SOURCES $srcdir/src/video/tizen/*.c"
+            SOURCES="$SOURCES $srcdir/src/core/tizen/*.c"
+            SDLMAIN_SOURCES="$srcdir/src/main/tizen/*.c"
+
+            SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
+            SDL_LIBS="-lSDL2main $SDL_LIBS"
+
+            EXTRA_CFLAGS="$EXTRA_CFLAGS $TIZEN_CFLAGS -DTIZEN"
+            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $TIZEN_LIBS"
+            SUMMARY_video="${SUMMARY_video} tizen"
+            have_video=yes
+        fi
+    fi
+}
+
 dnl Check for Mir
 CheckMir()
 {
@@ -1978,6 +2030,10 @@ AC_HELP_STRING([--enable-video-opengles1], [include OpenGL ES 1.1 support [[defa
 AC_ARG_ENABLE(video-opengles2,
 AC_HELP_STRING([--enable-video-opengles2], [include OpenGL ES 2.0 support [[default=yes]]]),
               , enable_video_opengles2=yes)
+AC_ARG_ENABLE(video-vulkan,
+AC_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]),
+              , enable_video_vulkan=yes)
+
 
 dnl Find OpenGL ES
 CheckOpenGLESX11()
@@ -2144,6 +2200,27 @@ CheckEmscriptenGLES()
     fi
 }
 
+dnl Check for Tizen Vulkan
+CheckVulkanTizen()
+{
+    if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then
+        AC_MSG_CHECKING(for Vulkan support)
+        video_vulkan=no
+        AC_TRY_COMPILE([
+         #include <vulkan/vulkan.h>
+        ],[
+        ],[
+        video_vulkan=yes
+        ])
+        AC_MSG_RESULT($video_vulkan)
+        if test x$video_vulkan = xyes; then
+            AC_DEFINE(SDL_VIDEO_VULKAN, 1, [ ])
+            SUMMARY_video="${SUMMARY_video} vulkan"
+            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvulkan"
+        fi
+    fi
+}
+
 dnl See if we can use the new unified event interface in Linux 2.4
 CheckInputEvents()
 {
@@ -2886,8 +2963,10 @@ case "$host" in
         CheckFusionSound
         CheckOpenGLX11
         CheckOpenGLESX11
+        CheckVulkanTizen
         CheckMir
         CheckWayland
+        CheckTizen
         CheckLibUDev
         CheckDBus
         CheckIBus
index 44173a0..87a471d 100644 (file)
 #cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@
 #cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@
 #cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@
+#cmakedefine SDL_VIDEO_DRIVER_TIZEN @SDL_VIDEO_DRIVER_TIZEN@
 
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR@
 #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON@
+#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XDGSHELLCLIENT @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XDGSHELLCLIENT@
+#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TEXTCLIENT @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TEXTCLIENT@
+#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TIZENEXTENSIONCLIENT @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TIZENEXTENSIONCLIENT@
 
 #cmakedefine SDL_VIDEO_DRIVER_MIR @SDL_VIDEO_DRIVER_MIR@
 #cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC @SDL_VIDEO_DRIVER_MIR_DYNAMIC@
 #cmakedefine SDL_VIDEO_OPENGL_EGL @SDL_VIDEO_OPENGL_EGL@
 #cmakedefine SDL_VIDEO_OPENGL_OSMESA @SDL_VIDEO_OPENGL_OSMESA@
 #cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@
+#cmakedefine SDL_VIDEO_VULKAN @SDL_VIDEO_VULKAN@
 
 /* Enable system power support */
 #cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@
index 2071be4..07f3879 100644 (file)
 #undef SDL_VIDEO_DRIVER_DUMMY
 #undef SDL_VIDEO_DRIVER_WINDOWS
 #undef SDL_VIDEO_DRIVER_WAYLAND
+#undef SDL_VIDEO_DRIVER_TIZEN
 #undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
 #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC
 #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL
 #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR
 #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
+#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XDGSHELLCLIENT
+#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TEXTCLIENT
+#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TIZENEXTENSIONCLIENT
 #undef SDL_VIDEO_DRIVER_MIR
 #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC
 #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
 #undef SDL_ASSEMBLY_ROUTINES
 #undef SDL_ALTIVEC_BLITTERS
 
+#undef SDL_VIDEO_VULKAN
 #endif /* _SDL_config_h */
index 7b51e57..114e39a 100644 (file)
 #define SDL_FILESYSTEM_UNIX 1
 
 #define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_X11 1
+#define SDL_VIDEO_DRIVER_X11 0
+#define SDL_VIDEO_DRIVER_WAYLAND 1
 #define SDL_VIDEO_DRIVER_PANDORA 1
 #define SDL_VIDEO_RENDER_OGL_ES 1
 #define SDL_VIDEO_OPENGL_ES 1
index 1437f4c..6cdcf66 100644 (file)
@@ -88,6 +88,7 @@ typedef enum
     /* Window events */
     SDL_WINDOWEVENT    = 0x200, /**< Window state change */
     SDL_SYSWMEVENT,             /**< System specific event */
+    SDL_ROTATEEVENT,            /**< Orientation change */
 
     /* Keyboard events */
     SDL_KEYDOWN        = 0x300, /**< Key pressed */
index 9ce3754..91c5b7f 100644 (file)
 */
 #define SDL_MAIN_NEEDED
 
+#elif defined(__TIZEN__)
+/* On Tizen SDL provides tizen backend and port for tizen device.
+
+ */
+#define SDL_MAIN_NEEDED
+
 #endif
 #endif /* SDL_MAIN_HANDLED */
 
@@ -150,6 +156,12 @@ extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), v
 
 #endif /* __WINRT__ */
 
+#ifdef __TIZEN__
+
+extern DECLSPEC int SDLCALL SDL_tizen_app_init(int argc, char *argv[]);
+
+#endif /* __TIZEN__ */
+
 
 #ifdef __cplusplus
 }
index c6c2139..92f878a 100644 (file)
 #undef __LINUX__ /* do we need to do this? */
 #define __ANDROID__ 1
 #endif
+#if defined(TIZEN) || defined(__TIZEN__)
+#undef __TIZEN__
+#define __TIZEN__ 1
+#endif
 
 #if defined(__APPLE__)
 /* lets us know what version of Mac OS X we're compiling on */
index 1056e52..ed731ef 100644 (file)
@@ -120,7 +120,8 @@ typedef enum
     SDL_SYSWM_WAYLAND,
     SDL_SYSWM_MIR,
     SDL_SYSWM_WINRT,
-    SDL_SYSWM_ANDROID
+    SDL_SYSWM_ANDROID,
+    SDL_SYSWM_TIZEN
 } SDL_SYSWM_TYPE;
 
 /**
@@ -258,6 +259,18 @@ struct SDL_SysWMinfo
             EGLSurface surface;
         } android;
 #endif
+#if defined(SDL_VIDEO_DRIVER_TIZEN)
+        struct
+        {
+//            struct wl_display *display;              /**< Wayland display */
+//            struct wl_surface *surface;              /**< Wayland surface */
+//            struct wl_shell_surface *shell_surface;  /**< Wayland shell_surface (window manager handle) */
+
+            /* For GLES */
+            void*  egl_display;                      /**< EGLDispaly when OPENGLES is enabled */
+            void*  egl_surface;                      /**< EGLSurface when OPENGLES is enabled for this wl_surface */
+        } tizen;
+#endif
 
         /* Can't have an empty union */
         int dummy;
index 74c0950..2ee76e7 100644 (file)
@@ -52,6 +52,7 @@ extern "C" {
 #define TEST_STARTED         0
 #define TEST_COMPLETED       1
 #define TEST_SKIPPED         2
+#define TEST_UNSUPPORTED     3
 
 /* ! Definition of all the possible test results for the harness */
 #define TEST_RESULT_PASSED              0
@@ -59,6 +60,7 @@ extern "C" {
 #define TEST_RESULT_NO_ASSERT           2
 #define TEST_RESULT_SKIPPED             3
 #define TEST_RESULT_SETUP_FAILURE       4
+#define TEST_RESULT_UNSUPPORTED         5
 
 /* !< Function pointer to a test case setup function (run before every test) */
 typedef void (*SDLTest_TestCaseSetUpFp)(void *arg);
index 52dbbc7..9de22f5 100644 (file)
@@ -109,7 +109,8 @@ typedef enum
     SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ),
     SDL_WINDOW_FOREIGN = 0x00000800,            /**< window not created by SDL */
     SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000,      /**< window should be created in high-DPI mode if supported */
-    SDL_WINDOW_MOUSE_CAPTURE = 0x00004000       /**< window has mouse captured (unrelated to INPUT_GRABBED) */
+    SDL_WINDOW_MOUSE_CAPTURE = 0x00004000,      /**< window has mouse captured (unrelated to INPUT_GRABBED) */
+    SDL_WINDOW_VULKAN = 0x10000000              /**< window usable with Vulkan */
 } SDL_WindowFlags;
 
 /**
@@ -217,6 +218,16 @@ typedef enum
 } SDL_GLcontextReleaseFlag;
 
 
+/**
+ *  \brief An opaque handle to an Vulkan instance.
+ */
+typedef void *SDL_vulkanInstance;
+
+/**
+ *  \brief An opaque handle to an Vulkan instance.
+ */
+typedef void *SDL_vulkanSurface;
+
 /* Function prototypes */
 
 /**
@@ -1091,6 +1102,15 @@ extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context);
 
 /* @} *//* OpenGL support functions */
 
+/**
+ *  \name Vulkan support functions
+ */
+/* @{ */
+
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(SDL_Window* window, unsigned* count, char** names);
+extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(SDL_Window* window, SDL_vulkanInstance instance, SDL_vulkanSurface* surface);
+
+/* @} *//* Vulkan support functions */
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus
diff --git a/packaging/SDL2.manifest b/packaging/SDL2.manifest
new file mode 100644 (file)
index 0000000..017d22d
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+    <domain name="_"/>
+ </request>
+</manifest>
diff --git a/packaging/SDL2.spec b/packaging/SDL2.spec
new file mode 100644 (file)
index 0000000..39e55fa
--- /dev/null
@@ -0,0 +1,155 @@
+Summary: Simple DirectMedia Layer
+Name: SDL2
+Version: 2.0.4
+Release: 2
+Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
+URL: http://www.libsdl.org/
+License: zlib
+Group: System Environment/Libraries
+BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
+Prefix: %{_prefix}
+%ifos linux
+Provides: libSDL2-2.0.so.0
+%endif
+
+
+
+%define _unpackaged_files_terminate_build 0
+
+
+%define __defattr %defattr(-,root,root)
+%define __soext so
+
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+BuildRequires:  pkgconfig(egl)
+BuildRequires:  pkgconfig(glesv2)
+BuildRequires:  pkgconfig(wayland-client)
+BuildRequires:  pkgconfig(wayland-cursor)
+BuildRequires:  pkgconfig(wayland-egl)
+BuildRequires:  pkgconfig(text-client)
+BuildRequires:  pkgconfig(xdg-shell-client)
+BuildRequires:  pkgconfig(tizen-extension-client)
+Requires:       libwayland-extension-client
+BuildRequires:  pkgconfig(xkbcommon)
+BuildRequires:  pkgconfig(libpng)
+BuildRequires:  pkgconfig(libxml-2.0)
+BuildRequires:  pkgconfig(pixman-1)
+BuildRequires:  pkgconfig(freetype2)
+BuildRequires:  pkgconfig(fontconfig)
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  binutils-devel
+BuildRequires:  which
+BuildRequires:  autoconf
+#BuildRequires:  Vulkan-LoaderAndValidationLayers
+#BuildRequires:  Vulkan-LoaderAndValidationLayers-devel
+
+BuildRequires:  pkgconfig(ecore)
+BuildRequires:  pkgconfig(ecore-wayland)
+BuildRequires:  pkgconfig(capi-appfw-application)
+BuildRequires:  pkgconfig(capi-system-system-settings)
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(ecore-imf)
+
+%description
+This is the Simple DirectMedia Layer, a generic API that provides low
+level access to audio, keyboard, mouse, and display framebuffer across
+multiple platforms.
+
+%package devel
+Summary: Libraries, includes and more to develop SDL applications.
+Group: Development/Libraries
+Requires: %{name} = %{version}
+
+%description devel
+This is the Simple DirectMedia Layer, a generic API that provides low
+level access to audio, keyboard, mouse, and display framebuffer across
+multiple platforms.
+
+This is the libraries, include files and other resources you can use
+to develop SDL applications.
+
+
+%prep
+%setup -q 
+
+%build
+%ifos linux
+CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-directfb --enable-video-tizen
+%else
+%configure
+%endif
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%ifos linux
+make install prefix=$RPM_BUILD_ROOT%{prefix} \
+             bindir=$RPM_BUILD_ROOT%{_bindir} \
+             libdir=$RPM_BUILD_ROOT%{_libdir} \
+             includedir=$RPM_BUILD_ROOT%{_includedir} \
+             datadir=$RPM_BUILD_ROOT%{_datadir} \
+             mandir=$RPM_BUILD_ROOT%{_mandir}
+%else
+%makeinstall
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%manifest packaging/SDL2.manifest
+%{__defattr}
+#%doc README*.txt COPYING.txt CREDITS.txt BUGS.txt
+%{_libdir}/lib*.%{__soext}.*
+
+%files devel
+%{__defattr}
+#%doc docs/README*.md
+%{_bindir}/*-config
+%{_libdir}/lib*.a
+%{_libdir}/lib*.la
+%{_libdir}/lib*.%{__soext}
+%{_includedir}/*/*.h
+%{_libdir}/pkgconfig/*
+%{_datadir}/aclocal/*
+
+%changelog
+* Thu Jun 04 2015 Ryan C. Gordon <icculus@icculus.org>
+- Fixed README paths.
+
+* Sun Dec 07 2014 Simone Contini <s.contini@oltrelinux.com>
+- Fixed changelog date issue and docs filenames
+
+* Sun Jan 22 2012 Sam Lantinga <slouken@libsdl.org>
+- Updated for SDL 2.0
+
+* Tue May 16 2006 Sam Lantinga <slouken@libsdl.org>
+- Removed support for Darwin, due to build problems on ps2linux
+
+* Sat Jan 03 2004 Anders Bjorklund <afb@algonet.se>
+- Added support for Darwin, updated spec file
+
+* Wed Jan 19 2000 Sam Lantinga <slouken@libsdl.org>
+- Re-integrated spec file into SDL distribution
+- 'name' and 'version' come from configure 
+- Some of the documentation is devel specific
+- Removed SMP support from %build - it doesn't work with libtool anyway
+
+* Tue Jan 18 2000 Hakan Tandogan <hakan@iconsult.com>
+- Hacked Mandrake sdl spec to build 1.1
+
+* Sun Dec 19 1999 John Buswell <johnb@mandrakesoft.com>
+- Build Release
+
+* Sat Dec 18 1999 John Buswell <johnb@mandrakesoft.com>
+- Add symlink for libSDL-1.0.so.0 required by sdlbomber
+- Added docs
+
+* Thu Dec 09 1999 Lenny Cartier <lenny@mandrakesoft.com>
+- v 1.0.0
+
+* Mon Nov  1 1999 Chmouel Boudjnah <chmouel@mandrakesoft.com>
+- First spec file for Mandrake distribution.
+
+# end of file
index 5d31002..10d50f4 100644 (file)
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -447,6 +447,8 @@ SDL_GetPlatform()
     return "iOS";
 #elif __PSP__
     return "PlayStation Portable";
+#elif __TIZEN__
+    return "Tizen";
 #else
     return "Unknown (see SDL_platform.h)";
 #endif
index 60bac9f..25c9e8a 100644 (file)
 #include <android/log.h>
 #endif
 
+#if defined(__TIZEN__)
+#include <dlog/dlog.h>
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "SDL_LOG"
+#define _SECURE_LOG
+#endif
+
 #define DEFAULT_PRIORITY                SDL_LOG_PRIORITY_CRITICAL
 #define DEFAULT_ASSERT_PRIORITY         SDL_LOG_PRIORITY_WARN
 #define DEFAULT_APPLICATION_PRIORITY    SDL_LOG_PRIORITY_INFO
@@ -72,6 +81,18 @@ static const char *SDL_priority_prefixes[SDL_NUM_LOG_PRIORITIES] = {
     "CRITICAL"
 };
 
+#if defined(__TIZEN__)
+static const int SDL_dlog_debug_priority[SDL_NUM_LOG_PRIORITIES] = {
+    NULL,
+    DLOG_VERBOSE,
+    DLOG_DEBUG,
+    DLOG_INFO,
+    DLOG_WARN,
+    DLOG_ERROR,
+    DLOG_FATAL
+};
+#endif
+
 #ifdef __ANDROID__
 static const char *SDL_category_prefixes[SDL_LOG_CATEGORY_RESERVED1] = {
     "APP",
@@ -312,6 +333,21 @@ static int consoleAttached = 0;
 static HANDLE stderrHandle = NULL;
 #endif
 
+#if defined(__TIZEN__)
+static void
+SDL_PrintDlog(int priority, char *format, ...)
+{
+    va_list ap;
+
+    if (priority >= SDL_NUM_LOG_PRIORITIES)
+        return;
+
+    va_start(ap, format);
+    dlog_vprint(SDL_dlog_debug_priority[priority], LOG_TAG, format, ap);
+    va_end(ap);
+}
+#endif
+
 static void
 SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
               const char *message)
@@ -410,13 +446,17 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
         fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message);
         fclose (pFile);
     }
+#elif defined(__TIZEN__)
+    {
+        SDL_PrintDlog(priority, "%s: %s", SDL_priority_prefixes[priority], message);
+    }
 #endif
 #if HAVE_STDIO_H
     fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message);
+#endif
 #if __NACL__
     fflush(stderr);
 #endif
-#endif
 }
 
 void
diff --git a/src/core/tizen/SDL_tizen.c b/src/core/tizen/SDL_tizen.c
new file mode 100644 (file)
index 0000000..4beaec1
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include <stdio.h>
+#include "../../SDL_internal.h"
+
+#if __TIZEN__
+#include "SDL_tizen.h"
+#include "SDL_log.h"
+#include "SDL_events.h"
+#include "../../events/SDL_events_c.h"
+#include <app_internal.h>
+#include <app_extension.h>
+#include <system_settings.h>
+
+static int tizen_appcore_initialized = 0;
+static appcore_context_h appcore_handle = NULL;
+static ui_app_lifecycle_callback_s event_callback = {0,};
+static app_event_handler_h handlers[5] = {NULL, };
+
+/* TODO  ::
+ * Impplementation of serveral app core callback function for SDL Application and App Core
+ * */
+
+static bool
+_tizen_sdl_create(void *data)
+{
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore CreateCB");
+    return true;
+}
+
+static void
+_tizen_sdl_terminate(void *data)
+{
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore TermincateCB");
+    SDL_SendQuit();
+    SDL_SendAppEvent(SDL_APP_TERMINATING);
+    return;
+}
+
+static void
+_tizen_sdl_pause (void *data)
+{
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore PauseCB");
+    SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND);
+    SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND);
+    return;
+}
+
+static void
+_tizen_sdl_resume(void *data)
+{
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore ResumeCB");
+    SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND);
+    SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND);
+    return;
+}
+
+static void
+_tizen_sdl_control(app_control_h app_control, void *data)
+{
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL_AppCore ControlCB");
+    return;
+}
+
+static void
+_tizen_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+    /*APP_EVENT_LANGUAGE_CHANGED*/
+    char *locale = NULL;
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Language changedCB");
+    system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+    free(locale);
+    return;
+}
+
+static void
+_tizen_app_orient_changed(app_event_info_h event_info, void *user_data)
+{
+    /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
+    app_device_orientation_e orientation;
+    app_event_get_device_orientation(event_info, &orientation);
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION," Orientation Changed CB, Rotation Degree : %d", orientation);
+    SDL_Event event;
+    SDL_memset(&event, 0, sizeof(event));
+    event.type = SDL_ROTATEEVENT;
+    event.user.code = 0;
+    event.window.data1 = (void*)orientation;
+    event.user.data2 = -1;
+
+    SDL_PushEvent(&event);
+    return;
+}
+
+static void
+_tizen_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+    /*APP_EVENT_REGION_FORMAT_CHANGED*/
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "region changedCB");
+}
+
+static void
+_tizen_app_low_battery(app_event_info_h event_info, void *user_data)
+{
+    /*APP_EVENT_LOW_BATTERY*/
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "low battery CB");
+}
+
+static void
+_tizen_app_low_memory(app_event_info_h event_info, void *user_data)
+{
+    /*APP_EVENT_LOW_MEMORY*/
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "low memory CB");
+    SDL_SendAppEvent(SDL_APP_LOWMEMORY);
+}
+
+int
+SDL_tizen_app_init(int argc, char *argv[])
+{
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "SDL Tizen App initialize");
+    if (tizen_appcore_initialized)
+    {
+        SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Already initialized!");
+        return 0;
+    }
+    tizen_appcore_initialized = 1;
+    if (argc < 1 || argv == NULL)
+    {
+        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "APP_ERROR_INVALID_PARAMETER");
+        return 0;
+    }
+
+    event_callback.create = _tizen_sdl_create;
+    event_callback.terminate = _tizen_sdl_terminate;
+    event_callback.pause = _tizen_sdl_pause;
+    event_callback.resume = _tizen_sdl_resume;
+    event_callback.app_control = _tizen_sdl_control;
+
+    ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, _tizen_app_low_battery, NULL);
+    ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, _tizen_app_low_memory, NULL);
+    ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, _tizen_app_orient_changed, NULL);
+    ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, _tizen_app_lang_changed, NULL);
+    ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, _tizen_app_region_changed, NULL);
+
+    return ui_app_init(argc, argv, &event_callback, NULL, &appcore_handle);
+}
+
+void
+SDL_tizen_app_exit(void)
+{
+    ui_app_fini(appcore_handle);
+}
+#endif
diff --git a/src/core/tizen/SDL_tizen.h b/src/core/tizen/SDL_tizen.h
new file mode 100644 (file)
index 0000000..908b310
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef _SDL_tizen_h
+#define _SDL_tizen_h
+
+#if __TIZEN__
+void SDL_tizen_app_exit(void);
+#endif
+
+#endif /* _SDL_tizen_h */
index c9ebfff..28804d6 100644 (file)
 #define SDL_JoystickCurrentPowerLevel SDL_JoystickCurrentPowerLevel_REAL
 #define SDL_GameControllerFromInstanceID SDL_GameControllerFromInstanceID_REAL
 #define SDL_JoystickFromInstanceID SDL_JoystickFromInstanceID_REAL
+#define SDL_tizen_app_init SDL_tizen_app_init_REAL
+#define SDL_Vulkan_GetInstanceExtensions SDL_Vulkan_GetInstanceExtensions_REAL
+#define SDL_Vulkan_CreateSurface SDL_Vulkan_CreateSurface_REAL
index 3f11a25..fb5bb7f 100644 (file)
@@ -631,3 +631,8 @@ SDL_DYNAPI_PROC(int,SDL_GetDisplayDPI,(int a, float *b, float *c, float *d),(a,b
 SDL_DYNAPI_PROC(SDL_JoystickPowerLevel,SDL_JoystickCurrentPowerLevel,(SDL_Joystick *a),(a),return)
 SDL_DYNAPI_PROC(SDL_GameController*,SDL_GameControllerFromInstanceID,(SDL_JoystickID a),(a),return)
 SDL_DYNAPI_PROC(SDL_Joystick*,SDL_JoystickFromInstanceID,(SDL_JoystickID a),(a),return)
+#ifdef __TIZEN__
+SDL_DYNAPI_PROC(int,SDL_tizen_app_init,(int a, char *b[]),(a,b),return)
+#endif
+SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_GetInstanceExtensions,(SDL_Window* a, unsigned int* b, char** c),(a,b,c),return)
+SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window* a, SDL_vulkanInstance b, SDL_vulkanSurface* c),(a,b,c),return)
index ffd1038..e6c39fc 100644 (file)
@@ -395,7 +395,6 @@ void
 SDL_PumpEvents(void)
 {
     SDL_VideoDevice *_this = SDL_GetVideoDevice();
-
     /* Get events from the video subsystem */
     if (_this) {
         _this->PumpEvents(_this);
@@ -406,7 +405,6 @@ SDL_PumpEvents(void)
         SDL_JoystickUpdate();
     }
 #endif
-
     SDL_SendPendingQuit();  /* in case we had a signal handler fire, etc. */
 }
 
@@ -431,7 +429,6 @@ SDL_WaitEventTimeout(SDL_Event * event, int timeout)
 
     if (timeout > 0)
         expiration = SDL_GetTicks() + timeout;
-
     for (;;) {
         SDL_PumpEvents();
         switch (SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) {
diff --git a/src/main/tizen/SDL_tizen_main.c b/src/main/tizen/SDL_tizen_main.c
new file mode 100644 (file)
index 0000000..ade8afb
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+    SDL_tizen_main.c, placed in the public domain by samsung  5/23/16
+*/
+#include "SDL_config.h"
+
+#ifdef __TIZEN__
+#include <stdlib.h>
+#include <stdio.h>
+#include "SDL.h"
+#include "SDL_main.h"
+
+#ifdef main
+#undef main
+#endif
+
+int main(int argc, char *argv[])
+{
+    SDL_tizen_app_init(argc, argv);
+    SDL_SetMainReady();
+    (void)SDL_main(argc, argv);
+    return 0;
+}
+
+#endif /* __TIZEN__ */
+
+/* vi: set ts=4 sw=4 expandtab: */
index fec3416..a291868 100644 (file)
@@ -32,7 +32,7 @@
 const char *SDLTest_InvalidNameFormat = "(Invalid)";
 
 /* Log summary message format */
-const char *SDLTest_LogSummaryFormat = "%s Summary: Total=%d Passed=%d Failed=%d Skipped=%d";
+const char *SDLTest_LogSummaryFormat = "%s Summary: Total=%d Passed=%d Failed=%d Skipped=%d Unsupported=%d";
 
 /* Final result message format */
 const char *SDLTest_FinalResultFormat = ">>> %s '%s': %s\n";
@@ -274,6 +274,9 @@ SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference
     } else if (testCaseResult == TEST_ABORTED) {
         /* Test was aborted early; assume it failed */
         testResult = TEST_RESULT_FAILED;
+    } else if (testCaseResult == TEST_UNSUPPORTED) {
+        /* Test was unsupported */
+        testResult = TEST_RESULT_UNSUPPORTED;
     } else {
         /* Perform failure analysis based on asserts */
         testResult = SDLTest_AssertSummaryToTestResult();
@@ -305,6 +308,9 @@ SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference
     } else if (testCaseResult == TEST_ABORTED) {
         /* Test was aborted early; assume it failed */
         SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Failed (Aborted)");
+    } else if (testCaseResult == TEST_UNSUPPORTED) {
+        /* Test was unsupported */
+        SDLTest_Log((char *)SDLTest_FinalResultFormat, "Test", testCase->name, "Unsupported");
     } else {
         SDLTest_LogAssertSummary();
     }
@@ -392,9 +398,11 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
     Uint32 totalTestFailedCount = 0;
     Uint32 totalTestPassedCount = 0;
     Uint32 totalTestSkippedCount = 0;
+    Uint32 totalTestUnsupportedCount = 0;
     Uint32 testFailedCount = 0;
     Uint32 testPassedCount = 0;
     Uint32 testSkippedCount = 0;
+    Uint32 testUnsupportedCount = 0;
     Uint32 countSum = 0;
     char *logFormat = (char *)SDLTest_LogSummaryFormat;
     SDLTest_TestCaseReference **failedTests;
@@ -420,6 +428,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
     totalTestFailedCount = 0;
     totalTestPassedCount = 0;
     totalTestSkippedCount = 0;
+    totalTestUnsupportedCount = 0;
 
     /* Take time - run start */
     runStartSeconds = GetClock();
@@ -509,6 +518,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
             testFailedCount = 0;
             testPassedCount = 0;
             testSkippedCount = 0;
+            testUnsupportedCount = 0;
 
             /* Take time - suite start */
             suiteStartSeconds = GetClock();
@@ -575,6 +585,9 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
                         } else if (testResult == TEST_RESULT_SKIPPED) {
                             testSkippedCount++;
                             totalTestSkippedCount++;
+                        } else if (testResult == TEST_RESULT_UNSUPPORTED) {
+                            testUnsupportedCount++;
+                            totalTestUnsupportedCount++;
                         } else {
                             testFailedCount++;
                             totalTestFailedCount++;
@@ -625,15 +638,15 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
             SDLTest_Log("Total Suite runtime: %.1f sec", runtime);
 
             /* Log summary and final Suite result */
-            countSum = testPassedCount + testFailedCount + testSkippedCount;
+            countSum = testPassedCount + testFailedCount + testSkippedCount + testUnsupportedCount;
             if (testFailedCount == 0)
             {
-                SDLTest_Log(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
+                SDLTest_Log(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount, testUnsupportedCount);
                 SDLTest_Log((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Passed");
             }
             else
             {
-                SDLTest_LogError(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount);
+                SDLTest_LogError(logFormat, "Suite", countSum, testPassedCount, testFailedCount, testSkippedCount, testUnsupportedCount);
                 SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Suite", currentSuiteName, "Failed");
             }
 
@@ -649,17 +662,17 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
     SDLTest_Log("Total Run runtime: %.1f sec", runtime);
 
     /* Log summary and final run result */
-    countSum = totalTestPassedCount + totalTestFailedCount + totalTestSkippedCount;
+    countSum = totalTestPassedCount + totalTestFailedCount + totalTestSkippedCount + totalTestUnsupportedCount;
     if (totalTestFailedCount == 0)
     {
         runResult = 0;
-        SDLTest_Log(logFormat, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount);
+        SDLTest_Log(logFormat, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount, totalTestUnsupportedCount);
         SDLTest_Log((char *)SDLTest_FinalResultFormat, "Run /w seed", runSeed, "Passed");
     }
     else
     {
         runResult = 1;
-        SDLTest_LogError(logFormat, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount);
+        SDLTest_LogError(logFormat, "Run", countSum, totalTestPassedCount, totalTestFailedCount, totalTestSkippedCount, totalTestUnsupportedCount);
         SDLTest_LogError((char *)SDLTest_FinalResultFormat, "Run /w seed", runSeed, "Failed");
     }
 
old mode 100644 (file)
new mode 100755 (executable)
index 097372e..19f57a0
@@ -79,6 +79,38 @@ void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
     SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
     va_end(list);
 
+       //write log
+       char *message;
+    message = SDL_stack_alloc(char, SDLTEST_MAX_LOGMESSAGE_LENGTH);
+    if (!message) {
+        return;
+    }
+
+    size_t len = SDL_strlen(logMessage);
+    strcpy(message, logMessage);
+
+    // Chop off final endline.
+
+    if ((len > 0) && (message[len-1] == '\n')) {
+        message[--len] = '\0';
+        if ((len > 0) && (message[len-1] == '\r')) {  // catch "\r\n", too. 
+            message[--len] = '\0';
+        }
+    }
+
+    SDL_RWops *rwops = SDL_RWFromFile("log.txt", "a+");
+    char *text;
+    text = SDL_stack_alloc(char, SDLTEST_MAX_LOGMESSAGE_LENGTH);
+    if(text)
+    {
+        SDL_snprintf(text, SDLTEST_MAX_LOGMESSAGE_LENGTH,  " INFO: %s: %s\n", SDLTest_TimestampToString(time(0)), message);
+        SDL_RWwrite(rwops, text, 1, SDL_strlen(text));
+        SDL_stack_free(text);
+    }
+
+    SDL_RWclose(rwops);
+    SDL_stack_free(message);
+
     /* Log with timestamp and newline */
     SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_INFO, " %s: %s", SDLTest_TimestampToString(time(0)), logMessage);
 }
@@ -97,6 +129,38 @@ void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
     SDL_vsnprintf(logMessage, SDLTEST_MAX_LOGMESSAGE_LENGTH - 1, fmt, list);
     va_end(list);
 
+       //write log
+       char *message;
+    message = SDL_stack_alloc(char, SDLTEST_MAX_LOGMESSAGE_LENGTH);
+    if (!message) {
+        return;
+    }
+
+    size_t len = SDL_strlen(logMessage);
+    strcpy(message, logMessage);
+
+    // Chop off final endline.
+
+    if ((len > 0) && (message[len-1] == '\n')) {
+        message[--len] = '\0';
+        if ((len > 0) && (message[len-1] == '\r')) {  // catch "\r\n", too. 
+            message[--len] = '\0';
+        }
+    }
+
+    SDL_RWops *rwops = SDL_RWFromFile("log.txt", "a+");
+    char *text;
+    text = SDL_stack_alloc(char, SDLTEST_MAX_LOGMESSAGE_LENGTH);
+    if(text)
+    {
+        SDL_snprintf(text, SDLTEST_MAX_LOGMESSAGE_LENGTH,  " ERROR: %s: %s\n", SDLTest_TimestampToString(time(0)), message);
+        SDL_RWwrite(rwops, text, 1, SDL_strlen(text));
+        SDL_stack_free(text);
+    }
+
+    SDL_RWclose(rwops);
+    SDL_stack_free(message);
+
     /* Log with timestamp and newline */
     SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR, "%s: %s", SDLTest_TimestampToString(time(0)), logMessage);
 }
index 77426c3..28b2b9f 100644 (file)
@@ -343,6 +343,9 @@ struct SDL_VideoDevice
     /* * * */
     /* The function used to dispose of this structure */
     void (*free) (_THIS);
+
+    SDL_bool (*vulkan_GetInstanceExtensions) (const char* driver, unsigned int* count, char** names);
+    SDL_bool (*vulkan_CreateSurface) (_THIS, SDL_Window* window, SDL_vulkanInstance instance, SDL_vulkanSurface* surface);
 };
 
 typedef struct VideoBootStrap
@@ -404,6 +407,9 @@ extern VideoBootStrap VIVANTE_bootstrap;
 #if SDL_VIDEO_DRIVER_EMSCRIPTEN
 extern VideoBootStrap Emscripten_bootstrap;
 #endif
+#if SDL_VIDEO_DRIVER_TIZEN
+extern VideoBootStrap TIZEN_bootstrap;
+#endif
 
 extern SDL_VideoDevice *SDL_GetVideoDevice(void);
 extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
index 511b4c0..b791f27 100644 (file)
@@ -108,6 +108,9 @@ static VideoBootStrap *bootstrap[] = {
 #if SDL_VIDEO_DRIVER_DUMMY
     &DUMMY_bootstrap,
 #endif
+#if SDL_VIDEO_DRIVER_TIZEN
+    &TIZEN_bootstrap,
+#endif
     NULL
 };
 
@@ -471,6 +474,12 @@ SDL_VideoInit(const char *driver_name)
     if (driver_name == NULL) {
         driver_name = SDL_getenv("SDL_VIDEODRIVER");
     }
+
+    /* For Tizen */
+       if (driver_name == NULL) {
+        driver_name = "tizen";
+    }
+
     if (driver_name != NULL) {
         for (i = 0; bootstrap[i]; ++i) {
             if (SDL_strncasecmp(bootstrap[i]->name, driver_name, SDL_strlen(driver_name)) == 0) {
@@ -1285,7 +1294,7 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
 }
 
 #define CREATE_FLAGS \
-    (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI)
+    (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_VULKAN)
 
 static void
 SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
@@ -1353,6 +1362,20 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
         }
     }
 
+#if (SDL_VIDEO_VULKAN)
+    if (flags & SDL_WINDOW_VULKAN) {
+        if (!_this->vulkan_GetInstanceExtensions) {
+            SDL_SetError("No Vulkan support in video driver");
+            return NULL;
+        }
+    }
+
+    if ((flags & SDL_WINDOW_OPENGL) && (flags & SDL_WINDOW_VULKAN)) {
+        SDL_SetError("Don't use both OPENGL and VULKAN");
+        return NULL;
+    }
+#endif
+
     /* Unless the user has specified the high-DPI disabling hint, respect the
      * SDL_WINDOW_ALLOW_HIGHDPI flag.
      */
@@ -1389,6 +1412,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
             window->y = bounds.y + (bounds.h - h) / 2;
         }
     }
+
     window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
     window->last_fullscreen_flags = window->flags;
     window->brightness = 1.0f;
@@ -3657,4 +3681,42 @@ float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches)
                                   SDL_sqrt((double)den2));
 }
 
+SDL_bool
+SDL_Vulkan_GetInstanceExtensions(SDL_Window* window, unsigned int* count, char** names)
+{
+    if (!count) {
+        SDL_SetError("count ptr is null");
+        return SDL_FALSE;
+    }
+
+    if (!(window->flags & SDL_WINDOW_VULKAN)) {
+        SDL_SetError("Not setup with SDL_WINDOW_VULKAN flags");
+        return SDL_FALSE;
+    }
+
+    const char *driver = SDL_GetCurrentVideoDriver();
+    if (!driver) {
+        SDL_SetError("Current video driveer is NULL");
+        return SDL_FALSE;
+    }
+
+    return _this->vulkan_GetInstanceExtensions(driver, count, names);
+}
+
+SDL_bool
+SDL_Vulkan_CreateSurface(SDL_Window* window, SDL_vulkanInstance instance, SDL_vulkanSurface* surface)
+{
+    if (!window) {
+        SDL_SetError("'window' is null");
+        return SDL_FALSE;
+    }
+
+    if (instance == 0) {
+        SDL_SetError("'instance' is null");
+        return SDL_FALSE;
+    }
+
+    return _this->vulkan_CreateSurface(_this, window, instance, surface);
+}
+
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/tizen/SDL_tizenevents.c b/src/video/tizen/SDL_tizenevents.c
new file mode 100644 (file)
index 0000000..cd28dfa
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_TIZEN
+
+#include "SDL_stdinc.h"
+#include "SDL_assert.h"
+
+#include "../../events/SDL_sysevents.h"
+#include "../../events/SDL_events_c.h"
+#include "../../events/scancodes_xfree86.h"
+
+#include "SDL_tizenvideo.h"
+#include "SDL_tizenevents_c.h"
+#include "SDL_tizenwindow.h"
+#include "SDL_log.h"
+
+void
+Tizen_PumpEvents(_THIS)
+{
+    ecore_main_loop_iterate();
+}
+
+Eina_Bool
+__tizen_cb_event_keyup_change(void *data, int type, void *event)
+{
+    if (!event) return ECORE_CALLBACK_PASS_ON;
+
+    Ecore_Event_Key * e = event;
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "key up: %d",e->keycode);
+    SDL_SendKeyboardKey(SDL_RELEASED, e->keycode);
+
+    return ECORE_CALLBACK_PASS_ON;
+}
+
+Eina_Bool
+__tizen_cb_event_keydown_change(void *data, int type, void *event)
+{
+    if (!event) return ECORE_CALLBACK_PASS_ON;
+
+    Ecore_Event_Key * e = event;
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "key down: %d",e->keycode);
+    SDL_SendKeyboardKey(SDL_PRESSED, e->keycode);
+
+    return ECORE_CALLBACK_PASS_ON;
+}
+
+
+#endif /* SDL_VIDEO_DRIVER_TIZEN */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/tizen/SDL_tizenevents_c.h b/src/video/tizen/SDL_tizenevents_c.h
new file mode 100644 (file)
index 0000000..cb1205c
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef _SDL_tizenevents_h
+#define _SDL_tizenevents_h
+
+#include "SDL_tizenvideo.h"
+#include "SDL_tizenwindow.h"
+
+extern void Tizen_PumpEvents(_THIS);
+
+
+extern Eina_Bool __tizen_cb_event_keyup_change(void *data, int type, void *event);
+
+extern Eina_Bool __tizen_cb_event_keydown_change(void *data, int type, void *event);
+
+
+#endif /* _SDL_tizenevents_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/tizen/SDL_tizenkeyboard.c b/src/video/tizen/SDL_tizenkeyboard.c
new file mode 100644 (file)
index 0000000..8352111
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#include "SDL_tizenkeyboard.h"
+#include "SDL_log.h"
+#include "../../events/SDL_keyboard_c.h"
+
+/*
+    Tizen Keyboard
+*/
+
+void
+_ecore_imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, void *event_info)
+{
+    char *commit_str = (char *)event_info;
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "commit string : %s\n", commit_str);
+    SDL_SendKeyboardText(commit_str);
+    return;
+}
+
+void
+_ecore_imf_event_state_change_cb(void *data, Ecore_IMF_Context *ctx EINA_UNUSED, int value)
+{
+    //ECORE_IMF_INPUT_PANEL_STATE_SHOW : 0
+    //ECORE_IMF_INPUT_PANEL_STATE_HIDE : 1
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "Keyboard State  : %d\n", value);
+    return;
+}
+
+void Tizen_InitKeyboard(_THIS)
+{
+    ecore_imf_init();
+
+    memset(&keyboard, 0, sizeof(keyboard));
+
+    const char *default_id = ecore_imf_context_default_id_get();
+    if (!default_id)
+      {
+         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't create ecore_imf_context\n");
+         return;
+      }
+
+    keyboard.imf_context = ecore_imf_context_add(default_id);
+
+    SDL_Window *window = _this->windows;
+    SDL_WindowData *wind = window->driverdata;
+
+    ecore_imf_context_client_window_set(keyboard.imf_context, (void*)wind->id);
+
+    ecore_imf_context_event_callback_add(keyboard.imf_context, ECORE_IMF_CALLBACK_COMMIT , _ecore_imf_event_commit_cb, NULL);
+    ecore_imf_context_input_panel_event_callback_add (keyboard.imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _ecore_imf_event_state_change_cb, NULL);
+
+    ecore_imf_context_cursor_position_set(keyboard.imf_context, 0);
+    ecore_imf_context_focus_out(keyboard.imf_context);
+    ecore_imf_context_input_panel_hide(keyboard.imf_context);
+
+}
+
+void Tizen_FiniKeyboard(void)
+{
+    if(keyboard.imf_context == NULL)
+        return;
+
+    ecore_imf_context_del(keyboard.imf_context);
+    keyboard.imf_context = NULL;
+
+    ecore_imf_shutdown();
+}
+
+void
+Tizen_StartTextInput(_THIS)
+{
+    if (!_this) {
+        SDL_SetError("Video subsystem must be initialized");
+        return;
+    }
+
+    if(keyboard.imf_context == NULL)
+      Tizen_InitKeyboard(_this);
+
+    Tizen_ShowScreenKeyboard(_this, NULL);
+}
+
+
+void
+Tizen_StopTextInput(_THIS)
+{
+   if (!_this) return;
+   if (keyboard.imf_context)
+     {
+        Tizen_HideScreenKeyboard(_this, _this->windows);
+     }
+}
+
+void Tizen_SetTextInputRect(void)
+{
+}
+
+
+SDL_bool
+Tizen_HasScreenKeyboardSupport(_THIS)
+{
+    return SDL_TRUE;
+}
+
+
+void
+Tizen_ShowScreenKeyboard(_THIS, SDL_Window * window)
+{
+    if (!keyboard.imf_context)
+          return;
+
+    ecore_imf_context_focus_in(keyboard.imf_context);
+    ecore_imf_context_input_panel_show(keyboard.imf_context);
+}
+
+void
+Tizen_HideScreenKeyboard(_THIS, SDL_Window * window)
+{
+    if (!keyboard.imf_context)
+          return;
+
+    ecore_imf_context_focus_out(keyboard.imf_context);
+    ecore_imf_context_input_panel_hide(keyboard.imf_context);
+}
+
+SDL_bool
+Tizen_IsScreenKeyboardShown(_THIS, SDL_Window * window)
+{
+    if (!keyboard.imf_context)
+          return SDL_FALSE;
+    //EAPI Ecore_IMF_Input_Panel_State  ecore_imf_context_input_panel_state_get (Ecore_IMF_Context *ctx)
+    return ecore_imf_context_input_panel_state_get(keyboard.imf_context);
+}
diff --git a/src/video/tizen/SDL_tizenkeyboard.h b/src/video/tizen/SDL_tizenkeyboard.h
new file mode 100644 (file)
index 0000000..8eb63ec
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+#include "../SDL_sysvideo.h"
+#include "SDL_tizenwindow.h"
+
+#include <Ecore_Wayland.h>
+#include <Ecore_IMF.h>
+
+/*
+#include "SDL_tizenvideo.h"
+#include "SDL_tizenwindow.h"
+#include "SDL_events.h"
+*/
+typedef struct _TizenKeyboard TizenKeyboard;
+struct _TizenKeyboard
+{
+    Ecore_IMF_Context     *imf_context;
+};
+
+static TizenKeyboard keyboard;
+
+extern void Tizen_InitKeyboard(_THIS);
+extern void Tizen_FiniKeyboard(void);
+
+extern void Tizen_StartTextInput(_THIS);
+extern void Tizen_StopTextInput(_THIS);
+extern void Tizen_SetTextInputRect(void);
+
+extern SDL_bool Tizen_HasScreenKeyboardSupport(_THIS);
+extern void Tizen_ShowScreenKeyboard(_THIS, SDL_Window * window);
+extern void Tizen_HideScreenKeyboard(_THIS, SDL_Window * window);
+extern SDL_bool  Tizen_IsScreenKeyboardShown(_THIS, SDL_Window * window);
+
diff --git a/src/video/tizen/SDL_tizenmouse.c b/src/video/tizen/SDL_tizenmouse.c
new file mode 100755 (executable)
index 0000000..84bfaf5
--- /dev/null
@@ -0,0 +1,290 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include "../../events/SDL_mouse_c.h"
+
+#include "SDL_tizenmouse.h"
+#include "SDL_log.h"
+
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+
+typedef struct {
+    struct wl_buffer   *buffer;
+    struct wl_surface  *surface;
+    SDL_WindowData     *win_data;
+
+    int                hot_x, hot_y;
+    int                w, h;
+
+    /* Either a preloaded cursor, or one we created ourselves */
+    struct wl_cursor   *cursor;
+    void               *shm_data;
+} Tizen_CursorData;
+
+static int
+wayland_create_tmp_file(off_t size)
+{
+    static const char template[] = "/sdl-shared-XXXXXX";
+    char *xdg_path;
+    char tmp_path[PATH_MAX];
+    int fd;
+
+    xdg_path = SDL_getenv("XDG_RUNTIME_DIR");
+    if (!xdg_path) {
+        errno = ENOENT;
+        return -1;
+    }
+
+    SDL_strlcpy(tmp_path, xdg_path, PATH_MAX);
+    SDL_strlcat(tmp_path, template, PATH_MAX);
+
+    fd = mkostemp(tmp_path, O_CLOEXEC);
+    if (fd < 0)
+        return -1;
+
+    if (ftruncate(fd, size) < 0) {
+        close(fd);
+        return -1;
+    }
+
+    return fd;
+}
+
+static void
+mouse_buffer_release(void *data, struct wl_buffer *buffer)
+{
+}
+
+static const struct wl_buffer_listener mouse_buffer_listener = {
+    mouse_buffer_release
+};
+
+static int
+create_buffer_from_shm(Tizen_CursorData *d, int width, int height, uint32_t format)
+{
+    //SDL_VideoDevice *vd = SDL_GetVideoDevice();
+    //SDL_VideoData *data = (SDL_VideoData *) vd->driverdata;
+    struct wl_shm_pool *shm_pool;
+
+    int stride = width * 4;
+    int size = stride * height;
+
+    int shm_fd;
+
+    shm_fd = wayland_create_tmp_file(size);
+    if (shm_fd < 0)
+    {
+        fprintf(stderr, "creating mouse cursor buffer failed!\n");
+        return -1;
+    }
+
+    d->shm_data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);
+    if (d->shm_data == MAP_FAILED) {
+        d->shm_data = NULL;
+        fprintf (stderr, "mmap () failed\n");
+        close (shm_fd);
+    }
+
+    shm_pool = wl_shm_create_pool(ecore_wl_shm_get(), shm_fd, size);
+    d->buffer = wl_shm_pool_create_buffer(shm_pool, 0, width, height, stride, format);
+    wl_buffer_add_listener(d->buffer, &mouse_buffer_listener, d);
+
+    wl_shm_pool_destroy (shm_pool);
+    close (shm_fd);
+
+    return 0;
+}
+
+static SDL_Cursor *
+Tizen_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y)
+{
+    SDL_Cursor *cursor;
+
+    cursor = calloc(1, sizeof (*cursor));
+    if (cursor) {
+        SDL_VideoDevice *vd = SDL_GetVideoDevice ();
+        SDL_Window* window = vd->windows;
+
+        Tizen_CursorData *data = calloc (1, sizeof (Tizen_CursorData));
+        data->win_data = window->driverdata;
+        cursor->driverdata = (void *) data;
+
+        /* Assume ARGB8888 */
+        SDL_assert(surface->format->format == SDL_PIXELFORMAT_ARGB8888);
+        SDL_assert(surface->pitch == surface->w * 4);
+
+        /* Allocate shared memory buffer for this cursor */
+        if (create_buffer_from_shm (data,
+                                    surface->w,
+                                    surface->h,
+                                    WL_SHM_FORMAT_XRGB8888) < 0)
+        {
+            free (cursor->driverdata);
+            free (cursor);
+            return NULL;
+        }
+
+        SDL_memcpy(data->shm_data,
+                   surface->pixels,
+                   surface->h * surface->pitch);
+
+        data->surface = wl_compositor_create_surface(ecore_wl_compositor_get());
+
+        data->hot_x = hot_x;
+        data->hot_y = hot_y;
+        data->w = surface->w;
+        data->h = surface->h;
+    }
+
+    return cursor;
+}
+
+
+static void
+Tizen_FreeCursor(SDL_Cursor *cursor)
+{
+    Tizen_CursorData *d;
+
+    if (!cursor)
+        return;
+
+    d = cursor->driverdata;
+
+    /* Probably not a cursor we own */
+    if (!d)
+        return;
+
+    if (d->buffer && !d->cursor)
+        wl_buffer_destroy(d->buffer);
+
+    if (d->surface)
+        wl_surface_destroy(d->surface);
+
+    /* Not sure what's meant to happen to shm_data */
+    free (cursor->driverdata);
+    SDL_free(cursor);
+}
+/*
+static int
+Tizen_ShowCursor(SDL_Cursor *cursor)
+{
+    if (cursor)
+    {
+        Tizen_CursorData *data = cursor->driverdata;
+        SDL_WindowData *win_data = data->win_data;
+        ecore_wl_window_buffer_attach(win_data->window, data->buffer, 0,0);
+        ecore_wl_input_pointer_set(ecore_wl_input_get(), data->surface, data->hot_x, data->hot_y);
+    }
+    else
+    {
+        ecore_wl_input_pointer_set(ecore_wl_input_get(), NULL, 0, 0);
+    }
+
+    return 0;
+}
+*/
+void
+Tizen_InitMouse(void)
+{
+    SDL_Mouse *mouse = SDL_GetMouse();
+
+    mouse->CreateCursor = Tizen_CreateCursor;
+    mouse->FreeCursor = Tizen_FreeCursor;
+}
+
+void
+Tizen_FiniMouse(void)
+{
+    /* This effectively assumes that nobody else touches SDL_Mouse which is effectively a singleton */
+    SDL_Mouse *mouse = SDL_GetMouse();
+
+    /* Free the current cursor if not the same pointer as
+     * the default cursor */
+    if (mouse->def_cursor != mouse->cur_cursor)
+        Tizen_FreeCursor (mouse->cur_cursor);
+
+    Tizen_FreeCursor (mouse->def_cursor);
+    mouse->def_cursor = NULL;
+    mouse->cur_cursor = NULL;
+
+    mouse->CreateCursor =  NULL;
+    mouse->CreateSystemCursor = NULL;
+    mouse->ShowCursor = NULL;
+    mouse->FreeCursor = NULL;
+    mouse->WarpMouse = NULL;
+    mouse->SetRelativeMouseMode = NULL;
+}
+
+Eina_Bool
+__tizen_cb_event_mousedown_change(void *data, int type, void *event)
+{
+    SDL_VideoDevice *_this = SDL_GetVideoDevice();
+
+    if (!event) return ECORE_CALLBACK_PASS_ON;
+
+    Ecore_Event_Mouse_Button *e = event;
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse down (%d x %d)",e->x,e->y);
+    SDL_SendMouseMotion(_this->current_glwin, 0, 0,  e->x, e->y);
+    SDL_SendMouseButton(_this->current_glwin, 0, SDL_PRESSED, SDL_BUTTON_LEFT);
+    return ECORE_CALLBACK_PASS_ON;
+}
+
+Eina_Bool
+__tizen_cb_event_mouseup_change(void *data, int type, void *event)
+{
+    SDL_VideoDevice *_this = SDL_GetVideoDevice();
+    if (!event) return ECORE_CALLBACK_PASS_ON;
+
+    Ecore_Event_Mouse_Button *e = event;
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse up (%d x %d)",e->x,e->y);
+    SDL_SendMouseMotion(_this->current_glwin, 0, 0,  e->x, e->y);
+    SDL_SendMouseButton(_this->current_glwin, 0, SDL_RELEASED, SDL_BUTTON_LEFT);
+    return ECORE_CALLBACK_PASS_ON;
+}
+
+Eina_Bool
+__tizen_cb_event_mousemove_change(void *data, int type, void *event)
+{
+    SDL_VideoDevice *_this = SDL_GetVideoDevice();
+
+    if (!event) return ECORE_CALLBACK_PASS_ON;
+
+    Ecore_Event_Mouse_Move *e = event;
+    //SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "mouse move (%d x %d)",e->x,e->y);
+    SDL_SendMouseMotion(_this->current_glwin, 0, 0,  e->x, e->y);
+
+    return ECORE_CALLBACK_PASS_ON;
+}
+
+
+
+
diff --git a/src/video/tizen/SDL_tizenmouse.h b/src/video/tizen/SDL_tizenmouse.h
new file mode 100755 (executable)
index 0000000..6cd8e84
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+#include "SDL_mouse.h"
+#include "SDL_tizenvideo.h"
+#include "SDL_tizenwindow.h"
+#include "SDL_events.h"
+
+#include "SDL_assert.h"
+
+extern void Tizen_InitMouse(void);
+extern void Tizen_FiniMouse(void);
+
+extern Eina_Bool __tizen_cb_event_mouseup_change(void *data, int type, void *event);
+extern Eina_Bool __tizen_cb_event_mousedown_change(void *data, int type, void *event);
+extern Eina_Bool __tizen_cb_event_mousemove_change(void *data, int type, void *event);
+
+
diff --git a/src/video/tizen/SDL_tizenopengles.c b/src/video/tizen/SDL_tizenopengles.c
new file mode 100644 (file)
index 0000000..337eeae
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_OPENGL_EGL
+
+#include "SDL_tizenvideo.h"
+#include "SDL_tizenopengles.h"
+#include "SDL_tizenwindow.h"
+#include "SDL_tizenevents_c.h"
+
+/* EGL implementation of SDL OpenGL ES support */
+
+int
+Tizen_GLES_LoadLibrary(_THIS, const char *path)
+{
+    int ret;
+
+    ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType)ecore_wl_display_get());
+    return ret;
+}
+
+
+SDL_GLContext
+Tizen_GLES_CreateContext(_THIS, SDL_Window *window)
+{
+    SDL_GLContext context;
+
+    context = SDL_EGL_CreateContext(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
+    return context;
+}
+
+void
+Tizen_GLES_SwapWindow(_THIS, SDL_Window *window)
+{
+    SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
+}
+
+
+int
+Tizen_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
+{
+    int ret;
+
+    if (window && context) {
+        ret = SDL_EGL_MakeCurrent(_this, ((SDL_WindowData *) window->driverdata)->egl_surface, context);
+    } else {
+        ret = SDL_EGL_MakeCurrent(_this, NULL, NULL);
+    }
+
+    return ret;
+}
+
+void
+Tizen_GLES_DeleteContext(_THIS, SDL_GLContext context)
+{
+    SDL_EGL_DeleteContext(_this, context);
+}
+
+#endif /* SDL_VIDEO_DRIVER_TIZEN && SDL_VIDEO_OPENGL_EGL */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/tizen/SDL_tizenopengles.h b/src/video/tizen/SDL_tizenopengles.h
new file mode 100644 (file)
index 0000000..c9610f7
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef _SDL_tizenopengles_h
+#define _SDL_tizenopengles_h
+
+#include "../SDL_sysvideo.h"
+#include "../SDL_egl_c.h"
+
+#if SDL_VIDEO_OPENGL_EGL
+
+typedef struct SDL_PrivateGLESData {
+} SDL_PrivateGLESData;
+
+/* OpenGLES functions */
+#define Tizen_GLES_GetAttribute SDL_EGL_GetAttribute
+#define Tizen_GLES_GetProcAddress SDL_EGL_GetProcAddress
+#define Tizen_GLES_UnloadLibrary SDL_EGL_UnloadLibrary
+#define Tizen_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
+#define Tizen_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
+
+extern int Tizen_GLES_LoadLibrary(_THIS, const char *path);
+extern SDL_GLContext Tizen_GLES_CreateContext(_THIS, SDL_Window *window);
+extern void Tizen_GLES_SwapWindow(_THIS, SDL_Window *window);
+extern int Tizen_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
+extern void Tizen_GLES_DeleteContext(_THIS, SDL_GLContext context);
+#endif
+
+#endif /* _SDL_tizenopengles_h */
diff --git a/src/video/tizen/SDL_tizentouch.c b/src/video/tizen/SDL_tizentouch.c
new file mode 100644 (file)
index 0000000..7ba8b98
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+/* Contributed by Thomas Perl <thomas.perl@jollamobile.com> */
+
+#include "../../SDL_internal.h"
+
diff --git a/src/video/tizen/SDL_tizentouch.h b/src/video/tizen/SDL_tizentouch.h
new file mode 100644 (file)
index 0000000..c64a48e
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
diff --git a/src/video/tizen/SDL_tizenvideo.c b/src/video/tizen/SDL_tizenvideo.c
new file mode 100644 (file)
index 0000000..df11641
--- /dev/null
@@ -0,0 +1,205 @@
+ /*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+ */
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_TIZEN
+
+#include "SDL_video.h"
+#include "SDL_mouse.h"
+#include "SDL_stdinc.h"
+#include "../../events/SDL_events_c.h"
+#include "../../core/tizen/SDL_tizen.h"
+
+#include "SDL_tizenvideo.h"
+#include "SDL_tizenevents_c.h"
+#include "SDL_tizenwindow.h"
+#include "SDL_tizenopengles.h"
+#include "SDL_tizenmouse.h"
+#include "SDL_tizentouch.h"
+#include "SDL_tizenkeyboard.h"
+#include "SDL_tizenvulkan.h"
+
+
+#define TIZENVID_DRIVER_NAME "tizen"
+
+/* Initialization/Query functions */
+static int
+Tizen_VideoInit(_THIS);
+
+static void
+Tizen_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display);
+static int
+Tizen_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
+
+static void
+Tizen_VideoQuit(_THIS);
+
+static void
+_tizen_add_display(SDL_VideoData *d, uint32_t id)
+{
+    SDL_VideoDisplay display;
+    SDL_DisplayMode mode;
+    static char *display_name = "tizen";
+
+    SDL_zero(display);
+    SDL_zero(mode);
+
+    display.name = display_name;
+
+    ecore_wl_screen_size_get(&mode.w, &mode.h);
+    mode.refresh_rate = 60; //Hz
+    SDL_AddDisplayMode(&display, &mode);
+
+    display.current_mode = mode;
+    display.desktop_mode = mode;
+
+    SDL_AddVideoDisplay(&display);
+}
+
+/* Wayland driver bootstrap functions */
+static int
+Tizen_Available(void)
+{
+    return 1;
+}
+
+static void
+Tizen_DeleteDevice(SDL_VideoDevice *device)
+{
+    SDL_free(device);
+}
+
+static SDL_VideoDevice *
+Tizen_CreateDevice(int devindex)
+{
+    SDL_VideoDevice *device;
+
+    /* Initialize all variables that we clean on shutdown */
+    device = SDL_calloc(1, sizeof(SDL_VideoDevice));
+    if (!device) {
+        SDL_OutOfMemory();
+        return NULL;
+    }
+
+    /* Tizen video */
+    device->VideoInit                          = Tizen_VideoInit;
+    device->VideoQuit                          = Tizen_VideoQuit;
+    device->SetDisplayMode                     = Tizen_SetDisplayMode;
+    device->GetDisplayModes            = Tizen_GetDisplayModes;
+    device->free                                       = Tizen_DeleteDevice;
+
+    device->PumpEvents = Tizen_PumpEvents;
+#if SDL_VIDEO_OPENGL_EGL
+    device->GL_SwapWindow = Tizen_GLES_SwapWindow;
+    device->GL_GetSwapInterval = Tizen_GLES_GetSwapInterval;
+    device->GL_SetSwapInterval = Tizen_GLES_SetSwapInterval;
+    device->GL_MakeCurrent = Tizen_GLES_MakeCurrent;
+    device->GL_CreateContext = Tizen_GLES_CreateContext;
+    device->GL_LoadLibrary = Tizen_GLES_LoadLibrary;
+    device->GL_UnloadLibrary = Tizen_GLES_UnloadLibrary;
+    device->GL_GetProcAddress = Tizen_GLES_GetProcAddress;
+    device->GL_DeleteContext = Tizen_GLES_DeleteContext;
+#endif
+    device->CreateWindow = Tizen_CreateWindow;
+    device->ShowWindow = Tizen_ShowWindow;
+    device->SetWindowFullscreen = Tizen_SetWindowFullscreen;
+    device->SetWindowSize = Tizen_SetWindowSize;
+    device->DestroyWindow = Tizen_DestroyWindow;
+    device->SetWindowHitTest = Tizen_SetWindowHitTest;
+    device->GetWindowWMInfo = Tizen_GetWindowWMInfo;
+
+    /* Text input */
+    device->StartTextInput = Tizen_StartTextInput;
+    device->StopTextInput = Tizen_StopTextInput;
+    //device->SetTextInputRect = Tizen_SetTextInputRect;
+
+    /* Screen keyboard */
+    device->HasScreenKeyboardSupport = Tizen_HasScreenKeyboardSupport;
+    device->ShowScreenKeyboard = Tizen_ShowScreenKeyboard;
+    //device->HideScreenKeyboard = Tizen_HideScreenKeyboard;
+    device->IsScreenKeyboardShown = Tizen_IsScreenKeyboardShown;
+
+#if SDL_VIDEO_VULKAN
+    device->vulkan_GetInstanceExtensions = Tizen_vulkan_GetInstanceExtensions;
+    device->vulkan_CreateSurface = Tizen_vulkan_CreateSurface;
+#endif
+
+    return device;
+}
+
+VideoBootStrap TIZEN_bootstrap = {
+    TIZENVID_DRIVER_NAME, "SDL tizen video driver",
+    Tizen_Available, Tizen_CreateDevice
+};
+
+int
+Tizen_VideoInit(_THIS)
+{
+    SDL_VideoData *data = SDL_malloc(sizeof * data);
+
+    if (data == NULL)
+        return SDL_OutOfMemory();
+    memset(data, 0, sizeof * data);
+
+    _this->driverdata = data;
+
+    ecore_wl_init(NULL);
+    _tizen_add_display(data, 0);
+    data->display = ecore_wl_display_get();
+
+    Tizen_InitWindow(_this);
+    Tizen_InitMouse();
+    return 0;
+}
+
+static void
+Tizen_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display)
+{
+    SDL_Unsupported();
+}
+
+static int
+Tizen_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
+{
+    return SDL_Unsupported();
+}
+
+void
+Tizen_VideoQuit(_THIS)
+{
+    SDL_VideoData *data = _this->driverdata;
+
+    Tizen_DeinitWindow(_this);
+    Tizen_FiniKeyboard();
+    Tizen_FiniMouse();
+    SDL_tizen_app_exit();
+    ecore_wl_shutdown();
+    free(data);
+
+    _this->driverdata = NULL;
+}
+
+
+#endif /* SDL_VIDEO_DRIVER_TIZEN */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/tizen/SDL_tizenvideo.h b/src/video/tizen/SDL_tizenvideo.h
new file mode 100644 (file)
index 0000000..b7b5b9e
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#ifndef _SDL_tizenvideo_h
+#define _SDL_tizenvideo_h
+
+#include <EGL/egl.h>
+#include <Ecore_Wayland.h>
+
+typedef struct {
+    struct wl_display *display;
+
+    EGLDisplay edpy;
+    EGLContext context;
+    EGLConfig econf;
+
+    Eina_Hash *windows;
+} SDL_VideoData;
+
+#endif /* _SDL_tizenvideo_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/tizen/SDL_tizenvulkan.c b/src/video/tizen/SDL_tizenvulkan.c
new file mode 100644 (file)
index 0000000..13b3c5e
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_VULKAN
+#include <SDL_syswm.h>
+#include "../SDL_sysvideo.h"
+#include "SDL_video.h"
+#include "SDL_tizenwindow.h"
+#include "SDL_tizenvideo.h"
+#include "SDL_tizenvideo.h"
+#include "SDL_tizenvulkan.h"
+
+SDL_bool
+Tizen_vulkan_GetInstanceExtensions(const char* driver, unsigned int* count, char** names)
+{
+    uint32_t instance_extension_count = 0;
+    uint32_t enabled_extension_count = 0;
+    VkBool32 surfaceExtFound = 0;
+    VkBool32 platformSurfaceExtFound = 0;
+    VkResult err;
+
+    if (strcmp(driver, "tizen")) {
+        SDL_SetError("Unsupported video driver '%s'", driver);
+        return SDL_FALSE;
+    }
+
+    err = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL);
+    if (err < 0) {
+        SDL_SetError("Fail to get Instance extension");
+        return SDL_FALSE;
+    }
+
+    if (instance_extension_count > 0) {
+        uint32_t i;
+        VkExtensionProperties *instance_extensions =
+            malloc(sizeof(VkExtensionProperties) * instance_extension_count);
+        err = vkEnumerateInstanceExtensionProperties(
+            NULL, &instance_extension_count, instance_extensions);
+        for (i = 0; i < instance_extension_count; i++) {
+            if (!strcmp(VK_KHR_SURFACE_EXTENSION_NAME,instance_extensions[i].extensionName)) {
+                names[enabled_extension_count++] = VK_KHR_SURFACE_EXTENSION_NAME;
+            }
+
+            if (!strcmp(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME,instance_extensions[i].extensionName)) {
+                names[enabled_extension_count++] = VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME;
+            }
+
+            if (enabled_extension_count > 64) {
+                SDL_SetError("Insufficient capacity for extension names");
+                free(instance_extensions);
+                return SDL_FALSE;
+            }
+        }
+        free(instance_extensions);
+    }
+    *count = enabled_extension_count;
+    return SDL_TRUE;
+}
+
+SDL_bool
+Tizen_vulkan_CreateSurface(_THIS, SDL_Window* window, SDL_vulkanInstance instance, SDL_vulkanSurface* surface)
+{
+    SDL_SysWMinfo wminfo;
+    SDL_WindowData *wmdata = (SDL_WindowData *)window->driverdata;
+    SDL_VideoData  *video_data  = (SDL_VideoData *)_this->driverdata;
+
+    if (!SDL_GetWindowWMInfo(window, &wminfo))
+        return SDL_FALSE;
+
+    switch (wminfo.subsystem)
+    {
+    case SDL_SYSWM_TIZEN:
+        {
+            VkWaylandSurfaceCreateInfoKHR createInfo;
+            VkResult ret;
+            createInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR;
+            createInfo.pNext = NULL;
+            createInfo.flags = 0;
+            createInfo.display = video_data->display;
+            createInfo.surface = wmdata->surface;
+
+            ret = vkCreateWaylandSurfaceKHR((VkInstance)instance, &createInfo, NULL, (VkSurfaceKHR*)surface);
+            if (ret != VK_SUCCESS) {
+                SDL_SetError("fail to vkCreateWaylandSurfaceKHR : %i", (int)ret);
+                return SDL_FALSE;
+            }
+            return SDL_TRUE;
+        }
+    default:
+        (void)surface;
+        SDL_SetError("Unsupported subsystem %i", (int)wminfo.subsystem);
+        return SDL_FALSE;
+    }
+}
+
+#endif
diff --git a/src/video/tizen/SDL_tizenvulkan.h b/src/video/tizen/SDL_tizenvulkan.h
new file mode 100644 (file)
index 0000000..0fe118b
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef _SDL_tizenvulkan_h
+#define _SDL_tizenvulkan_h
+
+#if SDL_VIDEO_VULKAN
+#define VK_USE_PLATFORM_WAYLAND_KHR
+#include <vulkan/vulkan.h>
+#include "../SDL_sysvideo.h"
+
+extern SDL_bool Tizen_vulkan_GetInstanceExtensions(const char* driver, unsigned int* count, char** names);
+extern SDL_bool Tizen_vulkan_CreateSurface(_THIS, SDL_Window* window, SDL_vulkanInstance instance, SDL_vulkanSurface* surface);
+#endif
+#endif /* _SDL_tizenvulkan_h */
diff --git a/src/video/tizen/SDL_tizenwindow.c b/src/video/tizen/SDL_tizenwindow.c
new file mode 100644 (file)
index 0000000..13c638e
--- /dev/null
@@ -0,0 +1,231 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_TIZEN
+
+#include "../SDL_sysvideo.h"
+#include "../../events/SDL_windowevents_c.h"
+#include "../SDL_egl_c.h"
+#include "SDL_tizenwindow.h"
+#include "SDL_tizenvideo.h"
+#include "SDL_tizentouch.h"
+#include "SDL_tizenkeyboard.h"
+
+#include "SDL_tizenmouse.h"
+#include "SDL_tizenevents_c.h"
+#include "SDL_log.h"
+#include "../../events/SDL_mouse_c.h"
+
+#include <wayland-egl.h>
+
+SDL_bool
+Tizen_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
+{
+    SDL_WindowData *wmdata = (SDL_WindowData *)window->driverdata;
+    SDL_VideoData  *video_data  = (SDL_VideoData *)_this->driverdata;
+
+//    info->info.tizen.display = video_data->display;
+//    info->info.tizen.surface = wmdata->surface;
+//    info->info.tizen.shell_surface = NULL;
+    info->info.tizen.egl_display = NULL;
+    info->info.tizen.egl_surface = NULL;
+#if SDL_VIDEO_OPENGL_EGL
+    if (_this->egl_data)
+    {
+       info->info.tizen.egl_display = (void*)_this->egl_data->egl_display;
+    }
+    info->info.tizen.egl_surface = (void*)wmdata->egl_surface;
+#endif
+    info->subsystem = SDL_SYSWM_TIZEN;
+    return SDL_TRUE;
+}
+
+int
+Tizen_SetWindowHitTest(SDL_Window *window, SDL_bool enabled)
+{
+    return 0;  /* just succeed, the real work is done elsewhere. */
+}
+
+void
+Tizen_ShowWindow(_THIS, SDL_Window *window)
+{
+    SDL_WindowData *wind = window->driverdata;
+
+    ecore_wl_window_show(wind->window);
+}
+
+void
+Tizen_SetWindowFullscreen(_THIS, SDL_Window *window,
+                          SDL_VideoDisplay *_display, SDL_bool fullscreen)
+{
+    /*DO NOTHING*/
+}
+
+int
+Tizen_CreateWindow(_THIS, SDL_Window *window)
+{
+    SDL_VideoData *data = _this->driverdata;
+    SDL_WindowData *wind;
+
+    wind = calloc(1, sizeof * wind);
+    if (!wind)
+        return SDL_OutOfMemory();
+
+    window->driverdata = wind;
+
+#if SDL_VIDEO_OPENGL_EGL
+    if (window->flags & SDL_WINDOW_OPENGL) {
+        SDL_GL_LoadLibrary(NULL);
+    }
+#endif
+
+    if (window->x == SDL_WINDOWPOS_UNDEFINED) {
+        window->x = 0;
+    }
+    if (window->y == SDL_WINDOWPOS_UNDEFINED) {
+        window->y = 0;
+    }
+
+    wind->window = ecore_wl_window_new(NULL,
+                                       window->x, window->y, window->w, window->h,
+                                       ECORE_WL_WINDOW_BUFFER_TYPE_SHM);
+    wind->surface = ecore_wl_window_surface_create(wind->window);
+#if SDL_VIDEO_OPENGL_EGL
+    if (window->flags & SDL_WINDOW_OPENGL) {
+        wind->egl_window = wl_egl_window_create(ecore_wl_window_surface_get(wind->window), window->w, window->h);
+
+        /* Create the GLES window surface */
+        wind->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) wind->egl_window);
+        if (wind->egl_surface == EGL_NO_SURFACE) {
+            return SDL_SetError("failed to create a window surface");
+        }
+    }
+#endif
+
+    wind->id = ecore_wl_window_id_get(wind->window);
+    eina_hash_add(data->windows, &wind->id, window);
+
+    if(keyboard.imf_context == NULL)
+        Tizen_InitKeyboard(_this);
+
+    SDL_SetMouseFocus(window);
+
+    return 0;
+}
+
+void
+Tizen_SetWindowSize(_THIS, SDL_Window *window)
+{
+    SDL_WindowData *wind = window->driverdata;
+#if SDL_VIDEO_OPENGL_EGL
+    if (window->flags & SDL_WINDOW_OPENGL) {
+        wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0);
+    }
+#endif
+}
+
+void
+Tizen_DestroyWindow(_THIS, SDL_Window *window)
+{
+    SDL_VideoData *data = _this->driverdata;
+    SDL_WindowData *wind = window->driverdata;
+
+    if (data) {
+        eina_hash_del(data->windows, &wind->id, window);
+#if SDL_VIDEO_OPENGL_EGL
+    if (window->flags & SDL_WINDOW_OPENGL) {
+        SDL_EGL_DestroySurface(_this, wind->egl_surface);
+        wl_egl_window_destroy(wind->egl_window);
+    }
+#endif
+        ecore_wl_window_free(wind->window);
+        SDL_free(wind);
+    }
+
+    window->driverdata = NULL;
+}
+
+static SDL_Window*
+__tizen_find_window(_THIS, Ecore_Wl_Window *ewin)
+{
+    SDL_VideoData *data = _this->driverdata;
+    int id;
+
+    id = ecore_wl_window_id_get(ewin);
+    return (SDL_Window*)eina_hash_find(data->windows, &id);
+}
+
+static Eina_Bool
+__tizen_cb_window_visibility_change(void *data, int type, void *event)
+{
+    _THIS = data;
+    Ecore_Wl_Event_Window_Visibility_Change *ev;
+    Ecore_Wl_Window *ew;
+    SDL_Window *window;
+
+    ev = event;
+    ew = ecore_wl_window_find(ev->win);
+    window = __tizen_find_window(_this, ew);
+
+    SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "visibility window: %p, ecore_wl_window: %p\n", window, ew);
+
+    SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0);
+    SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
+
+    return ECORE_CALLBACK_PASS_ON;
+}
+
+int
+Tizen_InitWindow(_THIS)
+{
+    SDL_VideoData *data = _this->driverdata;
+
+    data->windows = eina_hash_int32_new(NULL);
+
+    ecore_event_handler_add(ECORE_WL_EVENT_WINDOW_VISIBILITY_CHANGE,
+                        __tizen_cb_window_visibility_change, _this);
+    ecore_event_handler_add(ECORE_EVENT_KEY_UP,
+                        __tizen_cb_event_keyup_change,  NULL);
+    ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
+                        __tizen_cb_event_keydown_change,       NULL);
+    ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
+                        __tizen_cb_event_mousedown_change,     _this);
+    ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
+                        __tizen_cb_event_mouseup_change,       _this);
+    ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
+                        __tizen_cb_event_mousemove_change,     _this);
+
+    return 0;
+}
+
+void
+Tizen_DeinitWindow(_THIS)
+{
+    SDL_VideoData *data = _this->driverdata;
+
+    eina_hash_free(data->windows);
+}
+#endif /* SDL_VIDEO_DRIVER_TIZEN */
+
+/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/video/tizen/SDL_tizenwindow.h b/src/video/tizen/SDL_tizenwindow.h
new file mode 100644 (file)
index 0000000..489137b
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include <Ecore_Input.h>
+
+#include "../../SDL_internal.h"
+
+#ifndef _SDL_tizenwindow_h
+#define _SDL_tizenwindow_h
+
+#include "../SDL_sysvideo.h"
+#include "SDL_syswm.h"
+
+#include "SDL_tizenvideo.h"
+
+typedef struct {
+    uint32_t id;
+
+    Ecore_Wl_Window *window;
+    struct wl_surface *surface;
+    struct wl_shell_surface *shell_surface;
+    struct wl_egl_window *egl_window;
+    EGLSurface egl_surface;
+} SDL_WindowData;
+
+extern void Tizen_ShowWindow(_THIS, SDL_Window *window);
+extern void Tizen_SetWindowFullscreen(_THIS, SDL_Window *window,
+                                      SDL_VideoDisplay *_display,
+                                      SDL_bool fullscreen);
+extern int Tizen_CreateWindow(_THIS, SDL_Window *window);
+extern void Tizen_SetWindowSize(_THIS, SDL_Window *window);
+extern void Tizen_DestroyWindow(_THIS, SDL_Window *window);
+
+extern SDL_bool Tizen_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info);
+extern int Tizen_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
+
+extern int Tizen_InitWindow(_THIS);
+extern void Tizen_DeinitWindow(_THIS);
+
+#endif /* _SDL_tizenwindow_h */
+
+/* vi: set ts=4 sw=4 expandtab: */
index bc1d06e..cf3b29f 100644 (file)
@@ -53,12 +53,24 @@ typedef struct
 #ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON
 #define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON NULL
 #endif
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XDGSHELLCLIENT
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XDGSHELLCLIENT NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TEXTCLIENT
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TEXTCLIENT NULL
+#endif
+#ifndef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TIZENEXTENSIONCLIENT
+#define SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TIZENEXTENSIONCLIENT NULL
+#endif
 
 static waylanddynlib waylandlibs[] = {
     {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC},
     {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL},
     {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR},
-    {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON}
+    {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON},
+    {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XDGSHELLCLIENT},
+    {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TEXTCLIENT},
+    {NULL, SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_TIZENEXTENSIONCLIENT}
 };
 
 static void *
index b3ff9d8..5725ade 100644 (file)
@@ -79,6 +79,7 @@ void SDL_WAYLAND_UnloadSymbols(void);
 #define wl_proxy_get_user_data (*WAYLAND_wl_proxy_get_user_data)
 #define wl_proxy_add_listener (*WAYLAND_wl_proxy_add_listener)
 #define wl_proxy_marshal_constructor (*WAYLAND_wl_proxy_marshal_constructor)
+#define wl_proxy_marshal_constructor_versioned (*WAYLAND_wl_proxy_marshal_constructor_versioned)
 
 #define wl_seat_interface (*WAYLAND_wl_seat_interface)
 #define wl_surface_interface (*WAYLAND_wl_surface_interface)
@@ -93,11 +94,15 @@ void SDL_WAYLAND_UnloadSymbols(void);
 #define wl_output_interface (*WAYLAND_wl_output_interface)
 #define wl_shell_interface (*WAYLAND_wl_shell_interface)
 #define wl_shm_interface (*WAYLAND_wl_shm_interface)
+/*xdg-shell*/
+#define xdg_shell_interface (*WAYLAND_xdg_shell_interface)
+#define xdg_surface_interface (*WAYLAND_xdg_surface_interface)
 
 #endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
 
 #include "wayland-client.h"
 #include "wayland-egl.h"
+#include <wayland-extension/xdg-shell-client-protocol.h>
 
 #endif /* !defined _SDL_waylanddyn_h */
 
index 53b0ac9..0cd7d3d 100644 (file)
@@ -149,6 +149,9 @@ ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial)
         };
         switch (rc) {
             case SDL_HITTEST_DRAGGABLE:
+            if (window_data->xdgsurface)
+                xdg_surface_move(window_data->xdgsurface, input->seat, serial);
+            else if (window_data->shell_surface)
                 wl_shell_surface_move(window_data->shell_surface, input->seat, serial);
                 return SDL_TRUE;
 
@@ -160,7 +163,10 @@ ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial)
             case SDL_HITTEST_RESIZE_BOTTOM:
             case SDL_HITTEST_RESIZE_BOTTOMLEFT:
             case SDL_HITTEST_RESIZE_LEFT:
-                wl_shell_surface_resize(window_data->shell_surface, input->seat, serial, directions[rc - SDL_HITTEST_RESIZE_TOPLEFT]);
+                if (window_data->xdgsurface)
+                    xdg_surface_resize(window_data->xdgsurface, input->seat, serial, directions[rc - SDL_HITTEST_RESIZE_TOPLEFT]);
+                else if (window_data->shell_surface)
+                    wl_shell_surface_resize(window_data->shell_surface, input->seat, serial, directions[rc - SDL_HITTEST_RESIZE_TOPLEFT]);
                 return SDL_TRUE;
 
             default: return SDL_FALSE;
index b093d9d..21d1db0 100644 (file)
@@ -55,6 +55,10 @@ SDL_WAYLAND_SYM(void, wl_list_insert_list, (struct wl_list *, struct wl_list *))
 SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_4)
 SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor, (struct wl_proxy *, uint32_t opcode, const struct wl_interface *interface, ...))
 
+SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_10)
+SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor_versioned, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, ...))
+
+
 SDL_WAYLAND_INTERFACE(wl_seat_interface)
 SDL_WAYLAND_INTERFACE(wl_surface_interface)
 SDL_WAYLAND_INTERFACE(wl_shm_pool_interface)
@@ -99,6 +103,10 @@ SDL_WAYLAND_SYM(enum xkb_state_component, xkb_state_update_mask, (struct xkb_sta
                       xkb_layout_index_t latched_layout,\
                       xkb_layout_index_t locked_layout) )
 
+/* xdg-shell */
+SDL_WAYLAND_MODULE(WAYLAND_XDGSHELLCLIENT)
+SDL_WAYLAND_INTERFACE(xdg_shell_interface)
+SDL_WAYLAND_INTERFACE(xdg_surface_interface)
 
 /* *INDENT-ON* */
 
index b47ec29..bcdbbb6 100644 (file)
 #include "SDL_waylandopengles.h"
 #include "SDL_waylandmouse.h"
 #include "SDL_waylandtouch.h"
+#include "SDL_waylandvulkan.h"
 
 #include <fcntl.h>
 #include <xkbcommon/xkbcommon.h>
 
 #include "SDL_waylanddyn.h"
+#include <wayland-extension/xdg-shell-client-protocol.h>
 #include <wayland-util.h>
 
 #define WAYLANDVID_DRIVER_NAME "wayland"
+#define XDG_VERSION 5
 
 /* Initialization/Query functions */
 static int
@@ -123,6 +126,10 @@ Wayland_CreateDevice(int devindex)
 
     device->free = Wayland_DeleteDevice;
 
+#if SDL_VIDEO_VULKAN
+    device->vulkan_GetInstanceExtensions = Wayland_vulkan_GetInstanceExtensions;
+    device->vulkan_CreateSurface = Wayland_vulkan_CreateSurface;
+#endif
     return device;
 }
 
@@ -236,6 +243,18 @@ static const struct qt_windowmanager_listener windowmanager_listener = {
 };
 #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
 
+/* xdg shell */
+static void
+xdg_shell_ping(void *data, struct xdg_shell *shell, uint32_t serial)
+{
+   xdg_shell_pong(shell, serial);
+}
+
+static const struct xdg_shell_listener xdg_shell_listener =
+{
+   xdg_shell_ping,
+};
+
 static void
 display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
                       const char *interface, uint32_t version)
@@ -248,6 +267,10 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
         Wayland_add_display(d, id);
     } else if (strcmp(interface, "wl_seat") == 0) {
         Wayland_display_add_input(d, id);
+    } else if (strcmp(interface, "xdg_shell") == 0) {
+        d->xdgshell =  wl_registry_bind(d->registry, id, &xdg_shell_interface, 1);
+        xdg_shell_use_unstable_version(d->xdgshell, XDG_VERSION);
+        xdg_shell_add_listener(d->xdgshell, &xdg_shell_listener,d->display);
     } else if (strcmp(interface, "wl_shell") == 0) {
         d->shell = wl_registry_bind(d->registry, id, &wl_shell_interface, 1);
     } else if (strcmp(interface, "wl_shm") == 0) {
index 8111bf1..0d3a0bb 100644 (file)
@@ -53,6 +53,9 @@ typedef struct {
     struct xkb_context *xkb_context;
     struct SDL_WaylandInput *input;
 
+    /* XDBG */
+    struct xdg_shell *xdgshell;
+
 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
     struct SDL_WaylandTouch *touch;
     struct qt_surface_extension *surface_extension;
diff --git a/src/video/wayland/SDL_waylandvulkan.c b/src/video/wayland/SDL_waylandvulkan.c
new file mode 100644 (file)
index 0000000..3efd7ab
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_VULKAN
+#include <SDL_syswm.h>
+#include "SDL_video.h"
+#include "../SDL_sysvideo.h"
+#include "SDL_waylandwindow.h"
+#include "SDL_waylandvideo.h"
+#include "SDL_waylandvulkan.h"
+
+SDL_bool
+Wayland_vulkan_GetInstanceExtensions(const char* driver, unsigned int* count, char** names)
+{
+    uint32_t instance_extension_count = 0;
+    uint32_t enabled_extension_count = 0;
+    VkBool32 surfaceExtFound = 0;
+    VkBool32 platformSurfaceExtFound = 0;
+    VkResult err;
+
+    if (strcmp(driver, "wayland")) {
+        SDL_SetError("Unsupported video driver '%s'", driver);
+        return SDL_FALSE;
+    }
+
+    err = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL);
+    if (err < 0) {
+        SDL_SetError("Fail to get Instance extension");
+        return SDL_FALSE;
+    }
+
+    if (instance_extension_count > 0) {
+        uint32_t i;
+        VkExtensionProperties *instance_extensions =
+            malloc(sizeof(VkExtensionProperties) * instance_extension_count);
+        err = vkEnumerateInstanceExtensionProperties(
+            NULL, &instance_extension_count, instance_extensions);
+        for (i = 0; i < instance_extension_count; i++) {
+            if (!strcmp(VK_KHR_SURFACE_EXTENSION_NAME,instance_extensions[i].extensionName)) {
+                names[enabled_extension_count++] = VK_KHR_SURFACE_EXTENSION_NAME;
+            }
+
+            if (!strcmp(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME,instance_extensions[i].extensionName)) {
+                names[enabled_extension_count++] = VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME;
+            }
+
+            if (enabled_extension_count > 64) {
+                SDL_SetError("Insufficient capacity for extension names");
+                free(instance_extensions);
+                return SDL_FALSE;
+            }
+        }
+        free(instance_extensions);
+    }
+    *count = enabled_extension_count;
+    return SDL_TRUE;
+}
+
+SDL_bool
+Wayland_vulkan_CreateSurface(_THIS, SDL_Window* window, SDL_vulkanInstance instance, SDL_vulkanSurface* surface)
+{
+    SDL_SysWMinfo wminfo;
+    SDL_WindowData *wmdata = (SDL_WindowData *)window->driverdata;
+    SDL_VideoData  *video_data  = (SDL_VideoData *)_this->driverdata;
+    if (!SDL_GetWindowWMInfo(window, &wminfo))
+        return SDL_FALSE;
+
+    switch (wminfo.subsystem)
+    {
+    case SDL_SYSWM_WAYLAND:
+        {
+            VkWaylandSurfaceCreateInfoKHR createInfo;
+            VkResult ret;
+            createInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR;
+            createInfo.pNext = NULL;
+            createInfo.flags = 0;
+            createInfo.display = video_data->display;
+            createInfo.surface = wmdata->surface;
+
+            ret = vkCreateWaylandSurfaceKHR((VkInstance)instance, &createInfo, NULL, (VkSurfaceKHR*)surface);
+            if (ret != VK_SUCCESS) {
+                SDL_SetError("fail to vkCreateWaylandSurfaceKHR : %i", (int)ret);
+                return SDL_FALSE;
+            }
+            return SDL_TRUE;
+        }
+    default:
+        (void)surface;
+        SDL_SetError("Unsupported subsystem %i", (int)wminfo.subsystem);
+        return SDL_FALSE;
+    }
+}
+
+#endif
diff --git a/src/video/wayland/SDL_waylandvulkan.h b/src/video/wayland/SDL_waylandvulkan.h
new file mode 100644 (file)
index 0000000..f972d70
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef _SDL_waylandvulkan_h
+#define _SDL_waylandvulkan_h
+
+#if SDL_VIDEO_VULKAN
+#define VK_USE_PLATFORM_WAYLAND_KHR
+#include <vulkan/vulkan.h>
+#include "../SDL_sysvideo.h"
+
+extern SDL_bool Wayland_vulkan_GetInstanceExtensions(const char* driver, unsigned int* count, char** names);
+extern SDL_bool Wayland_vulkan_CreateSurface(_THIS, SDL_Window* window, SDL_vulkanInstance instance, SDL_vulkanSurface* surface);
+
+#endif
+#endif /* _SDL_waylandvulkan_h */
index b59759a..0c69b3e 100644 (file)
@@ -30,6 +30,7 @@
 #include "SDL_waylandvideo.h"
 #include "SDL_waylandtouch.h"
 #include "SDL_waylanddyn.h"
+#include <wayland-extension/xdg-shell-client-protocol.h>
 
 static void
 handle_ping(void *data, struct wl_shell_surface *shell_surface,
@@ -68,6 +69,36 @@ static const struct wl_shell_surface_listener shell_surface_listener = {
     handle_popup_done
 };
 
+
+static void
+_sdl_xdg_handle_surface_configure(void *data, struct xdg_surface *xdgsurface, int32_t width, int32_t height, struct wl_array *states, uint32_t serial)
+{
+   SDL_WindowData *win = (SDL_WindowData *)data;
+   //uint32_t *p;
+
+   fprintf(stderr,"%s:: %d, width %d, height %d\n",__FUNCTION__,__LINE__,width,height);
+   // TODO : resize
+/*
+   if ((width > 0) && (height > 0))
+     _ecore_wl_window_configure_send(win, width, height, 0);
+*/
+
+   if (win->xdgsurface)
+     xdg_surface_ack_configure(win->xdgsurface, serial);
+}
+
+static void
+_sdl_xdg_handle_surface_delete(void *data, struct xdg_surface *xdgsurface)
+{
+   fprintf(stderr,"%s:: %d\n",__FUNCTION__,__LINE__);
+}
+
+static const struct xdg_surface_listener _sdl_xdg_surface_listener =
+{
+   _sdl_xdg_handle_surface_configure,
+   _sdl_xdg_handle_surface_delete,
+};
+
 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
 static void
 handle_onscreen_visibility(void *data,
@@ -120,11 +151,21 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window)
     SDL_WindowData *wind = window->driverdata;
 
     if (window->flags & SDL_WINDOW_FULLSCREEN)
-        wl_shell_surface_set_fullscreen(wind->shell_surface,
-                                        WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
-                                        0, (struct wl_output *)window->fullscreen_mode.driverdata);
+    {
+        if (wind->xdgsurface)
+            xdg_surface_set_fullscreen(wind->xdgsurface, (struct wl_output *)window->fullscreen_mode.driverdata);
+        else if(wind->shell_surface)
+            wl_shell_surface_set_fullscreen(wind->shell_surface,
+                                            WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
+                                            0, (struct wl_output *)window->fullscreen_mode.driverdata);
+    }
     else
-        wl_shell_surface_set_toplevel(wind->shell_surface);
+    {
+        if (wind->xdgsurface)
+            xdg_surface_set_parent(wind->xdgsurface, NULL);
+        else if (wind->shell_surface)
+            wl_shell_surface_set_toplevel(wind->shell_surface);
+    }
 
     WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
 }
@@ -136,11 +177,22 @@ Wayland_SetWindowFullscreen(_THIS, SDL_Window * window,
     SDL_WindowData *wind = window->driverdata;
 
     if (fullscreen)
-        wl_shell_surface_set_fullscreen(wind->shell_surface,
-                                        WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE,
-                                        0, (struct wl_output *)_display->driverdata);
+    {
+        if (wind->xdgsurface)
+            xdg_surface_set_fullscreen(wind->xdgsurface, (struct wl_output *)_display->driverdata);
+
+        if(wind->shell_surface)
+            wl_shell_surface_set_fullscreen(wind->shell_surface,
+                                            WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE,
+                                            0, (struct wl_output *)_display->driverdata);
+    }
     else
-        wl_shell_surface_set_toplevel(wind->shell_surface);
+    {
+        if (wind->xdgsurface)
+            xdg_surface_unset_fullscreen(wind->xdgsurface);
+        else if (wind->shell_surface)
+            wl_shell_surface_set_toplevel(wind->shell_surface);
+    }
 
     WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display );
 }
@@ -176,14 +228,6 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
     data->surface =
         wl_compositor_create_surface(c->compositor);
     wl_surface_set_user_data(data->surface, data);
-    data->shell_surface = wl_shell_get_shell_surface(c->shell,
-                                                     data->surface);
-#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH    
-    if (c->surface_extension) {
-        data->extended_surface = qt_surface_extension_get_extended_surface(
-                c->surface_extension, data->surface);
-    }
-#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
 
     data->egl_window = WAYLAND_wl_egl_window_create(data->surface,
                                             window->w, window->h);
@@ -214,6 +258,29 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
     wl_surface_set_opaque_region(data->surface, region);
     wl_region_destroy(region);
 
+    /* XDG shell */
+    if (c->xdgshell)
+    {
+        data->xdgsurface = xdg_shell_get_xdg_surface(c->xdgshell,data->surface);
+        xdg_surface_set_user_data(data->xdgsurface, data);
+        xdg_surface_add_listener(data->xdgsurface,
+                                 &_sdl_xdg_surface_listener, data);
+    }
+    else if (c->shell)
+    {
+        /* WL Shell */
+        data->shell_surface = wl_shell_get_shell_surface(c->shell,
+                                                         data->surface);
+    }
+#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
+    if (c->surface_extension) {
+        data->extended_surface = qt_surface_extension_get_extended_surface(
+                c->surface_extension, data->surface);
+    }
+#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
+
+
+
     WAYLAND_wl_display_flush(c->display);
 
     return 0;
@@ -242,6 +309,10 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window)
         SDL_EGL_DestroySurface(_this, wind->egl_surface);
         WAYLAND_wl_egl_window_destroy(wind->egl_window);
 
+        if (wind->xdgsurface)
+            xdg_surface_destroy(wind->xdgsurface);
+        wind->xdgsurface = NULL;
+
         if (wind->shell_surface)
             wl_shell_surface_destroy(wind->shell_surface);
 
index 053b128..afde27c 100644 (file)
@@ -40,6 +40,9 @@ typedef struct {
     struct SDL_WaylandInput *keyboard_device;
     EGLSurface egl_surface;
 
+    /* XDG Shell */
+    struct xdg_surface *xdgsurface;
+
 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
     struct qt_extended_surface *extended_surface;
 #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */    
index 01f8ae6..b3a1c4e 100644 (file)
@@ -281,6 +281,11 @@ X11_CreateDevice(int devindex)
     
     device->free = X11_DeleteDevice;
 
+#if SDL_VIDEO_VULKAN
+    device->vulkan_GetInstanceExtensions = X11_vulkan_GetInstanceExtensions;
+    device->vulkan_CreateSurface = X11_vulkan_CreateSurface;
+#endif
+
     return device;
 }
 
diff --git a/src/video/x11/SDL_x11vulkan.c b/src/video/x11/SDL_x11vulkan.c
new file mode 100644 (file)
index 0000000..b4e7ac4
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#if SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_VULKAN
+
+#define VK_USE_PLATFORM_XCB_KHR
+#include <X11/Xlib-xcb.h>
+
+#include <vulkan/vulkan.h>
+#include <SDL_syswm.h>
+#include "SDL_x11video.h"
+#include "SDL_x11vulkan.h"
+
+SDL_bool
+X11_vulkan_GetInstanceExtensions(const char* driver, unsigned int* count, char** names)
+{
+    uint32_t instance_extension_count = 0;
+    uint32_t enabled_extension_count = 0;
+    VkBool32 surfaceExtFound = 0;
+    VkBool32 platformSurfaceExtFound = 0;
+    VkResult err;
+
+    if (strcmp(driver, "x11")) {
+        SDL_SetError("Unsupported video driver '%s'", driver);
+        return SDL_FALSE;
+    }
+
+    err = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL);
+    if (err < 0) {
+        SDL_SetError("Fail to get Instance extension");
+        return SDL_FALSE;
+    }
+
+    if (instance_extension_count > 0) {
+        uint32_t i;
+        VkExtensionProperties *instance_extensions =
+            malloc(sizeof(VkExtensionProperties) * instance_extension_count);
+        err = vkEnumerateInstanceExtensionProperties(
+            NULL, &instance_extension_count, instance_extensions);
+        for (i = 0; i < instance_extension_count; i++) {
+            if (!strcmp(VK_KHR_SURFACE_EXTENSION_NAME,instance_extensions[i].extensionName)) {
+                names[enabled_extension_count++] = VK_KHR_SURFACE_EXTENSION_NAME;
+            }
+
+            if (!strcmp(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME,instance_extensions[i].extensionName)) {
+                names[enabled_extension_count++] = VK_KHR_XCB_SURFACE_EXTENSION_NAME;
+            }
+
+            if (enabled_extension_count > 64) {
+                SDL_SetError("Insufficient capacity for extension names");
+                free(instance_extensions);
+                return SDL_FALSE;
+            }
+        }
+        free(instance_extensions);
+    }
+    *count = enabled_extension_count;
+    return SDL_TRUE;
+}
+
+SDL_bool
+X11_vulkan_CreateSurface(_THIS, SDL_Window* window, SDL_vulkanInstance instance, SDL_vulkanSurface* surface)
+{
+    SDL_SysWMinfo wminfo;
+    if (!SDL_GetWindowWMInfo(window, &wminfo))
+        return SDL_FALSE;
+
+    switch (wminfo.subsystem)
+    {
+    case SDL_SYSWM_X11:
+        {
+            VkXcbSurfaceCreateInfoKHR createInfo;
+            VkResult ret;
+            createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR;
+            createInfo.pNext = NULL;
+            createInfo.flags = 0;
+            createInfo.connection = XGetXCBConnection(wminfo.info.x11.display);
+            createInfo.window = wminfo.info.x11.window;
+
+            ret = vkCreateXcbSurfaceKHR((VkInstance)instance, &createInfo, NULL, (VkSurfaceKHR*)surface);
+            if (ret != VK_SUCCESS) {
+                SDL_SetError("fail to vkCreateXcbSurfaceKHR : %i", (int)ret);
+                return SDL_FALSE;
+            }
+            return SDL_TRUE;
+        }
+    default:
+        (void)surface;
+        SDL_SetError("Unsupported subsystem %i", (int)wminfo.subsystem);
+        return SDL_FALSE;
+    }
+}
+
+#endif
diff --git a/src/video/x11/SDL_x11vulkan.h b/src/video/x11/SDL_x11vulkan.h
new file mode 100644 (file)
index 0000000..0b65aa3
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+#include "../../SDL_internal.h"
+
+#ifndef _SDL_x11vulkan_h
+#define _SDL_x11vulkan_h
+
+#if SDL_VIDEO_VULKAN
+extern SDL_bool X11_vulkan_GetInstanceExtensions(const char* driver, unsigned int* count, char** names);
+extern SDL_bool X11_vulkan_CreateSurface(_THIS, SDL_Window* window,SDL_vulkanInstance instance, SDL_vulkanSurface* surface);
+#endif
+
+#endif /* _SDL_x11vulkan_h */
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..4697676
--- /dev/null
@@ -0,0 +1,326 @@
+INCLUDE(FindPkgConfig)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(sdl2_test C CXX)
+
+IF("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7l") 
+ADD_DEFINITIONS("-DARCH_ARMV7") 
+ELSE() 
+ADD_DEFINITIONS("-DARCH_I586") 
+ENDIF()
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "") 
+       SET(CMAKE_BUILD_TYPE "Debug") 
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") 
+       MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
+
+IF(NOT DEFINED PACKAGE_NAME) 
+       SET(PACKAGE_NAME "org.tizen.${PROJECT_NAME}") 
+ENDIF(NOT DEFINED PACKAGE_NAME)
+IF(NOT DEFINED RESDIR)
+    SET(RESDIR "${PREFIX}/res")
+ENDIF(NOT DEFINED RESDIR)
+
+set(SDL_MAJOR_VERSION 2)
+set(SDL_MINOR_VERSION 0)
+set(SDL_MICRO_VERSION 4)
+set(SDL_INTERFACE_AGE 0)
+set(SDL_BINARY_AGE 4)
+set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
+
+set(LIBNAME SDL2)
+set(CMAKE_C_FLAGS "-g -O2")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar")
+
+ADD_DEFINITIONS(-D__TIZEN__)
+INCLUDE(FindPkgConfig)
+pkg_check_modules(APPS_PKGS REQUIRED
+       dlog
+       egl
+       glesv2
+       glesv1
+       sdl2
+)
+FOREACH(flag ${APPS_PKGS_CFLAGS}) #${APPS_PKGS_LDFLAGS}
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
+
+set (SDL_TEST_SOURCE
+               testmain.c
+       )
+set (AUTOMATION_SOURCE
+               testautomation.c 
+               testautomation_audio.c 
+               testautomation_clipboard.c 
+               testautomation_events.c 
+               testautomation_hints.c
+               testautomation_keyboard.c 
+               testautomation_main.c 
+               testautomation_mouse.c 
+               testautomation_pixels.c 
+               testautomation_platform.c 
+               testautomation_rect.c 
+               testautomation_render.c 
+               testautomation_rwops.c 
+               testautomation_sdltest.c 
+               testautomation_stdlib.c 
+               testautomation_surface.c 
+               testautomation_syswm.c 
+               testautomation_timer.c 
+               testautomation_video.c 
+       )
+set (LOOPWAVE_SOURCE
+               loopwave.c
+       )
+set (LOOPWAVEQUEUE_SOURCE
+               loopwavequeue.c
+       )
+set (AUTOMIC_SOURCE
+               testatomic.c
+       )
+set (AUDIOHOTPLUGIN_SOURCE
+               testaudiohotplug.c
+       )
+set (AUDIOINFO_SOURCE
+               testaudioinfo.c
+       )
+set (DISPLAYINFO_SOURCE
+               testdisplayinfo.c
+       )
+set (DRAW2_SOURCE
+               testdraw2.c
+       )
+set (DRAWCHESSBOARD_SOURCE
+               testdrawchessboard.c
+       )
+set (DORPFILE_SOURCE
+               testdropfile.c
+       )
+set (ERROR_SOURCE
+               testerror.c
+       )
+set (FILE_SOURCE
+               testfile.c
+       )
+set (FILESYSTEM_SOURCE
+               testfilesystem.c
+       )
+set (GLES_SOURCE
+               testgles.c
+       )
+set (GLES2_SOURCE
+               testgles2.c
+       )
+set (HIT_SOURCE
+               testhittesting.c
+       )
+set (CONV_SOURCE
+               testiconv.c
+       )
+set (TIME_SOURCE
+               testime.c
+       )
+set (INTERSECTION_SOURCE
+               testintersections.c
+       )
+set (KEYS_SOURCE
+               testkeys.c
+       )
+set (LOADSO_SOURCE
+               testloadso.c
+       )
+set (LOCK_SOURCE
+               testlock.c
+       )
+set (MESSAGE_SOURCE
+               testmessage.c
+       )
+set (MULTIAUDIO_SOURCE
+               testmultiaudio.c
+       )
+set (OVERLAY2_SOURCE
+               testoverlay2.c
+       )
+set (PLATFORM_SOURCE
+               testplatform.c
+       )
+set (RELATIVE_SOURCE
+               testrelative.c
+       )
+set (RENDERCOPYEX_SOURCE
+               testrendercopyex.c
+       )
+set (RENDERTARGET_SOURCE
+               testrendertarget.c
+       )
+set (RESAMPLE_SOURCE
+               testresample.c
+       )
+set (SCALE_SOURCE
+               testscale.c
+       )
+set (SEM_SOURCE
+               testsem.c
+       )
+set (SHADER_SOURCE
+               testshader.c
+       )
+set (SHAPE_SOURCE
+               testshape.c
+       )
+set (SPRITE2_SOURCE
+               testsprite2.c
+       )
+set (SPRITEMINIMAL_SOURCE
+               testspriteminimal.c
+       )
+set (STREAMING_SOURCE
+               teststreaming.c
+       )
+set (THREAD_SOURCE
+               testthread.c
+       )
+set (TIMER_SOURCE
+               testtimer.c
+       )
+set (VER_SOURCE
+               testver.c
+       )
+set (VIEWPORT_SOURCE
+               testviewport.c
+       )
+set (TORTURETHREAD_SOURCE
+               torturethread.c
+       )
+add_executable(testmain  ${SDL_TEST_SOURCE})
+TARGET_LINK_LIBRARIES(testmain ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testautomation  ${AUTOMATION_SOURCE})
+TARGET_LINK_LIBRARIES(testautomation ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(loopwave  ${LOOPWAVE_SOURCE})
+TARGET_LINK_LIBRARIES(loopwave ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(loopwavequeue  ${LOOPWAVEQUEUE_SOURCE})
+TARGET_LINK_LIBRARIES(loopwavequeue ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testautomic  ${AUTOMIC_SOURCE})
+TARGET_LINK_LIBRARIES(testautomic ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testaudiohotplug  ${AUDIOHOTPLUGIN_SOURCE})
+TARGET_LINK_LIBRARIES(testaudiohotplug ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testaudioinfo  ${AUDIOINFO_SOURCE})
+TARGET_LINK_LIBRARIES(testaudioinfo ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testdisplayinfo  ${DISPLAYINFO_SOURCE})
+TARGET_LINK_LIBRARIES(testdisplayinfo ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testdraw2  ${DRAW2_SOURCE})
+TARGET_LINK_LIBRARIES(testdraw2 ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testdrawchessboard  ${DRAWCHESSBOARD_SOURCE})
+TARGET_LINK_LIBRARIES(testdrawchessboard ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testdorpfile  ${DRAWCHESSBOARD_SOURCE})
+TARGET_LINK_LIBRARIES(testdorpfile ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testerror  ${ERROR_SOURCE})
+TARGET_LINK_LIBRARIES(testerror ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testfile  ${FILE_SOURCE})
+TARGET_LINK_LIBRARIES(testfile ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testfilesystem  ${FILESYSTEM_SOURCE})
+TARGET_LINK_LIBRARIES(testfilesystem ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testgles  ${GLES_SOURCE})
+TARGET_LINK_LIBRARIES(testgles ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testgles2  ${GLES2_SOURCE})
+TARGET_LINK_LIBRARIES(testgles2 ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testhit  ${HIT_SOURCE})
+TARGET_LINK_LIBRARIES(testhit ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testconv  ${CONV_SOURCE})
+TARGET_LINK_LIBRARIES(testconv ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testtime  ${TIME_SOURCE})
+TARGET_LINK_LIBRARIES(testtime ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testintersection  ${INTERSECTION_SOURCE})
+TARGET_LINK_LIBRARIES(testintersection ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testkes  ${KEYS_SOURCE})
+TARGET_LINK_LIBRARIES(testkes ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testloadso  ${LOADSO_SOURCE})
+TARGET_LINK_LIBRARIES(testloadso ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testlock  ${LOCK_SOURCE})
+TARGET_LINK_LIBRARIES(testlock ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testmessage  ${MESSAGE_SOURCE})
+TARGET_LINK_LIBRARIES(testmessage ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testmultiaudio  ${MULTIAUDIO_SOURCE})
+TARGET_LINK_LIBRARIES(testmultiaudio ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testoverlay2  ${OVERLAY2_SOURCE})
+TARGET_LINK_LIBRARIES(testoverlay2 ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testplatform  ${PLATFORM_SOURCE})
+TARGET_LINK_LIBRARIES(testplatform ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testrelative  ${RELATIVE_SOURCE})
+TARGET_LINK_LIBRARIES(testrelative ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testrendercopyex  ${RENDERCOPYEX_SOURCE})
+TARGET_LINK_LIBRARIES(testrendercopyex ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testrendertarget  ${RENDERTARGET_SOURCE})
+TARGET_LINK_LIBRARIES(testrendertarget ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testresample  ${RESAMPLE_SOURCE})
+TARGET_LINK_LIBRARIES(testresample ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testscale  ${SCALE_SOURCE})
+TARGET_LINK_LIBRARIES(testscale ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testsem  ${SEM_SOURCE})
+TARGET_LINK_LIBRARIES(testsem ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testshader  ${SHADER_SOURCE})
+TARGET_LINK_LIBRARIES(testshader ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testshape  ${SHAPE_SOURCE})
+TARGET_LINK_LIBRARIES(testshape ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testsprite2  ${SPRITE2_SOURCE})
+TARGET_LINK_LIBRARIES(testsprite2 ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testspriteminimal  ${SPRITEMINIMAL_SOURCE})
+TARGET_LINK_LIBRARIES(testspriteminimal ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(teststreaming  ${STREAMING_SOURCE})
+TARGET_LINK_LIBRARIES(teststreaming ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testthread  ${THREAD_SOURCE})
+TARGET_LINK_LIBRARIES(testthread ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testtimer  ${TIMER_SOURCE})
+TARGET_LINK_LIBRARIES(testtimer ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testver  ${VER_SOURCE})
+TARGET_LINK_LIBRARIES(testver ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(testviewport  ${VIEWPORT_SOURCE})
+TARGET_LINK_LIBRARIES(testviewport ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+add_executable(torturethread  ${TORTURETHREAD_SOURCE})
+TARGET_LINK_LIBRARIES(torturethread ${APPS_PKGS_LDFLAGS} SDL2_test SDL2main)
+# Install
+INSTALL(TARGETS testmain DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testautomation DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS loopwave DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS loopwavequeue DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testautomic DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testaudiohotplug DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testaudioinfo DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testdisplayinfo DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testdraw2 DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testdrawchessboard DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testdorpfile DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testerror DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testfile DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testfilesystem DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testgles DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testgles2 DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testhit DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testconv DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testtime DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testintersection DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testkes DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testloadso DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testlock DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testmessage DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testmultiaudio DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testoverlay2 DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testplatform DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testrelative DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testrendercopyex DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testrendertarget DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testresample DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testscale DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testsem DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testshader DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testshape DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testsprite2 DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testspriteminimal DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS teststreaming DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testthread DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testtimer DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testver DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS testviewport DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(TARGETS torturethread DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
+INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/res DESTINATION /opt/usr/apps/org.tizen.sdl2_test/)
\ No newline at end of file
diff --git a/test/SDL_gles2funcs.h b/test/SDL_gles2funcs.h
new file mode 100755 (executable)
index 0000000..0ecfa7f
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+  Simple DirectMedia Layer
+  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+*/
+
+SDL_PROC(void, glActiveTexture, (GLenum))
+SDL_PROC(void, glAttachShader, (GLuint, GLuint))
+SDL_PROC(void, glBindAttribLocation, (GLuint, GLuint, const char *))
+SDL_PROC(void, glBindTexture, (GLenum, GLuint))
+SDL_PROC(void, glBlendFuncSeparate, (GLenum, GLenum, GLenum, GLenum))
+SDL_PROC(void, glClear, (GLbitfield))
+SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf))
+SDL_PROC(void, glCompileShader, (GLuint))
+SDL_PROC(GLuint, glCreateProgram, (void))
+SDL_PROC(GLuint, glCreateShader, (GLenum))
+SDL_PROC(void, glDeleteProgram, (GLuint))
+SDL_PROC(void, glDeleteShader, (GLuint))
+SDL_PROC(void, glDeleteTextures, (GLsizei, const GLuint *))
+SDL_PROC(void, glDisable, (GLenum))
+SDL_PROC(void, glDisableVertexAttribArray, (GLuint))
+SDL_PROC(void, glDrawArrays, (GLenum, GLint, GLsizei))
+SDL_PROC(void, glEnable, (GLenum))
+SDL_PROC(void, glEnableVertexAttribArray, (GLuint))
+SDL_PROC(void, glFinish, (void))
+SDL_PROC(void, glGenFramebuffers, (GLsizei, GLuint *))
+SDL_PROC(void, glGenTextures, (GLsizei, GLuint *))
+SDL_PROC(void, glGetBooleanv, (GLenum, GLboolean *))
+SDL_PROC(const GLubyte *, glGetString, (GLenum))
+SDL_PROC(GLenum, glGetError, (void))
+SDL_PROC(void, glGetIntegerv, (GLenum, GLint *))
+SDL_PROC(void, glGetProgramiv, (GLuint, GLenum, GLint *))
+SDL_PROC(void, glGetShaderInfoLog, (GLuint, GLsizei, GLsizei *, char *))
+SDL_PROC(void, glGetShaderiv, (GLuint, GLenum, GLint *))
+SDL_PROC(GLint, glGetUniformLocation, (GLuint, const char *))
+SDL_PROC(void, glLinkProgram, (GLuint))
+SDL_PROC(void, glPixelStorei, (GLenum, GLint))
+SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*))
+SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei))
+SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei))
+SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar* const*, const GLint *))
+SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))
+SDL_PROC(void, glTexParameteri, (GLenum, GLenum, GLint))
+SDL_PROC(void, glTexSubImage2D, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *))
+SDL_PROC(void, glUniform1i, (GLint, GLint))
+SDL_PROC(void, glUniform4f, (GLint, GLfloat, GLfloat, GLfloat, GLfloat))
+SDL_PROC(void, glUniformMatrix4fv, (GLint, GLsizei, GLboolean, const GLfloat *))
+SDL_PROC(void, glUseProgram, (GLuint))
+SDL_PROC(void, glVertexAttribPointer, (GLuint, GLint, GLenum, GLboolean, GLsizei, const void *))
+SDL_PROC(void, glViewport, (GLint, GLint, GLsizei, GLsizei))
+SDL_PROC(void, glBindFramebuffer, (GLenum, GLuint))
+SDL_PROC(void, glFramebufferTexture2D, (GLenum, GLenum, GLenum, GLuint, GLint))
+SDL_PROC(GLenum, glCheckFramebufferStatus, (GLenum))
+SDL_PROC(void, glDeleteFramebuffers, (GLsizei, const GLuint *))
+SDL_PROC(GLint, glGetAttribLocation, (GLuint, const GLchar *))
+SDL_PROC(void, glGetProgramInfoLog, (GLuint, GLsizei, GLsizei*, GLchar*))
+SDL_PROC(void, glGenBuffers, (GLsizei, GLuint *))
+SDL_PROC(void, glBindBuffer, (GLenum, GLuint))
+SDL_PROC(void, glBufferData, (GLenum, GLsizeiptr, const GLvoid *, GLenum))
+SDL_PROC(void, glBufferSubData, (GLenum, GLintptr, GLsizeiptr, const GLvoid *))
index 61c32fb..c8032ca 100755 (executable)
 #! /bin/sh
+
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69.
-#
-#
-# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
-#
+# Generated automatically using autoconf version 2.13 
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
-## -------------------- ##
-## M4sh Initialization. ##
-## -------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in #(
-  *posix*) :
-    set -o posix ;; #(
-  *) :
-     ;;
-esac
-fi
-
-
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
-    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='print -r --'
-  as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='printf %s\n'
-  as_echo_n='printf %s'
-else
-  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
-    as_echo_n='/usr/ucb/echo -n'
-  else
-    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
-    as_echo_n_body='eval
-      arg=$1;
-      case $arg in #(
-      *"$as_nl"*)
-       expr "X$arg" : "X\\(.*\\)$as_nl";
-       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
-      esac;
-      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
-    '
-    export as_echo_n_body
-    as_echo_n='sh -c $as_echo_n_body as_echo'
-  fi
-  export as_echo_body
-  as_echo='sh -c $as_echo_body as_echo'
-fi
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  PATH_SEPARATOR=:
-  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
-    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
-      PATH_SEPARATOR=';'
-  }
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" ""       $as_nl"
-
-# Find who we are.  Look in the path if we contain no directory separator.
-as_myself=
-case $0 in #((
-  *[\\/]* ) as_myself=$0 ;;
-  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-  done
-IFS=$as_save_IFS
-
-     ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
-  as_myself=$0
-fi
-if test ! -f "$as_myself"; then
-  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  exit 1
-fi
-
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there.  '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
-  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-# Use a proper internal environment variable to ensure we don't fall
-  # into an infinite loop, continuously re-executing ourselves.
-  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
-    _as_can_reexec=no; export _as_can_reexec;
-    # We cannot yet assume a decent shell, so we have to provide a
-# neutralization value for shells without unset; and this also
-# works around shells that cannot unset nonexistent variables.
-# Preserve -v and -x to the replacement shell.
-BASH_ENV=/dev/null
-ENV=/dev/null
-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-case $- in # ((((
-  *v*x* | *x*v* ) as_opts=-vx ;;
-  *v* ) as_opts=-v ;;
-  *x* ) as_opts=-x ;;
-  * ) as_opts= ;;
-esac
-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
-# Admittedly, this is quite paranoid, since all the known shells bail
-# out after a failed `exec'.
-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
-as_fn_exit 255
-  fi
-  # We don't want this to propagate to other subprocesses.
-          { _as_can_reexec=; unset _as_can_reexec;}
-if test "x$CONFIG_SHELL" = x; then
-  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '\${1+\"\$@\"}'='\"\$@\"'
-  setopt NO_GLOB_SUBST
-else
-  case \`(set -o) 2>/dev/null\` in #(
-  *posix*) :
-    set -o posix ;; #(
-  *) :
-     ;;
-esac
-fi
-"
-  as_required="as_fn_return () { (exit \$1); }
-as_fn_success () { as_fn_return 0; }
-as_fn_failure () { as_fn_return 1; }
-as_fn_ret_success () { return 0; }
-as_fn_ret_failure () { return 1; }
-
-exitcode=0
-as_fn_success || { exitcode=1; echo as_fn_success failed.; }
-as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
-as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
-as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
-if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
-
-else
-  exitcode=1; echo positional parameters were not saved.
-fi
-test x\$exitcode = x0 || exit 1
-test -x / || exit 1"
-  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
-  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
-  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
-  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1"
-  if (eval "$as_required") 2>/dev/null; then :
-  as_have_required=yes
-else
-  as_have_required=no
-fi
-  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
-
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-as_found=false
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  as_found=:
-  case $as_dir in #(
-        /*)
-          for as_base in sh bash ksh sh5; do
-            # Try only shells that exist, to save several forks.
-            as_shell=$as_dir/$as_base
-            if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-                   { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
-  CONFIG_SHELL=$as_shell as_have_required=yes
-                  if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
-  break 2
-fi
-fi
-          done;;
-       esac
-  as_found=false
-done
-$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
-             { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
-  CONFIG_SHELL=$SHELL as_have_required=yes
-fi; }
-IFS=$as_save_IFS
-
-
-      if test "x$CONFIG_SHELL" != x; then :
-  export CONFIG_SHELL
-             # We cannot yet assume a decent shell, so we have to provide a
-# neutralization value for shells without unset; and this also
-# works around shells that cannot unset nonexistent variables.
-# Preserve -v and -x to the replacement shell.
-BASH_ENV=/dev/null
-ENV=/dev/null
-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-case $- in # ((((
-  *v*x* | *x*v* ) as_opts=-vx ;;
-  *v* ) as_opts=-v ;;
-  *x* ) as_opts=-x ;;
-  * ) as_opts= ;;
-esac
-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
-# Admittedly, this is quite paranoid, since all the known shells bail
-# out after a failed `exec'.
-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
-exit 255
-fi
-
-    if test x$as_have_required = xno; then :
-  $as_echo "$0: This script requires a shell more modern than all"
-  $as_echo "$0: the shells that I found on your system."
-  if test x${ZSH_VERSION+set} = xset ; then
-    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
-    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
-  else
-    $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
-$0: including any error possibly output before this
-$0: message. Then install a modern shell, or manually run
-$0: the script under such a shell if you do have one."
-  fi
-  exit 1
-fi
-fi
-fi
-SHELL=${CONFIG_SHELL-/bin/sh}
-export SHELL
-# Unset more variables known to interfere with behavior of common tools.
-CLICOLOR_FORCE= GREP_OPTIONS=
-unset CLICOLOR_FORCE GREP_OPTIONS
-
-## --------------------- ##
-## M4sh Shell Functions. ##
-## --------------------- ##
-# as_fn_unset VAR
-# ---------------
-# Portably unset VAR.
-as_fn_unset ()
-{
-  { eval $1=; unset $1;}
-}
-as_unset=as_fn_unset
-
-# as_fn_set_status STATUS
-# -----------------------
-# Set $? to STATUS, without forking.
-as_fn_set_status ()
-{
-  return $1
-} # as_fn_set_status
-
-# as_fn_exit STATUS
-# -----------------
-# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
-as_fn_exit ()
-{
-  set +e
-  as_fn_set_status $1
-  exit $1
-} # as_fn_exit
-
-# as_fn_mkdir_p
-# -------------
-# Create "$as_dir" as a directory, including parents if necessary.
-as_fn_mkdir_p ()
-{
-
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || eval $as_mkdir_p || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$as_dir" : 'X\(//\)[^/]' \| \
-        X"$as_dir" : 'X\(//\)$' \| \
-        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
-
 
-} # as_fn_mkdir_p
-
-# as_fn_executable_p FILE
-# -----------------------
-# Test if FILE is an executable regular file.
-as_fn_executable_p ()
-{
-  test -f "$1" && test -x "$1"
-} # as_fn_executable_p
-# as_fn_append VAR VALUE
-# ----------------------
-# Append the text in VALUE to the end of the definition contained in VAR. Take
-# advantage of any shell optimizations that allow amortized linear growth over
-# repeated appends, instead of the typical quadratic growth present in naive
-# implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
-  eval 'as_fn_append ()
-  {
-    eval $1+=\$2
-  }'
-else
-  as_fn_append ()
-  {
-    eval $1=\$$1\$2
-  }
-fi # as_fn_append
-
-# as_fn_arith ARG...
-# ------------------
-# Perform arithmetic evaluation on the ARGs, and store the result in the
-# global $as_val. Take advantage of shells that can avoid forks. The arguments
-# must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
-  eval 'as_fn_arith ()
-  {
-    as_val=$(( $* ))
-  }'
-else
-  as_fn_arith ()
-  {
-    as_val=`expr "$@" || test $? -eq 1`
-  }
-fi # as_fn_arith
-
-
-# as_fn_error STATUS ERROR [LINENO LOG_FD]
-# ----------------------------------------
-# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with STATUS, using 1 if that was 0.
-as_fn_error ()
-{
-  as_status=$1; test $as_status -eq 0 && as_status=1
-  if test "$4"; then
-    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
-  fi
-  $as_echo "$as_me: error: $2" >&2
-  as_fn_exit $as_status
-} # as_fn_error
-
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-        X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-           s//\1/
-           q
-         }
-         /^X\/\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\/\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-
-  as_lineno_1=$LINENO as_lineno_1a=$LINENO
-  as_lineno_2=$LINENO as_lineno_2a=$LINENO
-  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
-  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
-  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
-
-  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
-  # already done that, so ensure we don't try to do so again and fall
-  # in an infinite loop.  This has already happened in practice.
-  _as_can_reexec=no; export _as_can_reexec
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in #(((((
--n*)
-  case `echo 'xy\c'` in
-  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
-  xy)  ECHO_C='\c';;
-  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
-       ECHO_T='        ';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
-  if ln -s conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s='ln -s'
-    # ... but there are two gotchas:
-    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -pR'.
-    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -pR'
-  elif ln conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s=ln
-  else
-    as_ln_s='cp -pR'
-  fi
-else
-  as_ln_s='cp -pR'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p='mkdir -p "$as_dir"'
-else
-  test -d ./-p && rmdir ./-p
-  as_mkdir_p=false
-fi
-
-as_test_x='test -x'
-as_executable_p=as_fn_executable_p
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-test -n "$DJDIR" || exec 7<&0 </dev/null
-exec 6>&1
-
-# Name of the host.
-# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-#
-# Initializations.
-#
+# Defaults:
+ac_help=
 ac_default_prefix=/usr/local
-ac_clean_files=
-ac_config_libobj_dir=.
-LIBOBJS=
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-
-# Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
-PACKAGE_URL=
-
-ac_unique_file="README"
-ac_subst_vars='LTLIBOBJS
-LIBOBJS
-SDL_TTF_LIB
-XLIB
-GLES2LIB
-GLESLIB
-GLLIB
-CPP
-XMKMF
-SDL_CONFIG
-SDL_LIBS
-SDL_CFLAGS
-PKG_CONFIG_LIBDIR
-PKG_CONFIG_PATH
-PKG_CONFIG
-ISUNIX
-ISWINDOWS
-ISMACOSX
-MATHLIB
-EXE
-OSMESA_CONFIG
-OBJEXT
-EXEEXT
-ac_ct_CC
-CPPFLAGS
-LDFLAGS
-CFLAGS
-CC
-host_os
-host_vendor
-host_cpu
-host
-build_os
-build_vendor
-build_cpu
-build
-target_alias
-host_alias
-build_alias
-LIBS
-ECHO_T
-ECHO_N
-ECHO_C
-DEFS
-mandir
-localedir
-libdir
-psdir
-pdfdir
-dvidir
-htmldir
-infodir
-docdir
-oldincludedir
-includedir
-localstatedir
-sharedstatedir
-sysconfdir
-datadir
-datarootdir
-libexecdir
-sbindir
-bindir
-program_transform_name
-prefix
-exec_prefix
-PACKAGE_URL
-PACKAGE_BUGREPORT
-PACKAGE_STRING
-PACKAGE_VERSION
-PACKAGE_TARNAME
-PACKAGE_NAME
-PATH_SEPARATOR
-SHELL'
-ac_subst_files=''
-ac_user_opts='
-enable_option_checking
-with_sdl_prefix
-with_sdl_exec_prefix
-enable_sdltest
-with_x
-'
-      ac_precious_vars='build_alias
-host_alias
-target_alias
-CC
-CFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
-PKG_CONFIG
-PKG_CONFIG_PATH
-PKG_CONFIG_LIBDIR
-SDL_CFLAGS
-SDL_LIBS
-XMKMF
-CPP'
-
+# Any additions from configure.in:
+ac_help="$ac_help
+  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)"
+ac_help="$ac_help
+  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)"
+ac_help="$ac_help
+  --disable-sdltest       Do not try to compile and run a test SDL program"
+ac_help="$ac_help
+  --with-x                use the X Window System"
 
 # Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-ac_unrecognized_opts=
-ac_unrecognized_sep=
 # The variables have the same names as the options, with
 # dashes changed to underlines.
-cache_file=/dev/null
+build=NONE
+cache_file=./config.cache
 exec_prefix=NONE
+host=NONE
 no_create=
+nonopt=NONE
 no_recursion=
 prefix=NONE
 program_prefix=NONE
@@ -699,132 +37,94 @@ program_transform_name=s,x,x,
 silent=
 site=
 srcdir=
+target=NONE
 verbose=
 x_includes=NONE
 x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-# (The list follows the same order as the GNU Coding Standards.)
 bindir='${exec_prefix}/bin'
 sbindir='${exec_prefix}/sbin'
 libexecdir='${exec_prefix}/libexec'
-datarootdir='${prefix}/share'
-datadir='${datarootdir}'
+datadir='${prefix}/share'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE}'
-infodir='${datarootdir}/info'
-htmldir='${docdir}'
-dvidir='${docdir}'
-pdfdir='${docdir}'
-psdir='${docdir}'
-libdir='${exec_prefix}/lib'
-localedir='${datarootdir}/locale'
-mandir='${datarootdir}/man'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
 
 ac_prev=
-ac_dashdash=
 for ac_option
 do
+
   # If the previous option needs an argument, assign it.
   if test -n "$ac_prev"; then
-    eval $ac_prev=\$ac_option
+    eval "$ac_prev=\$ac_option"
     ac_prev=
     continue
   fi
 
-  case $ac_option in
-  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
-  *=)   ac_optarg= ;;
-  *)    ac_optarg=yes ;;
+  case "$ac_option" in
+  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) ac_optarg= ;;
   esac
 
   # Accept the important Cygnus configure options, so we can diagnose typos.
 
-  case $ac_dashdash$ac_option in
-  --)
-    ac_dashdash=yes ;;
+  case "$ac_option" in
 
   -bindir | --bindir | --bindi | --bind | --bin | --bi)
     ac_prev=bindir ;;
   -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
-    bindir=$ac_optarg ;;
+    bindir="$ac_optarg" ;;
 
   -build | --build | --buil | --bui | --bu)
-    ac_prev=build_alias ;;
+    ac_prev=build ;;
   -build=* | --build=* | --buil=* | --bui=* | --bu=*)
-    build_alias=$ac_optarg ;;
+    build="$ac_optarg" ;;
 
   -cache-file | --cache-file | --cache-fil | --cache-fi \
   | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
     ac_prev=cache_file ;;
   -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
   | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-    cache_file=$ac_optarg ;;
-
-  --config-cache | -C)
-    cache_file=config.cache ;;
+    cache_file="$ac_optarg" ;;
 
-  -datadir | --datadir | --datadi | --datad)
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
     ac_prev=datadir ;;
-  -datadir=* | --datadir=* | --datadi=* | --datad=*)
-    datadir=$ac_optarg ;;
-
-  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
-  | --dataroo | --dataro | --datar)
-    ac_prev=datarootdir ;;
-  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
-  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
-    datarootdir=$ac_optarg ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir="$ac_optarg" ;;
 
   -disable-* | --disable-*)
-    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid feature name: $ac_useropt"
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"enable_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
-        ac_unrecognized_sep=', ';;
-    esac
-    eval enable_$ac_useropt=no ;;
-
-  -docdir | --docdir | --docdi | --doc | --do)
-    ac_prev=docdir ;;
-  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
-    docdir=$ac_optarg ;;
-
-  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
-    ac_prev=dvidir ;;
-  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
-    dvidir=$ac_optarg ;;
+    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    eval "enable_${ac_feature}=no" ;;
 
   -enable-* | --enable-*)
-    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid feature name: $ac_useropt"
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"enable_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
-        ac_unrecognized_sep=', ';;
+    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+    fi
+    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
     esac
-    eval enable_$ac_useropt=\$ac_optarg ;;
+    eval "enable_${ac_feature}='$ac_optarg'" ;;
 
   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -833,77 +133,116 @@ do
   -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
   | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
   | --exec=* | --exe=* | --ex=*)
-    exec_prefix=$ac_optarg ;;
+    exec_prefix="$ac_optarg" ;;
 
   -gas | --gas | --ga | --g)
     # Obsolete; use --with-gas.
     with_gas=yes ;;
 
-  -help | --help | --hel | --he | -h)
-    ac_init_help=long ;;
-  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
-    ac_init_help=recursive ;;
-  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
-    ac_init_help=short ;;
+  -help | --help | --hel | --he)
+    # Omit some internal or obsolete options to make the list less imposing.
+    # This message is too long to be a string in the A/UX 3.1 sh.
+    cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+  --cache-file=FILE       cache test results in FILE
+  --help                  print this message
+  --no-create             do not create output files
+  --quiet, --silent       do not print \`checking...' messages
+  --version               print the version of autoconf that created configure
+Directory and file names:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [same as prefix]
+  --bindir=DIR            user executables in DIR [EPREFIX/bin]
+  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+  --datadir=DIR           read-only architecture-independent data in DIR
+                          [PREFIX/share]
+  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
+                          [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+  --includedir=DIR        C header files in DIR [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+  --infodir=DIR           info documentation in DIR [PREFIX/info]
+  --mandir=DIR            man documentation in DIR [PREFIX/man]
+  --srcdir=DIR            find the sources in DIR [configure dir or ..]
+  --program-prefix=PREFIX prepend PREFIX to installed program names
+  --program-suffix=SUFFIX append SUFFIX to installed program names
+  --program-transform-name=PROGRAM
+                          run sed PROGRAM on installed program names
+EOF
+    cat << EOF
+Host type:
+  --build=BUILD           configure for building on BUILD [BUILD=HOST]
+  --host=HOST             configure for HOST [guessed]
+  --target=TARGET         configure for TARGET [TARGET=HOST]
+Features and packages:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --x-includes=DIR        X include files are in DIR
+  --x-libraries=DIR       X library files are in DIR
+EOF
+    if test -n "$ac_help"; then
+      echo "--enable and --with options recognized:$ac_help"
+    fi
+    exit 0 ;;
 
   -host | --host | --hos | --ho)
-    ac_prev=host_alias ;;
+    ac_prev=host ;;
   -host=* | --host=* | --hos=* | --ho=*)
-    host_alias=$ac_optarg ;;
-
-  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
-    ac_prev=htmldir ;;
-  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
-  | --ht=*)
-    htmldir=$ac_optarg ;;
+    host="$ac_optarg" ;;
 
   -includedir | --includedir | --includedi | --included | --include \
   | --includ | --inclu | --incl | --inc)
     ac_prev=includedir ;;
   -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
   | --includ=* | --inclu=* | --incl=* | --inc=*)
-    includedir=$ac_optarg ;;
+    includedir="$ac_optarg" ;;
 
   -infodir | --infodir | --infodi | --infod | --info | --inf)
     ac_prev=infodir ;;
   -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
-    infodir=$ac_optarg ;;
+    infodir="$ac_optarg" ;;
 
   -libdir | --libdir | --libdi | --libd)
     ac_prev=libdir ;;
   -libdir=* | --libdir=* | --libdi=* | --libd=*)
-    libdir=$ac_optarg ;;
+    libdir="$ac_optarg" ;;
 
   -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
   | --libexe | --libex | --libe)
     ac_prev=libexecdir ;;
   -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
   | --libexe=* | --libex=* | --libe=*)
-    libexecdir=$ac_optarg ;;
-
-  -localedir | --localedir | --localedi | --localed | --locale)
-    ac_prev=localedir ;;
-  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
-    localedir=$ac_optarg ;;
+    libexecdir="$ac_optarg" ;;
 
   -localstatedir | --localstatedir | --localstatedi | --localstated \
-  | --localstate | --localstat | --localsta | --localst | --locals)
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
     ac_prev=localstatedir ;;
   -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
-  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
-    localstatedir=$ac_optarg ;;
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir="$ac_optarg" ;;
 
   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
     ac_prev=mandir ;;
   -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
-    mandir=$ac_optarg ;;
+    mandir="$ac_optarg" ;;
 
   -nfp | --nfp | --nf)
     # Obsolete; use --without-fp.
     with_fp=no ;;
 
   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c | -n)
+  | --no-cr | --no-c)
     no_create=yes ;;
 
   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
@@ -917,26 +256,26 @@ do
   -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
   | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
   | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
-    oldincludedir=$ac_optarg ;;
+    oldincludedir="$ac_optarg" ;;
 
   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
     ac_prev=prefix ;;
   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-    prefix=$ac_optarg ;;
+    prefix="$ac_optarg" ;;
 
   -program-prefix | --program-prefix | --program-prefi | --program-pref \
   | --program-pre | --program-pr | --program-p)
     ac_prev=program_prefix ;;
   -program-prefix=* | --program-prefix=* | --program-prefi=* \
   | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-    program_prefix=$ac_optarg ;;
+    program_prefix="$ac_optarg" ;;
 
   -program-suffix | --program-suffix | --program-suffi | --program-suff \
   | --program-suf | --program-su | --program-s)
     ac_prev=program_suffix ;;
   -program-suffix=* | --program-suffix=* | --program-suffi=* \
   | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-    program_suffix=$ac_optarg ;;
+    program_suffix="$ac_optarg" ;;
 
   -program-transform-name | --program-transform-name \
   | --program-transform-nam | --program-transform-na \
@@ -953,17 +292,7 @@ do
   | --program-transfo=* | --program-transf=* \
   | --program-trans=* | --program-tran=* \
   | --progr-tra=* | --program-tr=* | --program-t=*)
-    program_transform_name=$ac_optarg ;;
-
-  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
-    ac_prev=pdfdir ;;
-  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
-    pdfdir=$ac_optarg ;;
-
-  -psdir | --psdir | --psdi | --psd | --ps)
-    ac_prev=psdir ;;
-  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
-    psdir=$ac_optarg ;;
+    program_transform_name="$ac_optarg" ;;
 
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil)
@@ -973,7 +302,7 @@ do
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
   | --sbi=* | --sb=*)
-    sbindir=$ac_optarg ;;
+    sbindir="$ac_optarg" ;;
 
   -sharedstatedir | --sharedstatedir | --sharedstatedi \
   | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
@@ -984,67 +313,58 @@ do
   | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
   | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
   | --sha=* | --sh=*)
-    sharedstatedir=$ac_optarg ;;
+    sharedstatedir="$ac_optarg" ;;
 
   -site | --site | --sit)
     ac_prev=site ;;
   -site=* | --site=* | --sit=*)
-    site=$ac_optarg ;;
+    site="$ac_optarg" ;;
 
   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
     ac_prev=srcdir ;;
   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-    srcdir=$ac_optarg ;;
+    srcdir="$ac_optarg" ;;
 
   -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
   | --syscon | --sysco | --sysc | --sys | --sy)
     ac_prev=sysconfdir ;;
   -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
   | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
-    sysconfdir=$ac_optarg ;;
+    sysconfdir="$ac_optarg" ;;
 
   -target | --target | --targe | --targ | --tar | --ta | --t)
-    ac_prev=target_alias ;;
+    ac_prev=target ;;
   -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-    target_alias=$ac_optarg ;;
+    target="$ac_optarg" ;;
 
   -v | -verbose | --verbose | --verbos | --verbo | --verb)
     verbose=yes ;;
 
-  -version | --version | --versio | --versi | --vers | -V)
-    ac_init_version=: ;;
+  -version | --version | --versio | --versi | --vers)
+    echo "configure generated by autoconf version 2.13"
+    exit 0 ;;
 
   -with-* | --with-*)
-    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid package name: $ac_useropt"
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"with_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
-        ac_unrecognized_sep=', ';;
+    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case "$ac_option" in
+      *=*) ;;
+      *) ac_optarg=yes ;;
     esac
-    eval with_$ac_useropt=\$ac_optarg ;;
+    eval "with_${ac_package}='$ac_optarg'" ;;
 
   -without-* | --without-*)
-    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      as_fn_error $? "invalid package name: $ac_useropt"
-    ac_useropt_orig=$ac_useropt
-    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
-    case $ac_user_opts in
-      *"
-"with_$ac_useropt"
-"*) ;;
-      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
-        ac_unrecognized_sep=', ';;
-    esac
-    eval with_$ac_useropt=no ;;
+    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+    fi
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    eval "with_${ac_package}=no" ;;
 
   --x)
     # Obsolete; use --with-x.
     ac_prev=x_includes ;;
   -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
   | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-    x_includes=$ac_optarg ;;
+    x_includes="$ac_optarg" ;;
 
   -x-libraries | --x-libraries | --x-librarie | --x-librari \
   | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
     ac_prev=x_libraries ;;
   -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-    x_libraries=$ac_optarg ;;
+    x_libraries="$ac_optarg" ;;
 
-  -*) as_fn_error $? "unrecognized option: \`$ac_option'
-Try \`$0 --help' for more information"
+  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
     ;;
 
-  *=*)
-    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
-    # Reject names that are not valid shell variable names.
-    case $ac_envvar in #(
-      '' | [0-9]* | *[!_$as_cr_alnum]* )
-      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
-    esac
-    eval $ac_envvar=\$ac_optarg
-    export $ac_envvar ;;
-
   *)
-    # FIXME: should be removed in autoconf 3.0.
-    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
-    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+      echo "configure: warning: $ac_option: invalid host type" 1>&2
+    fi
+    if test "x$nonopt" != xNONE; then
+      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+    fi
+    nonopt="$ac_option"
     ;;
 
   esac
 done
 
 if test -n "$ac_prev"; then
-  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  as_fn_error $? "missing argument to $ac_option"
+  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
 fi
 
-if test -n "$ac_unrecognized_opts"; then
-  case $enable_option_checking in
-    no) ;;
-    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
-    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
-  esac
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+  exec 6>/dev/null
+else
+  exec 6>&1
 fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
 
-# Check all directory arguments for consistency.
-for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
-               datadir sysconfdir sharedstatedir localstatedir includedir \
-               oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-               libdir localedir mandir
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
 do
-  eval ac_val=\$$ac_var
-  # Remove trailing slashes.
-  case $ac_val in
-    */ )
-      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
-      eval $ac_var=\$ac_val;;
-  esac
-  # Be sure to have absolute directory names.
-  case $ac_val in
-    [\\/$]* | ?:[\\/]* )  continue;;
-    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  case "$ac_arg" in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c) ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+  *" "*|*"     "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
   esac
-  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
 done
 
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
-  if test "x$build_alias" = x; then
-    cross_compiling=maybe
-  elif test "x$build_alias" != "x$host_alias"; then
-    cross_compiling=yes
-  fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
+# NLS nuisances.
+# Only set these to C if already set.  These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
 
-ac_pwd=`pwd` && test -n "$ac_pwd" &&
-ac_ls_di=`ls -di .` &&
-ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  as_fn_error $? "working directory cannot be determined"
-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  as_fn_error $? "pwd does not report name of working directory"
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
 
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=README
 
 # Find the source files, if location was not specified.
 if test -z "$srcdir"; then
   ac_srcdir_defaulted=yes
-  # Try the directory containing this script, then the parent directory.
-  ac_confdir=`$as_dirname -- "$as_myself" ||
-$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$as_myself" : 'X\(//\)[^/]' \| \
-        X"$as_myself" : 'X\(//\)$' \| \
-        X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_myself" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
+  # Try the directory containing this script, then its parent.
+  ac_prog=$0
+  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
   srcdir=$ac_confdir
-  if test ! -r "$srcdir/$ac_unique_file"; then
+  if test ! -r $srcdir/$ac_unique_file; then
     srcdir=..
   fi
 else
   ac_srcdir_defaulted=no
 fi
-if test ! -r "$srcdir/$ac_unique_file"; then
-  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+  else
+    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+  fi
 fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
-ac_abs_confdir=`(
-       cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
-       pwd)`
-# When building in place, set srcdir=.
-if test "$ac_abs_confdir" = "$ac_pwd"; then
-  srcdir=.
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
 fi
-# Remove unnecessary trailing slashes from srcdir.
-# Double slashes in file names in object file debugging info
-# mess up M-x gdb in Emacs.
-case $srcdir in
-*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
-esac
-for ac_var in $ac_precious_vars; do
-  eval ac_env_${ac_var}_set=\${${ac_var}+set}
-  eval ac_env_${ac_var}_value=\$${ac_var}
-  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
-  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    echo "loading site script $ac_site_file"
+    . "$ac_site_file"
+  fi
 done
 
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
-  # Omit some internal or obsolete options to make the list less imposing.
-  # This message is too long to be a string in the A/UX 3.1 sh.
-  cat <<_ACEOF
-\`configure' configures this package to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE.  See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
-  -h, --help              display this help and exit
-      --help=short        display options specific to this package
-      --help=recursive    display the short help of all the included packages
-  -V, --version           display version information and exit
-  -q, --quiet, --silent   do not print \`checking ...' messages
-      --cache-file=FILE   cache test results in FILE [disabled]
-  -C, --config-cache      alias for \`--cache-file=config.cache'
-  -n, --no-create         do not create output files
-      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
-
-Installation directories:
-  --prefix=PREFIX         install architecture-independent files in PREFIX
-                          [$ac_default_prefix]
-  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                          [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
-  --bindir=DIR            user executables [EPREFIX/bin]
-  --sbindir=DIR           system admin executables [EPREFIX/sbin]
-  --libexecdir=DIR        program executables [EPREFIX/libexec]
-  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
-  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
-  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --libdir=DIR            object code libraries [EPREFIX/lib]
-  --includedir=DIR        C header files [PREFIX/include]
-  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
-  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
-  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
-  --infodir=DIR           info documentation [DATAROOTDIR/info]
-  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
-  --mandir=DIR            man documentation [DATAROOTDIR/man]
-  --docdir=DIR            documentation root [DATAROOTDIR/doc/PACKAGE]
-  --htmldir=DIR           html documentation [DOCDIR]
-  --dvidir=DIR            dvi documentation [DOCDIR]
-  --pdfdir=DIR            pdf documentation [DOCDIR]
-  --psdir=DIR             ps documentation [DOCDIR]
-_ACEOF
-
-  cat <<\_ACEOF
-
-X features:
-  --x-includes=DIR    X include files are in DIR
-  --x-libraries=DIR   X library files are in DIR
-
-System types:
-  --build=BUILD     configure for building on BUILD [guessed]
-  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
-_ACEOF
+if test -r "$cache_file"; then
+  echo "loading cache $cache_file"
+  . $cache_file
+else
+  echo "creating cache $cache_file"
+  > $cache_file
 fi
 
-if test -n "$ac_init_help"; then
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+    ac_n= ac_c='
+' ac_t='       '
+  else
+    ac_n=-n ac_c= ac_t=
+  fi
+else
+  ac_n= ac_c='\c' ac_t=
+fi
 
-  cat <<\_ACEOF
 
-Optional Features:
-  --disable-option-checking  ignore unrecognized --enable/--with options
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --disable-sdltest       Do not try to compile and run a test SDL program
 
-Optional Packages:
-  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
-  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)
-  --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)
-  --with-x                use the X Window System
-
-Some influential environment variables:
-  CC          C compiler command
-  CFLAGS      C compiler flags
-  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
-              nonstandard directory <lib dir>
-  LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
-              you have headers in a nonstandard directory <include dir>
-  PKG_CONFIG  path to pkg-config utility
-  PKG_CONFIG_PATH
-              directories to add to pkg-config's search path
-  PKG_CONFIG_LIBDIR
-              path overriding pkg-config's built-in search path
-  SDL_CFLAGS  C compiler flags for SDL, overriding pkg-config
-  SDL_LIBS    linker flags for SDL, overriding pkg-config
-  XMKMF       Path to xmkmf, Makefile generator for X Window System
-  CPP         C preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-Report bugs to the package provider.
-_ACEOF
-ac_status=$?
+ac_aux_dir=
+for ac_dir in $srcdir/../build-scripts; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { echo "configure: error: can not find install-sh or install.sh in $srcdir/../build-scripts" 1>&2; exit 1; }
 fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
 
-if test "$ac_init_help" = "recursive"; then
-  # If there are subdirs, report their specific --help.
-  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d "$ac_dir" ||
-      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
-      continue
-    ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
-  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:560: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+  case $nonopt in
+  NONE)
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+    fi ;;
+  *) host_alias=$nonopt ;;
   esac ;;
 esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
-  .)  # We are building in place.
-    ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-    cd "$ac_dir" || { ac_status=$?; continue; }
-    # Check for guested configure.
-    if test -f "$ac_srcdir/configure.gnu"; then
-      echo &&
-      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
-    elif test -f "$ac_srcdir/configure"; then
-      echo &&
-      $SHELL "$ac_srcdir/configure" --help=recursive
-    else
-      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
-    fi || ac_status=$?
-    cd "$ac_pwd" || { ac_status=$?; break; }
-  done
-fi
 
-test -n "$ac_init_help" && exit $ac_status
-if $ac_init_version; then
-  cat <<\_ACEOF
-configure
-generated by GNU Autoconf 2.69
-
-Copyright (C) 2012 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
-  exit
-fi
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
 
-## ------------------------ ##
-## Autoconf initialization. ##
-## ------------------------ ##
 
-# ac_fn_c_try_compile LINENO
-# --------------------------
-# Try to compile conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_compile ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext
-  if { { ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compile") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_retval=1
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:585: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="gcc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_compile
-
-# ac_fn_c_try_run LINENO
-# ----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
-# that executables *can* be run.
-ac_fn_c_try_run ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then :
-  ac_retval=0
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
 else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-       $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_retval=$ac_status
+  echo "$ac_t""no" 1>&6
 fi
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
 
-} # ac_fn_c_try_run
-
-# ac_fn_c_try_link LINENO
-# -----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_link ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext conftest$ac_exeext
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        test -x conftest$ac_exeext
-       }; then :
-  ac_retval=0
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:615: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_retval=1
-fi
-  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
-  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
-  # interfere with the next link command; also delete a directory that is
-  # left behind by Apple's compiler.  We do this before executing the actions.
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_link
-
-# ac_fn_c_try_cpp LINENO
-# ----------------------
-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_cpp ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if { { ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_prog_rejected=no
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+        ac_prog_rejected=yes
+       continue
+      fi
+      ac_cv_prog_CC="cc"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# -gt 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    set dummy "$ac_dir/$ac_word" "$@"
+    shift
+    ac_cv_prog_CC="$@"
   fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } > conftest.i && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then :
-  ac_retval=0
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-    ac_retval=1
+  echo "$ac_t""no" 1>&6
 fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
 
-} # ac_fn_c_try_cpp
-cat >config.log <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by $as_me, which was
-generated by GNU Autoconf 2.69.  Invocation command line was
-
-  $ $0 $@
-
-_ACEOF
-exec 5>>config.log
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
-
-/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
-/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
-/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    $as_echo "PATH: $as_dir"
-  done
-IFS=$as_save_IFS
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
-  for ac_arg
-  do
-    case $ac_arg in
-    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-    | -silent | --silent | --silen | --sile | --sil)
-      continue ;;
-    *\'*)
-      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    case $ac_pass in
-    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
-    2)
-      as_fn_append ac_configure_args1 " '$ac_arg'"
-      if test $ac_must_keep_next = true; then
-       ac_must_keep_next=false # Got value, back to normal.
-      else
-       case $ac_arg in
-         *=* | --config-cache | -C | -disable-* | --disable-* \
-         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-         | -with-* | --with-* | -without-* | --without-* | --x)
-           case "$ac_configure_args0 " in
-             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-           esac
-           ;;
-         -* ) ac_must_keep_next=true ;;
-       esac
-      fi
-      as_fn_append ac_configure_args " '$ac_arg'"
-      ;;
-    esac
-  done
-done
-{ ac_configure_args0=; unset ac_configure_args0;}
-{ ac_configure_args1=; unset ac_configure_args1;}
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log.  We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
-trap 'exit_status=$?
-  # Save into config.log some information that might help in debugging.
-  {
-    echo
-
-    $as_echo "## ---------------- ##
-## Cache variables. ##
-## ---------------- ##"
-    echo
-    # The following way of writing the cache mishandles newlines in values,
-(
-  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) { eval $ac_var=; unset $ac_var;} ;;
-      esac ;;
-    esac
-  done
-  (set) 2>&1 |
-    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
-    *${as_nl}ac_space=\ *)
-      sed -n \
-       "s/'\''/'\''\\\\'\'''\''/g;
-         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
-      ;; #(
-    *)
-      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
-      ;;
-    esac |
-    sort
-)
-    echo
-
-    $as_echo "## ----------------- ##
-## Output variables. ##
-## ----------------- ##"
-    echo
-    for ac_var in $ac_subst_vars
-    do
-      eval ac_val=\$$ac_var
-      case $ac_val in
-      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-      esac
-      $as_echo "$ac_var='\''$ac_val'\''"
-    done | sort
-    echo
-
-    if test -n "$ac_subst_files"; then
-      $as_echo "## ------------------- ##
-## File substitutions. ##
-## ------------------- ##"
-      echo
-      for ac_var in $ac_subst_files
-      do
-       eval ac_val=\$$ac_var
-       case $ac_val in
-       *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-       esac
-       $as_echo "$ac_var='\''$ac_val'\''"
-      done | sort
-      echo
-    fi
-
-    if test -s confdefs.h; then
-      $as_echo "## ----------- ##
-## confdefs.h. ##
-## ----------- ##"
-      echo
-      cat confdefs.h
-      echo
-    fi
-    test "$ac_signal" != 0 &&
-      $as_echo "$as_me: caught signal $ac_signal"
-    $as_echo "$as_me: exit $exit_status"
-  } >&5
-  rm -f core *.core core.conftest.* &&
-    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
-    exit $exit_status
-' 0
-for ac_signal in 1 2 13 15; do
-  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
-
-$as_echo "/* confdefs.h */" > confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_URL "$PACKAGE_URL"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer an explicitly selected file to automatically selected ones.
-ac_site_file1=NONE
-ac_site_file2=NONE
-if test -n "$CONFIG_SITE"; then
-  # We do not want a PATH search for config.site.
-  case $CONFIG_SITE in #((
-    -*)  ac_site_file1=./$CONFIG_SITE;;
-    */*) ac_site_file1=$CONFIG_SITE;;
-    *)   ac_site_file1=./$CONFIG_SITE;;
-  esac
-elif test "x$prefix" != xNONE; then
-  ac_site_file1=$prefix/share/config.site
-  ac_site_file2=$prefix/etc/config.site
-else
-  ac_site_file1=$ac_default_prefix/share/config.site
-  ac_site_file2=$ac_default_prefix/etc/config.site
-fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
-do
-  test "x$ac_site_file" = xNONE && continue
-  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
-$as_echo "$as_me: loading site script $ac_site_file" >&6;}
-    sed 's/^/| /' "$ac_site_file" >&5
-    . "$ac_site_file" \
-      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5; }
-  fi
-done
-
-if test -r "$cache_file"; then
-  # Some versions of bash will fail to source /dev/null (special files
-  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
-  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
-$as_echo "$as_me: loading cache $cache_file" >&6;}
-    case $cache_file in
-      [\\/]* | ?:[\\/]* ) . "$cache_file";;
-      *)                      . "./$cache_file";;
-    esac
-  fi
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
-$as_echo "$as_me: creating cache $cache_file" >&6;}
-  >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
-  eval ac_old_set=\$ac_cv_env_${ac_var}_set
-  eval ac_new_set=\$ac_env_${ac_var}_set
-  eval ac_old_val=\$ac_cv_env_${ac_var}_value
-  eval ac_new_val=\$ac_env_${ac_var}_value
-  case $ac_old_set,$ac_new_set in
-    set,)
-      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,set)
-      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,);;
-    *)
-      if test "x$ac_old_val" != "x$ac_new_val"; then
-       # differences in whitespace do not lead to failure.
-       ac_old_val_w=`echo x $ac_old_val`
-       ac_new_val_w=`echo x $ac_new_val`
-       if test "$ac_old_val_w" != "$ac_new_val_w"; then
-         { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
-$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-         ac_cache_corrupted=:
-       else
-         { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
-$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
-         eval $ac_var=\$ac_old_val
-       fi
-       { $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
-$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
-       { $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
-$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
-      fi;;
-  esac
-  # Pass precious variables to config.status.
-  if test "$ac_new_set" = set; then
-    case $ac_new_val in
-    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
-    *) ac_arg=$ac_var=$ac_new_val ;;
-    esac
-    case " $ac_configure_args " in
-      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
-      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
-    esac
-  fi
-done
-if $ac_cache_corrupted; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
-$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
-fi
-## -------------------- ##
-## Main body of script. ##
-## -------------------- ##
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-ac_aux_dir=
-for ac_dir in $srcdir/../build-scripts; do
-  if test -f "$ac_dir/install-sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f "$ac_dir/install.sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f "$ac_dir/shtool"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  as_fn_error $? "cannot find install-sh, install.sh, or shtool in $srcdir/../build-scripts" "$LINENO" 5
-fi
-
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
-
-
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
-$as_echo_n "checking build system type... " >&6; }
-if ${ac_cv_build+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
-  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
-  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
-$as_echo "$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
-esac
-build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
-$as_echo_n "checking host system type... " >&6; }
-if ${ac_cv_host+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "x$host_alias" = x; then
-  ac_cv_host=$ac_cv_build
-else
-  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
-esac
-host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-
-
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="gcc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
-          if test -n "$ac_tool_prefix"; then
-    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="${ac_tool_prefix}cc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  fi
-fi
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-       ac_prog_rejected=yes
-       continue
-     fi
-    ac_cv_prog_CC="cc"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# != 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
-  fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl.exe
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
+  if test -z "$CC"; then
+    case "`uname -s`" in
+    *win32* | *WIN32*)
+      # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:666: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="cl"
+      break
+    fi
   done
-IFS=$as_save_IFS
-
+  IFS="$ac_save_ifs"
 fi
 fi
-CC=$ac_cv_prog_CC
+CC="$ac_cv_prog_CC"
 if test -n "$CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+  echo "$ac_t""$CC" 1>&6
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  echo "$ac_t""no" 1>&6
 fi
-
-
-    test -n "$CC" && break
-  done
-fi
-if test -z "$CC"; then
-  ac_ct_CC=$CC
-  for ac_prog in cl.exe
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+ ;;
+    esac
   fi
-done
-  done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
 fi
 
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:698: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
-  test -n "$ac_ct_CC" && break
-done
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext << EOF
+
+#line 709 "configure"
+#include "confdefs.h"
+
+main(){return(0);}
+EOF
+if { (eval echo configure:714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  ac_cv_prog_cc_works=yes
+  # If we can't run a trivial program, we are probably using a cross compiler.
+  if (./conftest; exit) 2>/dev/null; then
+    ac_cv_prog_cc_cross=no
   else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
+    ac_cv_prog_cc_cross=yes
   fi
-fi
-
-fi
-
-
-test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
-
-# Provide some information about the compiler.
-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-for ac_option in --version -v -V -qversion; do
-  { { ac_try="$ac_compiler $ac_option >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    sed '10a\
-... rest of stderr output deleted ...
-         10q' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-  fi
-  rm -f conftest.er1 conftest.err
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-done
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-
-# The possible output files:
-ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
-
-ac_rmfiles=
-for ac_file in $ac_files
-do
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
-    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
-  esac
-done
-rm -f $ac_rmfiles
-
-if { { ac_try="$ac_link_default"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link_default") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
-  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile.  We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
-do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
-       ;;
-    [ab].out )
-       # We found the default executable, but exeext='' is most
-       # certainly right.
-       break;;
-    *.* )
-       if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
-       then :; else
-          ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-       fi
-       # We set ac_cv_exeext here because the later test for it is not
-       # safe: cross compilers may not add the suffix if given an `-o'
-       # argument, so we may need to know it at that point already.
-       # Even if this section looks crufty: it has the advantage of
-       # actually working.
-       break;;
-    * )
-       break;;
-  esac
-done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
-else
-  ac_file=''
-fi
-if test -z "$ac_file"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-ac_exeext=$ac_cv_exeext
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
-if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
-  # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
-    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-         break;;
-    * ) break;;
-  esac
-done
 else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5; }
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_cv_prog_cc_works=no
 fi
-rm -f conftest conftest$ac_cv_exeext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdio.h>
-int
-main ()
-{
-FILE *f = fopen ("conftest.out", "w");
- return ferror (f) || fclose (f) != 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files="$ac_clean_files conftest.out"
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-if test "$cross_compiling" != yes; then
-  { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-  if { ac_try='./conftest$ac_cv_exeext'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-       cross_compiling=yes
-    else
-       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5; }
-    fi
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
-ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
-$as_echo_n "checking for suffix of object files... " >&6; }
-if ${ac_cv_objext+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { { ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_compile") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then :
-  for ac_file in conftest.o conftest.obj conftest.*; do
-  test -f "$ac_file" || continue;
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
-    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
-       break;;
-  esac
-done
+rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:740: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:745: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.c <<EOF
+#ifdef __GNUC__
+  yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:754: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+  ac_cv_prog_gcc=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5; }
+  ac_cv_prog_gcc=no
 fi
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if ${ac_cv_c_compiler_gnu+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
 
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_compiler_gnu=yes
-else
-  ac_compiler_gnu=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
+if test $ac_cv_prog_gcc = yes; then
   GCC=yes
 else
   GCC=
 fi
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if ${ac_cv_prog_cc_g+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_save_c_werror_flag=$ac_c_werror_flag
-   ac_c_werror_flag=yes
-   ac_cv_prog_cc_g=no
-   CFLAGS="-g"
-   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_g=yes
-else
-  CFLAGS=""
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
 
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:773: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_c_werror_flag=$ac_save_c_werror_flag
-        CFLAGS="-g"
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+  echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
   ac_cv_prog_cc_g=yes
+else
+  ac_cv_prog_cc_g=no
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_c_werror_flag=$ac_save_c_werror_flag
+rm -f conftest*
+
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
 if test "$ac_test_CFLAGS" = set; then
-  CFLAGS=$ac_save_CFLAGS
+  CFLAGS="$ac_save_CFLAGS"
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
     CFLAGS="-g -O2"
@@ -2711,183 +799,81 @@ else
     CFLAGS=
   fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdio.h>
-struct stat;
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
-   function prototypes and stuff, but not '\xHH' hex character constants.
-   These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
-   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
-   array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
-_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_prog_cc_c89=$ac_arg
-fi
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
 
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
-  xno)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-if test "x$ac_cv_prog_cc_c89" != xno; then :
 
-fi
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
-$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if ${ac_cv_c_const+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-#ifndef __cplusplus
-  /* Ultrix mips cc rejects this sort of thing.  */
-  typedef int charset[2];
-  const charset cs = { 0, 0 };
-  /* SunOS 4.1.1 cc rejects this.  */
-  char const *const *pcpcc;
-  char **ppc;
-  /* NEC SVR4.0.2 mips cc rejects this.  */
-  struct point {int x, y;};
-  static struct point const zero = {0,0};
-  /* AIX XL C 1.02.0.0 rejects this.
-     It does not let you subtract one const X* pointer from another in
-     an arm of an if-expression whose if-part is not a constant
-     expression */
-  const char *g = "string";
-  pcpcc = &g + (g ? g-g : 0);
-  /* HPUX 7.0 cc rejects these. */
-  ++pcpcc;
-  ppc = (char**) pcpcc;
-  pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this sort of thing.  */
-    char tx;
-    char *t = &tx;
-    char const *s = 0 ? (char *) 0 : (char const *) 0;
-
-    *t++ = 0;
-    if (s) return 0;
-  }
-  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
-    int x[] = {25, 17};
-    const int *foo = &x[0];
-    ++foo;
-  }
-  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
-    typedef const int *iptr;
-    iptr p = 0;
-    ++p;
-  }
-  { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
-       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; } bx;
-    struct s *b = &bx; b->j = 5;
-  }
-  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
-    const int foo = 10;
-    if (!foo) return 0;
-  }
-  return !cs[0] && !zero.x;
-#endif
-
-  ;
-  return 0;
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:807: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 812 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this.  */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this.  */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this.  */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+   It does not let you subtract one const X* pointer from another in an arm
+   of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this.  */
+  char *t;
+  char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+  *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+  int x[] = {25, 17};
+  const int *foo = &x[0];
+  ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+  typedef const int *iptr;
+  iptr p = 0;
+  ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+  struct s { int j; const int *ap[3]; };
+  struct s *b; b->j = 5;
 }
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+  const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:861: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
   ac_cv_c_const=yes
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
   ac_cv_c_const=no
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest*
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
-$as_echo "$ac_cv_c_const" >&6; }
-if test $ac_cv_c_const = no; then
 
-$as_echo "#define const /**/" >>confdefs.h
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+  cat >> confdefs.h <<\EOF
+#define const 
+EOF
 
 fi
 
@@ -2917,7 +903,7 @@ case "$host" in
     *-*-aix*)
         ISUNIX="true"
         EXE=""
-        if test x$ac_cv_c_compiler_gnu = xyes; then
+        if test x$ac_cv_prog_gcc = xyes; then
             CFLAGS="-mthreads"
         fi
         SYS_GL_LIBS=""
@@ -2927,45 +913,40 @@ case "$host" in
         MATHLIB=""
         # Extract the first word of "osmesa-config", so it can be a program name with args.
 set dummy osmesa-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_OSMESA_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:918: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_OSMESA_CONFIG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  case $OSMESA_CONFIG in
-  [\\/]* | ?:[\\/]*)
+  case "$OSMESA_CONFIG" in
+  /*)
   ac_cv_path_OSMESA_CONFIG="$OSMESA_CONFIG" # Let the user override the test with a path.
   ;;
+  ?:/*)                         
+  ac_cv_path_OSMESA_CONFIG="$OSMESA_CONFIG" # Let the user override the test with a dos path.
+  ;;
   *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_OSMESA_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_OSMESA_CONFIG="$ac_dir/$ac_word"
+      break
+    fi
   done
-IFS=$as_save_IFS
-
+  IFS="$ac_save_ifs"
   test -z "$ac_cv_path_OSMESA_CONFIG" && ac_cv_path_OSMESA_CONFIG="no"
   ;;
 esac
 fi
-OSMESA_CONFIG=$ac_cv_path_OSMESA_CONFIG
+OSMESA_CONFIG="$ac_cv_path_OSMESA_CONFIG"
 if test -n "$OSMESA_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OSMESA_CONFIG" >&5
-$as_echo "$OSMESA_CONFIG" >&6; }
+  echo "$ac_t""$OSMESA_CONFIG" 1>&6
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  echo "$ac_t""no" 1>&6
 fi
 
-
         if test "x$OSMESA_CONFIG" = "xyes"; then
             OSMESA_CFLAGS=`$OSMESA_CONFIG --cflags`
             OSMESA_LIBS=`$OSMESA_CONFIG --libs`
@@ -2999,144 +980,46 @@ esac
 
 
 SDL_VERSION=2.0.0
-
-
-
-
-
+m4_pattern_forbid(^_?PKG_[A-Z_]+$)
+m4_pattern_allow(^PKG_CONFIG(_PATH)?$)
+AC_ARG_VAR(PKG_CONFIG, path to pkg-config utility)
+AC_ARG_VAR(PKG_CONFIG_PATH, directories to add to pkg-config's search path)
+AC_ARG_VAR(PKG_CONFIG_LIBDIR, path overriding pkg-config's built-in search path)
 
 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
-       if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_PKG_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
+       AC_PATH_TOOL(PKG_CONFIG, pkg-config)
 fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
 if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_path_PKG_CONFIG"; then
-  ac_pt_PKG_CONFIG=$PKG_CONFIG
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $ac_pt_PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
-if test -n "$ac_pt_PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
-$as_echo "$ac_pt_PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-  if test "x$ac_pt_PKG_CONFIG" = x; then
-    PKG_CONFIG=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    PKG_CONFIG=$ac_pt_PKG_CONFIG
-  fi
-else
-  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
-fi
-
-fi
-if test -n "$PKG_CONFIG"; then
-       _pkg_min_version=0.9.0
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
-$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+       _pkg_min_version=m4_default(, 0.9.0)
+       echo $ac_n "checking pkg-config is at least version $_pkg_min_version""... $ac_c" 1>&6
+echo "configure:996: checking pkg-config is at least version $_pkg_min_version" >&5
        if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+               echo "$ac_t""yes" 1>&6
        else
-               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+               echo "$ac_t""no" 1>&6
                PKG_CONFIG=""
        fi
 fi
-
-# Check whether --with-sdl-prefix was given.
-if test "${with_sdl_prefix+set}" = set; then :
-  withval=$with_sdl_prefix; sdl_prefix="$withval"
+# Check whether --with-sdl-prefix or --without-sdl-prefix was given.
+if test "${with_sdl_prefix+set}" = set; then
+  withval="$with_sdl_prefix"
+  sdl_prefix="$withval"
 else
   sdl_prefix=""
 fi
 
-
-# Check whether --with-sdl-exec-prefix was given.
-if test "${with_sdl_exec_prefix+set}" = set; then :
-  withval=$with_sdl_exec_prefix; sdl_exec_prefix="$withval"
+# Check whether --with-sdl-exec-prefix or --without-sdl-exec-prefix was given.
+if test "${with_sdl_exec_prefix+set}" = set; then
+  withval="$with_sdl_exec_prefix"
+  sdl_exec_prefix="$withval"
 else
   sdl_exec_prefix=""
 fi
 
-# Check whether --enable-sdltest was given.
-if test "${enable_sdltest+set}" = set; then :
-  enableval=$enable_sdltest;
+# Check whether --enable-sdltest or --disable-sdltest was given.
+if test "${enable_sdltest+set}" = set; then
+  enableval="$enable_sdltest"
+  :
 else
   enable_sdltest=yes
 fi
@@ -3145,50 +1028,21 @@ fi
   min_sdl_version=$SDL_VERSION
 
   if test "x$sdl_prefix$sdl_exec_prefix" = x ; then
-
+    AC_ARG_VAR(SDL_CFLAGS, C compiler flags for SDL, overriding pkg-config)AC_ARG_VAR(SDL_LIBS, linker flags for SDL, overriding pkg-config)
 pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SDL" >&5
-$as_echo_n "checking for SDL... " >&6; }
-
-if test -n "$SDL_CFLAGS"; then
-    pkg_cv_SDL_CFLAGS="$SDL_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_SDL_CFLAGS=`$PKG_CONFIG --cflags "sdl2 >= $min_sdl_version" 2>/dev/null`
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-if test -n "$SDL_LIBS"; then
-    pkg_cv_SDL_LIBS="$SDL_LIBS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sdl2 >= \$min_sdl_version\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "sdl2 >= $min_sdl_version") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_SDL_LIBS=`$PKG_CONFIG --libs "sdl2 >= $min_sdl_version" 2>/dev/null`
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
+echo $ac_n "checking for SDL""... $ac_c" 1>&6
+echo "configure:1035: checking for SDL" >&5
 
+_PKG_CONFIG(SDL_CFLAGS, cflags, sdl2 >= $min_sdl_version)
+_PKG_CONFIG(SDL_LIBS, libs, sdl2 >= $min_sdl_version)
 
+m4_define(_PKG_TEXT, Alternatively, you may set the environment variables SDL[]_CFLAGS
+and SDL[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.)
 
 if test $pkg_failed = yes; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
+       echo "$ac_t""no" 1>&6
+        
 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
         _pkg_short_errors_supported=yes
 else
@@ -3196,22 +1050,37 @@ else
 fi
         if test $_pkg_short_errors_supported = yes; then
                SDL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "sdl2 >= $min_sdl_version" 2>&1`
-        else
+        else 
                SDL_PKG_ERRORS=`$PKG_CONFIG --print-errors "sdl2 >= $min_sdl_version" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
-       echo "$SDL_PKG_ERRORS" >&5
+       echo "$SDL_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+       m4_default(sdl_pc=no, AC_MSG_ERROR(
+[Package requirements (sdl2 >= $min_sdl_version) were not met:
+
+$SDL_PKG_ERRORS
 
-       sdl_pc=no
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])dnl
+        )
 elif test $pkg_failed = untried; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-       sdl_pc=no
+       echo "$ac_t""no" 1>&6
+       m4_default(sdl_pc=no, AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
+        )
 else
        SDL_CFLAGS=$pkg_cv_SDL_CFLAGS
        SDL_LIBS=$pkg_cv_SDL_LIBS
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+        echo "$ac_t""yes" 1>&6
        sdl_pc=yes
 fi
   else
@@ -3240,48 +1109,43 @@ fi
     fi
     # Extract the first word of "sdl2-config", so it can be a program name with args.
 set dummy sdl2-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_SDL_CONFIG+:} false; then :
-  $as_echo_n "(cached) " >&6
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1114: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_SDL_CONFIG'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  case $SDL_CONFIG in
-  [\\/]* | ?:[\\/]*)
+  case "$SDL_CONFIG" in
+  /*)
   ac_cv_path_SDL_CONFIG="$SDL_CONFIG" # Let the user override the test with a path.
   ;;
+  ?:/*)                         
+  ac_cv_path_SDL_CONFIG="$SDL_CONFIG" # Let the user override the test with a dos path.
+  ;;
   *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_SDL_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_SDL_CONFIG="$ac_dir/$ac_word"
+      break
+    fi
   done
-IFS=$as_save_IFS
-
+  IFS="$ac_save_ifs"
   test -z "$ac_cv_path_SDL_CONFIG" && ac_cv_path_SDL_CONFIG="no"
   ;;
 esac
 fi
-SDL_CONFIG=$ac_cv_path_SDL_CONFIG
+SDL_CONFIG="$ac_cv_path_SDL_CONFIG"
 if test -n "$SDL_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SDL_CONFIG" >&5
-$as_echo "$SDL_CONFIG" >&6; }
+  echo "$ac_t""$SDL_CONFIG" 1>&6
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  echo "$ac_t""no" 1>&6
 fi
 
-
     PATH="$as_save_PATH"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SDL - version >= $min_sdl_version" >&5
-$as_echo_n "checking for SDL - version >= $min_sdl_version... " >&6; }
+    echo $ac_n "checking for SDL - version >= $min_sdl_version""... $ac_c" 1>&6
+echo "configure:1149: checking for SDL - version >= $min_sdl_version" >&5
     no_sdl=""
 
     if test "$SDL_CONFIG" = "no" ; then
@@ -3304,11 +1168,12 @@ $as_echo_n "checking for SDL - version >= $min_sdl_version... " >&6; }
         CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
         LIBS="$LIBS $SDL_LIBS"
       rm -f conf.sdltest
-      if test "$cross_compiling" = yes; then :
+      if test "$cross_compiling" = yes; then
   echo $ac_n "cross compiling; assumed OK... $ac_c"
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+  cat > conftest.$ac_ext <<EOF
+#line 1176 "configure"
+#include "confdefs.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -3319,7 +1184,7 @@ char*
 my_strdup (char *str)
 {
   char *new_str;
-
+  
   if (str)
     {
       new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
@@ -3327,7 +1192,7 @@ my_strdup (char *str)
     }
   else
     new_str = NULL;
-
+  
   return new_str;
 }
 
@@ -3367,14 +1232,17 @@ int main (int argc, char *argv[])
 }
 
 
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
+EOF
+if { (eval echo configure:1237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  :
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
   no_sdl=yes
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -fr conftest*
 fi
 
         CFLAGS="$ac_save_CFLAGS"
@@ -3383,11 +1251,9 @@ fi
       fi
     fi
     if test "x$no_sdl" = x ; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+      echo "$ac_t""yes" 1>&6
     else
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+      echo "$ac_t""no" 1>&6
     fi
   fi
   if test "x$no_sdl" = x ; then
@@ -3406,8 +1272,9 @@ $as_echo "no" >&6; }
           CFLAGS="$CFLAGS $SDL_CFLAGS"
           CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
           LIBS="$LIBS $SDL_LIBS"
-          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+          cat > conftest.$ac_ext <<EOF
+#line 1277 "configure"
+#include "confdefs.h"
 
 #include <stdio.h>
 #include "SDL.h"
@@ -3417,15 +1284,12 @@ int main(int argc, char *argv[])
 #undef  main
 #define main K_and_R_C_main
 
-int
-main ()
-{
- return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+int main() {
+ return 0; 
+; return 0; }
+EOF
+if { (eval echo configure:1292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
    echo "*** The test program compiled, but did not run. This usually means"
           echo "*** that the run-time linker is not finding SDL or finding the wrong"
           echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
@@ -3436,175 +1300,123 @@ if ac_fn_c_try_link "$LINENO"; then :
           echo "*** If you have an old version installed, it is best to remove it, although"
           echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
 else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
    echo "*** The test program failed to compile or link. See the file config.log for the"
           echo "*** exact error that occured. This usually means SDL was incorrectly installed"
           echo "*** or that you have moved SDL since it was installed. In the latter case, you"
-          echo "*** may want to edit the sdl2-config script: $SDL_CONFIG"
+          echo "*** may want to edit the sdl2-config script: $SDL_CONFIG" 
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
+rm -f conftest*
           CFLAGS="$ac_save_CFLAGS"
-          CXXFLAGS="$ac_save_CXXFLAGS"
-          LIBS="$ac_save_LIBS"
-       fi
-     fi
-     SDL_CFLAGS=""
-     SDL_LIBS=""
-     as_fn_error $? "*** SDL version $SDL_VERSION not found!" "$LINENO" 5
-
-  fi
-
-
-  rm -f conf.sdltest
-
-CFLAGS="$CFLAGS $SDL_CFLAGS"
-LIBS="$LIBS -lSDL2_test $SDL_LIBS"
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-  if ${ac_cv_prog_CPP+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-                    Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-  break
-fi
-
-    done
-    ac_cv_prog_CPP=$CPP
-
-fi
-  CPP=$ac_cv_prog_CPP
-else
-  ac_cv_prog_CPP=$CPP
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-                    Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
-else
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-
-else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
+          CXXFLAGS="$ac_save_CXXFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     SDL_CFLAGS=""
+     SDL_LIBS=""
+     { echo "configure: error: *** SDL version $SDL_VERSION not found!" 1>&2; exit 1; }
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5
-$as_echo_n "checking for X... " >&6; }
+  fi
+  
+  
+  rm -f conf.sdltest
 
+CFLAGS="$CFLAGS $SDL_CFLAGS"
+LIBS="$LIBS -lSDL2_test $SDL_LIBS"
 
-# Check whether --with-x was given.
-if test "${with_x+set}" = set; then :
-  withval=$with_x;
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1331: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    # This must be in double quotes, not single quotes, because CPP may get
+  # substituted into the Makefile and "${CC-cc}" will confuse make.
+  CPP="${CC-cc} -E"
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp.
+  cat > conftest.$ac_ext <<EOF
+#line 1346 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1352: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -E -traditional-cpp"
+  cat > conftest.$ac_ext <<EOF
+#line 1363 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1369: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 1380 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1386: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+  ac_cv_prog_CPP="$CPP"
+fi
+  CPP="$ac_cv_prog_CPP"
+else
+  ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+# If we find X, set shell vars x_includes and x_libraries to the
+# paths, otherwise set no_x=yes.
+# Uses ac_ vars as temps to allow command line to override cache and checks.
+# --without-x overrides everything else, but does not touch the cache.
+echo $ac_n "checking for X""... $ac_c" 1>&6
+echo "configure:1415: checking for X" >&5
+
+# Check whether --with-x or --without-x was given.
+if test "${with_x+set}" = set; then
+  withval="$with_x"
+  :
 fi
 
 # $have_x is `yes', `no', `disabled', or empty when we do not yet know.
@@ -3612,183 +1424,220 @@ if test "x$with_x" = xno; then
   # The user explicitly disabled X.
   have_x=disabled
 else
-  case $x_includes,$x_libraries in #(
-    *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #(
-    *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then :
-  $as_echo_n "(cached) " >&6
+  if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
+    # Both variables are already set.
+    have_x=yes
+  else
+if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
   # One or both of the vars are not set, and there is no cached value.
-ac_x_includes=no ac_x_libraries=no
-rm -f -r conftest.dir
-if mkdir conftest.dir; then
-  cd conftest.dir
-  cat >Imakefile <<'_ACEOF'
-incroot:
-       @echo incroot='${INCROOT}'
-usrlibdir:
-       @echo usrlibdir='${USRLIBDIR}'
-libdir:
-       @echo libdir='${LIBDIR}'
-_ACEOF
-  if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then
-    # GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
-    for ac_var in incroot usrlibdir libdir; do
-      eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
-    done
+ac_x_includes=NO ac_x_libraries=NO
+rm -fr conftestdir
+if mkdir conftestdir; then
+  cd conftestdir
+  # Make sure to not put "make" in the Imakefile rules, since we grep it out.
+  cat > Imakefile <<'EOF'
+acfindx:
+       @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
+EOF
+  if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
+    # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+    eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
     # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
-    for ac_extension in a so sl dylib la dll; do
-      if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" &&
-        test -f "$ac_im_libdir/libX11.$ac_extension"; then
-       ac_im_usrlibdir=$ac_im_libdir; break
+    for ac_extension in a so sl; do
+      if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
+        test -f $ac_im_libdir/libX11.$ac_extension; then
+        ac_im_usrlibdir=$ac_im_libdir; break
       fi
     done
     # Screen out bogus values from the imake configuration.  They are
     # bogus both because they are the default anyway, and because
     # using them would break gcc on systems where it needs fixed includes.
-    case $ac_im_incroot in
-       /usr/include) ac_x_includes= ;;
-       *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
+    case "$ac_im_incroot" in
+       /usr/include) ;;
+       *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
     esac
-    case $ac_im_usrlibdir in
-       /usr/lib | /usr/lib64 | /lib | /lib64) ;;
-       *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
+    case "$ac_im_usrlibdir" in
+       /usr/lib | /lib) ;;
+       *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
     esac
   fi
   cd ..
-  rm -f -r conftest.dir
+  rm -fr conftestdir
 fi
 
-# Standard set of common directories for X headers.
-# Check X11 before X11Rn because it is often a symlink to the current release.
-ac_x_header_dirs='
-/usr/X11/include
-/usr/X11R7/include
-/usr/X11R6/include
-/usr/X11R5/include
-/usr/X11R4/include
-
-/usr/include/X11
-/usr/include/X11R7
-/usr/include/X11R6
-/usr/include/X11R5
-/usr/include/X11R4
-
-/usr/local/X11/include
-/usr/local/X11R7/include
-/usr/local/X11R6/include
-/usr/local/X11R5/include
-/usr/local/X11R4/include
-
-/usr/local/include/X11
-/usr/local/include/X11R7
-/usr/local/include/X11R6
-/usr/local/include/X11R5
-/usr/local/include/X11R4
-
-/usr/X386/include
-/usr/x386/include
-/usr/XFree86/include/X11
-
-/usr/include
-/usr/local/include
-/usr/unsupported/include
-/usr/athena/include
-/usr/local/x11r5/include
-/usr/lpp/Xamples/include
-
-/usr/openwin/include
-/usr/openwin/share/include'
-
-if test "$ac_x_includes" = no; then
-  # Guess where to find include files, by looking for Xlib.h.
+if test "$ac_x_includes" = NO; then
+  # Guess where to find include files, by looking for this one X11 .h file.
+  test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
+
   # First, try using that file with no special directory specified.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <X11/Xlib.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
+cat > conftest.$ac_ext <<EOF
+#line 1477 "configure"
+#include "confdefs.h"
+#include <$x_direct_test_include>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1482: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
   # We can compile using X headers with no special include directory.
 ac_x_includes=
 else
-  for ac_dir in $ac_x_header_dirs; do
-  if test -r "$ac_dir/X11/Xlib.h"; then
-    ac_x_includes=$ac_dir
-    break
-  fi
-done
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  # Look for the header file in a standard set of common directories.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+  for ac_dir in               \
+    /usr/X11/include          \
+    /usr/X11R6/include        \
+    /usr/X11R5/include        \
+    /usr/X11R4/include        \
+                              \
+    /usr/include/X11          \
+    /usr/include/X11R6        \
+    /usr/include/X11R5        \
+    /usr/include/X11R4        \
+                              \
+    /usr/local/X11/include    \
+    /usr/local/X11R6/include  \
+    /usr/local/X11R5/include  \
+    /usr/local/X11R4/include  \
+                              \
+    /usr/local/include/X11    \
+    /usr/local/include/X11R6  \
+    /usr/local/include/X11R5  \
+    /usr/local/include/X11R4  \
+                              \
+    /usr/X386/include         \
+    /usr/x386/include         \
+    /usr/XFree86/include/X11  \
+                              \
+    /usr/include              \
+    /usr/local/include        \
+    /usr/unsupported/include  \
+    /usr/athena/include       \
+    /usr/local/x11r5/include  \
+    /usr/lpp/Xamples/include  \
+                              \
+    /usr/openwin/include      \
+    /usr/openwin/share/include \
+    ; \
+  do
+    if test -r "$ac_dir/$x_direct_test_include"; then
+      ac_x_includes=$ac_dir
+      break
+    fi
+  done
 fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-fi # $ac_x_includes = no
+rm -f conftest*
+fi # $ac_x_includes = NO
 
-if test "$ac_x_libraries" = no; then
+if test "$ac_x_libraries" = NO; then
   # Check for the libraries.
+
+  test -z "$x_direct_test_library" && x_direct_test_library=Xt
+  test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
+
   # See if we find them without any special options.
   # Don't add to $LIBS permanently.
-  ac_save_LIBS=$LIBS
-  LIBS="-lX11 $LIBS"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <X11/Xlib.h>
-int
-main ()
-{
-XrmInitialize ()
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  LIBS=$ac_save_LIBS
+  ac_save_LIBS="$LIBS"
+  LIBS="-l$x_direct_test_library $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1551 "configure"
+#include "confdefs.h"
+
+int main() {
+${x_direct_test_function}()
+; return 0; }
+EOF
+if { (eval echo configure:1558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
 ac_x_libraries=
 else
-  LIBS=$ac_save_LIBS
-for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  LIBS="$ac_save_LIBS"
+# First see if replacing the include by lib works.
+# Check X11 before X11Rn because it is often a symlink to the current release.
+for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
+    /usr/X11/lib          \
+    /usr/X11R6/lib        \
+    /usr/X11R5/lib        \
+    /usr/X11R4/lib        \
+                          \
+    /usr/lib/X11          \
+    /usr/lib/X11R6        \
+    /usr/lib/X11R5        \
+    /usr/lib/X11R4        \
+                          \
+    /usr/local/X11/lib    \
+    /usr/local/X11R6/lib  \
+    /usr/local/X11R5/lib  \
+    /usr/local/X11R4/lib  \
+                          \
+    /usr/local/lib/X11    \
+    /usr/local/lib/X11R6  \
+    /usr/local/lib/X11R5  \
+    /usr/local/lib/X11R4  \
+                          \
+    /usr/X386/lib         \
+    /usr/x386/lib         \
+    /usr/XFree86/lib/X11  \
+                          \
+    /usr/lib              \
+    /usr/local/lib        \
+    /usr/unsupported/lib  \
+    /usr/athena/lib       \
+    /usr/local/x11r5/lib  \
+    /usr/lpp/Xamples/lib  \
+    /lib/usr/lib/X11     \
+                          \
+    /usr/openwin/lib      \
+    /usr/openwin/share/lib \
+    ; \
 do
-  # Don't even attempt the hair of trying to link an X program!
-  for ac_extension in a so sl dylib la dll; do
-    if test -r "$ac_dir/libX11.$ac_extension"; then
+  for ac_extension in a so sl; do
+    if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
       ac_x_libraries=$ac_dir
       break 2
     fi
   done
 done
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi # $ac_x_libraries = no
-
-case $ac_x_includes,$ac_x_libraries in #(
-  no,* | *,no | *\'*)
-    # Didn't find X, or a directory has "'" in its name.
-    ac_cv_have_x="have_x=no";; #(
-  *)
-    # Record where we found X for the cache.
-    ac_cv_have_x="have_x=yes\
-       ac_x_includes='$ac_x_includes'\
-       ac_x_libraries='$ac_x_libraries'"
-esac
+rm -f conftest*
+fi # $ac_x_libraries = NO
+
+if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
+  # Didn't find X anywhere.  Cache the known absence of X.
+  ac_cv_have_x="have_x=no"
+else
+  # Record where we found X for the cache.
+  ac_cv_have_x="have_x=yes \
+               ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
 fi
-;; #(
-    *) have_x=yes;;
-  esac
+fi
+  fi
   eval "$ac_cv_have_x"
 fi # $with_x != no
 
 if test "$have_x" != yes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5
-$as_echo "$have_x" >&6; }
+  echo "$ac_t""$have_x" 1>&6
   no_x=yes
 else
   # If each of the values was on the command line, it overrides each guess.
   test "x$x_includes" = xNONE && x_includes=$ac_x_includes
   test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
   # Update the cache value to reflect the command line values.
-  ac_cv_have_x="have_x=yes\
-       ac_x_includes='$x_includes'\
-       ac_x_libraries='$x_libraries'"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5
-$as_echo "libraries $x_libraries, headers $x_includes" >&6; }
+  ac_cv_have_x="have_x=yes \
+               ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
+  echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6
 fi
 
 if test x$have_x = xyes; then
@@ -3810,37 +1659,38 @@ if test x$have_x = xyes; then
     fi
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL support" >&5
-$as_echo_n "checking for OpenGL support... " >&6; }
+echo $ac_n "checking for OpenGL support""... $ac_c" 1>&6
+echo "configure:1664: checking for OpenGL support" >&5
 have_opengl=no
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+cat > conftest.$ac_ext <<EOF
+#line 1667 "configure"
+#include "confdefs.h"
 
  #include "SDL_opengl.h"
 
-int
-main ()
-{
-
+int main() {
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
 
+; return 0; }
+EOF
+if { (eval echo configure:1677: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
 have_opengl=yes
 
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengl" >&5
-$as_echo "$have_opengl" >&6; }
+rm -f conftest*
+echo "$ac_t""$have_opengl" 1>&6
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES support" >&5
-$as_echo_n "checking for OpenGL ES support... " >&6; }
+echo $ac_n "checking for OpenGL ES support""... $ac_c" 1>&6
+echo "configure:1690: checking for OpenGL ES support" >&5
 have_opengles=no
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+cat > conftest.$ac_ext <<EOF
+#line 1693 "configure"
+#include "confdefs.h"
 
  #if defined (__IPHONEOS__)
     #include <OpenGLES/ES1/gl.h>
@@ -3848,29 +1698,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     #include <GLES/gl.h>
  #endif /* __QNXNTO__ */
 
-int
-main ()
-{
-
+int main() {
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
 
+; return 0; }
+EOF
+if { (eval echo configure:1707: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
 have_opengles=yes
 
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengles" >&5
-$as_echo "$have_opengles" >&6; }
+rm -f conftest*
+echo "$ac_t""$have_opengles" 1>&6
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenGL ES2 support" >&5
-$as_echo_n "checking for OpenGL ES2 support... " >&6; }
+echo $ac_n "checking for OpenGL ES2 support""... $ac_c" 1>&6
+echo "configure:1720: checking for OpenGL ES2 support" >&5
 have_opengles2=no
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+cat > conftest.$ac_ext <<EOF
+#line 1723 "configure"
+#include "confdefs.h"
 
  #if defined (__IPHONEOS__)
     #include <OpenGLES/ES2/gl.h>
@@ -3880,23 +1730,22 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     #include <GLES2/gl2ext.h>
  #endif
 
-int
-main ()
-{
-
+int main() {
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
 
+; return 0; }
+EOF
+if { (eval echo configure:1739: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  
 have_opengles2=yes
 
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_opengles2" >&5
-$as_echo "$have_opengles2" >&6; }
+rm -f conftest*
+echo "$ac_t""$have_opengles2" 1>&6
 
 GLLIB=""
 GLESLIB=""
@@ -3919,44 +1768,44 @@ fi
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TTF_Init in -lSDL2_ttf" >&5
-$as_echo_n "checking for TTF_Init in -lSDL2_ttf... " >&6; }
-if ${ac_cv_lib_SDL2_ttf_TTF_Init+:} false; then :
-  $as_echo_n "(cached) " >&6
+echo $ac_n "checking for TTF_Init in -lSDL2_ttf""... $ac_c" 1>&6
+echo "configure:1773: checking for TTF_Init in -lSDL2_ttf" >&5
+ac_lib_var=`echo SDL2_ttf'_'TTF_Init | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_check_lib_save_LIBS=$LIBS
+  ac_save_LIBS="$LIBS"
 LIBS="-lSDL2_ttf  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char TTF_Init ();
-int
-main ()
-{
-return TTF_Init ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_SDL2_ttf_TTF_Init=yes
-else
-  ac_cv_lib_SDL2_ttf_TTF_Init=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL2_ttf_TTF_Init" >&5
-$as_echo "$ac_cv_lib_SDL2_ttf_TTF_Init" >&6; }
-if test "x$ac_cv_lib_SDL2_ttf_TTF_Init" = xyes; then :
+cat > conftest.$ac_ext <<EOF
+#line 1781 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char TTF_Init();
+
+int main() {
+TTF_Init()
+; return 0; }
+EOF
+if { (eval echo configure:1792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
   have_SDL_ttf=yes
+else
+  echo "$ac_t""no" 1>&6
 fi
 
 if test x$have_SDL_ttf = xyes; then
@@ -3965,1160 +1814,275 @@ if test x$have_SDL_ttf = xyes; then
 fi
 
 
-ac_config_files="$ac_config_files Makefile"
-
-cat >confcache <<\_ACEOF
+trap '' 1 2 15
+cat > confcache <<\EOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems.  If it contains results you don't
-# want to keep, you may remove or edit it.
+# scripts and configure runs.  It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
 #
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already.  You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
 #
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
+EOF
 # The following way of writing the cache mishandles newlines in values,
 # but we know of no workaround that is simple, portable, and efficient.
-# So, we kill variables containing newlines.
+# So, don't put newlines in cache variables' values.
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
-(
-  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) { eval $ac_var=; unset $ac_var;} ;;
-      esac ;;
-    esac
-  done
-
-  (set) 2>&1 |
-    case $as_nl`(ac_space=' '; set) 2>&1` in #(
-    *${as_nl}ac_space=\ *)
-      # `set' does not quote correctly, so add quotes: double-quote
-      # substitution turns \\\\ into \\, and sed turns \\ into \.
-      sed -n \
-       "s/'/'\\\\''/g;
-         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
-      ;; #(
-    *)
-      # `set' quotes correctly as required by POSIX, so do not add quotes.
-      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
-      ;;
-    esac |
-    sort
-) |
-  sed '
-     /^ac_cv_env_/b end
-     t clear
-     :clear
-     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
-     t end
-     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
-     :end' >>confcache
-if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
-  if test -w "$cache_file"; then
-    if test "x$cache_file" != "x/dev/null"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
-$as_echo "$as_me: updating cache $cache_file" >&6;}
-      if test ! -f "$cache_file" || test -h "$cache_file"; then
-       cat confcache >"$cache_file"
-      else
-        case $cache_file in #(
-        */* | ?:*)
-         mv -f confcache "$cache_file"$$ &&
-         mv -f "$cache_file"$$ "$cache_file" ;; #(
-        *)
-         mv -f confcache "$cache_file" ;;
-       esac
-      fi
-    fi
+(set) 2>&1 |
+  case `(ac_space=' '; set | grep ac_space) 2>&1` in
+  *ac_space=\ *)
+    # `set' does not quote correctly, so add quotes (double-quote substitution
+    # turns \\\\ into \\, and sed turns \\ into \).
+    sed -n \
+      -e "s/'/'\\\\''/g" \
+      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+    ;;
+  *)
+    # `set' quotes correctly as required by POSIX, so do not add quotes.
+    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+    ;;
+  esac >> confcache
+if cmp -s $cache_file confcache; then
+  :
+else
+  if test -w $cache_file; then
+    echo "updating cache $cache_file"
+    cat confcache > $cache_file
   else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
-$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+    echo "not updating unwritable cache $cache_file"
   fi
 fi
 rm -f confcache
 
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
 test "x$prefix" = xNONE && prefix=$ac_default_prefix
 # Let make expand exec_prefix.
 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[        ]*VPATH[        ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
 # Transform confdefs.h into DEFS.
 # Protect against shell expansion while executing Makefile rules.
 # Protect against Makefile macro expansion.
-#
-# If the first sed substitution is executed (which looks for macros that
-# take arguments), then branch to the quote section.  Otherwise,
-# look for a macro that doesn't take arguments.
-ac_script='
-:mline
-/\\$/{
- N
- s,\\\n,,
- b mline
-}
-t clear
-:clear
-s/^[    ]*#[    ]*define[       ][      ]*\([^  (][^    (]*([^)]*)\)[   ]*\(.*\)/-D\1=\2/g
-t quote
-s/^[    ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\)/-D\1=\2/g
-t quote
-b any
-:quote
-s/[     `~#$^&*(){}\\|;'\''"<>?]/\\&/g
-s/\[/\\&/g
-s/\]/\\&/g
-s/\$/$$/g
-H
-:any
-${
-       g
-       s/^\n//
-       s/\n/ /g
-       p
-}
-'
-DEFS=`sed -n "$ac_script" confdefs.h`
-
-
-ac_libobjs=
-ac_ltlibobjs=
-U=
-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
-  # 1. Remove the extension, and $U if already installed.
-  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
-  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
-  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
-  #    will be set to the directory where LIBOBJS objects are built.
-  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
-  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
-
-
-: "${CONFIG_STATUS=./config.status}"
-ac_write_fail=0
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-as_write_fail=0
-cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
-#! $SHELL
-# Generated by $as_me.
+cat > conftest.defs <<\EOF
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
+s%[    `~#$^&*(){}\\|;'"<>?]%\\&%g
+s%\[%\\&%g
+s%\]%\\&%g
+s%\$%$$%g
+EOF
+DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
+rm -f conftest.defs
+
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
 # Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
 # Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-
-SHELL=\${CONFIG_SHELL-$SHELL}
-export SHELL
-_ASEOF
-cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
-## -------------------- ##
-## M4sh Initialization. ##
-## -------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in #(
-  *posix*) :
-    set -o posix ;; #(
-  *) :
-     ;;
-esac
-fi
-
-
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
-    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='print -r --'
-  as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='printf %s\n'
-  as_echo_n='printf %s'
-else
-  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
-    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
-    as_echo_n='/usr/ucb/echo -n'
-  else
-    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
-    as_echo_n_body='eval
-      arg=$1;
-      case $arg in #(
-      *"$as_nl"*)
-       expr "X$arg" : "X\\(.*\\)$as_nl";
-       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
-      esac;
-      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
-    '
-    export as_echo_n_body
-    as_echo_n='sh -c $as_echo_n_body as_echo'
-  fi
-  export as_echo_body
-  as_echo='sh -c $as_echo_body as_echo'
-fi
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  PATH_SEPARATOR=:
-  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
-    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
-      PATH_SEPARATOR=';'
-  }
-fi
-
+# configure, is in ./config.log if it exists.
 
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" ""       $as_nl"
-
-# Find who we are.  Look in the path if we contain no directory separator.
-as_myself=
-case $0 in #((
-  *[\\/]* ) as_myself=$0 ;;
-  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
 do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-  done
-IFS=$as_save_IFS
-
-     ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
-  as_myself=$0
-fi
-if test ! -f "$as_myself"; then
-  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  exit 1
-fi
-
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there.  '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
-  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+  case "\$ac_option" in
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
+    exit 0 ;;
+  -help | --help | --hel | --he | --h)
+    echo "\$ac_cs_usage"; exit 0 ;;
+  *) echo "\$ac_cs_usage"; exit 1 ;;
+  esac
 done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
 
-# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+ac_given_srcdir=$srcdir
 
+trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
 
-# as_fn_error STATUS ERROR [LINENO LOG_FD]
-# ----------------------------------------
-# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with STATUS, using 1 if that was 0.
-as_fn_error ()
-{
-  as_status=$1; test $as_status -eq 0 && as_status=1
-  if test "$4"; then
-    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@CC@%$CC%g
+s%@OSMESA_CONFIG@%$OSMESA_CONFIG%g
+s%@EXE@%$EXE%g
+s%@MATHLIB@%$MATHLIB%g
+s%@ISMACOSX@%$ISMACOSX%g
+s%@ISWINDOWS@%$ISWINDOWS%g
+s%@ISUNIX@%$ISUNIX%g
+s%@SDL_CONFIG@%$SDL_CONFIG%g
+s%@SDL_CFLAGS@%$SDL_CFLAGS%g
+s%@SDL_LIBS@%$SDL_LIBS%g
+s%@CPP@%$CPP%g
+s%@GLLIB@%$GLLIB%g
+s%@GLESLIB@%$GLESLIB%g
+s%@GLES2LIB@%$GLES2LIB%g
+s%@XLIB@%$XLIB%g
+s%@SDL_TTF_LIB@%$SDL_TTF_LIB%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+  if test $ac_beg -gt 1; then
+    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+  else
+    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
   fi
-  $as_echo "$as_me: error: $2" >&2
-  as_fn_exit $as_status
-} # as_fn_error
-
-
-# as_fn_set_status STATUS
-# -----------------------
-# Set $? to STATUS, without forking.
-as_fn_set_status ()
-{
-  return $1
-} # as_fn_set_status
-
-# as_fn_exit STATUS
-# -----------------
-# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
-as_fn_exit ()
-{
-  set +e
-  as_fn_set_status $1
-  exit $1
-} # as_fn_exit
-
-# as_fn_unset VAR
-# ---------------
-# Portably unset VAR.
-as_fn_unset ()
-{
-  { eval $1=; unset $1;}
-}
-as_unset=as_fn_unset
-# as_fn_append VAR VALUE
-# ----------------------
-# Append the text in VALUE to the end of the definition contained in VAR. Take
-# advantage of any shell optimizations that allow amortized linear growth over
-# repeated appends, instead of the typical quadratic growth present in naive
-# implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
-  eval 'as_fn_append ()
-  {
-    eval $1+=\$2
-  }'
-else
-  as_fn_append ()
-  {
-    eval $1=\$$1\$2
-  }
-fi # as_fn_append
-
-# as_fn_arith ARG...
-# ------------------
-# Perform arithmetic evaluation on the ARGs, and store the result in the
-# global $as_val. Take advantage of shells that can avoid forks. The arguments
-# must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
-  eval 'as_fn_arith ()
-  {
-    as_val=$(( $* ))
-  }'
-else
-  as_fn_arith ()
-  {
-    as_val=`expr "$@" || test $? -eq 1`
-  }
-fi # as_fn_arith
-
-
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-        X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-           s//\1/
-           q
-         }
-         /^X\/\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\/\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in #(((((
--n*)
-  case `echo 'xy\c'` in
-  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
-  xy)  ECHO_C='\c';;
-  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
-       ECHO_T='        ';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
-  if ln -s conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s='ln -s'
-    # ... but there are two gotchas:
-    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -pR'.
-    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -pR'
-  elif ln conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s=ln
+  if test ! -s conftest.s$ac_file; then
+    ac_more_lines=false
+    rm -f conftest.s$ac_file
   else
-    as_ln_s='cp -pR'
+    if test -z "$ac_sed_cmds"; then
+      ac_sed_cmds="sed -f conftest.s$ac_file"
+    else
+      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+    fi
+    ac_file=`expr $ac_file + 1`
+    ac_beg=$ac_end
+    ac_end=`expr $ac_end + $ac_max_sed_cmds`
   fi
-else
-  as_ln_s='cp -pR'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-
-# as_fn_mkdir_p
-# -------------
-# Create "$as_dir" as a directory, including parents if necessary.
-as_fn_mkdir_p ()
-{
-
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || eval $as_mkdir_p || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$as_dir" : 'X\(//\)[^/]' \| \
-        X"$as_dir" : 'X\(//\)$' \| \
-        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
-
-
-} # as_fn_mkdir_p
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p='mkdir -p "$as_dir"'
-else
-  test -d ./-p && rmdir ./-p
-  as_mkdir_p=false
-fi
-
-
-# as_fn_executable_p FILE
-# -----------------------
-# Test if FILE is an executable regular file.
-as_fn_executable_p ()
-{
-  test -f "$1" && test -x "$1"
-} # as_fn_executable_p
-as_test_x='test -x'
-as_executable_p=as_fn_executable_p
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-exec 6>&1
-## ----------------------------------- ##
-## Main body of $CONFIG_STATUS script. ##
-## ----------------------------------- ##
-_ASEOF
-test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# Save the log message, to keep $0 and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.
-ac_log="
-This file was extended by $as_me, which was
-generated by GNU Autoconf 2.69.  Invocation command line was
-
-  CONFIG_FILES    = $CONFIG_FILES
-  CONFIG_HEADERS  = $CONFIG_HEADERS
-  CONFIG_LINKS    = $CONFIG_LINKS
-  CONFIG_COMMANDS = $CONFIG_COMMANDS
-  $ $0 $@
-
-on `(hostname || uname -n) 2>/dev/null | sed 1q`
-"
-
-_ACEOF
-
-case $ac_config_files in *"
-"*) set x $ac_config_files; shift; ac_config_files=$*;;
-esac
-
-
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-# Files that config.status was made for.
-config_files="$ac_config_files"
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-ac_cs_usage="\
-\`$as_me' instantiates files and other configuration actions
-from templates according to the current configuration.  Unless the files
-and actions are specified as TAGs, all are instantiated by default.
-
-Usage: $0 [OPTION]... [TAG]...
-
-  -h, --help       print this help, then exit
-  -V, --version    print version number and configuration settings, then exit
-      --config     print configuration, then exit
-  -q, --quiet, --silent
-                   do not print progress messages
-  -d, --debug      don't remove temporary files
-      --recheck    update $as_me by reconfiguring in the same conditions
-      --file=FILE[:TEMPLATE]
-                   instantiate the configuration file FILE
-
-Configuration files:
-$config_files
-
-Report bugs to the package provider."
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
-ac_cs_version="\\
-config.status
-configured by $0, generated by GNU Autoconf 2.69,
-  with options \\"\$ac_cs_config\\"
-
-Copyright (C) 2012 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-
-ac_pwd='$ac_pwd'
-srcdir='$srcdir'
-test -n "\$AWK" || AWK=awk
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# The default lists apply if the user does not specify any file.
-ac_need_defaults=:
-while test $# != 0
-do
-  case $1 in
-  --*=?*)
-    ac_option=`expr "X$1" : 'X\([^=]*\)='`
-    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
-    ac_shift=:
-    ;;
-  --*=)
-    ac_option=`expr "X$1" : 'X\([^=]*\)='`
-    ac_optarg=
-    ac_shift=:
-    ;;
-  *)
-    ac_option=$1
-    ac_optarg=$2
-    ac_shift=shift
-    ;;
-  esac
-
-  case $ac_option in
-  # Handling of the options.
-  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-    ac_cs_recheck=: ;;
-  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
-    $as_echo "$ac_cs_version"; exit ;;
-  --config | --confi | --conf | --con | --co | --c )
-    $as_echo "$ac_cs_config"; exit ;;
-  --debug | --debu | --deb | --de | --d | -d )
-    debug=: ;;
-  --file | --fil | --fi | --f )
-    $ac_shift
-    case $ac_optarg in
-    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    '') as_fn_error $? "missing file argument" ;;
-    esac
-    as_fn_append CONFIG_FILES " '$ac_optarg'"
-    ac_need_defaults=false;;
-  --he | --h |  --help | --hel | -h )
-    $as_echo "$ac_cs_usage"; exit ;;
-  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-  | -silent | --silent | --silen | --sile | --sil | --si | --s)
-    ac_cs_silent=: ;;
-
-  # This is an error.
-  -*) as_fn_error $? "unrecognized option: \`$1'
-Try \`$0 --help' for more information." ;;
-
-  *) as_fn_append ac_config_targets " $1"
-     ac_need_defaults=false ;;
-
-  esac
-  shift
 done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
-  exec 6>/dev/null
-  ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-if \$ac_cs_recheck; then
-  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
-  shift
-  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
-  CONFIG_SHELL='$SHELL'
-  export CONFIG_SHELL
-  exec "\$@"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-exec 5>>config.log
-{
-  echo
-  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-  $as_echo "$ac_log"
-} >&5
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-
-# Handling of arguments.
-for ac_config_target in $ac_config_targets
-do
-  case $ac_config_target in
-    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-
-  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+if test -z "$ac_sed_cmds"; then
+  ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case "$ac_file" in
+  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+  *) ac_file_in="${ac_file}.in" ;;
   esac
-done
-
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used.  Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
-  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
-fi
-
-# Have a temporary directory for convenience.  Make it in the build tree
-# simply because there is no reason against having it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Hook for its removal unless debugging.
-# Note that there is a small window in which the directory will not be cleaned:
-# after its creation but before its name has been assigned to `$tmp'.
-$debug ||
-{
-  tmp= ac_tmp=
-  trap 'exit_status=$?
-  : "${ac_tmp:=$tmp}"
-  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
-' 0
-  trap 'as_fn_exit 1' 1 2 13 15
-}
-# Create a (secure) tmp directory for tmp files.
-
-{
-  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -d "$tmp"
-}  ||
-{
-  tmp=./conf$$-$RANDOM
-  (umask 077 && mkdir "$tmp")
-} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
-ac_tmp=$tmp
-
-# Set up the scripts for CONFIG_FILES section.
-# No need to generate them if there are no CONFIG_FILES.
-# This happens for instance with `./config.status config.h'.
-if test -n "$CONFIG_FILES"; then
-
-
-ac_cr=`echo X | tr X '\015'`
-# On cygwin, bash can eat \r inside `` if the user requested igncr.
-# But we know of no other shell where ac_cr would be empty at this
-# point, so we can use a bashism as a fallback.
-if test "x$ac_cr" = x; then
-  eval ac_cr=\$\'\\r\'
-fi
-ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
-if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
-  ac_cs_awk_cr='\\r'
-else
-  ac_cs_awk_cr=$ac_cr
-fi
 
-echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
-_ACEOF
+  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
 
-
-{
-  echo "cat >conf$$subs.awk <<_ACEOF" &&
-  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
-  echo "_ACEOF"
-} >conf$$subs.sh ||
-  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
-  . ./conf$$subs.sh ||
-    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
-
-  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
-  if test $ac_delim_n = $ac_delim_num; then
-    break
-  elif $ac_last_try; then
-    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+  # Remove last slash and all that follows it.  Not all systems have dirname.
+  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+    # The file is in a subdirectory.
+    test ! -d "$ac_dir" && mkdir "$ac_dir"
+    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+    # A "../" for each directory in $ac_dir_suffix.
+    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
   else
-    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+    ac_dir_suffix= ac_dots=
   fi
-done
-rm -f conf$$subs.sh
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
-_ACEOF
-sed -n '
-h
-s/^/S["/; s/!.*/"]=/
-p
-g
-s/^[^!]*!//
-:repl
-t repl
-s/'"$ac_delim"'$//
-t delim
-:nl
-h
-s/\(.\{148\}\)..*/\1/
-t more1
-s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
-p
-n
-b repl
-:more1
-s/["\\]/\\&/g; s/^/"/; s/$/"\\/
-p
-g
-s/.\{148\}//
-t nl
-:delim
-h
-s/\(.\{148\}\)..*/\1/
-t more2
-s/["\\]/\\&/g; s/^/"/; s/$/"/
-p
-b
-:more2
-s/["\\]/\\&/g; s/^/"/; s/$/"\\/
-p
-g
-s/.\{148\}//
-t delim
-' <conf$$subs.awk | sed '
-/^[^""]/{
-  N
-  s/\n//
-}
-' >>$CONFIG_STATUS || ac_write_fail=1
-rm -f conf$$subs.awk
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-_ACAWK
-cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
-  for (key in S) S_is_set[key] = 1
-  FS = "\a"
-
-}
-{
-  line = $ 0
-  nfields = split(line, field, "@")
-  substed = 0
-  len = length(field[1])
-  for (i = 2; i < nfields; i++) {
-    key = field[i]
-    keylen = length(key)
-    if (S_is_set[key]) {
-      value = S[key]
-      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
-      len += length(value) + length(field[++i])
-      substed = 1
-    } else
-      len += 1 + keylen
-  }
-
-  print line
-}
-
-_ACAWK
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
-  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
-else
-  cat
-fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
-  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
-_ACEOF
-
-# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
-# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
-  ac_vpsub='/^[         ]*VPATH[        ]*=[    ]*/{
-h
-s///
-s/^/:/
-s/[     ]*$/:/
-s/:\$(srcdir):/:/g
-s/:\${srcdir}:/:/g
-s/:@srcdir@:/:/g
-s/^:*//
-s/:*$//
-x
-s/\(=[  ]*\).*/\1/
-G
-s/\n//
-s/^[^=]*=[      ]*$//
-}'
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-fi # test -n "$CONFIG_FILES"
-
-
-eval set X "  :F $CONFIG_FILES      "
-shift
-for ac_tag
-do
-  case $ac_tag in
-  :[FHLC]) ac_mode=$ac_tag; continue;;
-  esac
-  case $ac_mode$ac_tag in
-  :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
-  :[FH]-) ac_tag=-:-;;
-  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
-  esac
-  ac_save_IFS=$IFS
-  IFS=:
-  set x $ac_tag
-  IFS=$ac_save_IFS
-  shift
-  ac_file=$1
-  shift
-
-  case $ac_mode in
-  :L) ac_source=$1;;
-  :[FH])
-    ac_file_inputs=
-    for ac_f
-    do
-      case $ac_f in
-      -) ac_f="$ac_tmp/stdin";;
-      *) # Look for the file first in the build tree, then in the source tree
-        # (if the path is not absolute).  The absolute path cannot be DOS-style,
-        # because $ac_f cannot contain `:'.
-        test -f "$ac_f" ||
-          case $ac_f in
-          [\\/$]*) false;;
-          *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
-          esac ||
-          as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
-      esac
-      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
-      as_fn_append ac_file_inputs " '$ac_f'"
-    done
-
-    # Let's still pretend it is `configure' which instantiates (i.e., don't
-    # use $as_me), people would be surprised to read:
-    #    /* config.h.  Generated by config.status.  */
-    configure_input='Generated from '`
-         $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
-       `' by configure.'
-    if test x"$ac_file" != x-; then
-      configure_input="$ac_file.  $configure_input"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
-$as_echo "$as_me: creating $ac_file" >&6;}
-    fi
-    # Neutralize special characters interpreted by sed in replacement strings.
-    case $configure_input in #(
-    *\&* | *\|* | *\\* )
-       ac_sed_conf_input=`$as_echo "$configure_input" |
-       sed 's/[\\\\&|]/\\\\&/g'`;; #(
-    *) ac_sed_conf_input=$configure_input;;
-    esac
 
-    case $ac_tag in
-    *:-:* | *:-) cat >"$ac_tmp/stdin" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
-    esac
-    ;;
+  case "$ac_given_srcdir" in
+  .)  srcdir=.
+      if test -z "$ac_dots"; then top_srcdir=.
+      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+  *) # Relative path.
+    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+    top_srcdir="$ac_dots$ac_given_srcdir" ;;
   esac
 
-  ac_dir=`$as_dirname -- "$ac_file" ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$ac_file" : 'X\(//\)[^/]' \| \
-        X"$ac_file" : 'X\(//\)$' \| \
-        X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$ac_file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-  as_dir="$ac_dir"; as_fn_mkdir_p
-  ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
-  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
-  .)  # We are building in place.
-    ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-
-  case $ac_mode in
-  :F)
-  #
-  # CONFIG_FILE
-  #
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# If the template does not know about datarootdir, expand it.
-# FIXME: This hack should be removed a few years after 2.60.
-ac_datarootdir_hack=; ac_datarootdir_seen=
-ac_sed_dataroot='
-/datarootdir/ {
-  p
-  q
-}
-/@datadir@/p
-/@docdir@/p
-/@infodir@/p
-/@localedir@/p
-/@mandir@/p'
-case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
-*datarootdir*) ac_datarootdir_seen=yes;;
-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-  ac_datarootdir_hack='
-  s&@datadir@&$datadir&g
-  s&@docdir@&$docdir&g
-  s&@infodir@&$infodir&g
-  s&@localedir@&$localedir&g
-  s&@mandir@&$mandir&g
-  s&\\\${datarootdir}&$datarootdir&g' ;;
-esac
-_ACEOF
-
-# Neutralize VPATH when `$srcdir' = `.'.
-# Shell code in configure.ac might set extrasub.
-# FIXME: do we really want to maintain this feature?
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_sed_extra="$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s|@configure_input@|$ac_sed_conf_input|;t t
-s&@top_builddir@&$ac_top_builddir_sub&;t t
-s&@top_build_prefix@&$ac_top_build_prefix&;t t
-s&@srcdir@&$ac_srcdir&;t t
-s&@abs_srcdir@&$ac_abs_srcdir&;t t
-s&@top_srcdir@&$ac_top_srcdir&;t t
-s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
-s&@builddir@&$ac_builddir&;t t
-s&@abs_builddir@&$ac_abs_builddir&;t t
-s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
-$ac_datarootdir_hack
-"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
-  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
-
-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' \
-      "$ac_tmp/out"`; test -z "$ac_out"; } &&
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined" >&5
-$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined" >&2;}
-
-  rm -f "$ac_tmp/stdin"
-  case $ac_file in
-  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
-  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
-  esac \
-  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
- ;;
-
-
 
+  echo creating "$ac_file"
+  rm -f "$ac_file"
+  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+  case "$ac_file" in
+  *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+  *) ac_comsub= ;;
   esac
 
-done # for ac_tag
-
-
-as_fn_exit 0
-_ACEOF
-ac_clean_files=$ac_clean_files_save
-
-test $ac_write_fail = 0 ||
-  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
-
-
-# configure is writing to config.log, and then calls config.status.
-# config.status does its own redirection, appending to config.log.
-# Unfortunately, on DOS this fails, as config.log is still kept open
-# by configure, so config.status won't be able to write to it; its
-# output is simply discarded.  So we exec the FD to /dev/null,
-# effectively closing config.log, so it can be properly (re)opened and
-# appended to by config.status.  When coming back to configure, we
-# need to make the FD available again.
-if test "$no_create" != yes; then
-  ac_cs_success=:
-  ac_config_status_args=
-  test "$silent" = yes &&
-    ac_config_status_args="$ac_config_status_args --quiet"
-  exec 5>/dev/null
-  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
-  exec 5>>config.log
-  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
-  # would make configure fail if this is the last instruction.
-  $ac_cs_success || as_fn_exit 1
-fi
-if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
-$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
-fi
+  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+  sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
 
old mode 100644 (file)
new mode 100755 (executable)
index ec9f528..4f3e479
@@ -86,9 +86,8 @@ loop()
         emscripten_cancel_main_loop();
 }
 #endif
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int i;
     char filename[4096];
@@ -98,18 +97,18 @@ main(int argc, char *argv[])
 
     /* Load the SDL library */
     if (SDL_Init(SDL_INIT_AUDIO) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return (1);
     }
 
     if (argc > 1) {
         SDL_strlcpy(filename, argv[1], sizeof(filename));
     } else {
-        SDL_strlcpy(filename, "sample.wav", sizeof(filename));
+        SDL_strlcpy(filename, "res/sample.wav", sizeof(filename));
     }
     /* Load the wave file into memory */
     if (SDL_LoadWAV(filename, &wave.spec, &wave.sound, &wave.soundlen) == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError());
         quit(1);
     }
 
@@ -127,19 +126,19 @@ main(int argc, char *argv[])
 #endif /* HAVE_SIGNAL_H */
 
     /* Show the list of available drivers */
-    SDL_Log("Available audio drivers:");
+    SDLTest_Log("Available audio drivers:");
     for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
-        SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
+        SDLTest_Log("%i: %s", i, SDL_GetAudioDriver(i));
     }
 
     /* Initialize fillerup() variables */
     if (SDL_OpenAudio(&wave.spec, NULL) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError());
         SDL_FreeWAV(wave.sound);
         quit(2);
     }
 
-    SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
+    SDLTest_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
 
     /* Let the audio run */
     SDL_PauseAudio(0);
@@ -148,7 +147,10 @@ main(int argc, char *argv[])
     emscripten_set_main_loop(loop, 0, 1);
 #else
     while (!done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING))
-        SDL_Delay(1000);
+       {
+        SDL_Delay(10000);
+               done = 1;
+       }
 #endif
 
     /* Clean up on signal */
old mode 100644 (file)
new mode 100755 (executable)
index 85f5bd5..c1d8de1
@@ -61,39 +61,37 @@ loop()
     {
         /* The device from SDL_OpenAudio() is always device #1. */
         const Uint32 queued = SDL_GetQueuedAudioSize(1);
-        SDL_Log("Device has %u bytes queued.\n", (unsigned int) queued);
+        SDLTest_Log("Device has %u bytes queued.\n", (unsigned int) queued);
         if (queued <= 8192) {  /* time to requeue the whole thing? */
             if (SDL_QueueAudio(1, wave.sound, wave.soundlen) == 0) {
-                SDL_Log("Device queued %u more bytes.\n", (unsigned int) wave.soundlen);
+                SDLTest_Log("Device queued %u more bytes.\n", (unsigned int) wave.soundlen);
             } else {
-                SDL_Log("Device FAILED to queue %u more bytes: %s\n", (unsigned int) wave.soundlen, SDL_GetError());
+                SDLTest_Log("Device FAILED to queue %u more bytes: %s\n", (unsigned int) wave.soundlen, SDL_GetError());
             }
         }
     }
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     char filename[4096];
-
     /* Enable standard application logging */
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     /* Load the SDL library */
     if (SDL_Init(SDL_INIT_AUDIO) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return (1);
     }
 
     if (argc > 1) {
         SDL_strlcpy(filename, argv[1], sizeof(filename));
     } else {
-        SDL_strlcpy(filename, "sample.wav", sizeof(filename));
+        SDL_strlcpy(filename, "res/sample.wav", sizeof(filename));
     }
     /* Load the wave file into memory */
     if (SDL_LoadWAV(filename, &wave.spec, &wave.sound, &wave.soundlen) == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError());
         quit(1);
     }
 
@@ -113,7 +111,7 @@ main(int argc, char *argv[])
 
     /* Initialize fillerup() variables */
     if (SDL_OpenAudio(&wave.spec, NULL) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError());
         SDL_FreeWAV(wave.sound);
         quit(2);
     }
@@ -136,7 +134,8 @@ main(int argc, char *argv[])
     {
         loop();
 
-        SDL_Delay(100);  /* let it play for awhile. */
+        SDL_Delay(10000);  /* let it play for awhile. */
+               done = 1;
     }
 #endif
 
diff --git a/test/packaging/sdl_test.spec b/test/packaging/sdl_test.spec
new file mode 100755 (executable)
index 0000000..4317360
--- /dev/null
@@ -0,0 +1,71 @@
+Name:       org.tizen.sdl2_test
+Summary:    sdl2demo
+Version:    0.1
+Release:    1
+Group:      TO_BE/FILLED_IN
+License:    Apache
+Source0:    %{name}-%{version}.tar.gz
+
+BuildRequires:  edje-bin
+BuildRequires:  pkgconfig(dlog)
+
+BuildRequires:  cmake
+BuildRequires:  edje-bin
+BuildRequires:  embryo-bin
+BuildRequires:  gettext-devel
+
+BuildRequires:  pkgconfig(egl)
+BuildRequires:  pkgconfig(glesv2)
+BuildRequires:  pkgconfig(glesv1)
+BuildRequires:  pkgconfig(sdl2)
+
+%define _packagedir /opt/usr/apps/%{name}
+%define _resdir %{_packagedir}/res
+
+
+
+Autoreq: no
+
+
+%description
+Description: sdl_test
+
+%package devel
+Summary:    sdl_test library development headers
+Group:      Development/Libraries
+Requires:   %{name} = %{version}
+
+%description devel
+Web App Service library development headers
+%prep
+%setup -q
+
+%build
+export CFLAGS="$CFLAGS %{?__vd_cflags}  -Wno-error"
+export CXXFLAGS="$CXXFLAGS %{?__vd_cxxflags} -Wno-error"
+cmake . \
+       -DCMAKE_INSTALL_PREFIX=%{_packagedir} \
+       -DPACKAGE_NAME=%{name} \
+       -DVERSION=%{version} \
+       -DTIZEN_VERSION=%{tizen}
+#make %{?jobs:-j%jobs}
+#output different color when make error
+make 2>&1 %{?jobs:-j%jobs} | sed -e 's%^.*: error: .*$%\x1b[37;41m&\x1b[m%' -e  's%^.*: warning: .*$%\x1b[30;43m&\x1b[m%'
+
+%install
+rm -rf %{buildroot}
+
+%make_install
+
+
+%clean
+rm -rf %{buildroot}
+
+%post
+
+%files
+%defattr(-,root,root,-)
+%attr(755,root,root) %{_packagedir}/*
+
+
+%files devel
diff --git a/test/res/AutomationNotify.bmp b/test/res/AutomationNotify.bmp
new file mode 100755 (executable)
index 0000000..5362952
Binary files /dev/null and b/test/res/AutomationNotify.bmp differ
diff --git a/test/res/AutomationTest.bmp b/test/res/AutomationTest.bmp
new file mode 100755 (executable)
index 0000000..b538e4c
Binary files /dev/null and b/test/res/AutomationTest.bmp differ
diff --git a/test/res/InteractiveTest.bmp b/test/res/InteractiveTest.bmp
new file mode 100755 (executable)
index 0000000..d05965a
Binary files /dev/null and b/test/res/InteractiveTest.bmp differ
diff --git a/test/res/axis.bmp b/test/res/axis.bmp
new file mode 100755 (executable)
index 0000000..c7addd3
Binary files /dev/null and b/test/res/axis.bmp differ
diff --git a/test/res/bg.bmp b/test/res/bg.bmp
new file mode 100755 (executable)
index 0000000..ca85940
Binary files /dev/null and b/test/res/bg.bmp differ
diff --git a/test/res/button.bmp b/test/res/button.bmp
new file mode 100755 (executable)
index 0000000..1593cce
Binary files /dev/null and b/test/res/button.bmp differ
diff --git a/test/res/controllermap.bmp b/test/res/controllermap.bmp
new file mode 100755 (executable)
index 0000000..df167f6
Binary files /dev/null and b/test/res/controllermap.bmp differ
diff --git a/test/res/icon.bmp b/test/res/icon.bmp
new file mode 100755 (executable)
index 0000000..cc96356
Binary files /dev/null and b/test/res/icon.bmp differ
diff --git a/test/res/libSDL2-2.0.so b/test/res/libSDL2-2.0.so
new file mode 100755 (executable)
index 0000000..9b69eb2
Binary files /dev/null and b/test/res/libSDL2-2.0.so differ
diff --git a/test/res/loopwave.bmp b/test/res/loopwave.bmp
new file mode 100755 (executable)
index 0000000..dfba54e
Binary files /dev/null and b/test/res/loopwave.bmp differ
diff --git a/test/res/loopwavequeue.bmp b/test/res/loopwavequeue.bmp
new file mode 100755 (executable)
index 0000000..f5b40ef
Binary files /dev/null and b/test/res/loopwavequeue.bmp differ
diff --git a/test/res/moose.dat b/test/res/moose.dat
new file mode 100755 (executable)
index 0000000..1053004
Binary files /dev/null and b/test/res/moose.dat differ
diff --git a/test/res/sample.bmp b/test/res/sample.bmp
new file mode 100755 (executable)
index 0000000..aca8bbc
Binary files /dev/null and b/test/res/sample.bmp differ
diff --git a/test/res/sample.wav b/test/res/sample.wav
new file mode 100755 (executable)
index 0000000..002f815
Binary files /dev/null and b/test/res/sample.wav differ
diff --git a/test/res/test.bmp b/test/res/test.bmp
new file mode 100755 (executable)
index 0000000..7f51b7c
Binary files /dev/null and b/test/res/test.bmp differ
diff --git a/test/res/testadded.bmp b/test/res/testadded.bmp
new file mode 100755 (executable)
index 0000000..5f3e736
Binary files /dev/null and b/test/res/testadded.bmp differ
diff --git a/test/res/testatomic.bmp b/test/res/testatomic.bmp
new file mode 100755 (executable)
index 0000000..33e9ac3
Binary files /dev/null and b/test/res/testatomic.bmp differ
diff --git a/test/res/testaudiohotplug.bmp b/test/res/testaudiohotplug.bmp
new file mode 100755 (executable)
index 0000000..f3a82a0
Binary files /dev/null and b/test/res/testaudiohotplug.bmp differ
diff --git a/test/res/testaudioinfo.bmp b/test/res/testaudioinfo.bmp
new file mode 100755 (executable)
index 0000000..4841fc2
Binary files /dev/null and b/test/res/testaudioinfo.bmp differ
diff --git a/test/res/testchessboard.bmp b/test/res/testchessboard.bmp
new file mode 100755 (executable)
index 0000000..16c6b45
Binary files /dev/null and b/test/res/testchessboard.bmp differ
diff --git a/test/res/testdisplayinfo.bmp b/test/res/testdisplayinfo.bmp
new file mode 100755 (executable)
index 0000000..dbec084
Binary files /dev/null and b/test/res/testdisplayinfo.bmp differ
diff --git a/test/res/testdraw2.bmp b/test/res/testdraw2.bmp
new file mode 100755 (executable)
index 0000000..6c8e44c
Binary files /dev/null and b/test/res/testdraw2.bmp differ
diff --git a/test/res/testdropfile.bmp b/test/res/testdropfile.bmp
new file mode 100755 (executable)
index 0000000..5b1acbc
Binary files /dev/null and b/test/res/testdropfile.bmp differ
diff --git a/test/res/testerror.bmp b/test/res/testerror.bmp
new file mode 100755 (executable)
index 0000000..783d09d
Binary files /dev/null and b/test/res/testerror.bmp differ
diff --git a/test/res/testfile.bmp b/test/res/testfile.bmp
new file mode 100755 (executable)
index 0000000..4fbe794
Binary files /dev/null and b/test/res/testfile.bmp differ
diff --git a/test/res/testfilesystem.bmp b/test/res/testfilesystem.bmp
new file mode 100755 (executable)
index 0000000..4a8fb68
Binary files /dev/null and b/test/res/testfilesystem.bmp differ
diff --git a/test/res/testgles.bmp b/test/res/testgles.bmp
new file mode 100755 (executable)
index 0000000..7fe456a
Binary files /dev/null and b/test/res/testgles.bmp differ
diff --git a/test/res/testgles2.bmp b/test/res/testgles2.bmp
new file mode 100755 (executable)
index 0000000..e474a07
Binary files /dev/null and b/test/res/testgles2.bmp differ
diff --git a/test/res/testhit.bmp b/test/res/testhit.bmp
new file mode 100755 (executable)
index 0000000..1990692
Binary files /dev/null and b/test/res/testhit.bmp differ
diff --git a/test/res/testiconv.bmp b/test/res/testiconv.bmp
new file mode 100755 (executable)
index 0000000..90583c4
Binary files /dev/null and b/test/res/testiconv.bmp differ
diff --git a/test/res/testime.bmp b/test/res/testime.bmp
new file mode 100755 (executable)
index 0000000..da24a4f
Binary files /dev/null and b/test/res/testime.bmp differ
diff --git a/test/res/testintersection.bmp b/test/res/testintersection.bmp
new file mode 100755 (executable)
index 0000000..45fb590
Binary files /dev/null and b/test/res/testintersection.bmp differ
diff --git a/test/res/testkeys.bmp b/test/res/testkeys.bmp
new file mode 100755 (executable)
index 0000000..0689f74
Binary files /dev/null and b/test/res/testkeys.bmp differ
diff --git a/test/res/testloadso.bmp b/test/res/testloadso.bmp
new file mode 100755 (executable)
index 0000000..4bb6912
Binary files /dev/null and b/test/res/testloadso.bmp differ
diff --git a/test/res/testlock.bmp b/test/res/testlock.bmp
new file mode 100755 (executable)
index 0000000..03d3764
Binary files /dev/null and b/test/res/testlock.bmp differ
diff --git a/test/res/testmultiaudio.bmp b/test/res/testmultiaudio.bmp
new file mode 100755 (executable)
index 0000000..a1272fa
Binary files /dev/null and b/test/res/testmultiaudio.bmp differ
diff --git a/test/res/testoverlay2.bmp b/test/res/testoverlay2.bmp
new file mode 100755 (executable)
index 0000000..8680b4f
Binary files /dev/null and b/test/res/testoverlay2.bmp differ
diff --git a/test/res/testplatform.bmp b/test/res/testplatform.bmp
new file mode 100755 (executable)
index 0000000..1519a49
Binary files /dev/null and b/test/res/testplatform.bmp differ
diff --git a/test/res/testrelative.bmp b/test/res/testrelative.bmp
new file mode 100755 (executable)
index 0000000..3849e4a
Binary files /dev/null and b/test/res/testrelative.bmp differ
diff --git a/test/res/testrendercopyex.bmp b/test/res/testrendercopyex.bmp
new file mode 100755 (executable)
index 0000000..1bb3b80
Binary files /dev/null and b/test/res/testrendercopyex.bmp differ
diff --git a/test/res/testrendertarget.bmp b/test/res/testrendertarget.bmp
new file mode 100755 (executable)
index 0000000..99354ce
Binary files /dev/null and b/test/res/testrendertarget.bmp differ
diff --git a/test/res/testresample.bmp b/test/res/testresample.bmp
new file mode 100755 (executable)
index 0000000..00765f4
Binary files /dev/null and b/test/res/testresample.bmp differ
diff --git a/test/res/testscale.bmp b/test/res/testscale.bmp
new file mode 100755 (executable)
index 0000000..278a3a9
Binary files /dev/null and b/test/res/testscale.bmp differ
diff --git a/test/res/testsem.bmp b/test/res/testsem.bmp
new file mode 100755 (executable)
index 0000000..9b84f6b
Binary files /dev/null and b/test/res/testsem.bmp differ
diff --git a/test/res/testshader.bmp b/test/res/testshader.bmp
new file mode 100755 (executable)
index 0000000..55ad4b6
Binary files /dev/null and b/test/res/testshader.bmp differ
diff --git a/test/res/testsprite2.bmp b/test/res/testsprite2.bmp
new file mode 100755 (executable)
index 0000000..f508ffe
Binary files /dev/null and b/test/res/testsprite2.bmp differ
diff --git a/test/res/testspriteminimal.bmp b/test/res/testspriteminimal.bmp
new file mode 100755 (executable)
index 0000000..c9cc47d
Binary files /dev/null and b/test/res/testspriteminimal.bmp differ
diff --git a/test/res/teststreaming.bmp b/test/res/teststreaming.bmp
new file mode 100755 (executable)
index 0000000..0ff3aec
Binary files /dev/null and b/test/res/teststreaming.bmp differ
diff --git a/test/res/testthread.bmp b/test/res/testthread.bmp
new file mode 100755 (executable)
index 0000000..51f2579
Binary files /dev/null and b/test/res/testthread.bmp differ
diff --git a/test/res/testtimer.bmp b/test/res/testtimer.bmp
new file mode 100755 (executable)
index 0000000..91049f0
Binary files /dev/null and b/test/res/testtimer.bmp differ
diff --git a/test/res/testtoturethread.bmp b/test/res/testtoturethread.bmp
new file mode 100755 (executable)
index 0000000..7edae56
Binary files /dev/null and b/test/res/testtoturethread.bmp differ
diff --git a/test/res/testver.bmp b/test/res/testver.bmp
new file mode 100755 (executable)
index 0000000..1c7b456
Binary files /dev/null and b/test/res/testver.bmp differ
diff --git a/test/res/testviewport.bmp b/test/res/testviewport.bmp
new file mode 100755 (executable)
index 0000000..986b2f7
Binary files /dev/null and b/test/res/testviewport.bmp differ
diff --git a/test/res/tobeadded.bmp b/test/res/tobeadded.bmp
new file mode 100755 (executable)
index 0000000..6efe1a9
Binary files /dev/null and b/test/res/tobeadded.bmp differ
diff --git a/test/res/toturethread.bmp b/test/res/toturethread.bmp
new file mode 100755 (executable)
index 0000000..b9c4ee8
Binary files /dev/null and b/test/res/toturethread.bmp differ
diff --git a/test/res/utf8.txt b/test/res/utf8.txt
new file mode 100755 (executable)
index 0000000..aab22f1
--- /dev/null
@@ -0,0 +1,287 @@
+UTF-8 decoder capability and stress test
+----------------------------------------
+
+Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> - 2003-02-19
+
+This test file can help you examine, how your UTF-8 decoder handles
+various types of correct, malformed, or otherwise interesting UTF-8
+sequences. This file is not meant to be a conformance test. It does
+not prescribes any particular outcome and therefore there is no way to
+"pass" or "fail" this test file, even though the texts suggests a
+preferable decoder behaviour at some places. The aim is instead to
+help you think about and test the behaviour of your UTF-8 on a
+systematic collection of unusual inputs. Experience so far suggests
+that most first-time authors of UTF-8 decoders find at least one
+serious problem in their decoder by using this file.
+
+The test lines below cover boundary conditions, malformed UTF-8
+sequences as well as correctly encoded UTF-8 sequences of Unicode code
+points that should never occur in a correct UTF-8 file.
+
+According to ISO 10646-1:2000, sections D.7 and 2.3c, a device
+receiving UTF-8 shall interpret a "malformed sequence in the same way
+that it interprets a character that is outside the adopted subset" and
+"characters that are not within the adopted subset shall be indicated
+to the user" by a receiving device. A quite commonly used approach in
+UTF-8 decoders is to replace any malformed UTF-8 sequence by a
+replacement character (U+FFFD), which looks a bit like an inverted
+question mark, or a similar symbol. It might be a good idea to
+visually distinguish a malformed UTF-8 sequence from a correctly
+encoded Unicode character that is just not available in the current
+font but otherwise fully legal, even though ISO 10646-1 doesn't
+mandate this. In any case, just ignoring malformed sequences or
+unavailable characters does not conform to ISO 10646, will make
+debugging more difficult, and can lead to user confusion.
+
+Please check, whether a malformed UTF-8 sequence is (1) represented at
+all, (2) represented by exactly one single replacement character (or
+equivalent signal), and (3) the following quotation mark after an
+illegal UTF-8 sequence is correctly displayed, i.e. proper
+resynchronization takes place immageately after any malformed
+sequence. This file says "THE END" in the last line, so if you don't
+see that, your decoder crashed somehow before, which should always be
+cause for concern.
+
+All lines in this file are exactly 79 characters long (plus the line
+feed). In addition, all lines end with "|", except for the two test
+lines 2.1.1 and 2.2.1, which contain non-printable ASCII controls
+U+0000 and U+007F. If you display this file with a fixed-width font,
+these "|" characters should all line up in column 79 (right margin).
+This allows you to test quickly, whether your UTF-8 decoder finds the
+correct number of characters in every line, that is whether each
+malformed sequences is replaced by a single replacement character.
+
+Note that as an alternative to the notion of malformed sequence used
+here, it is also a perfectly acceptable (and in some situations even
+preferable) solution to represent each individual byte of a malformed
+sequence by a replacement character. If you follow this strategy in
+your decoder, then please ignore the "|" column.
+
+
+Here come the tests:                                                          |
+                                                                              |
+1  Some correct UTF-8 text                                                    |
+                                                                              |
+(The codepoints for this test are:                                            |
+  U+03BA U+1F79 U+03C3 U+03BC U+03B5  --ryan.)                                |
+                                                                              |
+You should see the Greek word 'kosme':       "κόσμε"                          |
+                                                                              |
+                                                                              |
+2  Boundary condition test cases                                              |
+                                                                              |
+2.1  First possible sequence of a certain length                              |
+                                                                              |
+(byte zero skipped...there's a null added at the end of the test. --ryan.)    |
+                                                                              |
+2.1.2  2 bytes (U-00000080):        "\80"                                       |
+2.1.3  3 bytes (U-00000800):        "à €"                                       |
+2.1.4  4 bytes (U-00010000):        "ð€€"                                       |
+                                                                              |
+(5 and 6 byte sequences were made illegal in rfc3629. --ryan.)                |
+2.1.5  5 bytes (U-00200000):        "øˆ€€€"                                       |
+2.1.6  6 bytes (U-04000000):        "ü„€€€€"                                       |
+                                                                              |
+2.2  Last possible sequence of a certain length                               |
+                                                                              |
+2.2.1  1 byte  (U-0000007F):        "\7f"                                       |
+2.2.2  2 bytes (U-000007FF):        "ß¿"                                       |
+                                                                              |
+(Section 5.3.2 below calls this illegal. --ryan.)                             |
+2.2.3  3 bytes (U-0000FFFF):        "ï¿¿"                                       |
+                                                                              |
+(5 and 6 bytes sequences, and 4 bytes sequences > 0x10FFFF were made illegal  |
+ in rfc3629, so these next three should be replaced with a invalid            |
+ character codepoint. --ryan.)                                                |
+2.2.4  4 bytes (U-001FFFFF):        "÷¿¿¿"                                       |
+2.2.5  5 bytes (U-03FFFFFF):        "û¿¿¿¿"                                       |
+2.2.6  6 bytes (U-7FFFFFFF):        "ý¿¿¿¿¿"                                       |
+                                                                              |
+2.3  Other boundary conditions                                                |
+                                                                              |
+2.3.1  U-0000D7FF = ed 9f bf = "퟿"                                            |
+2.3.2  U-0000E000 = ee 80 80 = ""                                            |
+2.3.3  U-0000FFFD = ef bf bd = "�"                                            |
+2.3.4  U-0010FFFF = f4 8f bf bf = "ô¿¿"                                         |
+                                                                              |
+(This one is bogus in rfc3629. --ryan.)                                       |
+2.3.5  U-00110000 = f4 90 80 80 = "ô€€"                                         |
+                                                                              |
+3  Malformed sequences                                                        |
+                                                                              |
+3.1  Unexpected continuation bytes                                            |
+                                                                              |
+Each unexpected continuation byte should be separately signalled as a         |
+malformed sequence of its own.                                                |
+                                                                              |
+3.1.1  First continuation byte 0x80: "\80"                                      |
+3.1.2  Last  continuation byte 0xbf: "¿"                                      |
+                                                                              |
+3.1.3  2 continuation bytes: "\80¿"                                             |
+3.1.4  3 continuation bytes: "\80¿\80"                                            |
+3.1.5  4 continuation bytes: "\80¿\80¿"                                           |
+3.1.6  5 continuation bytes: "\80¿\80¿\80"                                          |
+3.1.7  6 continuation bytes: "\80¿\80¿\80¿"                                         |
+3.1.8  7 continuation bytes: "\80¿\80¿\80¿\80"                                        |
+                                                                              |
+3.1.9  Sequence of all 64 possible continuation bytes (0x80-0xbf):            |
+                                                                              |
+   "\80\81\82\83\84\85\86\87\88\89\8a\8b\8c\8d\8e\8f                                                          |
+    \90\91\92\93\94\95\96\97\98\99\9a\9b\9c\9d\9e\9f                                                          |
+    Â Â¡Â¢Â£Â¤Â¥Â¦Â§Â¨Â©ÂªÂ«Â¬Â­Â®Â¯                                                          |
+    Â°Â±Â²Â³Â´ÂµÂ¶Â·Â¸Â¹ÂºÂ»Â¼Â½Â¾Â¿"                                                         |
+                                                                              |
+3.2  Lonely start characters                                                  |
+                                                                              |
+3.2.1  All 32 first bytes of 2-byte sequences (0xc0-0xdf),                    |
+       each followed by a space character:                                    |
+                                                                              |
+   "À Ã Ã‚ Ãƒ Ã„ Ã… Ã† Ã‡ Ãˆ Ã‰ ÃŠ Ã‹ ÃŒ Ã ÃŽ Ã                                           |
+    Ã Ã‘ Ã’ Ã“ Ã” Ã• Ã– Ã— Ã˜ Ã™ Ãš Ã› Ãœ Ã Ãž ÃŸ "                                         |
+                                                                              |
+3.2.2  All 16 first bytes of 3-byte sequences (0xe0-0xef),                    |
+       each followed by a space character:                                    |
+                                                                              |
+   "à Ã¡ Ã¢ Ã£ Ã¤ Ã¥ Ã¦ Ã§ Ã¨ Ã© Ãª Ã« Ã¬ Ã­ Ã® Ã¯ "                                         |
+                                                                              |
+3.2.3  All 8 first bytes of 4-byte sequences (0xf0-0xf7),                     |
+       each followed by a space character:                                    |
+                                                                              |
+   "ð Ã± Ã² Ã³ Ã´ Ãµ Ã¶ Ã· "                                                         |
+                                                                              |
+3.2.4  All 4 first bytes of 5-byte sequences (0xf8-0xfb),                     |
+       each followed by a space character:                                    |
+                                                                              |
+   "ø Ã¹ Ãº Ã» "                                                                 |
+                                                                              |
+3.2.5  All 2 first bytes of 6-byte sequences (0xfc-0xfd),                     |
+       each followed by a space character:                                    |
+                                                                              |
+   "ü Ã½ "                                                                     |
+                                                                              |
+3.3  Sequences with last continuation byte missing                            |
+                                                                              |
+All bytes of an incomplete sequence should be signalled as a single           |
+malformed sequence, i.e., you should see only a single replacement            |
+character in each of the next 10 tests. (Characters as in section 2)          |
+                                                                              |
+3.3.1  2-byte sequence with last byte missing (U+0000):     "À"               |
+3.3.2  3-byte sequence with last byte missing (U+0000):     "à\80"               |
+3.3.3  4-byte sequence with last byte missing (U+0000):     "ð\80\80"               |
+3.3.4  5-byte sequence with last byte missing (U+0000):     "ø\80\80\80"               |
+3.3.5  6-byte sequence with last byte missing (U+0000):     "ü\80\80\80\80"               |
+3.3.6  2-byte sequence with last byte missing (U-000007FF): "ß"               |
+3.3.7  3-byte sequence with last byte missing (U-0000FFFF): "ï¿"               |
+3.3.8  4-byte sequence with last byte missing (U-001FFFFF): "÷¿¿"               |
+3.3.9  5-byte sequence with last byte missing (U-03FFFFFF): "û¿¿¿"               |
+3.3.10 6-byte sequence with last byte missing (U-7FFFFFFF): "ý¿¿¿¿"               |
+                                                                              |
+3.4  Concatenation of incomplete sequences                                    |
+                                                                              |
+All the 10 sequences of 3.3 concatenated, you should see 10 malformed         |
+sequences being signalled:                                                    |
+                                                                              |
+   "Àà\80ð\80\80ø\80\80\80ü\80\80\80\80ßï¿÷¿¿û¿¿¿ý¿¿¿¿"                                                               |
+                                                                              |
+3.5  Impossible bytes                                                         |
+                                                                              |
+The following two bytes cannot appear in a correct UTF-8 string               |
+                                                                              |
+3.5.1  fe = "þ"                                                               |
+3.5.2  ff = "ÿ"                                                               |
+3.5.3  fe fe ff ff = "þþÿÿ"                                                   |
+                                                                              |
+4  Overlong sequences                                                         |
+                                                                              |
+The following sequences are not malformed according to the letter of          |
+the Unicode 2.0 standard. However, they are longer then necessary and         |
+a correct UTF-8 encoder is not allowed to produce them. A "safe UTF-8         |
+decoder" should reject them just like malformed sequences for two             |
+reasons: (1) It helps to debug applications if overlong sequences are         |
+not treated as valid representations of characters, because this helps        |
+to spot problems more quickly. (2) Overlong sequences provide                 |
+alternative representations of characters, that could maliciously be          |
+used to bypass filters that check only for ASCII characters. For              |
+instance, a 2-byte encoded line feed (LF) would not be caught by a            |
+line counter that counts only 0x0a bytes, but it would still be               |
+processed as a line feed by an unsafe UTF-8 decoder later in the              |
+pipeline. From a security point of view, ASCII compatibility of UTF-8         |
+sequences means also, that ASCII characters are *only* allowed to be          |
+represented by ASCII bytes in the range 0x00-0x7f. To ensure this             |
+aspect of ASCII compatibility, use only "safe UTF-8 decoders" that            |
+reject overlong UTF-8 sequences for which a shorter encoding exists.          |
+                                                                              |
+4.1  Examples of an overlong ASCII character                                  |
+                                                                              |
+With a safe UTF-8 decoder, all of the following five overlong                 |
+representations of the ASCII character slash ("/") should be rejected         |
+like a malformed UTF-8 sequence, for instance by substituting it with         |
+a replacement character. If you see a slash below, you do not have a          |
+safe UTF-8 decoder!                                                           |
+                                                                              |
+4.1.1 U+002F = c0 af             = "À¯"                                        |
+4.1.2 U+002F = e0 80 af          = "à\80¯"                                        |
+4.1.3 U+002F = f0 80 80 af       = "ð\80\80¯"                                        |
+4.1.4 U+002F = f8 80 80 80 af    = "ø\80\80\80¯"                                        |
+4.1.5 U+002F = fc 80 80 80 80 af = "ü\80\80\80\80¯"                                        |
+                                                                              |
+4.2  Maximum overlong sequences                                               |
+                                                                              |
+Below you see the highest Unicode value that is still resulting in an         |
+overlong sequence if represented with the given number of bytes. This         |
+is a boundary test for safe UTF-8 decoders. All five characters should        |
+be rejected like malformed UTF-8 sequences.                                   |
+                                                                              |
+4.2.1  U-0000007F = c1 bf             = "ÿ"                                   |
+4.2.2  U-000007FF = e0 9f bf          = "à\9f¿"                                   |
+4.2.3  U-0000FFFF = f0 8f bf bf       = "ð\8f¿¿"                                   |
+4.2.4  U-001FFFFF = f8 87 bf bf bf    = "ø\87¿¿¿"                                   |
+4.2.5  U-03FFFFFF = fc 83 bf bf bf bf = "ü\83¿¿¿¿"                                   |
+                                                                              |
+4.3  Overlong representation of the NUL character                             |
+                                                                              |
+The following five sequences should also be rejected like malformed           |
+UTF-8 sequences and should not be treated like the ASCII NUL                  |
+character.                                                                    |
+                                                                              |
+4.3.1  U+0000 = c0 80             = "À\80"                                       |
+4.3.2  U+0000 = e0 80 80          = "à\80\80"                                       |
+4.3.3  U+0000 = f0 80 80 80       = "ð\80\80\80"                                       |
+4.3.4  U+0000 = f8 80 80 80 80    = "ø\80\80\80\80"                                       |
+4.3.5  U+0000 = fc 80 80 80 80 80 = "ü\80\80\80\80\80"                                       |
+                                                                              |
+5  Illegal code positions                                                     |
+                                                                              |
+The following UTF-8 sequences should be rejected like malformed               |
+sequences, because they never represent valid ISO 10646 characters and        |
+a UTF-8 decoder that accepts them might introduce security problems           |
+comparable to overlong UTF-8 sequences.                                       |
+                                                                              |
+5.1 Single UTF-16 surrogates                                                  |
+                                                                              |
+5.1.1  U+D800 = ed a0 80 = "í €"                                                |
+5.1.2  U+DB7F = ed ad bf = "í­¿"                                                |
+5.1.3  U+DB80 = ed ae 80 = "í®€"                                                |
+5.1.4  U+DBFF = ed af bf = "í¯¿"                                                |
+5.1.5  U+DC00 = ed b0 80 = "í°€"                                                |
+5.1.6  U+DF80 = ed be 80 = "í¾€"                                                |
+5.1.7  U+DFFF = ed bf bf = "í¿¿"                                                |
+                                                                              |
+5.2 Paired UTF-16 surrogates                                                  |
+                                                                              |
+5.2.1  U+D800 U+DC00 = ed a0 80 ed b0 80 = "𐀀"                               |
+5.2.2  U+D800 U+DFFF = ed a0 80 ed bf bf = "𐏿"                               |
+5.2.3  U+DB7F U+DC00 = ed ad bf ed b0 80 = "í­¿í°€"                               |
+5.2.4  U+DB7F U+DFFF = ed ad bf ed bf bf = "í­¿í¿¿"                               |
+5.2.5  U+DB80 U+DC00 = ed ae 80 ed b0 80 = "󰀀"                               |
+5.2.6  U+DB80 U+DFFF = ed ae 80 ed bf bf = "󰏿"                               |
+5.2.7  U+DBFF U+DC00 = ed af bf ed b0 80 = "􏰀"                               |
+5.2.8  U+DBFF U+DFFF = ed af bf ed bf bf = "􏿿"                               |
+                                                                              |
+5.3 Other illegal code positions                                              |
+                                                                              |
+5.3.1  U+FFFE = ef bf be = "￾"                                                |
+5.3.2  U+FFFF = ef bf bf = "ï¿¿"                                                |
+                                                                              |
+THE END                                                                       |
+
old mode 100644 (file)
new mode 100755 (executable)
index 41cc9ab..978815c
@@ -42,39 +42,42 @@ void RunBasicTest()
     SDL_atomic_t v;
     SDL_bool tfret = SDL_FALSE;
 
-    SDL_Log("\nspin lock---------------------------------------\n\n");
+    SDLTest_Log("\nspin lock---------------------------------------\n\n");
 
     SDL_AtomicLock(&lock);
-    SDL_Log("AtomicLock                   lock=%d\n", lock);
+    SDLTest_Log("AtomicLock                   lock=%d\n", lock);
     SDL_AtomicUnlock(&lock);
-    SDL_Log("AtomicUnlock                 lock=%d\n", lock);
+    SDLTest_Log("AtomicUnlock                 lock=%d\n", lock);
 
-    SDL_Log("\natomic -----------------------------------------\n\n");
+    SDLTest_Log("\natomic -----------------------------------------\n\n");
 
     SDL_AtomicSet(&v, 0);
     tfret = SDL_AtomicSet(&v, 10) == 0 ? SDL_TRUE : SDL_FALSE;
-    SDL_Log("AtomicSet(10)        tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
+    SDLTest_Log("AtomicSet(10)        tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
     tfret = SDL_AtomicAdd(&v, 10) == 10 ? SDL_TRUE : SDL_FALSE;
-    SDL_Log("AtomicAdd(10)        tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
+    SDLTest_Log("AtomicAdd(10)        tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
 
     SDL_AtomicSet(&v, 0);
     SDL_AtomicIncRef(&v);
     tfret = (SDL_AtomicGet(&v) == 1) ? SDL_TRUE : SDL_FALSE;
-    SDL_Log("AtomicIncRef()       tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
+    SDLTest_Log("AtomicIncRef()       tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
     SDL_AtomicIncRef(&v);
     tfret = (SDL_AtomicGet(&v) == 2) ? SDL_TRUE : SDL_FALSE;
-    SDL_Log("AtomicIncRef()       tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
+    SDLTest_Log("AtomicIncRef()       tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
     tfret = (SDL_AtomicDecRef(&v) == SDL_FALSE) ? SDL_TRUE : SDL_FALSE;
-    SDL_Log("AtomicDecRef()       tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
+    SDLTest_Log("AtomicDecRef()       tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
     tfret = (SDL_AtomicDecRef(&v) == SDL_TRUE) ? SDL_TRUE : SDL_FALSE;
-    SDL_Log("AtomicDecRef()       tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
+    SDLTest_Log("AtomicDecRef()       tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
 
     SDL_AtomicSet(&v, 10);
     tfret = (SDL_AtomicCAS(&v, 0, 20) == SDL_FALSE) ? SDL_TRUE : SDL_FALSE;
-    SDL_Log("AtomicCAS()          tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
+    SDLTest_Log("AtomicCAS()          tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
     value = SDL_AtomicGet(&v);
     tfret = (SDL_AtomicCAS(&v, value, 20) == SDL_TRUE) ? SDL_TRUE : SDL_FALSE;
-    SDL_Log("AtomicCAS()          tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
+    SDLTest_Log("AtomicCAS()          tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
+       
+       SDL_MemoryBarrierAcquire();
+       SDL_MemoryBarrierRelease();
 }
 
 /**************************************************************************/
@@ -117,7 +120,7 @@ static
 int adder(void* junk)
 {
     unsigned long N=NInter;
-    SDL_Log("Thread subtracting %d %lu times\n",CountInc,N);
+    SDLTest_Log("Thread subtracting %d %lu times\n",CountInc,N);
     while (N--) {
         SDL_AtomicAdd(&good, -CountInc);
         bad-=CountInc;
@@ -149,7 +152,7 @@ void runAdder(void)
 
     end = SDL_GetTicks();
 
-    SDL_Log("Finished in %f sec\n", (end - start) / 1000.f);
+    SDLTest_Log("Finished in %f sec\n", (end - start) / 1000.f);
 }
 
 static
@@ -158,28 +161,28 @@ void RunEpicTest()
     int b;
     atomicValue v;
 
-    SDL_Log("\nepic test---------------------------------------\n\n");
+    SDLTest_Log("\nepic test---------------------------------------\n\n");
 
-    SDL_Log("Size asserted to be >= 32-bit\n");
+    SDLTest_Log("Size asserted to be >= 32-bit\n");
     SDL_assert(sizeof(atomicValue)>=4);
 
-    SDL_Log("Check static initializer\n");
+    SDLTest_Log("Check static initializer\n");
     v=SDL_AtomicGet(&good);
     SDL_assert(v==42);
 
     SDL_assert(bad==42);
 
-    SDL_Log("Test negative values\n");
+    SDLTest_Log("Test negative values\n");
     SDL_AtomicSet(&good, -5);
     v=SDL_AtomicGet(&good);
     SDL_assert(v==-5);
 
-    SDL_Log("Verify maximum value\n");
+    SDLTest_Log("Verify maximum value\n");
     SDL_AtomicSet(&good, CountTo);
     v=SDL_AtomicGet(&good);
     SDL_assert(v==CountTo);
 
-    SDL_Log("Test compare and exchange\n");
+    SDLTest_Log("Test compare and exchange\n");
 
     b=SDL_AtomicCAS(&good, 500, 43);
     SDL_assert(!b); /* no swap since CountTo!=500 */
@@ -191,7 +194,7 @@ void RunEpicTest()
     v=SDL_AtomicGet(&good);
     SDL_assert(v==44);
 
-    SDL_Log("Test Add\n");
+    SDLTest_Log("Test Add\n");
 
     v=SDL_AtomicAdd(&good, 1);
     SDL_assert(v==44);
@@ -203,7 +206,7 @@ void RunEpicTest()
     v=SDL_AtomicGet(&good);
     SDL_assert(v==55);
 
-    SDL_Log("Test Add (Negative values)\n");
+    SDLTest_Log("Test Add (Negative values)\n");
 
     v=SDL_AtomicAdd(&good, -20);
     SDL_assert(v==55);
@@ -220,7 +223,7 @@ void RunEpicTest()
     v=SDL_AtomicGet(&good);
     SDL_assert(v==15);
 
-    SDL_Log("Reset before count down test\n");
+    SDLTest_Log("Reset before count down test\n");
     SDL_AtomicSet(&good, CountTo);
     v=SDL_AtomicGet(&good);
     SDL_assert(v==CountTo);
@@ -228,11 +231,11 @@ void RunEpicTest()
     bad=CountTo;
     SDL_assert(bad==CountTo);
 
-    SDL_Log("Counting down from %d, Expect %d remaining\n",CountTo,Expect);
+    SDLTest_Log("Counting down from %d, Expect %d remaining\n",CountTo,Expect);
     runAdder();
 
     v=SDL_AtomicGet(&good);
-    SDL_Log("Atomic %d Non-Atomic %d\n",v,bad);
+    SDLTest_Log("Atomic %d Non-Atomic %d\n",v,bad);
     SDL_assert(v==Expect);
     SDL_assert(bad!=Expect);
 }
@@ -427,7 +430,7 @@ static SDL_bool EnqueueEvent_Mutex(SDL_EventQueue *queue, const SDL_Event *event
     } else if (delta < 0) {
         /* We ran into an old queue entry, which means it still needs to be dequeued */
     } else {
-        SDL_Log("ERROR: mutex failed!\n");
+        SDLTest_Log("ERROR: mutex failed!\n");
     }
 
     SDL_UnlockMutex(queue->mutex);
@@ -460,7 +463,7 @@ static SDL_bool DequeueEvent_Mutex(SDL_EventQueue *queue, SDL_Event *event)
     } else if (delta < 0) {
         /* We ran into an old queue entry, which means we've hit empty */
     } else {
-        SDL_Log("ERROR: mutex failed!\n");
+        SDLTest_Log("ERROR: mutex failed!\n");
     }
 
     SDL_UnlockMutex(queue->mutex);
@@ -599,8 +602,8 @@ static void RunFIFOTest(SDL_bool lock_free)
     char textBuffer[1024];
     int len;
 
-    SDL_Log("\nFIFO test---------------------------------------\n\n");
-    SDL_Log("Mode: %s\n", lock_free ? "LockFree" : "Mutex");
+    SDLTest_Log("\nFIFO test---------------------------------------\n\n");
+    SDLTest_Log("Mode: %s\n", lock_free ? "LockFree" : "Mutex");
 
     readersDone = SDL_CreateSemaphore(0);
     writersDone = SDL_CreateSemaphore(0);
@@ -622,7 +625,7 @@ static void RunFIFOTest(SDL_bool lock_free)
 #endif
 
     /* Start the readers first */
-    SDL_Log("Starting %d readers\n", NUM_READERS);
+    SDLTest_Log("Starting %d readers\n", NUM_READERS);
     SDL_zero(readerData);
     SDL_AtomicSet(&readersRunning, NUM_READERS);
     for (i = 0; i < NUM_READERS; ++i) {
@@ -634,7 +637,7 @@ static void RunFIFOTest(SDL_bool lock_free)
     }
 
     /* Start up the writers */
-    SDL_Log("Starting %d writers\n", NUM_WRITERS);
+    SDLTest_Log("Starting %d writers\n", NUM_WRITERS);
     SDL_zero(writerData);
     SDL_AtomicSet(&writersRunning, NUM_WRITERS);
     for (i = 0; i < NUM_WRITERS; ++i) {
@@ -668,16 +671,16 @@ static void RunFIFOTest(SDL_bool lock_free)
         SDL_DestroyMutex(queue.mutex);
     }
 
-    SDL_Log("Finished in %f sec\n", (end - start) / 1000.f);
+    SDLTest_Log("Finished in %f sec\n", (end - start) / 1000.f);
 
-    SDL_Log("\n");
+    SDLTest_Log("\n");
     for (i = 0; i < NUM_WRITERS; ++i) {
-        SDL_Log("Writer %d wrote %d events, had %d waits\n", i, EVENTS_PER_WRITER, writerData[i].waits);
+        SDLTest_Log("Writer %d wrote %d events, had %d waits\n", i, EVENTS_PER_WRITER, writerData[i].waits);
     }
-    SDL_Log("Writers wrote %d total events\n", NUM_WRITERS*EVENTS_PER_WRITER);
+    SDLTest_Log("Writers wrote %d total events\n", NUM_WRITERS*EVENTS_PER_WRITER);
 
     /* Print a breakdown of which readers read messages from which writer */
-    SDL_Log("\n");
+    SDLTest_Log("\n");
     grand_total = 0;
     for (i = 0; i < NUM_READERS; ++i) {
         int total = 0;
@@ -685,7 +688,7 @@ static void RunFIFOTest(SDL_bool lock_free)
             total += readerData[i].counters[j];
         }
         grand_total += total;
-        SDL_Log("Reader %d read %d events, had %d waits\n", i, total, readerData[i].waits);
+        SDLTest_Log("Reader %d read %d events, had %d waits\n", i, total, readerData[i].waits);
         SDL_snprintf(textBuffer, sizeof(textBuffer), "  { ");
         for (j = 0; j < NUM_WRITERS; ++j) {
             if (j > 0) {
@@ -697,16 +700,15 @@ static void RunFIFOTest(SDL_bool lock_free)
         }
         len = SDL_strlen(textBuffer);
         SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, " }\n");
-        SDL_Log("%s", textBuffer);
+        SDLTest_Log("%s", textBuffer);
     }
-    SDL_Log("Readers read %d total events\n", grand_total);
+    SDLTest_Log("Readers read %d total events\n", grand_total);
 }
 
 /* End FIFO test */
 /**************************************************************************/
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     /* Enable standard application logging */
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
old mode 100644 (file)
new mode 100755 (executable)
index e13868e..d822ff8
@@ -80,26 +80,26 @@ iteration()
     SDL_Event e;
     SDL_AudioDeviceID dev;
     while (SDL_PollEvent(&e)) {
-        if (e.type == SDL_QUIT) {
+        if (e.type == SDL_QUIT || e.key.keysym.sym == 0) {
             done = 1;
         } else if (e.type == SDL_AUDIODEVICEADDED) {
             const char *name = SDL_GetAudioDeviceName(e.adevice.which, 0);
-            SDL_Log("New %s audio device: %s\n", e.adevice.iscapture ? "capture" : "output", name);
+            SDLTest_Log("New %s audio device: %s\n", e.adevice.iscapture ? "capture" : "output", name);
             if (!e.adevice.iscapture) {
                 positions[posindex] = 0;
                 spec.userdata = &positions[posindex++];
                 spec.callback = fillerup;
                 dev = SDL_OpenAudioDevice(name, 0, &spec, NULL, 0);
                 if (!dev) {
-                    SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open '%s': %s\n", name, SDL_GetError());
+                    SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open '%s': %s\n", name, SDL_GetError());
                 } else {
-                    SDL_Log("Opened '%s' as %u\n", name, (unsigned int) dev);
+                    SDLTest_Log("Opened '%s' as %u\n", name, (unsigned int) dev);
                     SDL_PauseAudioDevice(dev, 0);
                 }
             }
         } else if (e.type == SDL_AUDIODEVICEREMOVED) {
             dev = (SDL_AudioDeviceID) e.adevice.which;
-            SDL_Log("%s device %u removed.\n", e.adevice.iscapture ? "capture" : "output", (unsigned int) dev);
+            SDLTest_Log("%s device %u removed.\n", e.adevice.iscapture ? "capture" : "output", (unsigned int) dev);
             SDL_CloseAudioDevice(dev);
         }
     }
@@ -115,9 +115,8 @@ loop()
         iteration();
 }
 #endif
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int i;
     char filename[4096];
@@ -127,7 +126,7 @@ main(int argc, char *argv[])
 
     /* Load the SDL library */
     if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return (1);
     }
 
@@ -137,11 +136,11 @@ main(int argc, char *argv[])
     if (argc > 1) {
         SDL_strlcpy(filename, argv[1], sizeof(filename));
     } else {
-        SDL_strlcpy(filename, "sample.wav", sizeof(filename));
+        SDL_strlcpy(filename, "res/sample.wav", sizeof(filename));
     }
     /* Load the wave file into memory */
     if (SDL_LoadWAV(filename, &spec, &sound, &soundlen) == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError());
         quit(1);
     }
 
@@ -158,12 +157,12 @@ main(int argc, char *argv[])
 #endif /* HAVE_SIGNAL_H */
 
     /* Show the list of available drivers */
-    SDL_Log("Available audio drivers:");
+    SDLTest_Log("Available audio drivers:");
     for (i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
-        SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
+        SDLTest_Log("%i: %s", i, SDL_GetAudioDriver(i));
     }
 
-    SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
+    SDLTest_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
 
 #ifdef __EMSCRIPTEN__
     emscripten_set_main_loop(loop, 0, 1);
old mode 100644 (file)
new mode 100755 (executable)
index 53bf0f5..3a6e446
@@ -18,23 +18,22 @@ print_devices(int iscapture)
     const char *typestr = ((iscapture) ? "capture" : "output");
     int n = SDL_GetNumAudioDevices(iscapture);
 
-    SDL_Log("%s devices:\n", typestr);
+    SDLTest_Log("%s devices:\n", typestr);
 
     if (n == -1)
-        SDL_Log("  Driver can't detect specific %s devices.\n\n", typestr);
+        SDLTest_Log("  Driver can't detect specific %s devices.\n\n", typestr);
     else if (n == 0)
-        SDL_Log("  No %s devices found.\n\n", typestr);
+        SDLTest_Log("  No %s devices found.\n\n", typestr);
     else {
         int i;
         for (i = 0; i < n; i++) {
-            SDL_Log("  %s\n", SDL_GetAudioDeviceName(i, iscapture));
+            SDLTest_Log("  %s\n", SDL_GetAudioDeviceName(i, iscapture));
         }
-        SDL_Log("\n");
+        SDLTest_Log("\n");
     }
 }
-
 int
-main(int argc, char **argv)
+SDL_main(int argc, char **argv)
 {
     int n;
 
@@ -43,24 +42,24 @@ main(int argc, char **argv)
 
     /* Load the SDL library */
     if (SDL_Init(SDL_INIT_AUDIO) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return (1);
     }
 
     /* Print available audio drivers */
     n = SDL_GetNumAudioDrivers();
     if (n == 0) {
-        SDL_Log("No built-in audio drivers\n\n");
+        SDLTest_Log("No built-in audio drivers\n\n");
     } else {
         int i;
-        SDL_Log("Built-in audio drivers:\n");
+        SDLTest_Log("Built-in audio drivers:\n");
         for (i = 0; i < n; ++i) {
-            SDL_Log("  %s\n", SDL_GetAudioDriver(i));
+            SDLTest_Log("  %s\n", SDL_GetAudioDriver(i));
         }
-        SDL_Log("\n");
+        SDLTest_Log("\n");
     }
 
-    SDL_Log("Using audio driver: %s\n\n", SDL_GetCurrentAudioDriver());
+    SDLTest_Log("Using audio driver: %s\n\n", SDL_GetCurrentAudioDriver());
 
     print_devices(0);
     print_devices(1);
old mode 100644 (file)
new mode 100755 (executable)
index eea74b3..f560b75
@@ -13,6 +13,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <time.h>
+#include <unistd.h>
 
 #include "SDL.h"
 #include "SDL_test.h"
@@ -28,10 +29,10 @@ quit(int rc)
     SDLTest_CommonQuit(state);
     exit(rc);
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
+    
     int result;
     int testIterations = 1;
     Uint64 userExecKey = 0;
@@ -80,7 +81,7 @@ main(int argc, char *argv[])
             }
         }
         if (consumed < 0) {
-            SDL_Log("Usage: %s %s [--iterations #] [--execKey #] [--seed string] [--filter suite_name|test_name]\n",
+            SDLTest_Log("Usage: %s %s [--iterations #] [--execKey #] [--seed string] [--filter suite_name|test_name]\n",
                     argv[0], SDLTest_CommonUsage(state));
             quit(1);
         }
@@ -120,5 +121,4 @@ main(int argc, char *argv[])
     quit(result);
     return(result);
 }
-
 /* vi: set ts=4 sw=4 expandtab: */
old mode 100644 (file)
new mode 100755 (executable)
index bef838d..c26ec45
@@ -708,6 +708,12 @@ int audio_openCloseAndGetAudioStatus()
      for (i = 0; i < count; i++) {
        /* Get device name */
        device = (char *)SDL_GetAudioDeviceName(i, 0);
+          /*add by majunqing for skip the device 1*/
+       const char* ignoreDevice = "VIRTUAL AUDIO W";
+       if(SDL_strcmp(device, ignoreDevice) == 0)
+       {
+               continue;
+       }
        SDLTest_AssertPass("SDL_GetAudioDeviceName(%i,0)", i);
        SDLTest_AssertCheck(device != NULL, "Validate device name is not NULL; got: %s", (device != NULL) ? device : "NULL");
        if (device == NULL) return TEST_ABORTED;
@@ -766,6 +772,14 @@ int audio_lockUnlockOpenAudioDevice()
      for (i = 0; i < count; i++) {
        /* Get device name */
        device = (char *)SDL_GetAudioDeviceName(i, 0);
+          
+       /*add by majunqing for skip the device 1*/
+       const char* ignoreDevice = "VIRTUAL AUDIO W";
+       if(SDL_strcmp(device, ignoreDevice) == 0)
+       {
+               continue;
+       }
+          
        SDLTest_AssertPass("SDL_GetAudioDeviceName(%i,0)", i);
        SDLTest_AssertCheck(device != NULL, "Validate device name is not NULL; got: %s", (device != NULL) ? device : "NULL");
        if (device == NULL) return TEST_ABORTED;
@@ -928,6 +942,13 @@ int audio_openCloseAudioDeviceConnected()
      for (i = 0; i < count; i++) {
        /* Get device name */
        device = (char *)SDL_GetAudioDeviceName(i, 0);
+             /*add by majunqing for skip the device 1*/
+       const char* ignoreDevice = "VIRTUAL AUDIO W";
+       if(SDL_strcmp(device, ignoreDevice) == 0)
+       {
+               continue;
+       }
+          
        SDLTest_AssertPass("SDL_GetAudioDeviceName(%i,0)", i);
        SDLTest_AssertCheck(device != NULL, "Validate device name is not NULL; got: %s", (device != NULL) ? device : "NULL");
        if (device == NULL) return TEST_ABORTED;
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index f9eb5bb..9114829
@@ -171,6 +171,8 @@ events_addDelEventWatchWithUserdata(void *arg)
    SDLTest_AssertPass("Call to SDL_PumpEvents()");
    SDLTest_AssertCheck(_eventFilterCalled == 0, "Check that event filter was NOT called");
 
+   SDL_FlushEvent(0);
+   SDLTest_AssertPass("Call to SDL_FlushEvent()");
    return TEST_COMPLETED;
 }
 
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 5a1bc9b..484ef1d
@@ -1061,6 +1061,7 @@ _clearScreen(void)
 /* ================= Test References ================== */
 
 /* Render test cases */
+
 static const SDLTest_TestCaseReference renderTest1 =
         { (SDLTest_TestCaseFp)render_testGetNumRenderDrivers, "render_testGetNumRenderDrivers", "Tests call to SDL_GetNumRenderDrivers", TEST_ENABLED };
 
@@ -1087,7 +1088,7 @@ static const SDLTest_TestCaseReference renderTest7 =
 
 /* Sequence of Render test cases */
 static const SDLTest_TestCaseReference *renderTests[] =  {
-    &renderTest1, &renderTest2, &renderTest3, &renderTest4, &renderTest5, &renderTest6, &renderTest7, NULL
+    /*&renderTest1,*/ &renderTest2, &renderTest3, &renderTest4, &renderTest5, &renderTest6, &renderTest7, NULL
 };
 
 /* Render test suite (global) */
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index ca41d4a..3995509
@@ -425,6 +425,33 @@ surface_testBlit(void *arg)
    return TEST_COMPLETED;
 }
 
+int surface_testBlitScaled(void *arg)
+{
+       SDL_Surface* compareSurface;
+       int ret;
+       SDL_Rect compareSurfaceRect, srcSurfaceRect;
+       compareSurfaceRect.x = 0;
+       compareSurfaceRect.y = 0;
+       compareSurfaceRect.w = testSurface->w;
+       compareSurfaceRect.h = testSurface->h;
+
+       srcSurfaceRect.x = 1;
+       srcSurfaceRect.y = 1;
+       srcSurfaceRect.w = testSurface->w -1;
+       srcSurfaceRect.h = testSurface->h - 1;
+       compareSurface = SDL_LoadBMP("res/sample.bmp");
+       ret = SDL_BlitScaled(testSurface, NULL, compareSurface, &compareSurfaceRect);
+               
+       SDLTest_AssertCheck(ret == 0, "Validate result from SDL_BlitScaled, expected: 0, got: %i", ret);
+       //compareSurface = SDL_LoadBMP("res/sample.bmp");
+       //ret = SDL_LowerBlitScaled(testSurface, NULL, compareSurface, &compareSurfaceRect);
+
+
+       //SDLTest_AssertCheck(ret == 0, "Validate result from SDL_LowerBlitScaled, expected: 0, got: %i && the error is %s", ret, SDL_GetError());
+       //SDL_FreeSurface(compareSurface);
+                       
+       return TEST_COMPLETED;
+}
 /**
  * @brief Tests some blitting routines with color mod
  */
@@ -630,11 +657,14 @@ static const SDLTest_TestCaseReference surfaceTest11 =
 static const SDLTest_TestCaseReference surfaceTest12 =
         { (SDLTest_TestCaseFp)surface_testBlitBlendMod, "surface_testBlitBlendMod", "Tests blitting routines with mod blending mode.", TEST_ENABLED};
 
+static const SDLTest_TestCaseReference surfaceTest13 =
+        { (SDLTest_TestCaseFp)surface_testBlitScaled, "surface_testBlitScaled", "Tests blitting scaled.", TEST_ENABLED};
+
 /* Sequence of Surface test cases */
 static const SDLTest_TestCaseReference *surfaceTests[] =  {
     &surfaceTest1, &surfaceTest2, &surfaceTest3, &surfaceTest4, &surfaceTest5,
     &surfaceTest6, &surfaceTest7, &surfaceTest8, &surfaceTest9, &surfaceTest10,
-    &surfaceTest11, &surfaceTest12, NULL
+    &surfaceTest11, &surfaceTest12, &surfaceTest13 ,NULL
 };
 
 /* Surface test suite (global) */
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index c228eb6..fc6a3f9
@@ -23,14 +23,15 @@ print_mode(const char *prefix, const SDL_DisplayMode *mode)
     if (!mode)
         return;
 
-    SDL_Log("%s: fmt=%s w=%d h=%d refresh=%d\n",
+    SDLTest_Log("%s: fmt=%s w=%d h=%d refresh=%d\n",
             prefix, SDL_GetPixelFormatName(mode->format),
             mode->w, mode->h, mode->refresh_rate);
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
+       SDL_tizen_app_init(argc, argv);
+       SDL_SetMainReady();
     SDL_DisplayMode mode;
     int num_displays, dpy;
 
@@ -39,14 +40,14 @@ main(int argc, char *argv[])
 
     /* Load the SDL library */
     if (SDL_Init(SDL_INIT_VIDEO) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return 1;
     }
 
-    SDL_Log("Using video target '%s'.\n", SDL_GetCurrentVideoDriver());
+    SDLTest_Log("Using video target '%s'.\n", SDL_GetCurrentVideoDriver());
     num_displays = SDL_GetNumVideoDisplays();
 
-    SDL_Log("See %d displays.\n", num_displays);
+    SDLTest_Log("See %d displays.\n", num_displays);
 
     for (dpy = 0; dpy < num_displays; dpy++) {
         const int num_modes = SDL_GetNumDisplayModes(dpy);
@@ -54,23 +55,23 @@ main(int argc, char *argv[])
         int m;
 
         SDL_GetDisplayBounds(dpy, &rect);
-        SDL_Log("%d: \"%s\" (%dx%d, (%d, %d)), %d modes.\n", dpy, SDL_GetDisplayName(dpy), rect.w, rect.h, rect.x, rect.y, num_modes);
+        SDLTest_Log("%d: \"%s\" (%dx%d, (%d, %d)), %d modes.\n", dpy, SDL_GetDisplayName(dpy), rect.w, rect.h, rect.x, rect.y, num_modes);
 
         if (SDL_GetCurrentDisplayMode(dpy, &mode) == -1) {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "    CURRENT: failed to query (%s)\n", SDL_GetError());
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "    CURRENT: failed to query (%s)\n", SDL_GetError());
         } else {
             print_mode("CURRENT", &mode);
         }
 
         if (SDL_GetDesktopDisplayMode(dpy, &mode) == -1) {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "    DESKTOP: failed to query (%s)\n", SDL_GetError());
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "    DESKTOP: failed to query (%s)\n", SDL_GetError());
         } else {
             print_mode("DESKTOP", &mode);
         }
 
         for (m = 0; m < num_modes; m++) {
             if (SDL_GetDisplayMode(dpy, m, &mode) == -1) {
-                SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "    MODE %d: failed to query (%s)\n", m, SDL_GetError());
+                SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "    MODE %d: failed to query (%s)\n", m, SDL_GetError());
             } else {
                 char prefix[64];
                 SDL_snprintf(prefix, sizeof (prefix), "    MODE %d", m);
@@ -78,7 +79,7 @@ main(int argc, char *argv[])
             }
         }
 
-        SDL_Log("\n");
+        SDLTest_Log("\n");
     }
 
     SDL_Quit();
old mode 100644 (file)
new mode 100755 (executable)
index 77bd8c1..d926df0
@@ -21,7 +21,8 @@
 #endif
 
 #include "SDL_test_common.h"
-
+#define WINDOW_WIDTH 720
+#define WINDOW_HEIGHT 1280
 #define NUM_OBJECTS 100
 
 static SDLTest_CommonState *state;
@@ -204,9 +205,8 @@ loop()
     }
 #endif
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int i;
     Uint32 then, now, frames;
@@ -219,6 +219,8 @@ main(int argc, char *argv[])
 
     /* Initialize test framework */
     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
+       state->window_w = WINDOW_WIDTH;
+    state->window_h = WINDOW_HEIGHT;
     if (!state) {
         return 1;
     }
@@ -256,7 +258,7 @@ main(int argc, char *argv[])
             }
         }
         if (consumed < 0) {
-            SDL_Log("Usage: %s %s [--blend none|blend|add|mod] [--cyclecolor] [--cyclealpha]\n",
+            SDLTest_Log("Usage: %s %s [--blend none|blend|add|mod] [--cyclecolor] [--cyclealpha]\n",
                     argv[0], SDLTest_CommonUsage(state));
             return 1;
         }
@@ -287,6 +289,8 @@ main(int argc, char *argv[])
     while (!done) {
         ++frames;
         loop();
+               //SDL_Delay(10000);  /* let it play for awhile. */
+               //done = 1;
         }
 #endif
 
@@ -297,7 +301,7 @@ main(int argc, char *argv[])
     now = SDL_GetTicks();
     if (now > then) {
         double fps = ((double) frames * 1000) / (now - then);
-        SDL_Log("%2.2f frames per second\n", fps);
+        SDLTest_Log("%2.2f frames per second\n", fps);
     }
     return 0;
 }
old mode 100644 (file)
new mode 100755 (executable)
index f2a1469..fccdb27
@@ -59,7 +59,7 @@ loop()
 {
     SDL_Event e;
     while (SDL_PollEvent(&e)) {
-        if (e.type == SDL_QUIT) {
+        if (e.type == SDL_QUIT || e.key.keysym.sym == SDLK_f) {
             done = 1;
 #ifdef __EMSCRIPTEN__
             emscripten_cancel_main_loop();
@@ -82,9 +82,8 @@ loop()
        now Update the drawing image on window screen */
     SDL_UpdateWindowSurface(window);
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     SDL_Surface *surface;
 
@@ -94,23 +93,37 @@ main(int argc, char *argv[])
     /* Initialize SDL */
     if(SDL_Init(SDL_INIT_VIDEO) != 0)
     {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
         return 1;
     }
 
 
     /* Create window and renderer for given surface */
-    window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN);
+    window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 720, 1280, SDL_WINDOW_SHOWN);
     if(!window)
     {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError());
         return 1;
     }
+    SDL_SetWindowTitle(window, "chess board");
+    const char* windowtitle = SDL_GetWindowTitle(window);
+
+    if(SDL_strcmp(windowtitle, "chess board") != 0)
+    {
+       SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Set Window title fail : %s\n",SDL_GetError());
+
+    }
+
+    if(SDL_SetWindowBrightness(window, 0.5f) == -1)
+    {
+       SDLTest_Log(SDL_LOG_CATEGORY_APPLICATION, "Set Window Brightness is not supported ");
+    }
+
     surface = SDL_GetWindowSurface(window);
     renderer = SDL_CreateSoftwareRenderer(surface);
     if(!renderer)
     {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n",SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n",SDL_GetError());
         return 1;
     }
 
old mode 100644 (file)
new mode 100755 (executable)
index b7f215e..0b010d3
@@ -24,9 +24,8 @@ quit(int rc)
     SDLTest_CommonQuit(state);
     exit(rc);
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int i, done;
     SDL_Event event;
@@ -52,7 +51,7 @@ main(int argc, char *argv[])
             consumed = -1;
         }
         if (consumed < 0) {
-            SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
+            SDLTest_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
             quit(1);
         }
         i += consumed;
@@ -79,7 +78,7 @@ main(int argc, char *argv[])
 
             if (event.type == SDL_DROPFILE) {
                 char *dropped_filedir = event.drop.file;
-                SDL_Log("File dropped on window: %s", dropped_filedir);
+                SDLTest_Log("File dropped on window: %s", dropped_filedir);
                 SDL_free(dropped_filedir);
             }
         }
old mode 100644 (file)
new mode 100755 (executable)
index b5fa3fb..da9fe1e
@@ -35,15 +35,14 @@ ThreadFunc(void *data)
     SDL_SetError("Thread %s (%lu) had a problem: %s",
                  (char *) data, SDL_ThreadID(), "nevermind");
     while (alive) {
-        SDL_Log("Thread '%s' is alive!\n", (char *) data);
+        SDLTest_Log("Thread '%s' is alive!\n", (char *) data);
         SDL_Delay(1 * 1000);
     }
-    SDL_Log("Child thread error string: %s\n", SDL_GetError());
+    SDLTest_Log("Child thread error string: %s\n", SDL_GetError());
     return (0);
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     SDL_Thread *thread;
 
@@ -52,7 +51,7 @@ main(int argc, char *argv[])
 
     /* Load the SDL library */
     if (SDL_Init(0) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return (1);
     }
 
@@ -62,15 +61,15 @@ main(int argc, char *argv[])
     alive = 1;
     thread = SDL_CreateThread(ThreadFunc, NULL, "#1");
     if (thread == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
         quit(1);
     }
     SDL_Delay(5 * 1000);
-    SDL_Log("Waiting for thread #1\n");
+    SDLTest_Log("Waiting for thread #1\n");
     alive = 0;
     SDL_WaitThread(thread, NULL);
 
-    SDL_Log("Main thread error string: %s\n", SDL_GetError());
+    SDLTest_Log("Main thread error string: %s\n", SDL_GetError());
 
     SDL_Quit();
     return (0);
old mode 100644 (file)
new mode 100755 (executable)
index b45795f..cf7c944
@@ -50,7 +50,7 @@ cleanup(void)
 static void
 rwops_error_quit(unsigned line, SDL_RWops * rwops)
 {
-    SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "testfile.c(%d): failed\n", line);
+    SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "testfile.c(%d): failed\n", line);
     if (rwops) {
         rwops->close(rwops);    /* This calls SDL_FreeRW(rwops); */
     }
@@ -61,9 +61,11 @@ rwops_error_quit(unsigned line, SDL_RWops * rwops)
 #define RWOP_ERR_QUIT(x)    rwops_error_quit( __LINE__, (x) )
 
 
-
+#ifdef main
+#undef main
+#endif
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     SDL_RWops *rwops = NULL;
     char test_buf[30];
@@ -90,7 +92,7 @@ main(int argc, char *argv[])
     rwops = SDL_RWFromFile("something", NULL);
     if (rwops)
         RWOP_ERR_QUIT(rwops);
-    SDL_Log("test1 OK\n");
+    SDLTest_Log("test1 OK\n");
 
 /* test 2 : check that inexistent file is not successfully opened/created when required */
 /* modes : r, r+ imply that file MUST exist
@@ -123,7 +125,7 @@ main(int argc, char *argv[])
         RWOP_ERR_QUIT(rwops);
     rwops->close(rwops);
     unlink(FBASENAME2);
-    SDL_Log("test2 OK\n");
+    SDLTest_Log("test2 OK\n");
 
 /* test 3 : creation, writing , reading, seeking,
             test : w mode, r mode, w+ mode
@@ -201,7 +203,7 @@ main(int argc, char *argv[])
     if (SDL_memcmp(test_buf, "12345678901234567890", 20))
         RWOP_ERR_QUIT(rwops);
     rwops->close(rwops);
-    SDL_Log("test3 OK\n");
+    SDLTest_Log("test3 OK\n");
 
 /* test 4: same in r+ mode */
     rwops = SDL_RWFromFile(FBASENAME1, "rb+");  /* write + read + file must exists, no truncation */
@@ -236,7 +238,7 @@ main(int argc, char *argv[])
     if (SDL_memcmp(test_buf, "12345678901234567890", 20))
         RWOP_ERR_QUIT(rwops);
     rwops->close(rwops);
-    SDL_Log("test4 OK\n");
+    SDLTest_Log("test4 OK\n");
 
 /* test5 : append mode */
     rwops = SDL_RWFromFile(FBASENAME1, "ab+");  /* write + read + append */
@@ -277,7 +279,7 @@ main(int argc, char *argv[])
     if (SDL_memcmp(test_buf, "123456789012345678901234567123", 30))
         RWOP_ERR_QUIT(rwops);
     rwops->close(rwops);
-    SDL_Log("test5 OK\n");
+    SDLTest_Log("test5 OK\n");
     cleanup();
     return 0;                   /* all ok */
 }
old mode 100644 (file)
new mode 100755 (executable)
index abd301c..838e3b1
 
 #include <stdio.h>
 #include "SDL.h"
-
+#ifdef main
+#undef main
+#endif
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     char *base_path;
     char *pref_path;
@@ -24,27 +26,27 @@ main(int argc, char *argv[])
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     if (SDL_Init(0) == -1) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError());
         return 1;
     }
 
     base_path = SDL_GetBasePath();
     if(base_path == NULL){
-      SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n",
+      SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n",
                    SDL_GetError());
       return 0;
     }
 
-    SDL_Log("base path: '%s'\n", base_path);
+    SDLTest_Log("base path: '%s'\n", base_path);
     SDL_free(base_path);
 
     pref_path = SDL_GetPrefPath("libsdl", "testfilesystem");
     if(pref_path == NULL){
-      SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n",
+      SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n",
                    SDL_GetError());
       return 0;
     }
-    SDL_Log("pref path: '%s'\n", pref_path); 
+    SDLTest_Log("pref path: '%s'\n", pref_path); 
     SDL_free(pref_path);
 
     SDL_Quit();
old mode 100644 (file)
new mode 100755 (executable)
index 291661a..dfc2565
 #include <math.h>
 
 #include "SDL_test_common.h"
-
-#if defined(__IPHONEOS__) || defined(__ANDROID__)
+#define WINDOW_WIDTH 720
+#define WINDOW_HEIGHT 1280
+#if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__TIZEN__)
 #define HAVE_OPENGLES
 #endif
 
+#define HAVE_OPENGLES2
+
 #ifdef HAVE_OPENGLES
 
 #include "SDL_opengles.h"
@@ -27,7 +30,7 @@
 static SDLTest_CommonState *state;
 static SDL_GLContext *context = NULL;
 static int depth = 16;
-
+int once = SDL_TRUE;
 /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
 static void
 quit(int rc)
@@ -98,9 +101,8 @@ Render()
     glMatrixMode(GL_MODELVIEW);
     glRotatef(5.0, 1.0, 1.0, 1.0);
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int fsaa, accel;
     int value;
@@ -119,6 +121,8 @@ main(int argc, char *argv[])
 
     /* Initialize test framework */
     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
+       state->window_w = WINDOW_WIDTH;
+    state->window_h = WINDOW_HEIGHT;
     if (!state) {
         return 1;
     }
@@ -146,7 +150,7 @@ main(int argc, char *argv[])
             }
         }
         if (consumed < 0) {
-            SDL_Log("Usage: %s %s [--fsaa] [--accel] [--zdepth %%d]\n", argv[0],
+            SDLTest_Log("Usage: %s %s [--fsaa] [--accel] [--zdepth %%d]\n", argv[0],
                     SDLTest_CommonUsage(state));
             quit(1);
         }
@@ -175,7 +179,7 @@ main(int argc, char *argv[])
 
     context = SDL_calloc(state->num_windows, sizeof(context));
     if (context == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
         quit(2);
     }
 
@@ -183,7 +187,7 @@ main(int argc, char *argv[])
     for (i = 0; i < state->num_windows; i++) {
         context[i] = SDL_GL_CreateContext(state->windows[i]);
         if (!context[i]) {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GL_CreateContext(): %s\n", SDL_GetError());
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_GL_CreateContext(): %s\n", SDL_GetError());
             quit(2);
         }
     }
@@ -195,65 +199,65 @@ main(int argc, char *argv[])
     }
 
     SDL_GetCurrentDisplayMode(0, &mode);
-    SDL_Log("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode.format));
-    SDL_Log("\n");
-    SDL_Log("Vendor     : %s\n", glGetString(GL_VENDOR));
-    SDL_Log("Renderer   : %s\n", glGetString(GL_RENDERER));
-    SDL_Log("Version    : %s\n", glGetString(GL_VERSION));
-    SDL_Log("Extensions : %s\n", glGetString(GL_EXTENSIONS));
-    SDL_Log("\n");
+    SDLTest_Log("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode.format));
+    SDLTest_Log("\n");
+    SDLTest_Log("Vendor     : %s\n", glGetString(GL_VENDOR));
+    SDLTest_Log("Renderer   : %s\n", glGetString(GL_RENDERER));
+    SDLTest_Log("Version    : %s\n", glGetString(GL_VERSION));
+    SDLTest_Log("Extensions : %s\n", glGetString(GL_EXTENSIONS));
+    SDLTest_Log("\n");
 
     status = SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value);
     if (!status) {
-        SDL_Log("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value);
+        SDLTest_Log("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value);
     } else {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_RED_SIZE: %s\n",
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_RED_SIZE: %s\n",
                 SDL_GetError());
     }
     status = SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value);
     if (!status) {
-        SDL_Log("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value);
+        SDLTest_Log("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value);
     } else {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_GREEN_SIZE: %s\n",
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_GREEN_SIZE: %s\n",
                 SDL_GetError());
     }
     status = SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value);
     if (!status) {
-        SDL_Log("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value);
+        SDLTest_Log("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value);
     } else {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_BLUE_SIZE: %s\n",
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_BLUE_SIZE: %s\n",
                 SDL_GetError());
     }
     status = SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value);
     if (!status) {
-        SDL_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", depth, value);
+        SDLTest_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", depth, value);
     } else {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_DEPTH_SIZE: %s\n",
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_DEPTH_SIZE: %s\n",
                 SDL_GetError());
     }
     if (fsaa) {
         status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value);
         if (!status) {
-            SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value);
+            SDLTest_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value);
         } else {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n",
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n",
                     SDL_GetError());
         }
         status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value);
         if (!status) {
-            SDL_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa,
+            SDLTest_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa,
                    value);
         } else {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n",
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n",
                     SDL_GetError());
         }
     }
     if (accel) {
         status = SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
         if (!status) {
-            SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value);
+            SDLTest_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value);
         } else {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
                     SDL_GetError());
         }
     }
@@ -264,7 +268,7 @@ main(int argc, char *argv[])
 
         status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
         if (status) {
-            SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
+            SDLTest_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
 
             /* Continue for next window */
             continue;
@@ -291,26 +295,38 @@ main(int argc, char *argv[])
         ++frames;
         while (SDL_PollEvent(&event)) {
             switch (event.type) {
-            case SDL_WINDOWEVENT:
+            /*case SDL_WINDOWEVENT:
                 switch (event.window.event) {
                     case SDL_WINDOWEVENT_RESIZED:
                         for (i = 0; i < state->num_windows; ++i) {
                             if (event.window.windowID == SDL_GetWindowID(state->windows[i])) {
                                 status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
                                 if (status) {
-                                    SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
+                                    SDLTest_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
                                     break;
                                 }
-                                /* Change view port to the new window dimensions */
+                                // Change view port to the new window dimensions 
                                 glViewport(0, 0, event.window.data1, event.window.data2);
-                                /* Update window content */
+                                // Update window content 
                                 Render();
                                 SDL_GL_SwapWindow(state->windows[i]);
                                 break;
                             }
                         }
                         break;
-                }
+                }*/
+                       case SDL_KEYDOWN:
+                               if(event.key.keysym.sym == 0)
+                               {
+                                       if(once)
+                                       {
+                                               once = SDL_FALSE;
+                                       }else
+                                       {
+                                               done = 1;
+                                       }
+                               }
+                               break;
             }
             SDLTest_CommonEvent(state, &event, &done);
         }
@@ -319,7 +335,7 @@ main(int argc, char *argv[])
                 continue;
             status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
             if (status) {
-                SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
+                SDLTest_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
 
                 /* Continue for next window */
                 continue;
@@ -332,7 +348,7 @@ main(int argc, char *argv[])
     /* Print out some timing information */
     now = SDL_GetTicks();
     if (now > then) {
-        SDL_Log("%2.2f frames per second\n",
+        SDLTest_Log("%2.2f frames per second\n",
                ((double) frames * 1000) / (now - then));
     }
 #if !defined(__ANDROID__)
@@ -346,7 +362,7 @@ main(int argc, char *argv[])
 int
 main(int argc, char *argv[])
 {
-    SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No OpenGL ES support on this system\n");
+    SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "No OpenGL ES support on this system\n");
     return 1;
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index af5962b..74700ac
 #endif
 
 #include "SDL_test_common.h"
-
-#if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__NACL__)
+#define WINDOW_WIDTH 720
+#define WINDOW_HEIGHT 1280
+#if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__NACL__) || defined(__TIZEN__)
 #define HAVE_OPENGLES2
 #endif
 
+#define HAVE_OPENGLES2
+
 #ifdef HAVE_OPENGLES2
 
 #include "SDL_opengles2.h"
@@ -31,7 +34,7 @@
 typedef struct GLES2_Context
 {
 #define SDL_PROC(ret,func,params) ret (APIENTRY *func) params;
-#include "../src/render/opengles2/SDL_gles2funcs.h"
+#include "SDL_gles2funcs.h"
 #undef SDL_PROC
 } GLES2_Context;
 
@@ -63,7 +66,7 @@ static int LoadContext(GLES2_Context * data)
     } while ( 0 );
 #endif /* __SDL_NOGETPROCADDR__ */
 
-#include "../src/render/opengles2/SDL_gles2funcs.h"
+#include "SDL_gles2funcs.h"
 #undef SDL_PROC
     return 0;
 }
@@ -93,7 +96,7 @@ quit(int rc)
         { \
           GLenum glError = ctx.glGetError(); \
           if(glError != GL_NO_ERROR) { \
-            SDL_Log("glGetError() = %i (0x%.8x) at line %i\n", glError, glError, __LINE__); \
+            SDLTest_Log("glGetError() = %i (0x%.8x) at line %i\n", glError, glError, __LINE__); \
             quit(1); \
           } \
         }
@@ -220,7 +223,7 @@ process_shader(GLuint *shader, const char * source, GLint shader_type)
     if(status != GL_TRUE) {
         ctx.glGetProgramInfoLog(*shader, sizeof(buffer), &length, &buffer[0]);
         buffer[length] = '\0';
-        SDL_Log("Shader compilation failed: %s", buffer);fflush(stderr);
+        SDLTest_Log("Shader compilation failed: %s", buffer);fflush(stderr);
         quit(-1);
     }
 }
@@ -426,7 +429,7 @@ void loop()
     ++frames;
     while (SDL_PollEvent(&event) && !done) {
         switch (event.type) {
-        case SDL_WINDOWEVENT:
+        /*case SDL_WINDOWEVENT:
             switch (event.window.event) {
                 case SDL_WINDOWEVENT_RESIZED:
                     for (i = 0; i < state->num_windows; ++i) {
@@ -434,22 +437,28 @@ void loop()
                             int w, h;
                             status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
                             if (status) {
-                                SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
+                                SDLTest_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
                                 break;
                             }
-                            /* Change view port to the new window dimensions */
+                            // Change view port to the new window dimensions 
                             SDL_GL_GetDrawableSize(state->windows[i], &w, &h);
                             ctx.glViewport(0, 0, w, h);
                             state->window_w = event.window.data1;
                             state->window_h = event.window.data2;
-                            /* Update window content */
+                            // Update window content 
                             Render(event.window.data1, event.window.data2, &datas[i]);
                             SDL_GL_SwapWindow(state->windows[i]);
                             break;
                         }
                     }
                     break;
-            }
+            }*/
+               case SDL_KEYDOWN:
+                       if(event.key.keysym.sym == 0)
+                       {
+                               done = 1;
+                       }
+                       break;
         }
         SDLTest_CommonEvent(state, &event, &done);
     }
@@ -457,7 +466,7 @@ void loop()
       for (i = 0; i < state->num_windows; ++i) {
           status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
           if (status) {
-              SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
+              SDLTest_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
 
               /* Continue for next window */
               continue;
@@ -472,9 +481,8 @@ void loop()
     }
 #endif
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int fsaa, accel;
     int value;
@@ -490,6 +498,8 @@ main(int argc, char *argv[])
 
     /* Initialize test framework */
     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
+       state->window_w = WINDOW_WIDTH;
+    state->window_h = WINDOW_HEIGHT;
     if (!state) {
         return 1;
     }
@@ -517,7 +527,7 @@ main(int argc, char *argv[])
             }
         }
         if (consumed < 0) {
-            SDL_Log ("Usage: %s %s [--fsaa] [--accel] [--zdepth %%d]\n", argv[0],
+            SDLTest_Log ("Usage: %s %s [--fsaa] [--accel] [--zdepth %%d]\n", argv[0],
                     SDLTest_CommonUsage(state));
             quit(1);
         }
@@ -548,7 +558,7 @@ main(int argc, char *argv[])
 
     context = SDL_calloc(state->num_windows, sizeof(context));
     if (context == NULL) {
-        SDL_Log("Out of memory!\n");
+        SDLTest_Log("Out of memory!\n");
         quit(2);
     }
     
@@ -556,14 +566,14 @@ main(int argc, char *argv[])
     for (i = 0; i < state->num_windows; i++) {
         context[i] = SDL_GL_CreateContext(state->windows[i]);
         if (!context[i]) {
-            SDL_Log("SDL_GL_CreateContext(): %s\n", SDL_GetError());
+            SDLTest_Log("SDL_GL_CreateContext(): %s\n", SDL_GetError());
             quit(2);
         }
     }
 
     /* Important: call this *after* creating the context */
     if (LoadContext(&ctx) < 0) {
-        SDL_Log("Could not load GLES2 functions\n");
+        SDLTest_Log("Could not load GLES2 functions\n");
         quit(2);
         return 0;
     }
@@ -577,65 +587,65 @@ main(int argc, char *argv[])
     }
 
     SDL_GetCurrentDisplayMode(0, &mode);
-    SDL_Log("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode.format));
-    SDL_Log("\n");
-    SDL_Log("Vendor     : %s\n", ctx.glGetString(GL_VENDOR));
-    SDL_Log("Renderer   : %s\n", ctx.glGetString(GL_RENDERER));
-    SDL_Log("Version    : %s\n", ctx.glGetString(GL_VERSION));
-    SDL_Log("Extensions : %s\n", ctx.glGetString(GL_EXTENSIONS));
-    SDL_Log("\n");
+    SDLTest_Log("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode.format));
+    SDLTest_Log("\n");
+    SDLTest_Log("Vendor     : %s\n", ctx.glGetString(GL_VENDOR));
+    SDLTest_Log("Renderer   : %s\n", ctx.glGetString(GL_RENDERER));
+    SDLTest_Log("Version    : %s\n", ctx.glGetString(GL_VERSION));
+    SDLTest_Log("Extensions : %s\n", ctx.glGetString(GL_EXTENSIONS));
+    SDLTest_Log("\n");
 
     status = SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value);
     if (!status) {
-        SDL_Log("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value);
+        SDLTest_Log("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value);
     } else {
-        SDL_Log( "Failed to get SDL_GL_RED_SIZE: %s\n",
+        SDLTest_Log( "Failed to get SDL_GL_RED_SIZE: %s\n",
                 SDL_GetError());
     }
     status = SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value);
     if (!status) {
-        SDL_Log("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value);
+        SDLTest_Log("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value);
     } else {
-        SDL_Log( "Failed to get SDL_GL_GREEN_SIZE: %s\n",
+        SDLTest_Log( "Failed to get SDL_GL_GREEN_SIZE: %s\n",
                 SDL_GetError());
     }
     status = SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value);
     if (!status) {
-        SDL_Log("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value);
+        SDLTest_Log("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value);
     } else {
-        SDL_Log( "Failed to get SDL_GL_BLUE_SIZE: %s\n",
+        SDLTest_Log( "Failed to get SDL_GL_BLUE_SIZE: %s\n",
                 SDL_GetError());
     }
     status = SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value);
     if (!status) {
-        SDL_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", depth, value);
+        SDLTest_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", depth, value);
     } else {
-        SDL_Log( "Failed to get SDL_GL_DEPTH_SIZE: %s\n",
+        SDLTest_Log( "Failed to get SDL_GL_DEPTH_SIZE: %s\n",
                 SDL_GetError());
     }
     if (fsaa) {
         status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value);
         if (!status) {
-            SDL_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value);
+            SDLTest_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value);
         } else {
-            SDL_Log( "Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n",
+            SDLTest_Log( "Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n",
                     SDL_GetError());
         }
         status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value);
         if (!status) {
-            SDL_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa,
+            SDLTest_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa,
                    value);
         } else {
-            SDL_Log( "Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n",
+            SDLTest_Log( "Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n",
                     SDL_GetError());
         }
     }
     if (accel) {
         status = SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
         if (!status) {
-            SDL_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value);
+            SDLTest_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value);
         } else {
-            SDL_Log( "Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
+            SDLTest_Log( "Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
                     SDL_GetError());
         }
     }
@@ -648,7 +658,7 @@ main(int argc, char *argv[])
         int w, h;
         status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
         if (status) {
-            SDL_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
+            SDLTest_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
 
             /* Continue for next window */
             continue;
@@ -708,7 +718,7 @@ main(int argc, char *argv[])
     /* Print out some timing information */
     now = SDL_GetTicks();
     if (now > then) {
-        SDL_Log("%2.2f frames per second\n",
+        SDLTest_Log("%2.2f frames per second\n",
                ((double) frames * 1000) / (now - then));
     }
 #if !defined(__ANDROID__) && !defined(__NACL__)  
@@ -722,7 +732,7 @@ main(int argc, char *argv[])
 int
 main(int argc, char *argv[])
 {
-    SDL_Log("No OpenGL ES support on this system\n");
+    SDLTest_Log("No OpenGL ES support on this system\n");
     return 1;
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index 5e32be4..fc33d6c
@@ -22,7 +22,7 @@ hitTest(SDL_Window *window, const SDL_Point *pt, void *data)
 
     for (i = 0; i < numareas; i++) {
         if (SDL_PointInRect(pt, &areas[i])) {
-            SDL_Log("HIT-TEST: DRAGGABLE\n");
+            SDLTest_Log("HIT-TEST: DRAGGABLE\n");
             return SDL_HITTEST_DRAGGABLE;
         }
     }
@@ -30,7 +30,7 @@ hitTest(SDL_Window *window, const SDL_Point *pt, void *data)
     SDL_GetWindowSize(window, &w, &h);
 
     #define REPORT_RESIZE_HIT(name) { \
-        SDL_Log("HIT-TEST: RESIZE_" #name "\n"); \
+        SDLTest_Log("HIT-TEST: RESIZE_" #name "\n"); \
         return SDL_HITTEST_RESIZE_##name; \
     }
 
@@ -52,12 +52,11 @@ hitTest(SDL_Window *window, const SDL_Point *pt, void *data)
         REPORT_RESIZE_HIT(LEFT);
     }
 
-    SDL_Log("HIT-TEST: NORMAL\n");
+    SDLTest_Log("HIT-TEST: NORMAL\n");
     return SDL_HITTEST_NORMAL;
 }
 
-
-int main(int argc, char **argv)
+int SDL_main(int argc, char **argv)
 {
     int done = 0;
     SDL_Window *window;
@@ -65,11 +64,11 @@ int main(int argc, char **argv)
 
     /* !!! FIXME: check for errors. */
     SDL_Init(SDL_INIT_VIDEO);
-    window = SDL_CreateWindow("Drag the red boxes", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE);
+    window = SDL_CreateWindow("Drag the red boxes", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 720, 1280, SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE);
     renderer = SDL_CreateRenderer(window, -1, 0);
 
     if (SDL_SetWindowHitTest(window, hitTest, NULL) == -1) {
-        SDL_Log("Enabling hit-testing failed!\n");
+        SDLTest_Log("Enabling hit-testing failed!\n");
         SDL_Quit();
         return 1;
     }
@@ -91,21 +90,21 @@ int main(int argc, char **argv)
             switch (e.type)
             {
                 case SDL_MOUSEBUTTONDOWN:
-                    SDL_Log("button down!\n");
+                    SDLTest_Log("button down!\n");
                     break;
 
                 case SDL_MOUSEBUTTONUP:
-                    SDL_Log("button up!\n");
+                    SDLTest_Log("button up!\n");
                     break;
 
                 case SDL_WINDOWEVENT:
                     if (e.window.event == SDL_WINDOWEVENT_MOVED) {
-                        SDL_Log("Window event moved to (%d, %d)!\n", (int) e.window.data1, (int) e.window.data2);
+                        SDLTest_Log("Window event moved to (%d, %d)!\n", (int) e.window.data1, (int) e.window.data2);
                     }
                     break;
 
                 case SDL_KEYDOWN:
-                    if (e.key.keysym.sym == SDLK_ESCAPE) {
+                    if (e.key.keysym.sym == SDLK_ESCAPE || e.key.keysym.sym == 0) {
                         done = 1;
                     } else if (e.key.keysym.sym == SDLK_x) {
                         if (!areas) {
old mode 100644 (file)
new mode 100755 (executable)
index 79efec8..d4f500c
@@ -24,9 +24,8 @@ widelen(char *data)
     }
     return len;
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     const char *formats[] = {
         "UTF8",
@@ -53,11 +52,11 @@ main(int argc, char *argv[])
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     if (!argv[1]) {
-        argv[1] = "utf8.txt";
+        argv[1] = "res/utf8.txt";
     }
     file = fopen(argv[1], "rb");
     if (!file) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to open %s\n", argv[1]);
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to open %s\n", argv[1]);
         return (1);
     }
 
@@ -72,7 +71,7 @@ main(int argc, char *argv[])
             test[0] = SDL_iconv_string(formats[i], "UCS-4", ucs4, len);
             test[1] = SDL_iconv_string("UCS-4", formats[i], test[0], len);
             if (!test[1] || SDL_memcmp(test[1], ucs4, len) != 0) {
-                SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "FAIL: %s\n", formats[i]);
+                SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "FAIL: %s\n", formats[i]);
                 ++errors;
             }
             SDL_free(test[0]);
old mode 100644 (file)
new mode 100755 (executable)
index d6e7ea1..91ced3b
@@ -21,6 +21,8 @@
 #endif
 
 #include "SDL_test_common.h"
+#define WINDOW_WIDTH 720
+#define WINDOW_HEIGHT 1280
 
 #define DEFAULT_PTSIZE  30
 #define DEFAULT_FONT    "/System/Library/Fonts/åŽæ–‡ç»†é»‘.ttf"
@@ -80,7 +82,7 @@ char *utf8_advance(char *p, size_t distance)
 
 void usage()
 {
-    SDL_Log("usage: testime [--font fontfile]\n");
+    SDLTest_Log("usage: testime [--font fontfile]\n");
     exit(0);
 }
 
@@ -206,8 +208,7 @@ void Redraw() {
         SDL_RenderPresent(renderer);
     }
 }
-
-int main(int argc, char *argv[]) {
+int SDL_main(int argc, char *argv[]) {
     int i, done;
     SDL_Event event;
     const char *fontname = DEFAULT_FONT;
@@ -217,6 +218,8 @@ int main(int argc, char *argv[]) {
 
     /* Initialize test framework */
     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
+       state->window_w = WINDOW_WIDTH;
+    state->window_h = WINDOW_HEIGHT;
     if (!state) {
         return 1;
     }
@@ -256,12 +259,12 @@ int main(int argc, char *argv[]) {
     font = TTF_OpenFont(fontname, DEFAULT_PTSIZE);
     if (! font)
     {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to find font: %s\n", TTF_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to find font: %s\n", TTF_GetError());
         exit(-1);
     }
 #endif
 
-    SDL_Log("Using font: %s\n", fontname);
+    SDLTest_Log("Using font: %s\n", fontname);
     atexit(SDL_Quit);
 
     InitInput();
@@ -283,6 +286,9 @@ int main(int argc, char *argv[]) {
                 case SDL_KEYDOWN: {
                     switch (event.key.keysym.sym)
                     {
+                                               case SDLK_f:
+                                                       done = 1;
+                                                       break;
                         case SDLK_RETURN:
                              text[0]=0x00;
                              Redraw();
@@ -326,7 +332,7 @@ int main(int argc, char *argv[]) {
                         break;
                     }
 
-                    SDL_Log("Keyboard: scancode 0x%08X = %s, keycode 0x%08X = %s\n",
+                    SDLTest_Log("Keyboard: scancode 0x%08X = %s, keycode 0x%08X = %s\n",
                             event.key.keysym.scancode,
                             SDL_GetScancodeName(event.key.keysym.scancode),
                             event.key.keysym.sym, SDL_GetKeyName(event.key.keysym.sym));
@@ -337,12 +343,12 @@ int main(int argc, char *argv[]) {
                         markedRect.w < 0)
                         break;
 
-                    SDL_Log("Keyboard: text input \"%s\"\n", event.text.text);
+                    SDLTest_Log("Keyboard: text input \"%s\"\n", event.text.text);
 
                     if (SDL_strlen(text) + SDL_strlen(event.text.text) < sizeof(text))
                         SDL_strlcat(text, event.text.text, sizeof(text));
 
-                    SDL_Log("text inputed: %s\n", text);
+                    SDLTest_Log("text inputed: %s\n", text);
 
                     /* After text inputed, we can clear up markedText because it */
                     /* is committed */
@@ -351,7 +357,7 @@ int main(int argc, char *argv[]) {
                     break;
 
                 case SDL_TEXTEDITING:
-                    SDL_Log("text editing \"%s\", selected range (%d, %d)\n",
+                    SDLTest_Log("text editing \"%s\", selected range (%d, %d)\n",
                             event.edit.text, event.edit.start, event.edit.length);
 
                     strcpy(markedText, event.edit.text);
old mode 100644 (file)
new mode 100755 (executable)
index 82aae63..b29bb38
@@ -21,7 +21,8 @@
 #endif
 
 #include "SDL_test_common.h"
-
+#define WINDOW_WIDTH 720
+#define WINDOW_HEIGHT 1280
 #define SWAP(typ,a,b) do{typ t=a;a=b;b=t;}while(0)
 #define NUM_OBJECTS 100
 
@@ -91,7 +92,7 @@ add_line(int x1, int y1, int x2, int y2)
     if ((x1 == x2) && (y1 == y2))
         return 0;
 
-    SDL_Log("adding line (%d, %d), (%d, %d)\n", x1, y1, x2, y2);
+    SDLTest_Log("adding line (%d, %d), (%d, %d)\n", x1, y1, x2, y2);
     lines[num_lines].x = x1;
     lines[num_lines].y = y1;
     lines[num_lines].w = x2;
@@ -140,7 +141,7 @@ add_rect(int x1, int y1, int x2, int y2)
     if (y1 > y2)
         SWAP(int, y1, y2);
 
-    SDL_Log("adding rect (%d, %d), (%d, %d) [%dx%d]\n", x1, y1, x2, y2,
+    SDLTest_Log("adding rect (%d, %d), (%d, %d) [%dx%d]\n", x1, y1, x2, y2,
            x2 - x1, y2 - y1);
 
     rects[num_rects].x = x1;
@@ -263,9 +264,8 @@ loop()
     }
 #endif
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int i;
     Uint32 then, now, frames;
@@ -278,6 +278,8 @@ main(int argc, char *argv[])
 
     /* Initialize test framework */
     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
+       state->window_w = WINDOW_WIDTH;
+    state->window_h = WINDOW_HEIGHT;
     if (!state) {
         return 1;
     }
@@ -315,7 +317,7 @@ main(int argc, char *argv[])
             }
         }
         if (consumed < 0) {
-            SDL_Log("Usage: %s %s [--blend none|blend|add|mod] [--cyclecolor] [--cyclealpha]\n",
+            SDLTest_Log("Usage: %s %s [--blend none|blend|add|mod] [--cyclecolor] [--cyclealpha]\n",
                     argv[0], SDLTest_CommonUsage(state));
             return 1;
         }
@@ -355,7 +357,7 @@ main(int argc, char *argv[])
     now = SDL_GetTicks();
     if (now > then) {
         double fps = ((double) frames * 1000) / (now - then);
-        SDL_Log("%2.2f frames per second\n", fps);
+        SDLTest_Log("%2.2f frames per second\n", fps);
     }
     return 0;
 }
old mode 100644 (file)
new mode 100755 (executable)
index aea496c..601bc49
@@ -18,9 +18,8 @@
 #include <string.h>
 
 #include "SDL.h"
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     SDL_Scancode scancode;
 
@@ -28,11 +27,11 @@ main(int argc, char *argv[])
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     if (SDL_Init(SDL_INIT_VIDEO) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         exit(1);
     }
     for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) {
-        SDL_Log("Scancode #%d, \"%s\"\n", scancode,
+        SDLTest_Log("Scancode #%d, \"%s\"\n", scancode,
                SDL_GetScancodeName(scancode));
     }
     SDL_Quit();
old mode 100644 (file)
new mode 100755 (executable)
index fb87fbe..0e0713c
@@ -20,9 +20,8 @@
 #include "SDL.h"
 
 typedef int (*fntype) (const char *);
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int retval = 0;
     int hello = 0;
@@ -33,14 +32,14 @@ main(int argc, char *argv[])
 
     if (argc != 3) {
         const char *app = argv[0];
-        SDL_Log("USAGE: %s <library> <functionname>\n", app);
-        SDL_Log("       %s --hello <lib with puts()>\n", app);
+        SDLTest_Log("USAGE: %s <library> <functionname>\n", app);
+        SDLTest_Log("       %s --hello <lib with puts()>\n", app);
         return 1;
     }
 
     /* Initialize SDL */
     if (SDL_Init(0) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return 2;
     }
 
@@ -55,23 +54,23 @@ main(int argc, char *argv[])
 
     lib = SDL_LoadObject(libname);
     if (lib == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadObject('%s') failed: %s\n",
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadObject('%s') failed: %s\n",
                 libname, SDL_GetError());
         retval = 3;
     } else {
         fn = (fntype) SDL_LoadFunction(lib, symname);
         if (fn == NULL) {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadFunction('%s') failed: %s\n",
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadFunction('%s') failed: %s\n",
                     symname, SDL_GetError());
             retval = 4;
         } else {
-            SDL_Log("Found %s in %s at %p\n", symname, libname, fn);
+            SDLTest_Log("Found %s in %s at %p\n", symname, libname, fn);
             if (hello) {
-                SDL_Log("Calling function...\n");
+                SDLTest_Log("Calling function...\n");
                 fflush(stdout);
                 fn("     HELLO, WORLD!\n");
-                SDL_Log("...apparently, we survived.  :)\n");
-                SDL_Log("Unloading library...\n");
+                SDLTest_Log("...apparently, we survived.  :)\n");
+                SDLTest_Log("Unloading library...\n");
                 fflush(stdout);
             }
         }
old mode 100644 (file)
new mode 100755 (executable)
index 1106ec3..8d34898
@@ -38,7 +38,7 @@ SDL_Quit_Wrapper(void)
 void
 printid(void)
 {
-    SDL_Log("Process %lu:  exiting\n", SDL_ThreadID());
+    SDLTest_Log("Process %lu:  exiting\n", SDL_ThreadID());
 }
 
 void
@@ -53,7 +53,7 @@ closemutex(int sig)
 {
     SDL_threadID id = SDL_ThreadID();
     int i;
-    SDL_Log("Process %lu:  Cleaning up...\n", id == mainthread ? 0 : id);
+    SDLTest_Log("Process %lu:  Cleaning up...\n", id == mainthread ? 0 : id);
     doterminate = 1;
     for (i = 0; i < 6; ++i)
         SDL_WaitThread(threads[i], NULL);
@@ -65,32 +65,35 @@ int SDLCALL
 Run(void *data)
 {
     if (SDL_ThreadID() == mainthread)
-        signal(SIGTERM, closemutex);
+       {
+        //signal(SIGTERM, closemutex);
+               SDL_Delay(5000);
+               closemutex(0);
+       }
     while (!doterminate) {
-        SDL_Log("Process %lu ready to work\n", SDL_ThreadID());
+        SDLTest_Log("Process %lu ready to work\n", SDL_ThreadID());
         if (SDL_LockMutex(mutex) < 0) {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock mutex: %s", SDL_GetError());
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock mutex: %s", SDL_GetError());
             exit(1);
         }
-        SDL_Log("Process %lu, working!\n", SDL_ThreadID());
+        SDLTest_Log("Process %lu, working!\n", SDL_ThreadID());
         SDL_Delay(1 * 1000);
-        SDL_Log("Process %lu, done!\n", SDL_ThreadID());
+        SDLTest_Log("Process %lu, done!\n", SDL_ThreadID());
         if (SDL_UnlockMutex(mutex) < 0) {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't unlock mutex: %s", SDL_GetError());
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't unlock mutex: %s", SDL_GetError());
             exit(1);
         }
         /* If this sleep isn't done, then threads may starve */
         SDL_Delay(10);
     }
     if (SDL_ThreadID() == mainthread && doterminate) {
-        SDL_Log("Process %lu:  raising SIGTERM\n", SDL_ThreadID());
+        SDLTest_Log("Process %lu:  raising SIGTERM\n", SDL_ThreadID());
         raise(SIGTERM);
     }
     return (0);
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int i;
     int maxproc = 6;
@@ -100,24 +103,24 @@ main(int argc, char *argv[])
 
     /* Load the SDL library */
     if (SDL_Init(0) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError());
         exit(1);
     }
     atexit(SDL_Quit_Wrapper);
 
     if ((mutex = SDL_CreateMutex()) == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create mutex: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create mutex: %s\n", SDL_GetError());
         exit(1);
     }
 
     mainthread = SDL_ThreadID();
-    SDL_Log("Main thread: %lu\n", mainthread);
+    SDLTest_Log("Main thread: %lu\n", mainthread);
     atexit(printid);
     for (i = 0; i < maxproc; ++i) {
         char name[64];
         SDL_snprintf(name, sizeof (name), "Worker%d", i);
         if ((threads[i] = SDL_CreateThread(Run, name, NULL)) == NULL)
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread!\n");
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread!\n");
     }
     signal(SIGINT, terminate);
     Run(NULL);
diff --git a/test/testmain.c b/test/testmain.c
new file mode 100755 (executable)
index 0000000..59843b0
--- /dev/null
@@ -0,0 +1,706 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include "testmain.h"
+#include <signal.h>
+SDL_Surface* createSurface(const char* file)
+{
+       SDL_Surface* imageSurface;
+       imageSurface = SDL_LoadBMP(file);
+       if(NULL == imageSurface)
+       {
+               SDL_Log("Fail in SDL_LoadBMP: %s", SDL_GetError());
+       }
+       
+       return imageSurface;
+}
+
+SDL_Texture* loadTexture(SDL_Renderer* ren ,SDL_Surface* sur)
+{
+       SDL_Texture* texture = NULL;
+       
+       if(sur != NULL)
+       {
+               texture = SDL_CreateTextureFromSurface(ren, sur);
+               SDL_FreeSurface(sur);
+               
+               if(NULL == texture)
+               {
+                       SDL_Log("Fail in SDL_CreateTextureFromSurface: %s", SDL_GetError());
+               }
+               else
+               {
+                       //SDL_Log("Succeed to create texture from surface!\n");
+               }
+       }
+       
+       return texture;
+}
+
+void renderTexture(SDL_Texture* tex, SDL_Renderer* ren, int x, int y)
+{
+       SDL_Rect dst;
+       dst.x = x;
+       dst.y = y;
+       
+       SDL_QueryTexture(tex, NULL, NULL, &dst.w, &dst.h);
+       SDL_RenderCopy(ren, tex, NULL, &dst);
+       SDL_DestroyTexture(tex);
+}
+
+
+void  switchstate(SDL_bool* a, SDL_bool* b)
+{
+       SDL_bool tmp; 
+       tmp = *b;
+       *b = *a;
+       *a = tmp;
+}
+
+void DrawAutomationPage(SDL_Renderer* ren)
+{
+       SDL_Surface* surface = createSurface(MAINPAGE_BG);
+       SDL_Texture* texture = loadTexture(ren, surface);
+
+       
+       renderTexture(texture, ren, 0, 0);
+
+}
+
+void DrawAutomationNotify(SDL_Renderer* ren, int x, int y)
+{
+       SDL_Surface* surface = createSurface(AUTOTEST_NOTIFICATION);
+       SDL_Texture* texture = loadTexture(ren, surface);
+
+       
+       renderTexture(texture, ren, x, y);
+}
+
+void DrawMainPage(SDL_Renderer* ren)
+{
+       SDL_Surface* surface = createSurface(MAINPAGE_BG);
+       
+       SDL_Texture* texture = loadTexture(ren, surface);
+       
+       renderTexture(texture, ren, 0, 0);
+}
+
+void DrawButton(Button b,SDL_Renderer* ren)
+{
+       SDL_Surface* surface = NULL;
+       switch(b.type)
+       {
+               case AUTOTEST_BT:
+                       surface = createSurface(AUTOTEST_BT_BG);
+                       break;
+               case INTERTEST_BT:
+                       surface = createSurface(INTERTEST_BT_BG);
+                       break;
+               case LOOPWAVE_BT:
+                       surface = createSurface(LOOPWAVE_BG);
+                       break;
+               case LOOPWAVEQUEUE_BT:
+                       surface = createSurface(LOOPWAVEQUEUE_BG);
+                       break;
+               case ATOMIC_BT:
+                       surface = createSurface(ATOMIC_BG);
+                       break;
+               case AUDIOHOTPLUG_BT:
+                       surface = createSurface(AUDIOHOTPLUG_BG);
+                       break;
+               case AUDIOINFO_BT:
+                       surface = createSurface(AUDIOINFO_BG);
+                       break;
+               case CHESSBOARD_BT:
+                       surface = createSurface(CHESSBOARD_BG);
+                       break;
+               case DISPLAYINFO_BT:
+                       surface = createSurface(DISPLAYINFO_BG);
+                       break;
+               case DRAW2_BT:
+                       surface = createSurface(DRAW2_BG);
+                       break;
+               case DROPFILE_BT:
+                       surface = createSurface(DROPFILE_BG);
+                       break;
+               case ERROR_BT:
+                       surface = createSurface(ERROR_BG);
+                       break;
+               case FILE_BT:
+                       surface = createSurface(FILE_BG);
+                       break;
+               case FILESYSTEM_BT:
+                       surface = createSurface(FILESYSTEM_BG);
+                       break;
+               case GLES_BT:
+                       surface = createSurface(GLES_BG);
+                       break;
+               case GLES2_BT:
+                       surface = createSurface(GLES2_BG);
+                       break;
+               case HIT_BT:
+                       surface = createSurface(HIT_BG);
+                       break;
+               case ICONV_BT:
+                       surface = createSurface(ICONV_BG);
+                       break;
+               case IME_BT:
+                       surface = createSurface(IME_BG);
+                       break;
+               case INTERSECTION_BT:
+                       surface = createSurface(INTERSECTION_BG);
+                       break;
+               case KEYS_BT:
+                       surface = createSurface(KEYS_BG);
+                       break;
+               case LOADSO_BT:
+                       surface = createSurface(LOADSO_BG);
+                       break;
+               case LOCK_BT:
+                       surface = createSurface(LOCK_BG);
+                       break;
+               case MULTIAUDIO_BT:
+                       surface = createSurface(MULTIAUDIO_BG);
+                       break;
+               case OVERLAY2_BT:
+                       surface = createSurface(OVERLAY2_BG);
+                       break;
+               case PLATFORM_BT:
+                       surface = createSurface(PLATFORM_BG);
+                       break;
+               case RELATIVE_BT:
+                       surface = createSurface(RELATIVE_BG);
+                       break;
+               case RENDERCOPYEX_BT:
+                       surface = createSurface(RENDERCOPYEX_BG);
+                       break;
+               case RENDERTARGET_BT:
+                       surface = createSurface(RENDERTARGET_BG);
+                       break;
+               case RESAMPLE_BT:
+                       surface = createSurface(RESAMPLE_BG);
+                       break;
+               case SCALE_BT:
+                       surface = createSurface(SCALE_BG);
+                       break;
+               case SEM_BT:
+                       surface = createSurface(SEM_BG);
+                       break;
+               case SHADER_BT:
+                       surface = createSurface(SHADER_BG);
+                       break;
+               case SPRITE2_BT:
+                       surface = createSurface(SPRITE2_BG);
+                       break;
+               case SPRITEMINIMAL_BT:
+                       surface = createSurface(SPRITEMINIMAL_BG);
+                       break;
+               case STREAMING_BT:
+                       surface = createSurface(STREAMING_BG);
+                       break;
+               case THREAD_BT:
+                       surface = createSurface(THREAD_BG);
+                       break;
+               case TIMER_BT:
+                       surface = createSurface(TIMER_BG);
+                       break;
+               case VER_BT:
+                       surface = createSurface(VER_BG);
+                       break;
+               case VIEWPORT_BT:
+                       surface = createSurface(VIEWPORT_BG);
+                       break;
+               case TOTURETHREAD_BT:
+                       surface = createSurface(TOTURETHREAD_BG);
+                       break;
+               case TOBEADD1_BT:
+                       surface = createSurface(TOBEADD1_BG);
+                       break;
+               default:
+                       break;
+                               
+
+       }
+
+       
+       SDL_Texture* texture = loadTexture(ren, surface);
+       
+       renderTexture(texture, ren, b.x, b.y);
+       
+}
+
+void DrawInterractivePage(render)
+{
+       SDL_Surface* surface = createSurface(MAINPAGE_BG);
+       
+       SDL_Texture* texture = loadTexture(render, surface);
+       
+       renderTexture(texture, render, 0, 0);
+
+}
+
+
+void DrawInterractiveButtons(Button b[INTERACTIVE_ROW][INTERACTIVE_COLUM], SDL_Renderer * ren)
+{
+       int i, j;
+       for(i = 0; i < INTERACTIVE_ROW; i++)
+       {
+               for(j = 0; j < INTERACTIVE_COLUM; j++)
+               {
+                       DrawButton(b[i][j], ren);
+
+               }
+
+       }
+
+}
+
+
+void InitInteractiveButtons(Button button[INTERACTIVE_ROW][INTERACTIVE_COLUM])
+{
+       int tmpType = LOOPWAVE_BT;
+       int i, j;
+
+       for(i = 0; i < INTERACTIVE_ROW; i++)
+       {
+               for(j = 0; j < INTERACTIVE_COLUM; j++)
+               {
+                       button[i][j].x =  (j)*30 + (j) * 120;
+                       button[i][j].y =  (i)*30 + (i) *  135;
+                       //button[i][j].state = SDL_FALSE;
+                       button[i][j].type = tmpType;
+                       tmpType++;
+                       
+               }
+
+       }
+
+       //button[0][0].state = SDL_TRUE;
+
+
+}
+
+Vec2 MainPageButtonPressed(Sint32 x, Sint32 y, Button button[Main_ROW][Main_COLUM])
+{
+       int i, j;
+       Vec2 vec;
+
+       for(i = 0; i < Main_ROW; i++)
+       {
+               for(j = 0; j < Main_COLUM; j++)
+               {
+                       SDL_Point point;
+                       point.x = (int)x;
+                       point.y = (int)y;
+
+                       SDL_Rect rect;
+                       rect.x = button[i][j].x;
+                       rect.y = button[i][j].y;
+                       rect.w = MAINPAGE_BT_WIDTH;
+                       rect.h = MAINPAGE_BT_HEIGHT;
+
+                       if(SDL_PointInRect(&point, &rect))
+                       {
+                               vec.row = i;
+                               vec.column = j;
+                               return vec;
+
+                       }
+                       
+               }
+
+       }
+
+       vec.row = -1;
+       vec.column = -1;
+       return vec;
+       
+
+
+}
+
+Vec2 InterPageButtonPressed(Sint32 x, Sint32 y, Button button[INTERACTIVE_ROW][INTERACTIVE_COLUM])
+{
+       int i, j;
+       Vec2 vec;
+       for(i = 0; i < INTERACTIVE_ROW; i++)
+       {
+               for(j = 0; j < INTERACTIVE_COLUM; j++)
+               {
+                       SDL_Point point;
+                       point.x = (int)x;
+                       point.y = (int)y;
+
+                       SDL_Rect rect;
+                       rect.x = button[i][j].x;
+                       rect.y = button[i][j].y;
+                       rect.w = INTERACTIVEPAGE_BT_WIDTH;
+                       rect.h = INTERACTIVEPAGE_BT_HEIGHT;
+
+                       if(SDL_PointInRect(&point, &rect))
+                       {
+                               vec.row = i;
+                               vec.column = j;
+                               return vec;
+
+                       }
+
+               }
+
+       }
+
+       vec.row = -1;
+       vec.column = -1;
+
+       return vec;
+
+
+
+}
+
+
+int SDL_main(int argc, char*argv[])
+{
+    SDL_RWops* rwops = SDL_RWFromFile("log.txt", "w+");
+       SDL_RWclose(rwops);
+       if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) != 0)
+       {
+               SDL_Log("Fail in SDL_Init: %s\n", SDL_GetError());
+               return 1;
+       }
+       
+       SDL_Window* window = NULL;
+       SDL_Renderer* render = NULL;
+       
+       window = SDL_CreateWindow("Testmain", 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_SHOWN);
+       if(NULL == window)
+       {
+               SDL_Log("Fail in SDL_CreateWindow: %s\n", SDL_GetError());
+               return 1;
+       }
+       
+       render = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
+       if(NULL == render)
+       {
+               SDL_Log("Fail in SDL_CreateRenderer: %s\n", SDL_GetError());
+               SDL_DestroyWindow(window);
+               SDL_Quit();
+               return 1;
+       }
+       
+       SDL_RenderClear(render);
+       DrawMainPage(render);
+
+       Button MainButton[Main_ROW][Main_COLUM];
+       Button AutomationButton;
+       AutomationButton.type = AUTOTEST_BT;
+       AutomationButton.state = SDL_FALSE;
+       AutomationButton.x = 110;
+       AutomationButton.y = 200;
+       DrawButton(AutomationButton, render);
+       MainButton[0][0] = AutomationButton;
+       
+
+       Button InteractiveButton;
+       InteractiveButton.type = INTERTEST_BT;
+       InteractiveButton.state = SDL_FALSE;
+       InteractiveButton.x = 110;
+       InteractiveButton.y = 400;
+       DrawButton(InteractiveButton, render);
+       MainButton[1][0] = InteractiveButton;
+       
+       SDL_RenderPresent(render);
+
+       SDL_Event e;
+       SDL_bool quit = SDL_FALSE;
+       int page = MAINPAGE;
+
+       Button InterButton[INTERACTIVE_ROW][INTERACTIVE_COLUM];
+       pid_t pid;
+       Vec2 tmpVec;
+       
+       //InitInteractiveButtons(button);
+       
+       while(!quit)
+       {
+               while(SDL_PollEvent(&e))
+               {
+                       if(e.type == SDL_KEYDOWN)
+                       {
+                               if((e.key.keysym.sym == 0) &&(page == MAINPAGE))
+                               {
+                                       quit = SDL_TRUE;
+                               }else if((e.key.keysym.sym == 0) &&(page == INTERPAGE))
+                               {
+                                       DrawMainPage(render);
+                                       DrawButton(AutomationButton, render);
+                                       DrawButton(InteractiveButton, render);
+                                       SDL_RenderPresent(render);
+                                       page = MAINPAGE;        
+                                       
+                               }
+                       }
+                       if(e.type == SDL_MOUSEBUTTONDOWN)
+                       {
+                               if(page == MAINPAGE)
+                               {
+                                       tmpVec = MainPageButtonPressed(e.button.x, e.button.y, MainButton);
+                                       if(tmpVec.row == -1 && tmpVec.column == -1)
+                                       {
+                                               continue;
+
+                                       }
+                                       if(tmpVec.row == 0)
+                                       {
+                                               //DrawAutomationPage(render);
+                                               DrawAutomationNotify(render, 0, 0);
+                                               SDL_RenderPresent(render);
+                                               page = NOTIFYPAGE;
+                                                                                               
+                                               pid = fork();
+                                       
+                                               if (pid < 0)
+                                               {
+                                                       perror("Error in create new process");
+                                                       return 1;
+                                               }
+                                               else if (pid == 0)
+                                               {
+                                                       execl("./testautomation", "testautomation" ,(char*)0);
+                                               }
+                                               else
+                                               {
+                                                       wait();
+                                                       DrawMainPage(render);
+                                                       DrawButton(AutomationButton, render);
+                                                       DrawButton(InteractiveButton, render);
+                                                       SDL_RenderPresent(render);
+                                                       page = MAINPAGE;
+                                       
+                                               }
+
+                                       }
+                                       else if(tmpVec.row == 1)
+                                       {
+                                               InitInteractiveButtons(InterButton);
+                                               DrawInterractivePage(render);
+                                               DrawInterractiveButtons(InterButton,render);
+                                               page = INTERPAGE;
+                                               SDL_RenderPresent(render);
+                                       }
+
+                               }
+                               else if(page == INTERPAGE)
+                               {
+                                       tmpVec = InterPageButtonPressed(e.button.x, e.button.y, InterButton);
+                                       if(tmpVec.row == -1 && tmpVec.column == -1)
+                                       {
+                                               continue;
+
+                                       }
+                                       //DrawAutomationPage(render);
+                                       DrawAutomationNotify(render, 0, 0);
+                                       SDL_RenderPresent(render);
+                                       page = NOTIFYPAGE;
+                                       pid = fork();
+
+                                       if (pid < 0)
+                                       {
+                                               perror("Error in create new process");
+                                               return 1;
+                                       }
+                                       else if(pid == 0)
+                                       {
+                                               
+                                               switch(InterButton[tmpVec.row][tmpVec.column].type)
+                                               {
+                                                       case LOOPWAVE_BT:
+                                                               SDLTest_Log("-------loopwave test start-------");
+                                                               execl("./loopwave", "loopwave" ,(char*)0);
+                                                               break;
+                                                       case LOOPWAVEQUEUE_BT:
+                                                               SDLTest_Log("-------loopwavequeue test start-------");
+                                                               execl("./loopwavequeue", "loopwavequeue", (char*)0);
+                                                               break;
+                                                       case ATOMIC_BT:
+                                                               SDLTest_Log("-------atomic test start-------");
+                                                               execl("./testautomic", "testautomic", (char*)0);
+                                                               break;
+                                                       case AUDIOHOTPLUG_BT:
+                                                               SDLTest_Log("-------audiohotplug test start-------");
+                                                               execl("./testaudiohotplug", "testaudiohotplug", (char*)0);
+                                                               break;
+                                                       case AUDIOINFO_BT:
+                                                               SDLTest_Log("-------audioinfo test start-------");
+                                                               execl("./testaudioinfo", "testaudioinfo", (char*)0);
+                                                               break;
+                                                       case CHESSBOARD_BT:
+                                                               SDLTest_Log("-------draw chessboard test start-------");
+                                                               execl("./testdrawchessboard", "testdrawchessboard", (char*)0);
+                                                               break;
+                                                       case DISPLAYINFO_BT:
+                                                               SDLTest_Log("-------displayinfo test start-------");
+                                                               execl("./testdisplayinfo", "testdisplayinfo",  (char*)0);
+                                                               break;
+                                                       case DRAW2_BT:
+                                                               SDLTest_Log("-------draw2 test start-------");
+                                                               execl("./testdraw2", "testdraw2", (char*)0);
+                                                               break;
+                                                       case DROPFILE_BT:
+                                                               SDLTest_Log("-------dropfile test start-------");
+                                                               execl("./testdorpfile", "testdorpfile", (char*)0);
+                                                               break;
+                                                       case ERROR_BT:
+                                                               SDLTest_Log("-------error test start-------");
+                                                               execl("./testerror", "testerror", (char*)0);
+                                                               break;
+                                                       case FILE_BT:
+                                                               SDLTest_Log("-------file test start-------");
+                                                               execl("./testfile", "testfile", (char*)0);
+                                                               break;
+                                                       case FILESYSTEM_BT:
+                                                               SDLTest_Log("-------filesystem test start-------");
+                                                               execl("./testfilesystem", "testfilesystem", (char*)0);
+                                                               break;
+                                                       case GLES_BT:
+                                                               SDLTest_Log("-------gles test start-------");
+                                                               execl("./testgles", "testgles", (char*)0);
+                                                               break;
+                                                       case GLES2_BT:
+                                                               SDLTest_Log("-------gles2 test start-------");
+                                                               execl("./testgles2", "testgles2", (char*)0);
+                                                               break;
+                                                       case HIT_BT:
+                                                               SDLTest_Log("-------hit test start-------");
+                                                               execl("./testhit", "testhit", (char*)0);
+                                                               break;
+                                                       case ICONV_BT:
+                                                               SDLTest_Log("-------iconv test start-------");
+                                                               execl("./testconv", "testconv", (char*)0);
+                                                               break;
+                                                       case IME_BT:
+                                                               SDLTest_Log("-------IME test start-------");
+                                                               execl("./testtime", "testtime", (char*)0);
+                                                               break;
+                                                       case INTERSECTION_BT:
+                                                               SDLTest_Log("-------intersection test start-------");
+                                                               execl("./testintersection", "testintersection", (char*)0);
+                                                               break;
+                                                       case KEYS_BT:
+                                                               SDLTest_Log("-------keys test start-------");
+                                                               execl("./testkes", "testkes", (char*)0);
+                                                               break;
+                                                       case LOADSO_BT:
+                                                               SDLTest_Log("-------loadso test start-------");
+                                                               execl("./testloadso", "testloadso", (char*)0);
+                                                               break;
+                                                       case LOCK_BT:
+                                                               SDLTest_Log("-------lock test start-------");
+                                                               execl("./testlock", "testlock", (char*)0);
+                                                               break;
+                                                       case MULTIAUDIO_BT:
+                                                               SDLTest_Log("-------multiaudio test start-------");
+                                                               execl("./testmultiaudio", "testmultiaudio", (char*)0);
+                                                               break;
+                                                       case OVERLAY2_BT:
+                                                               SDLTest_Log("-------overlay2 test start-------");
+                                                               execl("testoverlay2", "testoverlay2", (char*)0);
+                                                               break;
+                                                       case PLATFORM_BT:
+                                                               SDLTest_Log("-------platform test start-------");
+                                                               execl("./testplatform","testplatform", (char*)0);
+                                                               break;
+                                                       case RELATIVE_BT:
+                                                               SDLTest_Log("-------relative test start-------");
+                                                               execl("./testrelative", "testrelative", (char*)0);
+                                                               break;
+                                                       case RENDERCOPYEX_BT:
+                                                               SDLTest_Log("-------rendercopyex test start-------");
+                                                               execl("./testrendercopyex", "testrendercopyex", (char*)0);
+                                                               break;
+                                                       case RENDERTARGET_BT:
+                                                               SDLTest_Log("-------rendercopytarget test start-------");
+                                                               execl("./testrendertarget", "testrendertarget", (char*)0);
+                                                               break;
+                                                       case RESAMPLE_BT:
+                                                               SDLTest_Log("-------resample test start-------");
+                                                               execl("./testresample", "testresample", (char*)0);
+                                                               break;
+                                                       case SCALE_BT:
+                                                               SDLTest_Log("-------scale test start-------");
+                                                               execl("./testscale", "testscale", (char*)0);
+                                                               break;
+                                                       case SEM_BT:
+                                                               SDLTest_Log("-------semaphore test start-------");
+                                                               execl("./testsem", "testsem", (char*)0);
+                                                               break;
+                                                       case SHADER_BT:
+                                                               SDLTest_Log("-------shader test start-------");
+                                                               execl("./testshader", "testshader", (char*)0);
+                                                               break;
+                                                       case SPRITE2_BT:
+                                                               SDLTest_Log("-------sprite2 test start-------");
+                                                               execl("./testsprite2", "testsprite2", (char*)0);
+                                                               break;
+                                                       case SPRITEMINIMAL_BT:
+                                                               SDLTest_Log("-------testsptiteminimal test start-------");
+                                                               execl("./testspriteminimal", "testspriteminimal", (char*)0);
+                                                               break;
+                                                       case STREAMING_BT:
+                                                               SDLTest_Log("-------streaming test start-------");
+                                                               execl("./teststreaming", "teststreaming", (char*)0);
+                                                               break;
+                                                       case THREAD_BT:
+                                                               SDLTest_Log("-------thread test start-------");
+                                                               execl("./testthread", "testthread", (char*)0);
+                                                               break;
+                                                       case TIMER_BT:
+                                                               SDLTest_Log("-------timer test start-------");
+                                                               execl("./testtimer", "testtimer", (char*)0);
+                                                               break;
+                                                       case VER_BT:
+                                                               SDLTest_Log("-------version test start-------");
+                                                               execl("./testver", "testver", (char*)0);
+                                                               break;
+                                                       case VIEWPORT_BT:
+                                                               SDLTest_Log("-------viewport test start-------");
+                                                               execl("./testviewport", "testviewport", 0);
+                                                               break;
+                                                       case TOTURETHREAD_BT:
+                                                               SDLTest_Log("-------torturethread test start-------");
+                                                               execl("./torturethread", "torturethread", 0);
+                                                               break;
+                                                       default:
+                                                               signal(SIGCHLD, SIG_DFL);
+                                                               break;  
+                                               }
+                                       }
+                                       else
+                                       {
+                                               wait();
+                                               DrawInterractivePage(render);
+                                               DrawInterractiveButtons(InterButton,render);
+                                               SDL_RenderPresent(render);
+                                               page = INTERPAGE;
+                                               
+                                       }
+
+                               }
+                               
+                       }
+                       
+               }
+       }
+       
+       //SDL_Delay(10000);
+       
+       SDL_DestroyRenderer(render);
+       SDL_DestroyWindow(window);
+       SDL_Quit();
+       
+       return 0;
+
+}
diff --git a/test/testmain.h b/test/testmain.h
new file mode 100755 (executable)
index 0000000..3cc484f
--- /dev/null
@@ -0,0 +1,133 @@
+#include <SDL.h>\r
+\r
+#define WINDOW_WIDTH 720\r
+#define WINDOW_HEIGHT 1280\r
+\r
+#define INTERACTIVEPAGE_BT_WIDTH  120\r
+#define INTERACTIVEPAGE_BT_HEIGHT 135\r
+\r
+#define MAINPAGE_BT_WIDTH 500\r
+#define MAINPAGE_BT_HEIGHT 120\r
+\r
+#define MAINPAGE_BG "res/bg.bmp"\r
+#define AUTOTEST_BT_BG "res/AutomationTest.bmp"\r
+#define INTERTEST_BT_BG "res/InteractiveTest.bmp"\r
+#define AUTOTEST_BG "res/bg.bmp"\r
+#define AUTOTEST_NOTIFICATION "res/AutomationNotify.bmp"\r
+\r
+#define LOOPWAVE_BG                    "res/loopwave.bmp"\r
+#define LOOPWAVEQUEUE_BG               "res/loopwavequeue.bmp"\r
+#define ATOMIC_BG                              "res/testatomic.bmp"\r
+#define AUDIOHOTPLUG_BG                "res/testaudiohotplug.bmp"\r
+#define AUDIOINFO_BG                           "res/testaudioinfo.bmp"\r
+#define CHESSBOARD_BG                  "res/testchessboard.bmp"\r
+#define DISPLAYINFO_BG                         "res/testdisplayinfo.bmp"\r
+#define DRAW2_BG                               "res/testdraw2.bmp"\r
+#define DROPFILE_BG                            "res/testdropfile.bmp"\r
+#define ERROR_BG                               "res/testerror.bmp"\r
+#define FILE_BG                                        "res/testfile.bmp"\r
+#define FILESYSTEM_BG                  "res/testfilesystem.bmp"\r
+#define GLES_BG                                        "res/testgles.bmp"\r
+#define GLES2_BG                               "res/testgles2.bmp"\r
+#define HIT_BG                                         "res/testhit.bmp"\r
+#define ICONV_BG                                       "res/testiconv.bmp"\r
+#define IME_BG                                         "res/testime.bmp"\r
+#define INTERSECTION_BG                        "res/testintersection.bmp"\r
+#define KEYS_BG                                        "res/testkeys.bmp"\r
+#define LOADSO_BG                              "res/testloadso.bmp"\r
+#define LOCK_BG                                        "res/testlock.bmp"\r
+#define MULTIAUDIO_BG                  "res/testmultiaudio.bmp"\r
+#define OVERLAY2_BG                            "res/testoverlay2.bmp"\r
+#define PLATFORM_BG                            "res/testplatform.bmp"\r
+#define RELATIVE_BG                            "res/testrelative.bmp"\r
+#define RENDERCOPYEX_BG                "res/testrendercopyex.bmp"\r
+#define RENDERTARGET_BG                "res/testrendertarget.bmp"\r
+#define RESAMPLE_BG                            "res/testresample.bmp"\r
+#define SCALE_BG                                       "res/testscale.bmp"\r
+#define SEM_BG                                 "res/testsem.bmp"\r
+#define SHADER_BG                              "res/testshader.bmp"\r
+#define SPRITE2_BG                             "res/testsprite2.bmp"\r
+#define SPRITEMINIMAL_BG                       "res/testspriteminimal.bmp"\r
+#define STREAMING_BG                   "res/teststreaming.bmp"\r
+#define THREAD_BG                              "res/testthread.bmp"\r
+#define TIMER_BG                                       "res/testtimer.bmp"\r
+#define VER_BG                                 "res/testver.bmp"\r
+#define VIEWPORT_BG                            "res/testviewport.bmp"\r
+#define TOTURETHREAD_BG                "res/testtoturethread.bmp"\r
+#define TOBEADD1_BG                            "res/testadded.bmp"\r
+\r
+\r
+enum\r
+{\r\r
+       AUTOTEST_BT,\r
+       INTERTEST_BT,\r
+       LOOPWAVE_BT,\r
+       LOOPWAVEQUEUE_BT,\r
+       ATOMIC_BT ,\r
+       AUDIOHOTPLUG_BT ,\r
+       AUDIOINFO_BT ,\r
+       CHESSBOARD_BT,\r
+       DISPLAYINFO_BT,\r
+       DRAW2_BT ,\r
+       DROPFILE_BT,\r
+       ERROR_BT,\r
+       FILE_BT ,\r
+       FILESYSTEM_BT,\r
+       GLES_BT ,\r
+       GLES2_BT,\r
+       HIT_BT ,\r
+       ICONV_BT,\r
+       IME_BT,\r
+       INTERSECTION_BT,\r
+       KEYS_BT,\r
+       LOADSO_BT,\r
+       LOCK_BT,\r
+       MULTIAUDIO_BT,\r
+       OVERLAY2_BT,\r
+       PLATFORM_BT,\r
+       RELATIVE_BT,\r
+       RENDERCOPYEX_BT,\r
+       RENDERTARGET_BT,\r
+       RESAMPLE_BT,\r
+       SCALE_BT,\r
+       SEM_BT,\r
+       SHADER_BT,\r
+       SPRITE2_BT,\r
+       SPRITEMINIMAL_BT,\r
+       STREAMING_BT,\r
+       THREAD_BT,\r
+       TIMER_BT,\r
+       VER_BT,\r
+       VIEWPORT_BT,\r
+       TOTURETHREAD_BT,\r
+       TOBEADD1_BT\r
+\r
+};\r
+\r
+\r
+#define MAINPAGE                               0\r
+#define INTERPAGE                              1\r
+#define NOTIFYPAGE                             2\r
+\r
+#define INTERACTIVE_ROW                        8\r
+#define INTERACTIVE_COLUM              5\r
+\r
+#define Main_ROW                                       2\r
+#define Main_COLUM                             1\r
+\r
+typedef struct\r
+{\r
+       int type;\r
+       SDL_bool state;\r
+       int x;\r
+       int y;\r
+}Button;\r
+\r
+typedef struct\r
+{\r\r
+       int row;\r
+       int column;\r
+\r
+}Vec2;\r
+\r
+\r
old mode 100644 (file)
new mode 100755 (executable)
index 91968c3..1a4864a
@@ -59,7 +59,7 @@ button_messagebox(void *eventNumber)
 
     success = SDL_ShowMessageBox(&data, &button);
     if (success == -1) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
         if (eventNumber) {
             SDL_UserEvent event;
             event.type = (intptr_t)eventNumber;
@@ -69,7 +69,7 @@ button_messagebox(void *eventNumber)
             quit(2);
         }
     }
-    SDL_Log("Pressed button: %d, %s\n", button, button == -1 ? "[closed]" : button == 1 ? "Cancel" : "OK");
+    SDLTest_Log("Pressed button: %d, %s\n", button, button == -1 ? "[closed]" : button == 1 ? "Cancel" : "OK");
 
     if (eventNumber) {
         SDL_UserEvent event;
@@ -79,9 +79,8 @@ button_messagebox(void *eventNumber)
 
     return 0;
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int success;
 
@@ -93,7 +92,7 @@ main(int argc, char *argv[])
                 "This is a simple error MessageBox",
                 NULL);
     if (success == -1) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
         quit(1);
     }
 
@@ -102,7 +101,7 @@ main(int argc, char *argv[])
                 "This is a simple MessageBox with a newline:\r\nHello world!",
                 NULL);
     if (success == -1) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
         quit(1);
     }
 
@@ -112,7 +111,7 @@ main(int argc, char *argv[])
                 "Unicode text: '牛肉西蘭花' ...",
                 NULL);
     if (success == -1) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
         quit(1);
     }
 
@@ -122,7 +121,7 @@ main(int argc, char *argv[])
                 "Unicode text and newline:\r\n'牛肉西蘭花'\n'牛肉西蘭花'",
                 NULL);
     if (success == -1) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
         quit(1);
     }
 
@@ -132,7 +131,7 @@ main(int argc, char *argv[])
                 "Unicode text in the title.",
                 NULL);
     if (success == -1) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
         quit(1);
     }
 
@@ -145,7 +144,7 @@ main(int argc, char *argv[])
        subsystem on the main thread.
      */
     if (SDL_Init(SDL_INIT_VIDEO) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL video subsystem: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL video subsystem: %s\n", SDL_GetError());
         return (1);
     }
     {
@@ -163,7 +162,7 @@ main(int argc, char *argv[])
 
         SDL_WaitThread(thread, &status);
 
-        SDL_Log("Message box thread return %i\n", status);
+        SDLTest_Log("Message box thread return %i\n", status);
     }
 
     /* Test showing a message box with a parent window */
@@ -176,7 +175,7 @@ main(int argc, char *argv[])
                     "This is a simple error MessageBox with a parent window",
                     window);
         if (success == -1) {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
             quit(1);
         }
 
old mode 100644 (file)
new mode 100755 (executable)
index 117ef26..5f351b4
@@ -78,7 +78,7 @@ test_multi_audio(int devcount)
 #endif
 
     if (devcount > 64) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Too many devices (%d), clamping to 64...\n",
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Too many devices (%d), clamping to 64...\n",
                 devcount);
         devcount = 64;
     }
@@ -87,14 +87,14 @@ test_multi_audio(int devcount)
 
     for (i = 0; i < devcount; i++) {
         const char *devname = SDL_GetAudioDeviceName(i, 0);
-        SDL_Log("playing on device #%d: ('%s')...", i, devname);
+        SDLTest_Log("playing on device #%d: ('%s')...", i, devname);
         fflush(stdout);
 
         SDL_memset(&cbd[0], '\0', sizeof(callback_data));
         spec.userdata = &cbd[0];
         cbd[0].dev = SDL_OpenAudioDevice(devname, 0, &spec, NULL, 0);
         if (cbd[0].dev == 0) {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Open device failed: %s\n", SDL_GetError());
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Open device failed: %s\n", SDL_GetError());
         } else {
             SDL_PauseAudioDevice(cbd[0].dev, 0);
 #ifdef __EMSCRIPTEN__
@@ -110,20 +110,20 @@ test_multi_audio(int devcount)
             }
             SDL_PauseAudioDevice(cbd[0].dev, 1);
 #endif
-            SDL_Log("done.\n");
+            SDLTest_Log("done.\n");
             SDL_CloseAudioDevice(cbd[0].dev);
         }
     }
 
     SDL_memset(cbd, '\0', sizeof(cbd));
 
-    SDL_Log("playing on all devices...\n");
+    SDLTest_Log("playing on all devices...\n");
     for (i = 0; i < devcount; i++) {
         const char *devname = SDL_GetAudioDeviceName(i, 0);
         spec.userdata = &cbd[i];
         cbd[i].dev = SDL_OpenAudioDevice(devname, 0, &spec, NULL, 0);
         if (cbd[i].dev == 0) {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Open device %d failed: %s\n", i, SDL_GetError());
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Open device %d failed: %s\n", i, SDL_GetError());
         }
     }
 
@@ -156,13 +156,12 @@ test_multi_audio(int devcount)
         }
     }
 
-    SDL_Log("All done!\n");
+    SDLTest_Log("All done!\n");
 #endif
 }
 
-
 int
-main(int argc, char **argv)
+SDL_main(int argc, char **argv)
 {
     int devcount = 0;
 
@@ -171,23 +170,23 @@ main(int argc, char **argv)
 
     /* Load the SDL library */
     if (SDL_Init(SDL_INIT_AUDIO) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return (1);
     }
 
-    SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
+    SDLTest_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
     
     devcount = SDL_GetNumAudioDevices(0);
     if (devcount < 1) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Don't see any specific audio devices!\n");
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Don't see any specific audio devices!\n");
     } else {
         if (argv[1] == NULL) {
-            argv[1] = "sample.wav";
+            argv[1] = "res/sample.wav";
         }
 
         /* Load the wave file into memory */
         if (SDL_LoadWAV(argv[1], &spec, &sound, &soundlen) == NULL) {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", argv[1],
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", argv[1],
                     SDL_GetError());
         } else {
             test_multi_audio(devcount);
old mode 100644 (file)
new mode 100755 (executable)
index 453f0f4..1025a71
@@ -248,18 +248,18 @@ ConvertRGBtoNV12(Uint8 *rgb, Uint8 *out, int w, int h,
 static void
 PrintUsage(char *argv0)
 {
-    SDL_Log("Usage: %s [arg] [arg] [arg] ...\n", argv0);
-    SDL_Log("\n");
-    SDL_Log("Where 'arg' is any of the following options:\n");
-    SDL_Log("\n");
-    SDL_Log("    -fps <frames per second>\n");
-    SDL_Log("    -nodelay\n");
-    SDL_Log("    -format <fmt> (one of the: YV12, IYUV, YUY2, UYVY, YVYU)\n");
-    SDL_Log("    -scale <scale factor> (initial scale of the overlay)\n");
-    SDL_Log("    -help (shows this help)\n");
-    SDL_Log("\n");
-    SDL_Log("Press ESC to exit, or SPACE to freeze the movie while application running.\n");
-    SDL_Log("\n");
+    SDLTest_Log("Usage: %s [arg] [arg] [arg] ...\n", argv0);
+    SDLTest_Log("\n");
+    SDLTest_Log("Where 'arg' is any of the following options:\n");
+    SDLTest_Log("\n");
+    SDLTest_Log("    -fps <frames per second>\n");
+    SDLTest_Log("    -nodelay\n");
+    SDLTest_Log("    -format <fmt> (one of the: YV12, IYUV, YUY2, UYVY, YVYU)\n");
+    SDLTest_Log("    -scale <scale factor> (initial scale of the overlay)\n");
+    SDLTest_Log("    -help (shows this help)\n");
+    SDLTest_Log("\n");
+    SDLTest_Log("Press ESC to exit, or SPACE to freeze the movie while application running.\n");
+    SDLTest_Log("\n");
 }
 
 void
@@ -294,6 +294,11 @@ loop()
             if (event.key.keysym.sym != SDLK_ESCAPE) {
                 break;
             }
+          if(event.key.keysym.sym == 0)
+          {
+               done = SDL_TRUE;
+               break;
+          }
         case SDL_QUIT:
             done = SDL_TRUE;
             break;
@@ -319,9 +324,8 @@ loop()
     }
 #endif
 }
-
 int
-main(int argc, char **argv)
+SDL_main(int argc, char **argv)
 {
     Uint8 *RawMooseData;
     SDL_RWops *handle;
@@ -341,7 +345,7 @@ main(int argc, char **argv)
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     if (SDL_Init(SDL_INIT_VIDEO) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return 3;
     }
 
@@ -350,19 +354,19 @@ main(int argc, char **argv)
             if (argv[2]) {
                 fps = atoi(argv[2]);
                 if (fps == 0) {
-                    SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
+                    SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION,
                             "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
                     quit(10);
                 }
                 if ((fps < 0) || (fps > 1000)) {
-                    SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
+                    SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION,
                             "The -fps option must be in range from 1 to 1000, default is 12.\n");
                     quit(10);
                 }
                 argv += 2;
                 argc -= 2;
             } else {
-                SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
+                SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION,
                         "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
                 quit(10);
             }
@@ -374,19 +378,19 @@ main(int argc, char **argv)
             if (argv[2]) {
                 scale = atoi(argv[2]);
                 if (scale == 0) {
-                    SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
+                    SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION,
                             "The -scale option requires an argument [from 1 to 50], default is 5.\n");
                     quit(10);
                 }
                 if ((scale < 0) || (scale > 50)) {
-                    SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
+                    SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION,
                             "The -scale option must be in range from 1 to 50, default is 5.\n");
                     quit(10);
                 }
                 argv += 2;
                 argc -= 2;
             } else {
-                SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
+                SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION,
                         "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
                 quit(10);
             }
@@ -395,7 +399,7 @@ main(int argc, char **argv)
             PrintUsage(argv[0]);
             quit(0);
         } else {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unrecognized option: %s.\n", argv[1]);
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unrecognized option: %s.\n", argv[1]);
             quit(10);
         }
         break;
@@ -403,15 +407,15 @@ main(int argc, char **argv)
 
     RawMooseData = (Uint8 *) malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT);
     if (RawMooseData == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't allocate memory for movie !\n");
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't allocate memory for movie !\n");
         free(RawMooseData);
         quit(1);
     }
 
     /* load the trojan moose images */
-    handle = SDL_RWFromFile("moose.dat", "rb");
+    handle = SDL_RWFromFile("res/moose.dat", "rb");
     if (handle == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n");
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n");
         free(RawMooseData);
         quit(2);
     }
@@ -429,21 +433,21 @@ main(int argc, char **argv)
                               window_w, window_h,
                               SDL_WINDOW_RESIZABLE);
     if (!window) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError());
         free(RawMooseData);
         quit(4);
     }
 
     renderer = SDL_CreateRenderer(window, -1, 0);
     if (!renderer) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError());
         free(RawMooseData);
         quit(4);
     }
 
     MooseTexture = SDL_CreateTexture(renderer, pixel_format, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H);
     if (!MooseTexture) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError());
         free(RawMooseData);
         quit(5);
     }
@@ -471,7 +475,7 @@ main(int argc, char **argv)
             ConvertRGBtoNV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100);
             break;
         default:
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unsupported pixel format\n");
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unsupported pixel format\n");
             break;
         }
     }
diff --git a/test/testpicture.c b/test/testpicture.c
new file mode 100755 (executable)
index 0000000..cc6f86d
--- /dev/null
@@ -0,0 +1,46 @@
+#include "SDL.h"
+
+int SDL_main(int argc, char *argv[]) {
+   
+    SDL_Window *win = NULL;
+    SDL_Renderer *renderer = NULL;
+    SDL_Texture *bitmapTex = NULL;
+    SDL_Surface *bitmapSurface = NULL;
+    int posX = 100, posY = 100, width = 320, height = 240;
+
+    SDL_Init(SDL_INIT_VIDEO);
+
+    win = SDL_CreateWindow("Hello World", posX, posY, width, height, 0);
+
+    renderer = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED);
+
+    bitmapSurface = SDL_LoadBMP("res/test.bmp");
+    bitmapTex = SDL_CreateTextureFromSurface(renderer, bitmapSurface);
+    SDL_FreeSurface(bitmapSurface);
+
+    SDL_RenderClear(renderer);
+    SDL_RenderCopy(renderer, bitmapTex, NULL, NULL);
+    SDL_RenderPresent(renderer);
+
+    /*
+    while (1) {
+        SDL_Event e;
+        if (SDL_PollEvent(&e)) {
+            if (e.type == SDL_QUIT) {
+                break;
+            }
+        }
+
+    }*/
+
+    SDL_Delay(5000);
+
+    SDL_DestroyTexture(bitmapTex);
+    SDL_DestroyRenderer(renderer);
+    SDL_DestroyWindow(win);
+
+    SDL_Quit();
+
+    return 0;
+}
+
old mode 100644 (file)
new mode 100755 (executable)
index 14acac4..82b350c
@@ -32,30 +32,30 @@ TestTypes(SDL_bool verbose)
 
     if (badsize(sizeof(Uint8), 1)) {
         if (verbose)
-            SDL_Log("sizeof(Uint8) != 1, instead = %u\n",
+            SDLTest_Log("sizeof(Uint8) != 1, instead = %u\n",
                    (unsigned int)sizeof(Uint8));
         ++error;
     }
     if (badsize(sizeof(Uint16), 2)) {
         if (verbose)
-            SDL_Log("sizeof(Uint16) != 2, instead = %u\n",
+            SDLTest_Log("sizeof(Uint16) != 2, instead = %u\n",
                    (unsigned int)sizeof(Uint16));
         ++error;
     }
     if (badsize(sizeof(Uint32), 4)) {
         if (verbose)
-            SDL_Log("sizeof(Uint32) != 4, instead = %u\n",
+            SDLTest_Log("sizeof(Uint32) != 4, instead = %u\n",
                    (unsigned int)sizeof(Uint32));
         ++error;
     }
     if (badsize(sizeof(Uint64), 8)) {
         if (verbose)
-            SDL_Log("sizeof(Uint64) != 8, instead = %u\n",
+            SDLTest_Log("sizeof(Uint64) != 8, instead = %u\n",
                    (unsigned int)sizeof(Uint64));
         ++error;
     }
     if (verbose && !error)
-        SDL_Log("All data types are the expected size.\n");
+        SDLTest_Log("All data types are the expected size.\n");
 
     return (error ? 1 : 0);
 }
@@ -80,7 +80,7 @@ TestEndian(SDL_bool verbose)
     swapped64 |= 0xDEADBEEF;
 
     if (verbose) {
-        SDL_Log("Detected a %s endian machine.\n",
+        SDLTest_Log("Detected a %s endian machine.\n",
                (SDL_BYTEORDER == SDL_LIL_ENDIAN) ? "little" : "big");
     }
     if ((*((char *) &value) >> 4) == 0x1) {
@@ -90,38 +90,38 @@ TestEndian(SDL_bool verbose)
     }
     if (real_byteorder != SDL_BYTEORDER) {
         if (verbose) {
-            SDL_Log("Actually a %s endian machine!\n",
+            SDLTest_Log("Actually a %s endian machine!\n",
                    (real_byteorder == SDL_LIL_ENDIAN) ? "little" : "big");
         }
         ++error;
     }
     if (verbose) {
-        SDL_Log("Value 16 = 0x%X, swapped = 0x%X\n", value16,
+        SDLTest_Log("Value 16 = 0x%X, swapped = 0x%X\n", value16,
                SDL_Swap16(value16));
     }
     if (SDL_Swap16(value16) != swapped16) {
         if (verbose) {
-            SDL_Log("16 bit value swapped incorrectly!\n");
+            SDLTest_Log("16 bit value swapped incorrectly!\n");
         }
         ++error;
     }
     if (verbose) {
-        SDL_Log("Value 32 = 0x%X, swapped = 0x%X\n", value32,
+        SDLTest_Log("Value 32 = 0x%X, swapped = 0x%X\n", value32,
                SDL_Swap32(value32));
     }
     if (SDL_Swap32(value32) != swapped32) {
         if (verbose) {
-            SDL_Log("32 bit value swapped incorrectly!\n");
+            SDLTest_Log("32 bit value swapped incorrectly!\n");
         }
         ++error;
     }
     if (verbose) {
-        SDL_Log("Value 64 = 0x%"SDL_PRIX64", swapped = 0x%"SDL_PRIX64"\n", value64,
+        SDLTest_Log("Value 64 = 0x%"SDL_PRIX64", swapped = 0x%"SDL_PRIX64"\n", value64,
                SDL_Swap64(value64));
     }
     if (SDL_Swap64(value64) != swapped64) {
         if (verbose) {
-            SDL_Log("64 bit value swapped incorrectly!\n");
+            SDLTest_Log("64 bit value swapped incorrectly!\n");
         }
         ++error;
     }
@@ -133,19 +133,19 @@ int
 TestCPUInfo(SDL_bool verbose)
 {
     if (verbose) {
-        SDL_Log("CPU count: %d\n", SDL_GetCPUCount());
-        SDL_Log("CPU cache line size: %d\n", SDL_GetCPUCacheLineSize());
-        SDL_Log("RDTSC %s\n", SDL_HasRDTSC()? "detected" : "not detected");
-        SDL_Log("AltiVec %s\n", SDL_HasAltiVec()? "detected" : "not detected");
-        SDL_Log("MMX %s\n", SDL_HasMMX()? "detected" : "not detected");
-        SDL_Log("3DNow! %s\n", SDL_Has3DNow()? "detected" : "not detected");
-        SDL_Log("SSE %s\n", SDL_HasSSE()? "detected" : "not detected");
-        SDL_Log("SSE2 %s\n", SDL_HasSSE2()? "detected" : "not detected");
-        SDL_Log("SSE3 %s\n", SDL_HasSSE3()? "detected" : "not detected");
-        SDL_Log("SSE4.1 %s\n", SDL_HasSSE41()? "detected" : "not detected");
-        SDL_Log("SSE4.2 %s\n", SDL_HasSSE42()? "detected" : "not detected");
-        SDL_Log("AVX %s\n", SDL_HasAVX()? "detected" : "not detected");
-        SDL_Log("System RAM %d MB\n", SDL_GetSystemRAM());
+        SDLTest_Log("CPU count: %d\n", SDL_GetCPUCount());
+        SDLTest_Log("CPU cache line size: %d\n", SDL_GetCPUCacheLineSize());
+        SDLTest_Log("RDTSC %s\n", SDL_HasRDTSC()? "detected" : "not detected");
+        SDLTest_Log("AltiVec %s\n", SDL_HasAltiVec()? "detected" : "not detected");
+        SDLTest_Log("MMX %s\n", SDL_HasMMX()? "detected" : "not detected");
+        SDLTest_Log("3DNow! %s\n", SDL_Has3DNow()? "detected" : "not detected");
+        SDLTest_Log("SSE %s\n", SDL_HasSSE()? "detected" : "not detected");
+        SDLTest_Log("SSE2 %s\n", SDL_HasSSE2()? "detected" : "not detected");
+        SDLTest_Log("SSE3 %s\n", SDL_HasSSE3()? "detected" : "not detected");
+        SDLTest_Log("SSE4.1 %s\n", SDL_HasSSE41()? "detected" : "not detected");
+        SDLTest_Log("SSE4.2 %s\n", SDL_HasSSE42()? "detected" : "not detected");
+        SDLTest_Log("AVX %s\n", SDL_HasAVX()? "detected" : "not detected");
+        SDLTest_Log("System RAM %d MB\n", SDL_GetSystemRAM());
     }
     return (0);
 }
@@ -169,7 +169,7 @@ TestAssertions(SDL_bool verbose)
     {
         const SDL_AssertData *item = SDL_GetAssertionReport();
         while (item) {
-            SDL_Log("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
+            SDLTest_Log("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
                 item->condition, item->function, item->filename,
                 item->linenum, item->trigger_count,
                 item->always_ignore ? "yes" : "no");
@@ -178,9 +178,8 @@ TestAssertions(SDL_bool verbose)
     }
     return (0);
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     SDL_bool verbose = SDL_TRUE;
     int status = 0;
@@ -192,7 +191,7 @@ main(int argc, char *argv[])
         verbose = SDL_FALSE;
     }
     if (verbose) {
-        SDL_Log("This system is running %s\n", SDL_GetPlatform());
+        SDLTest_Log("This system is running %s\n", SDL_GetPlatform());
     }
 
     status += TestTypes(verbose);
old mode 100644 (file)
new mode 100755 (executable)
index 59d23f6..020c5ed
@@ -17,7 +17,8 @@
 #include <time.h>
 
 #include "SDL_test_common.h"
-
+#define WINDOW_WIDTH 720
+#define WINDOW_HEIGHT 1280
 #ifdef __EMSCRIPTEN__
 #include <emscripten/emscripten.h>
 #endif
@@ -46,6 +47,12 @@ loop(){
                 rect.y += event.motion.yrel;
             }
             break;
+               case SDL_KEYDOWN:
+                       if(event.key.keysym.sym == 0)
+                       {
+                               done = 1;
+                       }
+                       break;
         }
     }
     for (i = 0; i < state->num_windows; ++i) {
@@ -73,16 +80,16 @@ loop(){
     }
 #endif
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
-
     /* Enable standard application logging */
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     /* Initialize test framework */
     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
+       state->window_w = WINDOW_WIDTH;
+    state->window_h = WINDOW_HEIGHT;
     if (!state) {
         return 1;
     }
@@ -106,8 +113,8 @@ main(int argc, char *argv[])
         return 3;
     };
 
-    rect.x = DEFAULT_WINDOW_WIDTH / 2;
-    rect.y = DEFAULT_WINDOW_HEIGHT / 2;
+    rect.x = WINDOW_WIDTH / 2;
+    rect.y = WINDOW_HEIGHT / 2;
     rect.w = 10;
     rect.h = 10;
     /* Main render loop */
old mode 100644 (file)
new mode 100755 (executable)
index 856abf7..f626e9f
@@ -20,7 +20,8 @@
 #endif
 
 #include "SDL_test_common.h"
-
+#define WINDOW_WIDTH 720
+#define WINDOW_HEIGHT 1280
 
 static SDLTest_CommonState *state;
 
@@ -53,7 +54,7 @@ LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
     /* Load the sprite image */
     temp = SDL_LoadBMP(file);
     if (temp == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
         return NULL;
     }
 
@@ -84,7 +85,7 @@ LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
     /* Create textures from the image */
     texture = SDL_CreateTextureFromSurface(renderer, temp);
     if (!texture) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
         SDL_FreeSurface(temp);
         return NULL;
     }
@@ -146,6 +147,14 @@ void loop()
 
     while (SDL_PollEvent(&event)) {
         SDLTest_CommonEvent(state, &event, &done);
+               switch(event.type) {
+               case SDL_KEYDOWN:
+                       if(event.key.keysym.sym == 0)
+                       {
+                               done = 1;
+                       }
+                       break;
+        }
     }
     for (i = 0; i < state->num_windows; ++i) {
         if (state->windows[i] == NULL)
@@ -158,9 +167,8 @@ void loop()
     }
 #endif
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int i;
     int frames;
@@ -171,6 +179,8 @@ main(int argc, char *argv[])
 
     /* Initialize test framework */
     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
+       state->window_w = WINDOW_WIDTH;
+    state->window_h = WINDOW_HEIGHT;
     if (!state) {
         return 1;
     }
@@ -179,7 +189,7 @@ main(int argc, char *argv[])
 
         consumed = SDLTest_CommonArg(state, i);
         if (consumed == 0) {
-            SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
+            SDLTest_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
             return 1;
         }
         i += consumed;
@@ -194,8 +204,8 @@ main(int argc, char *argv[])
 
         drawstate->window = state->windows[i];
         drawstate->renderer = state->renderers[i];
-        drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE);
-        drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE);
+        drawstate->sprite = LoadTexture(drawstate->renderer, "res/icon.bmp", SDL_TRUE);
+        drawstate->background = LoadTexture(drawstate->renderer, "res/sample.bmp", SDL_FALSE);
         if (!drawstate->sprite || !drawstate->background) {
             quit(2);
         }
@@ -221,7 +231,7 @@ main(int argc, char *argv[])
     now = SDL_GetTicks();
     if (now > then) {
         double fps = ((double) frames * 1000) / (now - then);
-        SDL_Log("%2.2f frames per second\n", fps);
+        SDLTest_Log("%2.2f frames per second\n", fps);
     }
 
     SDL_stack_free(drawstates);
old mode 100644 (file)
new mode 100755 (executable)
index c5e1dce..ec38cd6
@@ -20,7 +20,8 @@
 #endif
 
 #include "SDL_test_common.h"
-
+#define WINDOW_WIDTH 720
+#define WINDOW_HEIGHT 1280
 
 static SDLTest_CommonState *state;
 
@@ -54,7 +55,7 @@ LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
     /* Load the sprite image */
     temp = SDL_LoadBMP(file);
     if (temp == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
         return NULL;
     }
 
@@ -85,7 +86,7 @@ LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
     /* Create textures from the image */
     texture = SDL_CreateTextureFromSurface(renderer, temp);
     if (!texture) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
         SDL_FreeSurface(temp);
         return NULL;
     }
@@ -122,7 +123,7 @@ DrawComposite(DrawState *s)
         SDL_RenderCopy(s->renderer, A, NULL, NULL);
         SDL_RenderReadPixels(s->renderer, NULL, SDL_PIXELFORMAT_ARGB8888, &P, sizeof(P));
 
-        SDL_Log("Blended pixel: 0x%8.8X\n", P);
+        SDLTest_Log("Blended pixel: 0x%8.8X\n", P);
 
         SDL_DestroyTexture(A);
         SDL_DestroyTexture(B);
@@ -188,7 +189,7 @@ Draw(DrawState *s)
 
     target = SDL_CreateTexture(s->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, viewport.w, viewport.h);
     if (!target) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create render target texture: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create render target texture: %s\n", SDL_GetError());
         return SDL_FALSE;
     }
     SDL_SetRenderTarget(s->renderer, target);
@@ -231,6 +232,14 @@ loop()
     /* Check for events */
     while (SDL_PollEvent(&event)) {
         SDLTest_CommonEvent(state, &event, &done);
+               switch(event.type) {
+               case SDL_KEYDOWN:
+                       if(event.key.keysym.sym == 0)
+                       {
+                               done = 1;
+                       }
+                       break;
+        }
     }
     for (i = 0; i < state->num_windows; ++i) {
         if (state->windows[i] == NULL)
@@ -247,9 +256,11 @@ loop()
     }
 #endif
 }
-
+#ifdef main
+#undef main
+#endif
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int i;
     int frames;
@@ -260,6 +271,8 @@ main(int argc, char *argv[])
 
     /* Initialize test framework */
     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
+       state->window_w = WINDOW_WIDTH;
+    state->window_h = WINDOW_HEIGHT;
     if (!state) {
         return 1;
     }
@@ -275,7 +288,7 @@ main(int argc, char *argv[])
             }
         }
         if (consumed < 0) {
-            SDL_Log("Usage: %s %s [--composite]\n",
+            SDLTest_Log("Usage: %s %s [--composite]\n",
                     argv[0], SDLTest_CommonUsage(state));
             quit(1);
         }
@@ -292,11 +305,11 @@ main(int argc, char *argv[])
         drawstate->window = state->windows[i];
         drawstate->renderer = state->renderers[i];
         if (test_composite) {
-            drawstate->sprite = LoadTexture(drawstate->renderer, "icon-alpha.bmp", SDL_TRUE);
+            drawstate->sprite = LoadTexture(drawstate->renderer, "res/icon-alpha.bmp", SDL_TRUE);
         } else {
-            drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE);
+            drawstate->sprite = LoadTexture(drawstate->renderer, "res/icon.bmp", SDL_TRUE);
         }
-        drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE);
+        drawstate->background = LoadTexture(drawstate->renderer, "res/sample.bmp", SDL_FALSE);
         if (!drawstate->sprite || !drawstate->background) {
             quit(2);
         }
@@ -323,7 +336,7 @@ main(int argc, char *argv[])
     now = SDL_GetTicks();
     if (now > then) {
         double fps = ((double) frames * 1000) / (now - then);
-        SDL_Log("%2.2f frames per second\n", fps);
+        SDLTest_Log("%2.2f frames per second\n", fps);
     }
 
     SDL_stack_free(drawstates);
old mode 100644 (file)
new mode 100755 (executable)
index 0e92bbe..3397644
@@ -11,9 +11,8 @@
 */
 
 #include "SDL.h"
-
 int
-main(int argc, char **argv)
+SDL_main(int argc, char **argv)
 {
     SDL_AudioSpec spec;
     SDL_AudioCVT cvt;
@@ -29,26 +28,26 @@ main(int argc, char **argv)
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     if (argc != 4) {
-        SDL_Log("USAGE: %s in.wav out.wav newfreq\n", argv[0]);
+        SDLTest_Log("USAGE: %s in.wav out.wav newfreq\n", argv[0]);
         return 1;
     }
 
     cvtfreq = SDL_atoi(argv[3]);
 
     if (SDL_Init(SDL_INIT_AUDIO) == -1) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError());
         return 2;
     }
 
     if (SDL_LoadWAV(argv[1], &spec, &data, &len) == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "failed to load %s: %s\n", argv[1], SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "failed to load %s: %s\n", argv[1], SDL_GetError());
         SDL_Quit();
         return 3;
     }
 
     if (SDL_BuildAudioCVT(&cvt, spec.format, spec.channels, spec.freq,
                           spec.format, spec.channels, cvtfreq) == -1) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "failed to build CVT: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "failed to build CVT: %s\n", SDL_GetError());
         SDL_FreeWAV(data);
         SDL_Quit();
         return 4;
@@ -57,7 +56,7 @@ main(int argc, char **argv)
     cvt.len = len;
     cvt.buf = (Uint8 *) SDL_malloc(len * cvt.len_mult);
     if (cvt.buf == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory.\n");
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory.\n");
         SDL_FreeWAV(data);
         SDL_Quit();
         return 5;
@@ -65,7 +64,7 @@ main(int argc, char **argv)
     SDL_memcpy(cvt.buf, data, len);
 
     if (SDL_ConvertAudio(&cvt) == -1) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Conversion failed: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Conversion failed: %s\n", SDL_GetError());
         SDL_free(cvt.buf);
         SDL_FreeWAV(data);
         SDL_Quit();
@@ -75,7 +74,7 @@ main(int argc, char **argv)
     /* write out a WAV header... */
     io = SDL_RWFromFile(argv[2], "wb");
     if (io == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "fopen('%s') failed: %s\n", argv[2], SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "fopen('%s') failed: %s\n", argv[2], SDL_GetError());
         SDL_free(cvt.buf);
         SDL_FreeWAV(data);
         SDL_Quit();
@@ -102,7 +101,7 @@ main(int argc, char **argv)
     SDL_RWwrite(io, cvt.buf, cvt.len_cvt, 1);
 
     if (SDL_RWclose(io) == -1) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "fclose('%s') failed: %s\n", argv[2], SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "fclose('%s') failed: %s\n", argv[2], SDL_GetError());
         SDL_free(cvt.buf);
         SDL_FreeWAV(data);
         SDL_Quit();
old mode 100644 (file)
new mode 100755 (executable)
index 9f5fdbf..f71457d
@@ -21,8 +21,8 @@
 
 #include "SDL_test_common.h"
 
-#define WINDOW_WIDTH    640
-#define WINDOW_HEIGHT   480
+#define WINDOW_WIDTH 720
+#define WINDOW_HEIGHT 1280
 
 static SDLTest_CommonState *state;
 
@@ -55,7 +55,7 @@ LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
     /* Load the sprite image */
     temp = SDL_LoadBMP(file);
     if (temp == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
         return NULL;
     }
 
@@ -86,7 +86,7 @@ LoadTexture(SDL_Renderer *renderer, char *file, SDL_bool transparent)
     /* Create textures from the image */
     texture = SDL_CreateTextureFromSurface(renderer, temp);
     if (!texture) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
         SDL_FreeSurface(temp);
         return NULL;
     }
@@ -136,6 +136,14 @@ loop()
     /* Check for events */
     while (SDL_PollEvent(&event)) {
         SDLTest_CommonEvent(state, &event, &done);
+               switch(event.type) {
+               case SDL_KEYDOWN:
+                       if(event.key.keysym.sym == 0)
+                       {
+                               done = 1;
+                       }
+                       break;
+        }
     }
     for (i = 0; i < state->num_windows; ++i) {
         if (state->windows[i] == NULL)
@@ -148,9 +156,8 @@ loop()
     }
 #endif
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int i;
     int frames;
@@ -161,6 +168,8 @@ main(int argc, char *argv[])
 
     /* Initialize test framework */
     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
+       state->window_w = WINDOW_WIDTH;
+    state->window_h = WINDOW_HEIGHT;
     if (!state) {
         return 1;
     }
@@ -169,7 +178,7 @@ main(int argc, char *argv[])
 
         consumed = SDLTest_CommonArg(state, i);
         if (consumed == 0) {
-            SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
+            SDLTest_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
             return 1;
         }
         i += consumed;
@@ -184,8 +193,8 @@ main(int argc, char *argv[])
 
         drawstate->window = state->windows[i];
         drawstate->renderer = state->renderers[i];
-        drawstate->sprite = LoadTexture(drawstate->renderer, "icon.bmp", SDL_TRUE);
-        drawstate->background = LoadTexture(drawstate->renderer, "sample.bmp", SDL_FALSE);
+        drawstate->sprite = LoadTexture(drawstate->renderer, "res/icon.bmp", SDL_TRUE);
+        drawstate->background = LoadTexture(drawstate->renderer, "res/sample.bmp", SDL_FALSE);
         if (!drawstate->sprite || !drawstate->background) {
             quit(2);
         }
@@ -212,7 +221,7 @@ main(int argc, char *argv[])
     now = SDL_GetTicks();
     if (now > then) {
         double fps = ((double) frames * 1000) / (now - then);
-        SDL_Log("%2.2f frames per second\n", fps);
+        SDLTest_Log("%2.2f frames per second\n", fps);
     }
 
     SDL_stack_free(drawstates);
old mode 100644 (file)
new mode 100755 (executable)
index b8d3b27..e3d1ace
@@ -29,15 +29,15 @@ ThreadFunc(void *data)
     int threadnum = (int) (uintptr_t) data;
     while (alive) {
         SDL_SemWait(sem);
-        SDL_Log("Thread number %d has got the semaphore (value = %d)!\n",
+        SDLTest_Log("Thread number %d has got the semaphore (value = %d)!\n",
                 threadnum, SDL_SemValue(sem));
         SDL_Delay(200);
         SDL_SemPost(sem);
-        SDL_Log("Thread number %d has released the semaphore (value = %d)!\n",
+        SDLTest_Log("Thread number %d has released the semaphore (value = %d)!\n",
                 threadnum, SDL_SemValue(sem));
         SDL_Delay(1);           /* For the scheduler */
     }
-    SDL_Log("Thread number %d exiting.\n", threadnum);
+    SDLTest_Log("Thread number %d exiting.\n", threadnum);
     return 0;
 }
 
@@ -46,7 +46,24 @@ killed(int sig)
 {
     alive = 0;
 }
-
+static void 
+TestSDLCond(void)
+{
+       SDL_mutex *mutex = SDL_CreateMutex();
+       SDL_cond *cond= SDL_CreateCond();
+       SDL_CondSignal(cond);
+       SDL_CondBroadcast(cond);
+       
+       SDL_LockMutex(mutex);
+       SDL_CondWait(cond, mutex);
+       SDL_UnlockMutex(mutex);
+       
+       int retval = SDL_CondWaitTimeout(cond, mutex, 300);
+       if(retval != SDL_MUTEX_TIMEDOUT)
+       {
+               SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_CondWaitTimeout returned: %d; expected: %d\n", retval, SDL_MUTEX_TIMEDOUT);
+       }
+}
 static void
 TestWaitTimeout(void)
 {
@@ -56,7 +73,7 @@ TestWaitTimeout(void)
     int retval;
 
     sem = SDL_CreateSemaphore(0);
-    SDL_Log("Waiting 2 seconds on semaphore\n");
+    SDLTest_Log("Waiting 2 seconds on semaphore\n");
 
     start_ticks = SDL_GetTicks();
     retval = SDL_SemWaitTimeout(sem, 2000);
@@ -66,17 +83,16 @@ TestWaitTimeout(void)
 
     /* Accept a little offset in the effective wait */
     if (duration > 1900 && duration < 2050)
-        SDL_Log("Wait done.\n");
+        SDLTest_Log("Wait done.\n");
     else
-        SDL_Log("Wait took %d milliseconds\n", duration);
+        SDLTest_Log("Wait took %d milliseconds\n", duration);
 
     /* Check to make sure the return value indicates timed out */
     if (retval != SDL_MUTEX_TIMEDOUT)
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_SemWaitTimeout returned: %d; expected: %d\n", retval, SDL_MUTEX_TIMEDOUT);
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_SemWaitTimeout returned: %d; expected: %d\n", retval, SDL_MUTEX_TIMEDOUT);
 }
-
 int
-main(int argc, char **argv)
+SDL_main(int argc, char **argv)
 {
     SDL_Thread *threads[NUM_THREADS];
     uintptr_t i;
@@ -86,13 +102,13 @@ main(int argc, char **argv)
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     if (argc < 2) {
-        SDL_Log("Usage: %s init_value\n", argv[0]);
+        SDLTest_Log("Usage: %s init_value\n", argv[0]);
         return (1);
     }
 
     /* Load the SDL library */
     if (SDL_Init(0) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return (1);
     }
     signal(SIGTERM, killed);
@@ -101,7 +117,7 @@ main(int argc, char **argv)
     init_sem = atoi(argv[1]);
     sem = SDL_CreateSemaphore(init_sem);
 
-    SDL_Log("Running %d threads, semaphore value = %d\n", NUM_THREADS,
+    SDLTest_Log("Running %d threads, semaphore value = %d\n", NUM_THREADS,
            init_sem);
     /* Create all the threads */
     for (i = 0; i < NUM_THREADS; ++i) {
@@ -114,17 +130,17 @@ main(int argc, char **argv)
     SDL_Delay(10 * 1000);
 
     /* Wait for all threads to finish */
-    SDL_Log("Waiting for threads to finish\n");
+    SDLTest_Log("Waiting for threads to finish\n");
     alive = 0;
     for (i = 0; i < NUM_THREADS; ++i) {
         SDL_WaitThread(threads[i], NULL);
     }
-    SDL_Log("Finished waiting for threads\n");
+    SDLTest_Log("Finished waiting for threads\n");
 
     SDL_DestroySemaphore(sem);
 
     TestWaitTimeout();
-
+       TestSDLCond();
     SDL_Quit();
     return (0);
 }
old mode 100644 (file)
new mode 100755 (executable)
index fc6da29..807be1b
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
+  Copyright (r) 1997-2016 Sam Lantinga <slouken@libsdl.org>
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
   including commercial applications, and to alter it and redistribute it
   freely.
 */
-/* This is a simple example of using GLSL shaders with SDL */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
 
-#include "SDL.h"
+#ifdef __EMSCRIPTEN__
+#include <emscripten/emscripten.h>
+#endif
 
-#ifdef HAVE_OPENGL
+#include "SDL_test_common.h"
+#define WINDOW_WIDTH 720
+#define WINDOW_HEIGHT 1280
+#if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__NACL__) || defined(__TIZEN__)
+#define HAVE_OPENGLES2
+#endif
 
-#include "SDL_opengl.h"
+#define HAVE_OPENGLES2
 
+#ifdef HAVE_OPENGLES2
 
-static SDL_bool shaders_supported;
-static int      current_shader = 0;
+#include "SDL_opengles2.h"
 
-enum {
-    SHADER_COLOR,
-    SHADER_TEXTURE,
-    SHADER_TEXCOORDS,
-    NUM_SHADERS
-};
+typedef struct GLES2_Context
+{
+#define SDL_PROC(ret,func,params) ret (APIENTRY *func) params;
+#include "SDL_gles2funcs.h"
+#undef SDL_PROC
+} GLES2_Context;
 
-typedef struct {
-    GLhandleARB program;
-    GLhandleARB vert_shader;
-    GLhandleARB frag_shader;
-    const char *vert_source;
-    const char *frag_source;
-} ShaderData;
-
-static ShaderData shaders[NUM_SHADERS] = {
-
-    /* SHADER_COLOR */
-    { 0, 0, 0,
-        /* vertex shader */
-"varying vec4 v_color;\n"
-"\n"
-"void main()\n"
-"{\n"
-"    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
-"    v_color = gl_Color;\n"
-"}",
-        /* fragment shader */
-"varying vec4 v_color;\n"
-"\n"
-"void main()\n"
-"{\n"
-"    gl_FragColor = v_color;\n"
-"}"
-    },
-
-    /* SHADER_TEXTURE */
-    { 0, 0, 0,
-        /* vertex shader */
-"varying vec4 v_color;\n"
-"varying vec2 v_texCoord;\n"
-"\n"
-"void main()\n"
-"{\n"
-"    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
-"    v_color = gl_Color;\n"
-"    v_texCoord = vec2(gl_MultiTexCoord0);\n"
-"}",
-        /* fragment shader */
-"varying vec4 v_color;\n"
-"varying vec2 v_texCoord;\n"
-"uniform sampler2D tex0;\n"
-"\n"
-"void main()\n"
-"{\n"
-"    gl_FragColor = texture2D(tex0, v_texCoord) * v_color;\n"
-"}"
-    },
-
-    /* SHADER_TEXCOORDS */
-    { 0, 0, 0,
-        /* vertex shader */
-"varying vec2 v_texCoord;\n"
-"\n"
-"void main()\n"
-"{\n"
-"    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
-"    v_texCoord = vec2(gl_MultiTexCoord0);\n"
-"}",
-        /* fragment shader */
-"varying vec2 v_texCoord;\n"
-"\n"
-"void main()\n"
-"{\n"
-"    vec4 color;\n"
-"    vec2 delta;\n"
-"    float dist;\n"
-"\n"
-"    delta = vec2(0.5, 0.5) - v_texCoord;\n"
-"    dist = dot(delta, delta);\n"
-"\n"
-"    color.r = v_texCoord.x;\n"
-"    color.g = v_texCoord.x * v_texCoord.y;\n"
-"    color.b = v_texCoord.y;\n"
-"    color.a = 1.0 - (dist * 4.0);\n"
-"    gl_FragColor = color;\n"
-"}"
-    },
-};
 
-static PFNGLATTACHOBJECTARBPROC glAttachObjectARB;
-static PFNGLCOMPILESHADERARBPROC glCompileShaderARB;
-static PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB;
-static PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB;
-static PFNGLDELETEOBJECTARBPROC glDeleteObjectARB;
-static PFNGLGETINFOLOGARBPROC glGetInfoLogARB;
-static PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB;
-static PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB;
-static PFNGLLINKPROGRAMARBPROC glLinkProgramARB;
-static PFNGLSHADERSOURCEARBPROC glShaderSourceARB;
-static PFNGLUNIFORM1IARBPROC glUniform1iARB;
-static PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB;
-
-static SDL_bool CompileShader(GLhandleARB shader, const char *source)
+static SDLTest_CommonState *state;
+static SDL_GLContext *context = NULL;
+static int depth = 16;
+static GLES2_Context ctx;
+
+static int LoadContext(GLES2_Context * data)
 {
-    GLint status;
-
-    glShaderSourceARB(shader, 1, &source, NULL);
-    glCompileShaderARB(shader);
-    glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &status);
-    if (status == 0) {
-        GLint length;
-        char *info;
-
-        glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length);
-        info = SDL_stack_alloc(char, length+1);
-        glGetInfoLogARB(shader, length, NULL, info);
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to compile shader:\n%s\n%s", source, info);
-        SDL_stack_free(info);
-
-        return SDL_FALSE;
-    } else {
-        return SDL_TRUE;
-    }
+#if SDL_VIDEO_DRIVER_UIKIT
+#define __SDL_NOGETPROCADDR__
+#elif SDL_VIDEO_DRIVER_ANDROID
+#define __SDL_NOGETPROCADDR__
+#elif SDL_VIDEO_DRIVER_PANDORA
+#define __SDL_NOGETPROCADDR__
+#endif
+
+#if defined __SDL_NOGETPROCADDR__
+#define SDL_PROC(ret,func,params) data->func=func;
+#else
+#define SDL_PROC(ret,func,params) \
+    do { \
+        data->func = SDL_GL_GetProcAddress(#func); \
+        if ( ! data->func ) { \
+            return SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \
+        } \
+    } while ( 0 );
+#endif /* __SDL_NOGETPROCADDR__ */
+
+#include "SDL_gles2funcs.h"
+#undef SDL_PROC
+    return 0;
 }
 
-static SDL_bool CompileShaderProgram(ShaderData *data)
+/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
+static void
+quit(int rc)
 {
-    const int num_tmus_bound = 4;
     int i;
-    GLint location;
 
-    glGetError();
-
-    /* Create one program object to rule them all */
-    data->program = glCreateProgramObjectARB();
+    if (context != NULL) {
+        for (i = 0; i < state->num_windows; i++) {
+            if (context[i]) {
+                SDL_GL_DeleteContext(context[i]);
+            }
+        }
 
-    /* Create the vertex shader */
-    data->vert_shader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
-    if (!CompileShader(data->vert_shader, data->vert_source)) {
-        return SDL_FALSE;
+        SDL_free(context);
     }
 
-    /* Create the fragment shader */
-    data->frag_shader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
-    if (!CompileShader(data->frag_shader, data->frag_source)) {
-        return SDL_FALSE;
-    }
+    SDLTest_CommonQuit(state);
+    exit(rc);
+}
 
-    /* ... and in the darkness bind them */
-    glAttachObjectARB(data->program, data->vert_shader);
-    glAttachObjectARB(data->program, data->frag_shader);
-    glLinkProgramARB(data->program);
-
-    /* Set up some uniform variables */
-    glUseProgramObjectARB(data->program);
-    for (i = 0; i < num_tmus_bound; ++i) {
-        char tex_name[5];
-        SDL_snprintf(tex_name, SDL_arraysize(tex_name), "tex%d", i);
-        location = glGetUniformLocationARB(data->program, tex_name);
-        if (location >= 0) {
-            glUniform1iARB(location, i);
+#define GL_CHECK(x) \
+        x; \
+        { \
+          GLenum glError = ctx.glGetError(); \
+          if(glError != GL_NO_ERROR) { \
+            SDLTest_Log("glGetError() = %i (0x%.8x) at line %i\n", glError, glError, __LINE__); \
+            quit(1); \
+          } \
         }
+
+/* 
+ * Simulates desktop's glRotatef. The matrix is returned in column-major 
+ * order. 
+ */
+static void
+rotate_matrix(float angle, float x, float y, float z, float *r)
+{
+    float radians, c, s, c1, u[3], length;
+    int i, j;
+
+    radians = (float)(angle * M_PI) / 180.0f;
+
+    c = SDL_cosf(radians);
+    s = SDL_sinf(radians);
+
+    c1 = 1.0f - SDL_cosf(radians);
+
+    length = (float)SDL_sqrt(x * x + y * y + z * z);
+
+    u[0] = x / length;
+    u[1] = y / length;
+    u[2] = z / length;
+
+    for (i = 0; i < 16; i++) {
+        r[i] = 0.0;
     }
-    glUseProgramObjectARB(0);
 
-    return (glGetError() == GL_NO_ERROR) ? SDL_TRUE : SDL_FALSE;
-}
+    r[15] = 1.0;
 
-static void DestroyShaderProgram(ShaderData *data)
-{
-    if (shaders_supported) {
-        glDeleteObjectARB(data->vert_shader);
-        glDeleteObjectARB(data->frag_shader);
-        glDeleteObjectARB(data->program);
+    for (i = 0; i < 3; i++) {
+        r[i * 4 + (i + 1) % 3] = u[(i + 2) % 3] * s;
+        r[i * 4 + (i + 2) % 3] = -u[(i + 1) % 3] * s;
+    }
+
+    for (i = 0; i < 3; i++) {
+        for (j = 0; j < 3; j++) {
+            r[i * 4 + j] += c1 * u[i] * u[j] + (i == j ? c : 0.0f);
+        }
     }
 }
 
-static SDL_bool InitShaders()
+/* 
+ * Simulates gluPerspectiveMatrix 
+ */
+static void 
+perspective_matrix(float fovy, float aspect, float znear, float zfar, float *r)
 {
     int i;
+    float f;
 
-    /* Check for shader support */
-    shaders_supported = SDL_FALSE;
-    if (SDL_GL_ExtensionSupported("GL_ARB_shader_objects") &&
-        SDL_GL_ExtensionSupported("GL_ARB_shading_language_100") &&
-        SDL_GL_ExtensionSupported("GL_ARB_vertex_shader") &&
-        SDL_GL_ExtensionSupported("GL_ARB_fragment_shader")) {
-        glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) SDL_GL_GetProcAddress("glAttachObjectARB");
-        glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) SDL_GL_GetProcAddress("glCompileShaderARB");
-        glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glCreateProgramObjectARB");
-        glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) SDL_GL_GetProcAddress("glCreateShaderObjectARB");
-        glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC) SDL_GL_GetProcAddress("glDeleteObjectARB");
-        glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC) SDL_GL_GetProcAddress("glGetInfoLogARB");
-        glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC) SDL_GL_GetProcAddress("glGetObjectParameterivARB");
-        glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) SDL_GL_GetProcAddress("glGetUniformLocationARB");
-        glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) SDL_GL_GetProcAddress("glLinkProgramARB");
-        glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) SDL_GL_GetProcAddress("glShaderSourceARB");
-        glUniform1iARB = (PFNGLUNIFORM1IARBPROC) SDL_GL_GetProcAddress("glUniform1iARB");
-        glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) SDL_GL_GetProcAddress("glUseProgramObjectARB");
-        if (glAttachObjectARB &&
-            glCompileShaderARB &&
-            glCreateProgramObjectARB &&
-            glCreateShaderObjectARB &&
-            glDeleteObjectARB &&
-            glGetInfoLogARB &&
-            glGetObjectParameterivARB &&
-            glGetUniformLocationARB &&
-            glLinkProgramARB &&
-            glShaderSourceARB &&
-            glUniform1iARB &&
-            glUseProgramObjectARB) {
-            shaders_supported = SDL_TRUE;
-        }
-    }
+    f = 1.0f/SDL_tanf(fovy * 0.5f);
 
-    if (!shaders_supported) {
-        return SDL_FALSE;
+    for (i = 0; i < 16; i++) {
+        r[i] = 0.0;
     }
 
-    /* Compile all the shaders */
-    for (i = 0; i < NUM_SHADERS; ++i) {
-        if (!CompileShaderProgram(&shaders[i])) {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to compile shader!\n");
-            return SDL_FALSE;
+    r[0] = f / aspect;
+    r[5] = f;
+    r[10] = (znear + zfar) / (znear - zfar);
+    r[11] = -1.0f;
+    r[14] = (2.0f * znear * zfar) / (znear - zfar);
+    r[15] = 0.0f;
+}
+
+/* 
+ * Multiplies lhs by rhs and writes out to r. All matrices are 4x4 and column
+ * major. In-place multiplication is supported.
+ */
+static void
+multiply_matrix(float *lhs, float *rhs, float *r)
+{
+    int i, j, k;
+    float tmp[16];
+
+    for (i = 0; i < 4; i++) {
+        for (j = 0; j < 4; j++) {
+            tmp[j * 4 + i] = 0.0;
+
+            for (k = 0; k < 4; k++) {
+                tmp[j * 4 + i] += lhs[k * 4 + i] * rhs[j * 4 + k];
+            }
         }
     }
 
-    /* We're done! */
-    return SDL_TRUE;
+    for (i = 0; i < 16; i++) {
+        r[i] = tmp[i];
+    }
 }
 
-static void QuitShaders()
+/* 
+ * Create shader, load in source, compile, dump debug as necessary.
+ *
+ * shader: Pointer to return created shader ID.
+ * source: Passed-in shader source code.
+ * shader_type: Passed to GL, e.g. GL_VERTEX_SHADER.
+ */
+void 
+process_shader(GLuint *shader, const char * source, GLint shader_type)
 {
-    int i;
+    GLint status = GL_FALSE;
+    const char *shaders[1] = { NULL };
+    char buffer[1024];
+    GLsizei length;
+
+    /* Create shader and load into GL. */
+    *shader = GL_CHECK(ctx.glCreateShader(shader_type));
+
+    shaders[0] = source;
 
-    for (i = 0; i < NUM_SHADERS; ++i) {
-        DestroyShaderProgram(&shaders[i]);
+    GL_CHECK(ctx.glShaderSource(*shader, 1, shaders, NULL));
+
+    /* Clean up shader source. */
+    shaders[0] = NULL;
+
+    /* Try compiling the shader. */
+    GL_CHECK(ctx.glCompileShader(*shader));
+    GL_CHECK(ctx.glGetShaderiv(*shader, GL_COMPILE_STATUS, &status));
+
+    /* Dump debug info (source and log) if compilation failed. */
+    if(status != GL_TRUE) {
+        ctx.glGetProgramInfoLog(*shader, sizeof(buffer), &length, &buffer[0]);
+        buffer[length] = '\0';
+        SDLTest_Log("Shader compilation failed: %s", buffer);fflush(stderr);
+        quit(-1);
     }
 }
 
-/* Quick utility function for texture creation */
-static int
-power_of_two(int input)
+/* 3D data. Vertex range -0.5..0.5 in all axes.
+* Z -0.5 is near, 0.5 is far. */
+const float _vertices[] =
 {
-    int value = 1;
+    /* Front face. */
+    /* Bottom left */
+    -0.5,  0.5, -0.5,
+    0.5, -0.5, -0.5,
+    -0.5, -0.5, -0.5,
+    /* Top right */
+    -0.5,  0.5, -0.5,
+    0.5,  0.5, -0.5,
+    0.5, -0.5, -0.5,
+    /* Left face */
+    /* Bottom left */
+    -0.5,  0.5,  0.5,
+    -0.5, -0.5, -0.5,
+    -0.5, -0.5,  0.5,
+    /* Top right */
+    -0.5,  0.5,  0.5,
+    -0.5,  0.5, -0.5,
+    -0.5, -0.5, -0.5,
+    /* Top face */
+    /* Bottom left */
+    -0.5,  0.5,  0.5,
+    0.5,  0.5, -0.5,
+    -0.5,  0.5, -0.5,
+    /* Top right */
+    -0.5,  0.5,  0.5,
+    0.5,  0.5,  0.5,
+    0.5,  0.5, -0.5,
+    /* Right face */
+    /* Bottom left */
+    0.5,  0.5, -0.5,
+    0.5, -0.5,  0.5,
+    0.5, -0.5, -0.5,
+    /* Top right */
+    0.5,  0.5, -0.5,
+    0.5,  0.5,  0.5,
+    0.5, -0.5,  0.5,
+    /* Back face */
+    /* Bottom left */
+    0.5,  0.5,  0.5,
+    -0.5, -0.5,  0.5,
+    0.5, -0.5,  0.5,
+    /* Top right */
+    0.5,  0.5,  0.5,
+    -0.5,  0.5,  0.5,
+    -0.5, -0.5,  0.5,
+    /* Bottom face */
+    /* Bottom left */
+    -0.5, -0.5, -0.5,
+    0.5, -0.5,  0.5,
+    -0.5, -0.5,  0.5,
+    /* Top right */
+    -0.5, -0.5, -0.5,
+    0.5, -0.5, -0.5,
+    0.5, -0.5,  0.5,
+};
 
-    while (value < input) {
-        value <<= 1;
-    }
-    return value;
-}
+const float _colors[] =
+{
+    /* Front face */
+    /* Bottom left */
+    1.0, 0.0, 0.0, /* red */
+    0.0, 0.0, 1.0, /* blue */
+    0.0, 1.0, 0.0, /* green */
+    /* Top right */
+    1.0, 0.0, 0.0, /* red */
+    1.0, 1.0, 0.0, /* yellow */
+    0.0, 0.0, 1.0, /* blue */
+    /* Left face */
+    /* Bottom left */
+    1.0, 1.0, 1.0, /* white */
+    0.0, 1.0, 0.0, /* green */
+    0.0, 1.0, 1.0, /* cyan */
+    /* Top right */
+    1.0, 1.0, 1.0, /* white */
+    1.0, 0.0, 0.0, /* red */
+    0.0, 1.0, 0.0, /* green */
+    /* Top face */
+    /* Bottom left */
+    1.0, 1.0, 1.0, /* white */
+    1.0, 1.0, 0.0, /* yellow */
+    1.0, 0.0, 0.0, /* red */
+    /* Top right */
+    1.0, 1.0, 1.0, /* white */
+    0.0, 0.0, 0.0, /* black */
+    1.0, 1.0, 0.0, /* yellow */
+    /* Right face */
+    /* Bottom left */
+    1.0, 1.0, 0.0, /* yellow */
+    1.0, 0.0, 1.0, /* magenta */
+    0.0, 0.0, 1.0, /* blue */
+    /* Top right */
+    1.0, 1.0, 0.0, /* yellow */
+    0.0, 0.0, 0.0, /* black */
+    1.0, 0.0, 1.0, /* magenta */
+    /* Back face */
+    /* Bottom left */
+    0.0, 0.0, 0.0, /* black */
+    0.0, 1.0, 1.0, /* cyan */
+    1.0, 0.0, 1.0, /* magenta */
+    /* Top right */
+    0.0, 0.0, 0.0, /* black */
+    1.0, 1.0, 1.0, /* white */
+    0.0, 1.0, 1.0, /* cyan */
+    /* Bottom face */
+    /* Bottom left */
+    0.0, 1.0, 0.0, /* green */
+    1.0, 0.0, 1.0, /* magenta */
+    0.0, 1.0, 1.0, /* cyan */
+    /* Top right */
+    0.0, 1.0, 0.0, /* green */
+    0.0, 0.0, 1.0, /* blue */
+    1.0, 0.0, 1.0, /* magenta */
+};
 
-GLuint
-SDL_GL_LoadTexture(SDL_Surface * surface, GLfloat * texcoord)
+const char* _shader_vert_src = 
+" attribute vec4 av4position; "
+" attribute vec3 av3color; "
+" uniform mat4 mvp; "
+" varying vec3 vv3color; "
+" void main() { "
+"    vv3color = av3color; "
+"    gl_Position = mvp * av4position; "
+" } ";
+
+const char* _shader_frag_src = 
+" precision lowp float; "
+" varying vec3 vv3color; "
+" void main() { "
+"    gl_FragColor = vec4(vv3color, 1.0); "
+" } ";
+
+typedef struct shader_data
 {
-    GLuint texture;
-    int w, h;
-    SDL_Surface *image;
-    SDL_Rect area;
-    SDL_BlendMode saved_mode;
-
-    /* Use the surface width and height expanded to powers of 2 */
-    w = power_of_two(surface->w);
-    h = power_of_two(surface->h);
-    texcoord[0] = 0.0f;         /* Min X */
-    texcoord[1] = 0.0f;         /* Min Y */
-    texcoord[2] = (GLfloat) surface->w / w;     /* Max X */
-    texcoord[3] = (GLfloat) surface->h / h;     /* Max Y */
-
-    image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32,
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN     /* OpenGL RGBA masks */
-                                 0x000000FF,
-                                 0x0000FF00, 0x00FF0000, 0xFF000000
-#else
-                                 0xFF000000,
-                                 0x00FF0000, 0x0000FF00, 0x000000FF
-#endif
-        );
-    if (image == NULL) {
-        return 0;
-    }
+    GLuint shader_program, shader_frag, shader_vert;
 
-    /* Save the alpha blending attributes */
-    SDL_GetSurfaceBlendMode(surface, &saved_mode);
-    SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE);
-
-    /* Copy the surface into the GL texture image */
-    area.x = 0;
-    area.y = 0;
-    area.w = surface->w;
-    area.h = surface->h;
-    SDL_BlitSurface(surface, &area, image, &area);
-
-    /* Restore the alpha blending attributes */
-    SDL_SetSurfaceBlendMode(surface, saved_mode);
-
-    /* Create an OpenGL texture for the image */
-    glGenTextures(1, &texture);
-    glBindTexture(GL_TEXTURE_2D, texture);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-    glTexImage2D(GL_TEXTURE_2D,
-                 0,
-                 GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, image->pixels);
-    SDL_FreeSurface(image);     /* No longer needed */
-
-    return texture;
-}
+    GLint attr_position;
+    GLint attr_color, attr_mvp;
+
+    int angle_x, angle_y, angle_z;
 
-/* A general OpenGL initialization function.    Sets all of the initial parameters. */
-void InitGL(int Width, int Height)                    /* We call this right after our OpenGL window is created. */
+} shader_data;
+
+static void
+Render(unsigned int width, unsigned int height, shader_data* data)
 {
-    GLdouble aspect;
+    float matrix_rotate[16], matrix_modelview[16], matrix_perspective[16], matrix_mvp[16];
+
+    /* 
+    * Do some rotation with Euler angles. It is not a fixed axis as
+    * quaterions would be, but the effect is cool. 
+    */
+    rotate_matrix((float)data->angle_x, 1.0f, 0.0f, 0.0f, matrix_modelview);
+    rotate_matrix((float)data->angle_y, 0.0f, 1.0f, 0.0f, matrix_rotate);
 
-    glViewport(0, 0, Width, Height);
-    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);        /* This Will Clear The Background Color To Black */
-    glClearDepth(1.0);                /* Enables Clearing Of The Depth Buffer */
-    glDepthFunc(GL_LESS);                /* The Type Of Depth Test To Do */
-    glEnable(GL_DEPTH_TEST);            /* Enables Depth Testing */
-    glShadeModel(GL_SMOOTH);            /* Enables Smooth Color Shading */
+    multiply_matrix(matrix_rotate, matrix_modelview, matrix_modelview);
 
-    glMatrixMode(GL_PROJECTION);
-    glLoadIdentity();                /* Reset The Projection Matrix */
+    rotate_matrix((float)data->angle_z, 0.0f, 1.0f, 0.0f, matrix_rotate);
 
-    aspect = (GLdouble)Width / Height;
-    glOrtho(-3.0, 3.0, -3.0 / aspect, 3.0 / aspect, 0.0, 1.0);
+    multiply_matrix(matrix_rotate, matrix_modelview, matrix_modelview);
 
-    glMatrixMode(GL_MODELVIEW);
+    /* Pull the camera back from the cube */
+    matrix_modelview[14] -= 2.5;
+
+    perspective_matrix(45.0f, (float)width/height, 0.01f, 100.0f, matrix_perspective);
+    multiply_matrix(matrix_perspective, matrix_modelview, matrix_mvp);
+
+    GL_CHECK(ctx.glUniformMatrix4fv(data->attr_mvp, 1, GL_FALSE, matrix_mvp));
+
+    data->angle_x += 3;
+    data->angle_y += 2;
+    data->angle_z += 1;
+
+    if(data->angle_x >= 360) data->angle_x -= 360;
+    if(data->angle_x < 0) data->angle_x += 360;
+    if(data->angle_y >= 360) data->angle_y -= 360;
+    if(data->angle_y < 0) data->angle_y += 360;
+    if(data->angle_z >= 360) data->angle_z -= 360;
+    if(data->angle_z < 0) data->angle_z += 360;
+
+    GL_CHECK(ctx.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT));
+    GL_CHECK(ctx.glDrawArrays(GL_TRIANGLES, 0, 36));
 }
 
-/* The main drawing function. */
-void DrawGLScene(SDL_Window *window, GLuint texture, GLfloat * texcoord)
+int done;
+Uint32 frames;
+shader_data *datas;
+
+void loop()
 {
-    /* Texture coordinate lookup, to make it simple */
-    enum {
-        MINX,
-        MINY,
-        MAXX,
-        MAXY
-    };
-
-    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);        /* Clear The Screen And The Depth Buffer */
-    glLoadIdentity();                /* Reset The View */
-
-    glTranslatef(-1.5f,0.0f,0.0f);        /* Move Left 1.5 Units */
-
-    /* draw a triangle (in smooth coloring mode) */
-    glBegin(GL_POLYGON);                /* start drawing a polygon */
-    glColor3f(1.0f,0.0f,0.0f);            /* Set The Color To Red */
-    glVertex3f( 0.0f, 1.0f, 0.0f);        /* Top */
-    glColor3f(0.0f,1.0f,0.0f);            /* Set The Color To Green */
-    glVertex3f( 1.0f,-1.0f, 0.0f);        /* Bottom Right */
-    glColor3f(0.0f,0.0f,1.0f);            /* Set The Color To Blue */
-    glVertex3f(-1.0f,-1.0f, 0.0f);        /* Bottom Left */
-    glEnd();                    /* we're done with the polygon (smooth color interpolation) */
-
-    glTranslatef(3.0f,0.0f,0.0f);         /* Move Right 3 Units */
-
-    /* Enable blending */
-    glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-    glEnable(GL_BLEND);
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
-    /* draw a textured square (quadrilateral) */
-    glEnable(GL_TEXTURE_2D);
-    glBindTexture(GL_TEXTURE_2D, texture);
-    glColor3f(1.0f,1.0f,1.0f);
-    if (shaders_supported) {
-        glUseProgramObjectARB(shaders[current_shader].program);
+    SDL_Event event;
+    int i;
+    int status;
+
+    /* Check for events */
+    ++frames;
+    while (SDL_PollEvent(&event) && !done) {
+        switch (event.type) {
+        /*case SDL_WINDOWEVENT:
+            switch (event.window.event) {
+                case SDL_WINDOWEVENT_RESIZED:
+                    for (i = 0; i < state->num_windows; ++i) {
+                        if (event.window.windowID == SDL_GetWindowID(state->windows[i])) {
+                            int w, h;
+                            status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
+                            if (status) {
+                                SDLTest_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
+                                break;
+                            }
+                            // Change view port to the new window dimensions 
+                            SDL_GL_GetDrawableSize(state->windows[i], &w, &h);
+                            ctx.glViewport(0, 0, w, h);
+                            state->window_w = event.window.data1;
+                            state->window_h = event.window.data2;
+                            // Update window content 
+                            Render(event.window.data1, event.window.data2, &datas[i]);
+                            SDL_GL_SwapWindow(state->windows[i]);
+                            break;
+                        }
+                    }
+                    break;
+            }*/
+               case SDL_KEYDOWN:
+               if(event.key.keysym.sym == 0)
+               {
+                       done = 1;
+               }
+               break;
+        }
+        SDLTest_CommonEvent(state, &event, &done);
     }
-
-    glBegin(GL_QUADS);                /* start drawing a polygon (4 sided) */
-    glTexCoord2f(texcoord[MINX], texcoord[MINY]);
-    glVertex3f(-1.0f, 1.0f, 0.0f);        /* Top Left */
-    glTexCoord2f(texcoord[MAXX], texcoord[MINY]);
-    glVertex3f( 1.0f, 1.0f, 0.0f);        /* Top Right */
-    glTexCoord2f(texcoord[MAXX], texcoord[MAXY]);
-    glVertex3f( 1.0f,-1.0f, 0.0f);        /* Bottom Right */
-    glTexCoord2f(texcoord[MINX], texcoord[MAXY]);
-    glVertex3f(-1.0f,-1.0f, 0.0f);        /* Bottom Left */
-    glEnd();                    /* done with the polygon */
-
-    if (shaders_supported) {
-        glUseProgramObjectARB(0);
+    if (!done) {
+      for (i = 0; i < state->num_windows; ++i) {
+          status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
+          if (status) {
+              SDLTest_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
+
+              /* Continue for next window */
+              continue;
+          }
+          Render(state->window_w, state->window_h, &datas[i]);
+          SDL_GL_SwapWindow(state->windows[i]);
+      }
     }
-    glDisable(GL_TEXTURE_2D);
-
-    /* swap buffers to display, since we're double buffered. */
-    SDL_GL_SwapWindow(window);
+#ifdef __EMSCRIPTEN__
+    else {
+        emscripten_cancel_main_loop();
+    }
+#endif
 }
-
-int main(int argc, char **argv)
+int
+SDL_main(int argc, char *argv[])
 {
-    int done;
-    SDL_Window *window;
-    SDL_Surface *surface;
-    GLuint texture;
-    GLfloat texcoords[4];
-
-    /* Enable standard application logging */
-    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
-
-    /* Initialize SDL for video output */
-    if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to initialize SDL: %s\n", SDL_GetError());
-        exit(1);
+    int fsaa, accel;
+    int value;
+    int i;
+    SDL_DisplayMode mode;
+    Uint32 then, now;
+    int status;
+    shader_data *data;
+
+    /* Initialize parameters */
+    fsaa = 0;
+    accel = 0;
+
+    /* Initialize test framework */
+    state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
+       state->window_w = WINDOW_WIDTH;
+    state->window_h = WINDOW_HEIGHT;
+    if (!state) {
+        return 1;
+    }
+    for (i = 1; i < argc;) {
+        int consumed;
+
+        consumed = SDLTest_CommonArg(state, i);
+        if (consumed == 0) {
+            if (SDL_strcasecmp(argv[i], "--fsaa") == 0) {
+                ++fsaa;
+                consumed = 1;
+            } else if (SDL_strcasecmp(argv[i], "--accel") == 0) {
+                ++accel;
+                consumed = 1;
+            } else if (SDL_strcasecmp(argv[i], "--zdepth") == 0) {
+                i++;
+                if (!argv[i]) {
+                    consumed = -1;
+                } else {
+                    depth = SDL_atoi(argv[i]);
+                    consumed = 1;
+                }
+            } else {
+                consumed = -1;
+            }
+        }
+        if (consumed < 0) {
+            SDLTest_Log ("Usage: %s %s [--fsaa] [--accel] [--zdepth %%d]\n", argv[0],
+                    SDLTest_CommonUsage(state));
+            quit(1);
+        }
+        i += consumed;
+    }
+
+    /* Set OpenGL parameters */
+    state->window_flags |= SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_BORDERLESS;
+    state->gl_red_size = 5;
+    state->gl_green_size = 5;
+    state->gl_blue_size = 5;
+    state->gl_depth_size = depth;
+    state->gl_major_version = 2;
+    state->gl_minor_version = 0;
+    state->gl_profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
+
+    if (fsaa) {
+        state->gl_multisamplebuffers=1;
+        state->gl_multisamplesamples=fsaa;
+    }
+    if (accel) {
+        state->gl_accelerated=1;
+    }
+    if (!SDLTest_CommonInit(state)) {
+        quit(2);
+        return 0;
     }
 
-    /* Create a 640x480 OpenGL screen */
-    window = SDL_CreateWindow( "Shader Demo", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_OPENGL );
-    if ( !window ) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create OpenGL window: %s\n", SDL_GetError());
-        SDL_Quit();
-        exit(2);
+    context = SDL_calloc(state->num_windows, sizeof(context));
+    if (context == NULL) {
+        SDLTest_Log("Out of memory!\n");
+        quit(2);
+    }
+    
+    /* Create OpenGL ES contexts */
+    for (i = 0; i < state->num_windows; i++) {
+        context[i] = SDL_GL_CreateContext(state->windows[i]);
+        if (!context[i]) {
+            SDLTest_Log("SDL_GL_CreateContext(): %s\n", SDL_GetError());
+            quit(2);
+        }
     }
 
-    if ( !SDL_GL_CreateContext(window)) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create OpenGL context: %s\n", SDL_GetError());
-        SDL_Quit();
-        exit(2);
+    /* Important: call this *after* creating the context */
+    if (LoadContext(&ctx) < 0) {
+        SDLTest_Log("Could not load GLES2 functions\n");
+        quit(2);
+        return 0;
     }
 
-    surface = SDL_LoadBMP("icon.bmp");
-    if ( ! surface ) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to load icon.bmp: %s\n", SDL_GetError());
-        SDL_Quit();
-        exit(3);
+
+
+    if (state->render_flags & SDL_RENDERER_PRESENTVSYNC) {
+        SDL_GL_SetSwapInterval(1);
+    } else {
+        SDL_GL_SetSwapInterval(0);
     }
-    texture = SDL_GL_LoadTexture(surface, texcoords);
-    SDL_FreeSurface(surface);
 
-    /* Loop, drawing and checking events */
-    InitGL(640, 480);
-    if (InitShaders()) {
-        SDL_Log("Shaders supported, press SPACE to cycle them.\n");
+    SDL_GetCurrentDisplayMode(0, &mode);
+    SDLTest_Log("Screen bpp: %d\n", SDL_BITSPERPIXEL(mode.format));
+    SDLTest_Log("\n");
+    SDLTest_Log("Vendor     : %s\n", ctx.glGetString(GL_VENDOR));
+    SDLTest_Log("Renderer   : %s\n", ctx.glGetString(GL_RENDERER));
+    SDLTest_Log("Version    : %s\n", ctx.glGetString(GL_VERSION));
+    SDLTest_Log("Extensions : %s\n", ctx.glGetString(GL_EXTENSIONS));
+    SDLTest_Log("\n");
+
+    status = SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value);
+    if (!status) {
+        SDLTest_Log("SDL_GL_RED_SIZE: requested %d, got %d\n", 5, value);
     } else {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Shaders not supported!\n");
+        SDLTest_Log( "Failed to get SDL_GL_RED_SIZE: %s\n",
+                SDL_GetError());
     }
-    done = 0;
-    while ( ! done ) {
-        DrawGLScene(window, texture, texcoords);
-
-        /* This could go in a separate function */
-        { SDL_Event event;
-            while ( SDL_PollEvent(&event) ) {
-                if ( event.type == SDL_QUIT ) {
-                    done = 1;
-                }
-                if ( event.type == SDL_KEYDOWN ) {
-                    if ( event.key.keysym.sym == SDLK_SPACE ) {
-                        current_shader = (current_shader + 1) % NUM_SHADERS;
-                    }
-                    if ( event.key.keysym.sym == SDLK_ESCAPE ) {
-                        done = 1;
-                    }
-                }
-            }
+    status = SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value);
+    if (!status) {
+        SDLTest_Log("SDL_GL_GREEN_SIZE: requested %d, got %d\n", 5, value);
+    } else {
+        SDLTest_Log( "Failed to get SDL_GL_GREEN_SIZE: %s\n",
+                SDL_GetError());
+    }
+    status = SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value);
+    if (!status) {
+        SDLTest_Log("SDL_GL_BLUE_SIZE: requested %d, got %d\n", 5, value);
+    } else {
+        SDLTest_Log( "Failed to get SDL_GL_BLUE_SIZE: %s\n",
+                SDL_GetError());
+    }
+    status = SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value);
+    if (!status) {
+        SDLTest_Log("SDL_GL_DEPTH_SIZE: requested %d, got %d\n", depth, value);
+    } else {
+        SDLTest_Log( "Failed to get SDL_GL_DEPTH_SIZE: %s\n",
+                SDL_GetError());
+    }
+    if (fsaa) {
+        status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLEBUFFERS, &value);
+        if (!status) {
+            SDLTest_Log("SDL_GL_MULTISAMPLEBUFFERS: requested 1, got %d\n", value);
+        } else {
+            SDLTest_Log( "Failed to get SDL_GL_MULTISAMPLEBUFFERS: %s\n",
+                    SDL_GetError());
+        }
+        status = SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &value);
+        if (!status) {
+            SDLTest_Log("SDL_GL_MULTISAMPLESAMPLES: requested %d, got %d\n", fsaa,
+                   value);
+        } else {
+            SDLTest_Log( "Failed to get SDL_GL_MULTISAMPLESAMPLES: %s\n",
+                    SDL_GetError());
         }
     }
-    QuitShaders();
-    SDL_Quit();
-    return 1;
+    if (accel) {
+        status = SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
+        if (!status) {
+            SDLTest_Log("SDL_GL_ACCELERATED_VISUAL: requested 1, got %d\n", value);
+        } else {
+            SDLTest_Log( "Failed to get SDL_GL_ACCELERATED_VISUAL: %s\n",
+                    SDL_GetError());
+        }
+    }
+
+    datas = SDL_calloc(state->num_windows, sizeof(shader_data));
+
+    /* Set rendering settings for each context */
+    for (i = 0; i < state->num_windows; ++i) {
+
+        int w, h;
+        status = SDL_GL_MakeCurrent(state->windows[i], context[i]);
+        if (status) {
+            SDLTest_Log("SDL_GL_MakeCurrent(): %s\n", SDL_GetError());
+
+            /* Continue for next window */
+            continue;
+        }
+        SDL_GL_GetDrawableSize(state->windows[i], &w, &h);
+        ctx.glViewport(0, 0, w, h);
+
+        data = &datas[i];
+        data->angle_x = 0; data->angle_y = 0; data->angle_z = 0;
+
+        /* Shader Initialization */
+        process_shader(&data->shader_vert, _shader_vert_src, GL_VERTEX_SHADER);
+        process_shader(&data->shader_frag, _shader_frag_src, GL_FRAGMENT_SHADER);
+
+        /* Create shader_program (ready to attach shaders) */
+        data->shader_program = GL_CHECK(ctx.glCreateProgram());
+
+        /* Attach shaders and link shader_program */
+        GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_vert));
+        GL_CHECK(ctx.glAttachShader(data->shader_program, data->shader_frag));
+        GL_CHECK(ctx.glLinkProgram(data->shader_program));
+
+        /* Get attribute locations of non-fixed attributes like color and texture coordinates. */
+        data->attr_position = GL_CHECK(ctx.glGetAttribLocation(data->shader_program, "av4position"));
+        data->attr_color = GL_CHECK(ctx.glGetAttribLocation(data->shader_program, "av3color"));
+
+        /* Get uniform locations */
+        data->attr_mvp = GL_CHECK(ctx.glGetUniformLocation(data->shader_program, "mvp"));
+
+        GL_CHECK(ctx.glUseProgram(data->shader_program));
+
+        /* Enable attributes for position, color and texture coordinates etc. */
+        GL_CHECK(ctx.glEnableVertexAttribArray(data->attr_position));
+        GL_CHECK(ctx.glEnableVertexAttribArray(data->attr_color));
+
+        /* Populate attributes for position, color and texture coordinates etc. */
+        GL_CHECK(ctx.glVertexAttribPointer(data->attr_position, 3, GL_FLOAT, GL_FALSE, 0, _vertices));
+        GL_CHECK(ctx.glVertexAttribPointer(data->attr_color, 3, GL_FLOAT, GL_FALSE, 0, _colors));
+
+        GL_CHECK(ctx.glEnable(GL_CULL_FACE));
+        GL_CHECK(ctx.glEnable(GL_DEPTH_TEST));
+    }
+
+    /* Main render loop */
+    frames = 0;
+    then = SDL_GetTicks();
+    done = 0;
+
+#ifdef __EMSCRIPTEN__
+    emscripten_set_main_loop(loop, 0, 1);
+#else
+    while (!done) {
+        loop();
+    }
+#endif
+
+    /* Print out some timing information */
+    now = SDL_GetTicks();
+    if (now > then) {
+        SDLTest_Log("%2.2f frames per second\n",
+               ((double) frames * 1000) / (now - then));
+    }
+#if !defined(__ANDROID__) && !defined(__NACL__)  
+    quit(0);
+#endif    
+    return 0;
 }
 
-#else /* HAVE_OPENGL */
+#else /* HAVE_OPENGLES2 */
 
 int
 main(int argc, char *argv[])
 {
-    SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No OpenGL support on this system\n");
+    SDLTest_Log("No OpenGL ES support on this system\n");
     return 1;
 }
 
-#endif /* HAVE_OPENGL */
+#endif /* HAVE_OPENGLES2 */
 
 /* vi: set ts=4 sw=4 expandtab: */
old mode 100644 (file)
new mode 100755 (executable)
index 00750a9..44c8c16
@@ -37,8 +37,7 @@ void render(SDL_Renderer *renderer,SDL_Texture *texture,SDL_Rect texture_dimensi
 
     SDL_RenderPresent(renderer);
 }
-
-int main(int argc,char** argv)
+int SDL_main(int argc,char** argv)
 {
     Uint8 num_pictures;
     LoadedPicture* pictures;
@@ -60,12 +59,12 @@ int main(int argc,char** argv)
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     if(argc < 2) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Shape requires at least one bitmap file as argument.");
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Shape requires at least one bitmap file as argument.");
         exit(-1);
     }
 
     if(SDL_VideoInit(NULL) == -1) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not initialize SDL video.");
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not initialize SDL video.");
         exit(-2);
     }
 
@@ -82,7 +81,7 @@ int main(int argc,char** argv)
                 SDL_FreeSurface(pictures[j].surface);
             SDL_free(pictures);
             SDL_VideoQuit();
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not load surface from named bitmap file: %s", argv[i+1]);
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not load surface from named bitmap file: %s", argv[i+1]);
             exit(-3);
         }
 
@@ -107,7 +106,7 @@ int main(int argc,char** argv)
             SDL_FreeSurface(pictures[i].surface);
         SDL_free(pictures);
         SDL_VideoQuit();
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create shaped window for SDL_Shape.");
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create shaped window for SDL_Shape.");
         exit(-4);
     }
     renderer = SDL_CreateRenderer(window,-1,0);
@@ -117,7 +116,7 @@ int main(int argc,char** argv)
             SDL_FreeSurface(pictures[i].surface);
         SDL_free(pictures);
         SDL_VideoQuit();
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create rendering context for SDL_Shape window.");
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create rendering context for SDL_Shape window.");
         exit(-5);
     }
 
@@ -136,7 +135,7 @@ int main(int argc,char** argv)
             SDL_DestroyRenderer(renderer);
             SDL_DestroyWindow(window);
             SDL_VideoQuit();
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create texture for SDL_shape.");
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create texture for SDL_shape.");
             exit(-6);
         }
     }
@@ -159,7 +158,7 @@ int main(int argc,char** argv)
         if(event_pending == 1) {
             if(event.type == SDL_KEYDOWN) {
                 button_down = 1;
-                if(event.key.keysym.sym == SDLK_ESCAPE) {
+                if(event.key.keysym.sym == SDLK_ESCAPE || event.key.keysym.sym == 0) {
                     should_exit = 1;
                     break;
                 }
old mode 100644 (file)
new mode 100755 (executable)
index 7a33af3..8067990
@@ -21,7 +21,8 @@
 
 #include "SDL_test.h"
 #include "SDL_test_common.h"
-
+#define WINDOW_WIDTH 720
+#define WINDOW_HEIGHT 1280
 #define NUM_SPRITES    100
 #define MAX_SPEED     1
 
@@ -64,11 +65,22 @@ LoadSprite(const char *file)
     /* Load the sprite image */
     temp = SDL_LoadBMP(file);
     if (temp == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError());
         return (-1);
     }
     sprite_w = temp->w;
     sprite_h = temp->h;
+    SDL_SetClipRect(temp, NULL);
+    SDL_Rect clipRect, full_clipRect;
+    SDL_GetClipRect(temp,&clipRect);
+    full_clipRect.x = 0;
+    full_clipRect.y = 0;
+    full_clipRect.w = sprite_w;
+    full_clipRect.h = sprite_h;
+    if(clipRect.x != full_clipRect.x || clipRect.y != full_clipRect.y || clipRect.w != full_clipRect.w || clipRect.h != full_clipRect.h)
+    {
+       SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION ,"Couldn't set cliprect!\n");
+    }
 
     /* Set transparent pixel as the pixel at (0,0) */
     if (temp->format->palette) {
@@ -95,11 +107,17 @@ LoadSprite(const char *file)
         SDL_Renderer *renderer = state->renderers[i];
         sprites[i] = SDL_CreateTextureFromSurface(renderer, temp);
         if (!sprites[i]) {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
             SDL_FreeSurface(temp);
             return (-1);
         }
         SDL_SetTextureBlendMode(sprites[i], blendMode);
+       SDL_BlendMode  retblendMode;
+       SDL_GetTextureBlendMode(sprites[i],&retblendMode);
+       if(blendMode != retblendMode)
+       {
+               SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Texture blend fails!\n");
+       }
     }
     SDL_FreeSurface(temp);
 
@@ -162,6 +180,18 @@ MoveSprites(SDL_Renderer * renderer, SDL_Texture * sprite)
     SDL_RenderDrawLine(renderer, 0, 1, 0, viewport.h-2);
     SDL_RenderDrawLine(renderer, viewport.w-1, 1, viewport.w-1, viewport.h-2);
 
+    SDL_Rect rect[2];
+    rect[0].x = 0;
+    rect[0].y = 0;
+    rect[0].w = 100;
+    rect[0].h = 100;
+    rect[1].x = 200;
+    rect[1].y = 200;
+    rect[1].w = 100;
+    rect[1].h = 100;
+    SDL_SetRenderDrawColor(renderer, 0x00, 0xFF, 0x00, 0xFF);
+    SDL_RenderDrawRects(renderer,rect, 2);
+
     /* Test fill and copy */
     SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
     temp.x = 1;
@@ -245,6 +275,14 @@ loop()
     /* Check for events */
     while (SDL_PollEvent(&event)) {
         SDLTest_CommonEvent(state, &event, &done);
+               switch(event.type) {
+               case SDL_KEYDOWN:
+                       if(event.key.keysym.sym == 0)
+                       {
+                               done = 1;
+                       }
+                       break;
+        }
     }
     for (i = 0; i < state->num_windows; ++i) {
         if (state->windows[i] == NULL)
@@ -257,20 +295,21 @@ loop()
     }
 #endif
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int i;
     Uint32 then, now, frames;
     Uint64 seed;
-    const char *icon = "icon.bmp";
+    const char *icon = "res/icon.bmp";
 
     /* Initialize parameters */
     num_sprites = NUM_SPRITES;
 
     /* Initialize test framework */
     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
+       state->window_w = WINDOW_WIDTH;
+    state->window_h = WINDOW_HEIGHT;
     if (!state) {
         return 1;
     }
@@ -332,7 +371,7 @@ main(int argc, char *argv[])
     sprites =
         (SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites));
     if (!sprites) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
         quit(2);
     }
     for (i = 0; i < state->num_windows; ++i) {
@@ -344,11 +383,34 @@ main(int argc, char *argv[])
         quit(2);
     }
 
+    if(SDL_RenderTargetSupported(state->renderers[0]) == SDL_FALSE)
+    {
+       SDLTest_Log(SDL_LOG_CATEGORY_APPLICATION, "SDL_RenderTarget is not support!\n");
+    }
+    else
+    {
+       SDL_Texture* renderTargetTexture = SDL_GetRenderTarget(state->renderers[0]);
+       if(renderTargetTexture == NULL)
+       {
+               SDLTest_Log(SDL_LOG_CATEGORY_APPLICATION, "renderTargetTexture is NULL!\n");
+       }
+    }
+
+    int render_width, render_height;
+    SDL_RenderGetLogicalSize(state->renderers[0], &render_width, &render_height);
+    SDLTest_Log(SDL_LOG_CATEGORY_APPLICATION, "Render Logical size is %d * %d", render_width, render_height);
+
+    if(SDL_RenderIsClipEnabled(state->renderers[0]) == SDL_FALSE)
+    {
+       SDLTest_Log(SDL_LOG_CATEGORY_APPLICATION, "SDL_RenderIsClipEnabled is not support!\n");
+    }
+
+
     /* Allocate memory for the sprite info */
     positions = (SDL_Rect *) SDL_malloc(num_sprites * sizeof(SDL_Rect));
     velocities = (SDL_Rect *) SDL_malloc(num_sprites * sizeof(SDL_Rect));
     if (!positions || !velocities) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n");
         quit(2);
     }
 
old mode 100644 (file)
new mode 100755 (executable)
index 05f9730..b686b43
@@ -21,8 +21,8 @@
 
 #include "SDL.h"
 
-#define WINDOW_WIDTH    640
-#define WINDOW_HEIGHT   480
+#define WINDOW_WIDTH    720
+#define WINDOW_HEIGHT   1280
 #define NUM_SPRITES     100
 #define MAX_SPEED       1
 
@@ -49,7 +49,7 @@ LoadSprite(char *file, SDL_Renderer *renderer)
     /* Load the sprite image */
     temp = SDL_LoadBMP(file);
     if (temp == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", file, SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", file, SDL_GetError());
         return (-1);
     }
     sprite_w = temp->w;
@@ -80,7 +80,7 @@ LoadSprite(char *file, SDL_Renderer *renderer)
     /* Create textures from the image */
     sprite = SDL_CreateTextureFromSurface(renderer, temp);
     if (!sprite) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError());
         SDL_FreeSurface(temp);
         return (-1);
     }
@@ -142,9 +142,8 @@ void loop()
     }
 #endif
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     SDL_Window *window;
     int i;
@@ -157,7 +156,7 @@ main(int argc, char *argv[])
         quit(2);
     }
 
-    if (LoadSprite("icon.bmp", renderer) < 0) {
+    if (LoadSprite("res/icon.bmp", renderer) < 0) {
         quit(2);
     }
 
old mode 100644 (file)
new mode 100755 (executable)
index 86cc139..d14d10d
@@ -77,7 +77,7 @@ void UpdateTexture(SDL_Texture *texture, int frame)
     int pitch;
 
     if (SDL_LockTexture(texture, NULL, &pixels, &pitch) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock texture: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock texture: %s\n", SDL_GetError());
         quit(5);
     }
     src = MooseFrames[frame];
@@ -99,7 +99,7 @@ loop()
     while (SDL_PollEvent(&event)) {
         switch (event.type) {
         case SDL_KEYDOWN:
-            if (event.key.keysym.sym == SDLK_ESCAPE) {
+            if (event.key.keysym.sym == SDLK_ESCAPE || event.key.keysym.sym == SDLK_f) {
                 done = SDL_TRUE;
             }
             break;
@@ -122,9 +122,8 @@ loop()
     }
 #endif
 }
-
 int
-main(int argc, char **argv)
+SDL_main(int argc, char **argv)
 {
     SDL_Window *window;
     SDL_RWops *handle;
@@ -133,14 +132,14 @@ main(int argc, char **argv)
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     if (SDL_Init(SDL_INIT_VIDEO) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return 1;
     }
 
     /* load the moose images */
-    handle = SDL_RWFromFile("moose.dat", "rb");
+    handle = SDL_RWFromFile("res/moose.dat", "rb");
     if (handle == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n");
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n");
         quit(2);
     }
     SDL_RWread(handle, MooseFrames, MOOSEFRAME_SIZE, MOOSEFRAMES_COUNT);
@@ -154,19 +153,19 @@ main(int argc, char **argv)
                               MOOSEPIC_W*4, MOOSEPIC_H*4,
                               SDL_WINDOW_RESIZABLE);
     if (!window) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError());
         quit(3);
     }
 
     renderer = SDL_CreateRenderer(window, -1, 0);
     if (!renderer) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError());
         quit(4);
     }
 
     MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H);
     if (!MooseTexture) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError());
         quit(5);
     }
 
old mode 100644 (file)
new mode 100755 (executable)
index 90e2c60..214dd3d
@@ -33,27 +33,26 @@ int SDLCALL
 ThreadFunc(void *data)
 {
     SDL_TLSSet(tls, "baby thread", NULL);
-    SDL_Log("Started thread %s: My thread id is %lu, thread data = %s\n",
+    SDLTest_Log("Started thread %s: My thread id is %lu, thread data = %s\n",
            (char *) data, SDL_ThreadID(), (const char *)SDL_TLSGet(tls));
     while (alive) {
-        SDL_Log("Thread '%s' is alive!\n", (char *) data);
+        SDLTest_Log("Thread '%s' is alive!\n", (char *) data);
         SDL_Delay(1 * 1000);
     }
-    SDL_Log("Thread '%s' exiting!\n", (char *) data);
+    SDLTest_Log("Thread '%s' exiting!\n", (char *) data);
     return (0);
 }
 
 static void
 killed(int sig)
 {
-    SDL_Log("Killed with SIGTERM, waiting 5 seconds to exit\n");
+    SDLTest_Log("Killed with SIGTERM, waiting 5 seconds to exit\n");
     SDL_Delay(5 * 1000);
     alive = 0;
     quit(0);
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     SDL_Thread *thread;
 
@@ -62,33 +61,33 @@ main(int argc, char *argv[])
 
     /* Load the SDL library */
     if (SDL_Init(0) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return (1);
     }
 
     tls = SDL_TLSCreate();
     SDL_assert(tls);
     SDL_TLSSet(tls, "main thread", NULL);
-    SDL_Log("Main thread data initially: %s\n", (const char *)SDL_TLSGet(tls));
+    SDLTest_Log("Main thread data initially: %s\n", (const char *)SDL_TLSGet(tls));
 
     alive = 1;
     thread = SDL_CreateThread(ThreadFunc, "One", "#1");
     if (thread == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
         quit(1);
     }
     SDL_Delay(5 * 1000);
-    SDL_Log("Waiting for thread #1\n");
+    SDLTest_Log("Waiting for thread #1\n");
     alive = 0;
     SDL_WaitThread(thread, NULL);
 
-    SDL_Log("Main thread data finally: %s\n", (const char *)SDL_TLSGet(tls));
+    SDLTest_Log("Main thread data finally: %s\n", (const char *)SDL_TLSGet(tls));
 
     alive = 1;
     signal(SIGTERM, killed);
     thread = SDL_CreateThread(ThreadFunc, "Two", "#2");
     if (thread == NULL) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
         quit(1);
     }
     raise(SIGTERM);
old mode 100644 (file)
new mode 100755 (executable)
index 32b7490..584668c
@@ -33,12 +33,11 @@ ticktock(Uint32 interval, void *param)
 static Uint32 SDLCALL
 callback(Uint32 interval, void *param)
 {
-    SDL_Log("Timer %d : param = %d\n", interval, (int) (uintptr_t) param);
+    SDLTest_Log("Timer %d : param = %d\n", interval, (int) (uintptr_t) param);
     return interval;
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int i, desired;
     SDL_TimerID t1, t2, t3;
@@ -49,7 +48,7 @@ main(int argc, char *argv[])
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
     if (SDL_Init(SDL_INIT_TIMER) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return (1);
     }
 
@@ -64,7 +63,7 @@ main(int argc, char *argv[])
     t1 = SDL_AddTimer(desired, ticktock, NULL);
 
     /* Wait 10 seconds */
-    SDL_Log("Waiting 10 seconds\n");
+    SDLTest_Log("Waiting 10 seconds\n");
     SDL_Delay(10 * 1000);
 
     /* Stop the timer */
@@ -72,27 +71,27 @@ main(int argc, char *argv[])
 
     /* Print the results */
     if (ticks) {
-        SDL_Log("Timer resolution: desired = %d ms, actual = %f ms\n",
+        SDLTest_Log("Timer resolution: desired = %d ms, actual = %f ms\n",
                 desired, (double) (10 * 1000) / ticks);
     }
 
     /* Test multiple timers */
-    SDL_Log("Testing multiple timers...\n");
+    SDLTest_Log("Testing multiple timers...\n");
     t1 = SDL_AddTimer(100, callback, (void *) 1);
     if (!t1)
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,"Could not create timer 1: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION,"Could not create timer 1: %s\n", SDL_GetError());
     t2 = SDL_AddTimer(50, callback, (void *) 2);
     if (!t2)
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,"Could not create timer 2: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION,"Could not create timer 2: %s\n", SDL_GetError());
     t3 = SDL_AddTimer(233, callback, (void *) 3);
     if (!t3)
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,"Could not create timer 3: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION,"Could not create timer 3: %s\n", SDL_GetError());
 
     /* Wait 10 seconds */
-    SDL_Log("Waiting 10 seconds\n");
+    SDLTest_Log("Waiting 10 seconds\n");
     SDL_Delay(10 * 1000);
 
-    SDL_Log("Removing timer 1 and waiting 5 more seconds\n");
+    SDLTest_Log("Removing timer 1 and waiting 5 more seconds\n");
     SDL_RemoveTimer(t1);
 
     SDL_Delay(5 * 1000);
@@ -105,15 +104,15 @@ main(int argc, char *argv[])
         ticktock(0, NULL);
     }
     now = SDL_GetPerformanceCounter();
-    SDL_Log("1 million iterations of ticktock took %f ms\n", (double)((now - start)*1000) / SDL_GetPerformanceFrequency());
+    SDLTest_Log("1 million iterations of ticktock took %f ms\n", (double)((now - start)*1000) / SDL_GetPerformanceFrequency());
 
-    SDL_Log("Performance counter frequency: %"SDL_PRIu64"\n", (unsigned long long) SDL_GetPerformanceFrequency());
+    SDLTest_Log("Performance counter frequency: %"SDL_PRIu64"\n", (unsigned long long) SDL_GetPerformanceFrequency());
     start32 = SDL_GetTicks();
     start = SDL_GetPerformanceCounter();
     SDL_Delay(1000);
     now = SDL_GetPerformanceCounter();
     now32 = SDL_GetTicks();
-    SDL_Log("Delay 1 second = %d ms in ticks, %f ms according to performance counter\n", (now32-start32), (double)((now - start)*1000) / SDL_GetPerformanceFrequency());
+    SDLTest_Log("Delay 1 second = %d ms in ticks, %f ms according to performance counter\n", (now32-start32), (double)((now - start)*1000) / SDL_GetPerformanceFrequency());
 
     SDL_Quit();
     return (0);
old mode 100644 (file)
new mode 100755 (executable)
index f0e3bcf..ca6a934
@@ -19,9 +19,8 @@
 
 #include "SDL.h"
 #include "SDL_revision.h"
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     SDL_version compiled;
     SDL_version linked;
@@ -30,18 +29,19 @@ main(int argc, char *argv[])
     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
 
 #if SDL_VERSION_ATLEAST(2, 0, 0)
-    SDL_Log("Compiled with SDL 2.0 or newer\n");
+    SDLTest_Log("Compiled with SDL 2.0 or newer\n");
 #else
-    SDL_Log("Compiled with SDL older than 2.0\n");
+    SDLTest_Log("Compiled with SDL older than 2.0\n");
 #endif
     SDL_VERSION(&compiled);
-    SDL_Log("Compiled version: %d.%d.%d.%d (%s)\n",
+    SDLTest_Log("Compiled version: %d.%d.%d.%d (%s)\n",
            compiled.major, compiled.minor, compiled.patch,
            SDL_REVISION_NUMBER, SDL_REVISION);
     SDL_GetVersion(&linked);
-    SDL_Log("Linked version: %d.%d.%d.%d (%s)\n",
+    SDLTest_Log("Linked version: %d.%d.%d.%d (%s)\n",
            linked.major, linked.minor, linked.patch,
            SDL_GetRevisionNumber(), SDL_GetRevision());
     SDL_Quit();
     return (0);
 }
+
old mode 100644 (file)
new mode 100755 (executable)
index 7ed4e6e..41840b5
@@ -21,7 +21,8 @@
 
 #include "SDL_test.h"
 #include "SDL_test_common.h"
-
+#define WINDOW_WIDTH    720
+#define WINDOW_HEIGHT   1280
 
 static SDLTest_CommonState *state;
 
@@ -102,6 +103,14 @@ loop()
     /* Check for events */
     while (SDL_PollEvent(&event)) {
         SDLTest_CommonEvent(state, &event, &done);
+               switch(event.type) {
+               case SDL_KEYDOWN:
+                       if(event.key.keysym.sym == 0)
+                       {
+                               done = 1;
+                       }
+                       break;
+        }
     }
 
     /* Move a viewport box in steps around the screen */
@@ -110,7 +119,7 @@ loop()
     viewport.w = 100 + j * 50;
     viewport.h = 100 + j * 50;
     j = (j + 1) % 4;
-    SDL_Log("Current Viewport x=%i y=%i w=%i h=%i", viewport.x, viewport.y, viewport.w, viewport.h);
+    SDLTest_Log("Current Viewport x=%i y=%i w=%i h=%i", viewport.x, viewport.y, viewport.w, viewport.h);
 
     for (i = 0; i < state->num_windows; ++i) {
         if (state->windows[i] == NULL)
@@ -136,15 +145,16 @@ loop()
     }
 #endif
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     int i;
     Uint32 then, now, frames;
 
     /* Initialize test framework */
     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
+       state->window_w = WINDOW_WIDTH;
+    state->window_h = WINDOW_HEIGHT;
     if (!state) {
         return 1;
     }
@@ -161,7 +171,7 @@ main(int argc, char *argv[])
             }
         }
         if (consumed < 0) {
-            SDL_Log("Usage: %s %s [--target]\n",
+            SDLTest_Log("Usage: %s %s [--target]\n",
                     argv[0], SDLTest_CommonUsage(state));
             quit(1);
         }
@@ -208,7 +218,7 @@ main(int argc, char *argv[])
     now = SDL_GetTicks();
     if (now > then) {
         double fps = ((double) frames * 1000) / (now - then);
-        SDL_Log("%2.2f frames per second\n", fps);
+        SDLTest_Log("%2.2f frames per second\n", fps);
     }
     quit(0);
     return 0;
old mode 100644 (file)
new mode 100755 (executable)
index 5719a71..1a13d92
@@ -48,7 +48,7 @@ ThreadFunc(void *data)
     int i;
     int tid = (int) (uintptr_t) data;
 
-    SDL_Log("Creating Thread %d\n", tid);
+    SDLTest_Log("Creating Thread %d\n", tid);
 
     for (i = 0; i < NUMTHREADS; i++) {
         char name[64];
@@ -57,24 +57,23 @@ ThreadFunc(void *data)
         sub_threads[i] = SDL_CreateThread(SubThreadFunc, name, &flags[i]);
     }
 
-    SDL_Log("Thread '%d' waiting for signal\n", tid);
+    SDLTest_Log("Thread '%d' waiting for signal\n", tid);
     while (time_for_threads_to_die[tid] != 1) {
         ;                       /* do nothing */
     }
 
-    SDL_Log("Thread '%d' sending signals to subthreads\n", tid);
+    SDLTest_Log("Thread '%d' sending signals to subthreads\n", tid);
     for (i = 0; i < NUMTHREADS; i++) {
         flags[i] = 1;
         SDL_WaitThread(sub_threads[i], NULL);
     }
 
-    SDL_Log("Thread '%d' exiting!\n", tid);
+    SDLTest_Log("Thread '%d' exiting!\n", tid);
 
     return 0;
 }
-
 int
-main(int argc, char *argv[])
+SDL_main(int argc, char *argv[])
 {
     SDL_Thread *threads[NUMTHREADS];
     int i;
@@ -84,7 +83,7 @@ main(int argc, char *argv[])
 
     /* Load the SDL library */
     if (SDL_Init(0) < 0) {
-        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
+        SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
         return (1);
     }
 
@@ -96,7 +95,7 @@ main(int argc, char *argv[])
         threads[i] = SDL_CreateThread(ThreadFunc, name, (void*) (uintptr_t) i);
 
         if (threads[i] == NULL) {
-            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
+            SDLTest_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError());
             quit(1);
         }
     }
old mode 100644 (file)
new mode 100755 (executable)