Fixed bug 3805 - Why is there no --enable-video-rpi option in configure? Andreas Falkenhahn When compiling SDL for the Raspberry Pi, I have to use the --host parameter to enable compilation of the native Raspberry Pi video driver, like so: --host=arm-raspberry-linux-gnueabihf It took me a while to figure out that this was necessary in order to have the native Raspberry Pi video driver compiled in. I think it would be better if there was an option like --enable-video-rpi that could be passed to configure and that would also show up when saying configure --help. Currently, it?s rather difficult to figure out that you have to use the --host parameter with arm-raspberry-linux-gnueabihf in order to get Raspberry Pi video support. It?s also somewhat inconsistent because most other video drivers can in fact be enabled/disabled through specific configure parameters but there is no such parameter for the native Raspberry Pi video driver.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
diff --git a/configure b/configure
index d3595e3..7fc232d 100755
--- a/configure
+++ b/configure
@@ -832,6 +832,7 @@ enable_video_wayland_qt_touch
enable_wayland_shared
enable_video_mir
enable_mir_shared
+enable_video_rpi
enable_video_x11
with_x
enable_x11_shared
@@ -1572,6 +1573,7 @@ Optional Features:
--enable-wayland-shared dynamically load Wayland support [[default=maybe]]
--enable-video-mir use Mir video driver [[default=yes]]
--enable-mir-shared dynamically load Mir support [[default=maybe]]
+ --enable-video-rpi use Raspberry Pi video driver [[default=yes]]
--enable-video-x11 use X11 video driver [[default=yes]]
--enable-x11-shared dynamically load X11 support [[default=maybe]]
--enable-video-x11-xcursor
@@ -19460,10 +19462,77 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
}
-CheckX11()
+CheckRPI()
{
+ # Check whether --enable-video-rpi was given.
+if test "${enable_video_rpi+set}" = set; then :
+ enableval=$enable_video_rpi;
+else
+ enable_video_rpi=yes
+fi
+
+ if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
+ if test x$ARCH = xnetbsd; then
+ RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
+ RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
+ else
+ RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
+ RPI_LDFLAGS="-L/opt/vc/lib -lbcm_host"
+ fi
+
+ # Save the original compiler flags and libraries
+ ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
+
+ # Add the Raspberry Pi compiler flags and libraries
+ CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS"
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Raspberry Pi" >&5
+$as_echo_n "checking for Raspberry Pi... " >&6; }
+ have_video_rpi=no
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <bcm_host.h>
+
+int
+main ()
+{
+
+ bcm_host_init();
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ have_video_rpi=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_video_rpi" >&5
+$as_echo "$have_video_rpi" >&6; }
+
+ # Restore the compiler flags and libraries
+ CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
+
+ if test x$have_video_rpi = xyes; then
+ CFLAGS="$CFLAGS $RPI_CFLAGS"
+ SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
+ EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS"
+ SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
+
+$as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
+
+ SUMMARY_video="${SUMMARY_video} rpi"
+ fi
+ fi
+}
+
+CheckX11()
+{
# Check whether --enable-video-x11 was given.
if test "${enable_video_x11+set}" = set; then :
enableval=$enable_video_x11;
@@ -23640,22 +23709,6 @@ CheckWarnAll
case "$host" in
*-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
case "$host" in
- *-raspberry-linux*)
- # Raspberry Pi
- ARCH=linux
- RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
- CFLAGS="$CFLAGS $RPI_CFLAGS"
- SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
- EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/vc/lib -lbcm_host -ldl"
-
- if test x$enable_video = xyes; then
- SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
- # FIXME: confdefs? Not AC_DEFINE?
- $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
- SUMMARY_video="${SUMMARY_video} rpi"
- fi
- ;;
*-*-androideabi*)
# Android
ARCH=android
@@ -23682,21 +23735,6 @@ case "$host" in
*-*-bsdi*) ARCH=bsdi ;;
*-*-freebsd*) ARCH=freebsd ;;
*-*-dragonfly*) ARCH=freebsd ;;
- *-raspberry-netbsd*)
- # Raspberry Pi
- ARCH=netbsd
- RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
- CFLAGS="$CFLAGS $RPI_CFLAGS"
- SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
- EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host -ldl"
-
- if test x$enable_video = xyes; then
- SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
- $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
- SUMMARY_video="${SUMMARY_video} raspberry"
- fi
- ;;
*-*-netbsd*) ARCH=netbsd ;;
*-*-openbsd*) ARCH=openbsd ;;
*-*-sysv5*) ARCH=sysv5 ;;
@@ -23724,6 +23762,8 @@ case "$host" in
CheckSNDIO
CheckFusionSound
CheckLibSampleRate
+ # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
+ CheckRPI
CheckX11
CheckDirectFB
CheckKMSDRM
diff --git a/configure.in b/configure.in
index 68790f9..43e30c0 100644
--- a/configure.in
+++ b/configure.in
@@ -1554,11 +1554,56 @@ CheckNativeClient()
}
-dnl Find the X11 include and library directories
-CheckX11()
+CheckRPI()
{
+ AC_ARG_ENABLE(video-rpi,
+AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]),
+ , enable_video_rpi=yes)
+ if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
+ if test x$ARCH = xnetbsd; then
+ RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
+ RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
+ else
+ RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
+ RPI_LDFLAGS="-L/opt/vc/lib -lbcm_host"
+ fi
+
+ # Save the original compiler flags and libraries
+ ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
+
+ # Add the Raspberry Pi compiler flags and libraries
+ CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS"
+ AC_MSG_CHECKING(for Raspberry Pi)
+ have_video_rpi=no
+ AC_TRY_LINK([
+ #include <bcm_host.h>
+ ],[
+ bcm_host_init();
+ ],[
+ have_video_rpi=yes
+ ],[
+ ])
+ AC_MSG_RESULT($have_video_rpi)
+
+ # Restore the compiler flags and libraries
+ CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
+
+ if test x$have_video_rpi = xyes; then
+ CFLAGS="$CFLAGS $RPI_CFLAGS"
+ SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
+ EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS"
+ SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
+ AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ])
+ SUMMARY_video="${SUMMARY_video} rpi"
+ fi
+ fi
+}
+dnl Find the X11 include and library directories
+CheckX11()
+{
AC_ARG_ENABLE(video-x11,
AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
, enable_video_x11=yes)
@@ -3195,22 +3240,6 @@ dnl Set up the configuration based on the host platform!
case "$host" in
*-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
case "$host" in
- *-raspberry-linux*)
- # Raspberry Pi
- ARCH=linux
- RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
- CFLAGS="$CFLAGS $RPI_CFLAGS"
- SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
- EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/vc/lib -lbcm_host -ldl"
-
- if test x$enable_video = xyes; then
- SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
- # FIXME: confdefs? Not AC_DEFINE?
- $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
- SUMMARY_video="${SUMMARY_video} rpi"
- fi
- ;;
*-*-androideabi*)
# Android
ARCH=android
@@ -3237,21 +3266,6 @@ case "$host" in
*-*-bsdi*) ARCH=bsdi ;;
*-*-freebsd*) ARCH=freebsd ;;
*-*-dragonfly*) ARCH=freebsd ;;
- *-raspberry-netbsd*)
- # Raspberry Pi
- ARCH=netbsd
- RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
- CFLAGS="$CFLAGS $RPI_CFLAGS"
- SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
- EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host -ldl"
-
- if test x$enable_video = xyes; then
- SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
- $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
- SUMMARY_video="${SUMMARY_video} raspberry"
- fi
- ;;
*-*-netbsd*) ARCH=netbsd ;;
*-*-openbsd*) ARCH=openbsd ;;
*-*-sysv5*) ARCH=sysv5 ;;
@@ -3279,6 +3293,8 @@ case "$host" in
CheckSNDIO
CheckFusionSound
CheckLibSampleRate
+ # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
+ CheckRPI
CheckX11
CheckDirectFB
CheckKMSDRM
diff --git a/src/video/raspberry/SDL_rpivideo.h b/src/video/raspberry/SDL_rpivideo.h
index 1b69f13..ba1f0b2 100644
--- a/src/video/raspberry/SDL_rpivideo.h
+++ b/src/video/raspberry/SDL_rpivideo.h
@@ -25,7 +25,7 @@
#include "../../SDL_internal.h"
#include "../SDL_sysvideo.h"
-#include "bcm_host.h"
+#include <bcm_host.h>
#include "GLES/gl.h"
#include "EGL/egl.h"
#include "EGL/eglext.h"