configure.in
changeset 11175 cbc6a8a5b701
parent 11138 c936a84f05ba
child 11205 ab9d4689a439
     1.1 --- a/configure.in	Mon Jul 31 13:49:22 2017 -0400
     1.2 +++ b/configure.in	Wed Aug 02 10:22:48 2017 -0700
     1.3 @@ -2084,6 +2084,81 @@
     1.4      fi
     1.5  }
     1.6  
     1.7 +dnl Find KMSDRM
     1.8 +CheckKMSDRM()
     1.9 +{
    1.10 +    AC_ARG_ENABLE(video-kmsdrm,
    1.11 +AC_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [[default=no]]]),
    1.12 +                  , enable_video_kmsdrm=no)
    1.13 +
    1.14 +    if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then
    1.15 +        video_kmsdrm=no
    1.16 +        libdrm_avail=no
    1.17 +        libgbm_avail=no
    1.18 +
    1.19 +        LIBDRM_REQUIRED_VERSION=2.4.46
    1.20 +        LIBGBM_REQUIRED_VERSION=9.0.0
    1.21 +
    1.22 +        AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
    1.23 +        if test x$PKG_CONFIG != xno; then
    1.24 +            if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then
    1.25 +                if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then
    1.26 +                    LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm`
    1.27 +                    LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm`
    1.28 +                    LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm`
    1.29 +                    libdrm_avail=yes
    1.30 +                fi
    1.31 +                if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then
    1.32 +                    LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm`
    1.33 +                    LIBGBM_LIBS=`$PKG_CONFIG --libs gbm`
    1.34 +                    LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm`
    1.35 +                    libgbm_avail=yes
    1.36 +                fi
    1.37 +                if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then
    1.38 +                    video_kmsdrm=yes
    1.39 +                fi
    1.40 + 
    1.41 +                AC_MSG_CHECKING(for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support)
    1.42 +                AC_MSG_RESULT($libdrm_avail)
    1.43 +                AC_MSG_CHECKING(for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support)
    1.44 +                AC_MSG_RESULT($libgbm_avail)
    1.45 +
    1.46 +                if test x$video_kmsdrm = xyes; then
    1.47 +                    AC_ARG_ENABLE(kmsdrm-shared,
    1.48 +AC_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[default=yes]]]),
    1.49 +                              , enable_kmsdrm_shared=yes)
    1.50 +
    1.51 +                    AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ])
    1.52 +                    SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c"
    1.53 +                    EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS"
    1.54 +
    1.55 +                    AC_MSG_CHECKING(for kmsdrm dynamic loading support)
    1.56 +                    kmsdrm_shared=no
    1.57 +                    drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`]
    1.58 +                    gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`]
    1.59 +                    if test x$have_loadso != xyes && \
    1.60 +                       test x$enable_kmsdrm_shared = xyes; then
    1.61 +                        AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading])
    1.62 +                    fi
    1.63 +                    if test x$have_loadso = xyes && \
    1.64 +                       test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then
    1.65 +                        kmsdrm_shared=yes
    1.66 +                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ])
    1.67 +                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ])
    1.68 +                        AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ])
    1.69 +                        SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)"
    1.70 +                    else
    1.71 +                        EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS"
    1.72 +                        SUMMARY_video="${SUMMARY_video} kmsdrm"
    1.73 +                    fi
    1.74 +                    AC_MSG_RESULT($kmsdrm_shared)
    1.75 +                    have_video=yes
    1.76 +                fi
    1.77 +            fi
    1.78 +        fi
    1.79 +    fi
    1.80 +}
    1.81 +
    1.82  dnl rcg04172001 Set up the Null video driver.
    1.83  CheckDummyVideo()
    1.84  {
    1.85 @@ -3148,6 +3223,7 @@
    1.86          CheckLibSampleRate
    1.87          CheckX11
    1.88          CheckDirectFB
    1.89 +        CheckKMSDRM
    1.90          CheckOpenGLX11
    1.91          CheckOpenGLESX11
    1.92          CheckMir