configure
changeset 11472 f31b73040ea3
parent 11457 3db9f2a42870
child 11480 e7a79b236dc0
     1.1 --- a/configure	Fri Sep 08 18:26:25 2017 -0700
     1.2 +++ b/configure	Fri Sep 08 22:21:01 2017 -0700
     1.3 @@ -832,6 +832,7 @@
     1.4  enable_wayland_shared
     1.5  enable_video_mir
     1.6  enable_mir_shared
     1.7 +enable_video_rpi
     1.8  enable_video_x11
     1.9  with_x
    1.10  enable_x11_shared
    1.11 @@ -1572,6 +1573,7 @@
    1.12    --enable-wayland-shared dynamically load Wayland support [[default=maybe]]
    1.13    --enable-video-mir      use Mir video driver [[default=yes]]
    1.14    --enable-mir-shared     dynamically load Mir support [[default=maybe]]
    1.15 +  --enable-video-rpi      use Raspberry Pi video driver [[default=yes]]
    1.16    --enable-video-x11      use X11 video driver [[default=yes]]
    1.17    --enable-x11-shared     dynamically load X11 support [[default=maybe]]
    1.18    --enable-video-x11-xcursor
    1.19 @@ -19460,10 +19462,77 @@
    1.20  }
    1.21  
    1.22  
    1.23 +CheckRPI()
    1.24 +{
    1.25 +    # Check whether --enable-video-rpi was given.
    1.26 +if test "${enable_video_rpi+set}" = set; then :
    1.27 +  enableval=$enable_video_rpi;
    1.28 +else
    1.29 +  enable_video_rpi=yes
    1.30 +fi
    1.31 +
    1.32 +    if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
    1.33 +        if test x$ARCH = xnetbsd; then
    1.34 +            RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
    1.35 +            RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host"
    1.36 +        else
    1.37 +            RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
    1.38 +            RPI_LDFLAGS="-L/opt/vc/lib -lbcm_host"
    1.39 +        fi
    1.40 +
    1.41 +        # Save the original compiler flags and libraries
    1.42 +        ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
    1.43 +
    1.44 +        # Add the Raspberry Pi compiler flags and libraries
    1.45 +        CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS"
    1.46 +
    1.47 +        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Raspberry Pi" >&5
    1.48 +$as_echo_n "checking for Raspberry Pi... " >&6; }
    1.49 +        have_video_rpi=no
    1.50 +        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1.51 +/* end confdefs.h.  */
    1.52 +
    1.53 +          #include <bcm_host.h>
    1.54 +
    1.55 +int
    1.56 +main ()
    1.57 +{
    1.58 +
    1.59 +          bcm_host_init();
    1.60 +
    1.61 +  ;
    1.62 +  return 0;
    1.63 +}
    1.64 +_ACEOF
    1.65 +if ac_fn_c_try_link "$LINENO"; then :
    1.66 +
    1.67 +        have_video_rpi=yes
    1.68 +
    1.69 +fi
    1.70 +rm -f core conftest.err conftest.$ac_objext \
    1.71 +    conftest$ac_exeext conftest.$ac_ext
    1.72 +        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_video_rpi" >&5
    1.73 +$as_echo "$have_video_rpi" >&6; }
    1.74 +
    1.75 +        # Restore the compiler flags and libraries
    1.76 +        CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
    1.77 +
    1.78 +        if test x$have_video_rpi = xyes; then
    1.79 +            CFLAGS="$CFLAGS $RPI_CFLAGS"
    1.80 +            SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
    1.81 +            EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
    1.82 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS"
    1.83 +            SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
    1.84 +
    1.85 +$as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
    1.86 +
    1.87 +            SUMMARY_video="${SUMMARY_video} rpi"
    1.88 +        fi
    1.89 +    fi
    1.90 +}
    1.91 +
    1.92  CheckX11()
    1.93  {
    1.94 -
    1.95 -
    1.96      # Check whether --enable-video-x11 was given.
    1.97  if test "${enable_video_x11+set}" = set; then :
    1.98    enableval=$enable_video_x11;
    1.99 @@ -23640,22 +23709,6 @@
   1.100  case "$host" in
   1.101      *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
   1.102          case "$host" in
   1.103 -            *-raspberry-linux*)
   1.104 -                # Raspberry Pi
   1.105 -                ARCH=linux
   1.106 -                RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
   1.107 -                CFLAGS="$CFLAGS $RPI_CFLAGS"
   1.108 -                SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
   1.109 -                EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
   1.110 -                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/vc/lib -lbcm_host -ldl"
   1.111 -
   1.112 -                if test x$enable_video = xyes; then
   1.113 -                    SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
   1.114 -                    # FIXME: confdefs? Not AC_DEFINE?
   1.115 -                    $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
   1.116 -                    SUMMARY_video="${SUMMARY_video} rpi"
   1.117 -                fi
   1.118 -                ;;
   1.119              *-*-androideabi*)
   1.120                  # Android
   1.121                  ARCH=android
   1.122 @@ -23682,21 +23735,6 @@
   1.123              *-*-bsdi*)          ARCH=bsdi ;;
   1.124              *-*-freebsd*)       ARCH=freebsd ;;
   1.125              *-*-dragonfly*)     ARCH=freebsd ;;
   1.126 -            *-raspberry-netbsd*)
   1.127 -                # Raspberry Pi
   1.128 -                ARCH=netbsd
   1.129 -                RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
   1.130 -                CFLAGS="$CFLAGS $RPI_CFLAGS"
   1.131 -                SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
   1.132 -                EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
   1.133 -                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host -ldl"
   1.134 -
   1.135 -                if test x$enable_video = xyes; then
   1.136 -                    SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
   1.137 -                    $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
   1.138 -                    SUMMARY_video="${SUMMARY_video} raspberry"
   1.139 -                fi
   1.140 -                ;;
   1.141              *-*-netbsd*)        ARCH=netbsd ;;
   1.142              *-*-openbsd*)       ARCH=openbsd ;;
   1.143              *-*-sysv5*)         ARCH=sysv5 ;;
   1.144 @@ -23724,6 +23762,8 @@
   1.145          CheckSNDIO
   1.146          CheckFusionSound
   1.147          CheckLibSampleRate
   1.148 +        # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
   1.149 +        CheckRPI
   1.150          CheckX11
   1.151          CheckDirectFB
   1.152          CheckKMSDRM