 +    if test x$enable_video = xyes -a x$enable_naclvideo = xyes; then
 +        AC_DEFINE(SDL_VIDEO_DRIVER_NACL)
 +        SOURCES="$SOURCES $srcdir/src/video/nacl/*.cc"
-+        SDL_LIBS="-Wl,--start-group -lSDLmain $SDL_LIBS -lppapi -lppapi_cpp -Wl,--end-group -lstdc++"
++        SDL_LIBS="-Wl,--start-group -lSDLmain $SDL_LIBS -lppapi -lppapi_cpp -lppapi_gles2 -Wl,--end-group -lRegal -lstdc++"
 +    fi
 +
 +    AC_ARG_ENABLE(naclaudio,

+                ;;
+        esac
+        MATHLIB="-lm"
+        SYS_GL_LIBS="-lppapi_gles2 -lRegal -lstdc++"
+        ;;
     *)
         EXE=""

+extern void NACL_PumpEvents(_THIS);
diff --git a/src/video/nacl/SDL_naclvideo.cc b/src/video/nacl/SDL_naclvideo.cc
new file mode 100644
index 0000000..5404234
--- /dev/null
+++ b/src/video/nacl/SDL_naclvideo.cc
@@ -0,0 +1,392 @@
+#include "SDL_config.h"
+
+#include <assert.h>
