configure: mingw32 targets: test for WIC support

Replace usage of _WIN32 in examples as this does not guarantee the
presence of wincodec.h.
mingw-w64 notably includes wincodec.h, though other releases do not.

Under cygwin the following can be used for a WIC enabled binary:
./configure --target=i686-pc-mingw32 CC=i686-w64-mingw32-gcc.exe

Change-Id: Ica6a714c3356a8eaf88486a1c3f5aa6adde394c0
This commit is contained in:
James Zern
2011-06-06 17:56:50 -07:00
parent e29072a8ce
commit 31f9dc6fdd
4 changed files with 76 additions and 11 deletions

View File

@ -1,4 +1,5 @@
AC_INIT([webpdecode], [0.1])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
AC_PROG_LIBTOOL
AM_PROG_CC_C_O
@ -74,6 +75,49 @@ AC_CHECK_HEADER(jpeglib.h,
AC_SUBST(JPEG_LIBS)
AC_SUBST(JPEG_INCLUDES)
dnl === check for WIC support ===
if test "$target_os" = "mingw32"; then
AC_CHECK_HEADERS([wincodec.h shlwapi.h windows.h])
if test "$ac_cv_header_wincodec_h" = "yes"; then
AC_MSG_CHECKING(for Windows Imaging Component support)
saved_LIBS=$LIBS
LIBS="-lshlwapi -lole32 $LIBS"
# match include structure from [cd]webp.c
wic_headers="
#define INITGUID
#define CINTERFACE
#define COBJMACROS
#define _WIN32_IE 0x500
#include <shlwapi.h>
#include <windows.h>
#include <wincodec.h>
"
# test for functions from each lib and the GUID is created properly
wic_main="
int main(void) {
CLSID_WICImagingFactory;
CoInitialize(NULL);
SHCreateStreamOnFile(NULL, 0, NULL);
return 0;
}
"
AC_LANG_PUSH(C)
AC_LINK_IFELSE(
[AC_LANG_SOURCE([
$wic_headers
$wic_main])],
[wic_support=yes],
[wic_support=no]
)
AC_LANG_POP
test "$wic_support" = "yes" || LIBS=$saved_LIBS
AC_MSG_RESULT(${wic_support-no})
fi
fi
dnl === If --enable-experimental is defined, add the flag WEBP_EXPERIMENTAL_FEATURES
USE_EXPERIMENTAL_CODE=""