acinclude/pkg_config.m4
author Sam Lantinga
Sun, 05 Apr 2020 08:58:47 -0700
changeset 13689 c3055b205671
parent 12639 1e4dd5933351
permissions -rw-r--r--
Fixed bug 5015 - SDL_RenderReadPixels on DirectX 11.1 backend seems to be broken

Konrad

It appears that I cannot use SDL_RenderReadPixels on a bound framebuffer (SDL_Texture set as render target) as it simply results in gibberish data. However, drawing that framebuffer into the default target (window surface) does render it correctly. Other backends (OpenGL, software, Direct3D) do work fine.

It looks to me like D3D11_RenderReadPixels just gets the general backbuffer and not the current render target and its backbuffer.

Here is the patch which actually fetches the current render target and its underlying ID3D11Resource which is ID3D11Texture2D.
slouken@12639
     1
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
slouken@12639
     2
# ----------------------------------
slouken@12639
     3
AC_DEFUN([PKG_PROG_PKG_CONFIG],
slouken@12639
     4
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
slouken@12639
     5
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
slouken@12639
     6
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
slouken@12639
     7
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
slouken@12639
     8
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
slouken@12639
     9
slouken@12639
    10
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
slouken@12639
    11
	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
slouken@12639
    12
fi
slouken@12639
    13
if test -n "$PKG_CONFIG"; then
slouken@12639
    14
	_pkg_min_version=m4_default([$1], [0.9.0])
slouken@12639
    15
	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
slouken@12639
    16
	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
slouken@12639
    17
		AC_MSG_RESULT([yes])
slouken@12639
    18
	else
slouken@12639
    19
		AC_MSG_RESULT([no])
slouken@12639
    20
		PKG_CONFIG=""
slouken@12639
    21
	fi
slouken@12639
    22
fi[]dnl
slouken@12639
    23
])# PKG_PROG_PKG_CONFIG
slouken@12639
    24
slouken@12639
    25
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
slouken@12639
    26
#
slouken@12639
    27
# Check to see whether a particular set of modules exists.  Similar
slouken@12639
    28
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
slouken@12639
    29
#
slouken@12639
    30
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
slouken@12639
    31
# only at the first occurence in configure.ac, so if the first place
slouken@12639
    32
# it's called might be skipped (such as if it is within an "if", you
slouken@12639
    33
# have to call PKG_CHECK_EXISTS manually
slouken@12639
    34
# --------------------------------------------------------------
slouken@12639
    35
AC_DEFUN([PKG_CHECK_EXISTS],
slouken@12639
    36
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
slouken@12639
    37
if test -n "$PKG_CONFIG" && \
slouken@12639
    38
    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
slouken@12639
    39
  m4_default([$2], [:])
slouken@12639
    40
m4_ifvaln([$3], [else
slouken@12639
    41
  $3])dnl
slouken@12639
    42
fi])
slouken@12639
    43
slouken@12639
    44
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
slouken@12639
    45
# ---------------------------------------------
slouken@12639
    46
m4_define([_PKG_CONFIG],
slouken@12639
    47
[if test -n "$$1"; then
slouken@12639
    48
    pkg_cv_[]$1="$$1"
slouken@12639
    49
 elif test -n "$PKG_CONFIG"; then
slouken@12639
    50
    PKG_CHECK_EXISTS([$3],
slouken@12639
    51
                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
slouken@12639
    52
		     [pkg_failed=yes])
slouken@12639
    53
 else
slouken@12639
    54
    pkg_failed=untried
slouken@12639
    55
fi[]dnl
slouken@12639
    56
])# _PKG_CONFIG
slouken@12639
    57
slouken@12639
    58
# _PKG_SHORT_ERRORS_SUPPORTED
slouken@12639
    59
# -----------------------------
slouken@12639
    60
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
slouken@12639
    61
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
slouken@12639
    62
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
slouken@12639
    63
        _pkg_short_errors_supported=yes
slouken@12639
    64
else
slouken@12639
    65
        _pkg_short_errors_supported=no
slouken@12639
    66
fi[]dnl
slouken@12639
    67
])# _PKG_SHORT_ERRORS_SUPPORTED
slouken@12639
    68
slouken@12639
    69
slouken@12639
    70
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
slouken@12639
    71
# [ACTION-IF-NOT-FOUND])
slouken@12639
    72
#
slouken@12639
    73
#
slouken@12639
    74
# Note that if there is a possibility the first call to
slouken@12639
    75
# PKG_CHECK_MODULES might not happen, you should be sure to include an
slouken@12639
    76
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
slouken@12639
    77
#
slouken@12639
    78
#
slouken@12639
    79
# --------------------------------------------------------------
slouken@12639
    80
AC_DEFUN([PKG_CHECK_MODULES],
slouken@12639
    81
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
slouken@12639
    82
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
slouken@12639
    83
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
slouken@12639
    84
slouken@12639
    85
pkg_failed=no
slouken@12639
    86
AC_MSG_CHECKING([for $1])
slouken@12639
    87
slouken@12639
    88
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
slouken@12639
    89
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
slouken@12639
    90
slouken@12639
    91
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
slouken@12639
    92
and $1[]_LIBS to avoid the need to call pkg-config.
slouken@12639
    93
See the pkg-config man page for more details.])
slouken@12639
    94
slouken@12639
    95
if test $pkg_failed = yes; then
slouken@12639
    96
   	AC_MSG_RESULT([no])
slouken@12639
    97
        _PKG_SHORT_ERRORS_SUPPORTED
slouken@12639
    98
        if test $_pkg_short_errors_supported = yes; then
slouken@12639
    99
	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
slouken@12639
   100
        else 
slouken@12639
   101
	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
slouken@12639
   102
        fi
slouken@12639
   103
	# Put the nasty error message in config.log where it belongs
slouken@12639
   104
	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
slouken@12639
   105
slouken@12639
   106
	m4_default([$4], [AC_MSG_ERROR(
slouken@12639
   107
[Package requirements ($2) were not met:
slouken@12639
   108
slouken@12639
   109
$$1_PKG_ERRORS
slouken@12639
   110
slouken@12639
   111
Consider adjusting the PKG_CONFIG_PATH environment variable if you
slouken@12639
   112
installed software in a non-standard prefix.
slouken@12639
   113
slouken@12639
   114
_PKG_TEXT])dnl
slouken@12639
   115
        ])
slouken@12639
   116
elif test $pkg_failed = untried; then
slouken@12639
   117
     	AC_MSG_RESULT([no])
slouken@12639
   118
	m4_default([$4], [AC_MSG_FAILURE(
slouken@12639
   119
[The pkg-config script could not be found or is too old.  Make sure it
slouken@12639
   120
is in your PATH or set the PKG_CONFIG environment variable to the full
slouken@12639
   121
path to pkg-config.
slouken@12639
   122
slouken@12639
   123
_PKG_TEXT
slouken@12639
   124
slouken@12639
   125
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
slouken@12639
   126
        ])
slouken@12639
   127
else
slouken@12639
   128
	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
slouken@12639
   129
	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
slouken@12639
   130
        AC_MSG_RESULT([yes])
slouken@12639
   131
	$3
slouken@12639
   132
fi[]dnl
slouken@12639
   133
])# PKG_CHECK_MODULES