configure.in
changeset 11472 f31b73040ea3
parent 11457 3db9f2a42870
child 11480 e7a79b236dc0
     1.1 --- a/configure.in	Fri Sep 08 18:26:25 2017 -0700
     1.2 +++ b/configure.in	Fri Sep 08 22:21:01 2017 -0700
     1.3 @@ -1554,11 +1554,56 @@
     1.4  }
     1.5  
     1.6  
     1.7 +CheckRPI()
     1.8 +{
     1.9 +    AC_ARG_ENABLE(video-rpi,
    1.10 +AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]),
    1.11 +                  , enable_video_rpi=yes)
    1.12 +    if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
    1.13 +        if test x$ARCH = xnetbsd; then
    1.14 +            RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
    1.15 +            RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
    1.16 +        else
    1.17 +            RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
    1.18 +            RPI_LDFLAGS="-L/opt/vc/lib -lbcm_host"
    1.19 +        fi
    1.20 +
    1.21 +        # Save the original compiler flags and libraries
    1.22 +        ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
    1.23 +
    1.24 +        # Add the Raspberry Pi compiler flags and libraries
    1.25 +        CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS"
    1.26 +
    1.27 +        AC_MSG_CHECKING(for Raspberry Pi)
    1.28 +        have_video_rpi=no
    1.29 +        AC_TRY_LINK([
    1.30 +          #include <bcm_host.h>
    1.31 +        ],[
    1.32 +          bcm_host_init();
    1.33 +        ],[
    1.34 +        have_video_rpi=yes
    1.35 +        ],[
    1.36 +        ])
    1.37 +        AC_MSG_RESULT($have_video_rpi)
    1.38 +
    1.39 +        # Restore the compiler flags and libraries
    1.40 +        CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
    1.41 +        
    1.42 +        if test x$have_video_rpi = xyes; then
    1.43 +            CFLAGS="$CFLAGS $RPI_CFLAGS"
    1.44 +            SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
    1.45 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
    1.46 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS"
    1.47 +            SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
    1.48 +            AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ])
    1.49 +            SUMMARY_video="${SUMMARY_video} rpi"
    1.50 +        fi
    1.51 +    fi
    1.52 +}
    1.53 +
    1.54  dnl Find the X11 include and library directories
    1.55  CheckX11()
    1.56  {
    1.57 -
    1.58 -
    1.59      AC_ARG_ENABLE(video-x11,
    1.60  AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
    1.61                    , enable_video_x11=yes)
    1.62 @@ -3195,22 +3240,6 @@
    1.63  case "$host" in
    1.64      *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
    1.65          case "$host" in
    1.66 -            *-raspberry-linux*)
    1.67 -                # Raspberry Pi
    1.68 -                ARCH=linux
    1.69 -                RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
    1.70 -                CFLAGS="$CFLAGS $RPI_CFLAGS"
    1.71 -                SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
    1.72 -                EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
    1.73 -                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/vc/lib -lbcm_host -ldl"
    1.74 -
    1.75 -                if test x$enable_video = xyes; then
    1.76 -                    SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
    1.77 -                    # FIXME: confdefs? Not AC_DEFINE?
    1.78 -                    $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
    1.79 -                    SUMMARY_video="${SUMMARY_video} rpi"
    1.80 -                fi
    1.81 -                ;;
    1.82              *-*-androideabi*)
    1.83                  # Android
    1.84                  ARCH=android
    1.85 @@ -3237,21 +3266,6 @@
    1.86              *-*-bsdi*)          ARCH=bsdi ;;
    1.87              *-*-freebsd*)       ARCH=freebsd ;;
    1.88              *-*-dragonfly*)     ARCH=freebsd ;;
    1.89 -            *-raspberry-netbsd*)
    1.90 -                # Raspberry Pi
    1.91 -                ARCH=netbsd
    1.92 -                RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
    1.93 -                CFLAGS="$CFLAGS $RPI_CFLAGS"
    1.94 -                SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
    1.95 -                EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
    1.96 -                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host -ldl"
    1.97 -
    1.98 -                if test x$enable_video = xyes; then
    1.99 -                    SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
   1.100 -                    $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
   1.101 -                    SUMMARY_video="${SUMMARY_video} raspberry"
   1.102 -                fi
   1.103 -                ;;
   1.104              *-*-netbsd*)        ARCH=netbsd ;;
   1.105              *-*-openbsd*)       ARCH=openbsd ;;
   1.106              *-*-sysv5*)         ARCH=sysv5 ;;
   1.107 @@ -3279,6 +3293,8 @@
   1.108          CheckSNDIO
   1.109          CheckFusionSound
   1.110          CheckLibSampleRate
   1.111 +        # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
   1.112 +        CheckRPI
   1.113          CheckX11
   1.114          CheckDirectFB
   1.115          CheckKMSDRM