Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- aclocal.m4 | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 12 +++++++++ 2 files changed, 83 insertions(+)
diff --git a/aclocal.m4 b/aclocal.m4 index 07a0359a3f1..611909253c7 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -64,6 +64,15 @@ AC_CHECK_TOOL(READELF,[readelf],true)]) AC_DEFUN([WINE_PATH_PKG_CONFIG], [WINE_CHECK_HOST_TOOL(PKG_CONFIG,[pkg-config])])
+AC_DEFUN([WINE_PATH_MINGW_PKG_CONFIG], +[case "$host_cpu" in + i[[3456789]]86*) + ac_prefix_list="m4_foreach([ac_wine_cpu],[i686,i586,i486,i386],[ac_wine_cpu-w64-mingw32-pkg-config ])" ;; + *) + ac_prefix_list="$host_cpu-w64-mingw32-pkg-config" ;; +esac +AC_CHECK_PROGS(MINGW_PKG_CONFIG,[$ac_prefix_list],false)]) + dnl **** Extract the soname of a library **** dnl dnl Usage: WINE_CHECK_SONAME(library, function, [action-if-found, [action-if-not-found, [other_libraries, [pattern]]]]) @@ -124,6 +133,30 @@ CPPFLAGS=$ac_save_CPPFLAGS AS_VAR_POPDEF([ac_libs])dnl AS_VAR_POPDEF([ac_cflags])])dnl
+dnl **** Get flags from MinGW pkg-config or alternate xxx-config program **** +dnl +dnl Usage: WINE_MINGW_PACKAGE_FLAGS(var,pkg-name,[default-lib,[cflags-alternate,libs-alternate,[checks]]]) +dnl +AC_DEFUN([WINE_MINGW_PACKAGE_FLAGS], +[AC_REQUIRE([WINE_PATH_MINGW_PKG_CONFIG])dnl +AS_VAR_PUSHDEF([ac_cflags],[[$1]_PE_CFLAGS])dnl +AS_VAR_PUSHDEF([ac_libs],[[$1]_PE_LIBS])dnl +AS_VAR_IF([ac_cflags],[], + [AS_VAR_SET_IF([MINGW_PKG_CONFIG], + [ac_cflags=`$MINGW_PKG_CONFIG --cflags [$2] 2>/dev/null`])]) +m4_ifval([$4],[test "$cross_compiling" = yes || ac_cflags=[$]{ac_cflags:-[$4]}]) +AS_VAR_IF([ac_libs],[], + [AS_VAR_SET_IF([MINGW_PKG_CONFIG], + [ac_libs=`$MINGW_PKG_CONFIG --libs [$2] 2>/dev/null`])]) +m4_ifval([$5],[test "$cross_compiling" = yes || ac_libs=[$]{ac_libs:-[$5]}]) +m4_ifval([$3],[ac_libs=[$]{ac_libs:-"$3"}]) +ac_save_CPPFLAGS=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $ac_cflags" +$6 +CPPFLAGS=$ac_save_CPPFLAGS +AS_VAR_POPDEF([ac_libs])dnl +AS_VAR_POPDEF([ac_cflags])])dnl + dnl **** Get flags for an external lib program **** dnl dnl Usage: WINE_EXTLIB_FLAGS(var,pkg-name,default-libs,default-cflags) @@ -189,6 +222,44 @@ ac_exeext=$ac_wine_try_cflags_saved_exeext]) AS_VAR_IF([ac_var],[yes],[m4_default([$2], [EXTRACROSSCFLAGS="$EXTRACROSSCFLAGS $1"])], [$3])dnl AS_VAR_POPDEF([ac_var])])
+dnl **** Check whether the given MinGW header is available **** +dnl +dnl Usage: WINE_CHECK_MINGW_HEADER(header,[action-if-found],[action-if-not-found],[other-includes]) +dnl +AC_DEFUN([WINE_CHECK_MINGW_HEADER], +[AS_VAR_PUSHDEF([ac_var],[ac_cv_mingw_header_$1])dnl +AC_CACHE_CHECK([for MinGW $1], ac_var, +[ac_wine_check_headers_saved_cc=$CC +ac_wine_check_headers_saved_exeext=$ac_exeext +CC="$CROSSCC" +ac_exeext=".exe" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$4 +#include <$1>]])],[AS_VAR_SET([ac_var],[yes])],[AS_VAR_SET([ac_var],[no])]) +CC=$ac_wine_check_headers_saved_cc +ac_exeext=$ac_wine_check_headers_saved_exeext]) +AS_VAR_IF([ac_var],[yes],[$2],[$3])dnl +AS_VAR_POPDEF([ac_var])]) + +dnl **** Check whether the given MinGW library is available **** +dnl +dnl Usage: WINE_CHECK_MINGW_LIB(library,function,[action-if-found],[action-if-not-found],[other-libraries]) +dnl +AC_DEFUN([WINE_CHECK_MINGW_LIB], +[AS_VAR_PUSHDEF([ac_var],[ac_cv_mingw_lib_$1])dnl +AC_CACHE_CHECK([for $2 in MinGW -l$1], ac_var, +[ac_wine_check_headers_saved_cc=$CC +ac_wine_check_headers_saved_exeext=$ac_exeext +ac_wine_check_headers_saved_libs=$LIBS +CC="$CROSSCC" +ac_exeext=".exe" +LIBS="-l$1 $5 $LIBS" +AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],[AS_VAR_SET([ac_var],[yes])],[AS_VAR_SET([ac_var],[no])]) +CC=$ac_wine_check_headers_saved_cc +ac_exeext=$ac_wine_check_headers_saved_exeext +LIBS=$ac_wine_check_headers_saved_libs]) +AS_VAR_IF([ac_var],[yes],[$3],[$4])dnl +AS_VAR_POPDEF([ac_var])]) + dnl **** Check if we can link an empty shared lib (no main) with special CFLAGS **** dnl dnl Usage: WINE_TRY_SHLIB_FLAGS(flags,[action-if-yes,[action-if-no]]) diff --git a/configure.ac b/configure.ac index 163d06fc327..5c32f71e672 100644 --- a/configure.ac +++ b/configure.ac @@ -1033,6 +1033,18 @@ WINE_NOTICE_WITH(mingw,[test "x$CROSSTARGET" = "x"],
dnl **** External libraries ****
+if test "x$with_system_dllpath" != "x" -a "$CROSSCC" != "false" +then + WINE_MINGW_PACKAGE_FLAGS(ZLIB,[zlib],[-lz],,, + [WINE_CHECK_MINGW_HEADER(zlib.h, + [WINE_CHECK_MINGW_LIB(z,inflate,[:],[ZLIB_PE_CFLAGS=""; ZLIB_PE_LIBS=""],[$ZLIB_PE_LIBS])], + [ZLIB_PE_CFLAGS=""; ZLIB_PE_LIBS=""])]) + if test "x$ZLIB_PE_LIBS" = "x" + then + WINE_NOTICE([zlib ${notice_platform}MinGW development files not found; using bundled version.]) + fi +fi + WINE_EXTLIB_FLAGS(FAUDIO, faudio, "faudio mfplat mfreadwrite mfuuid propsys", "-I$(top_srcdir)/libs/faudio/include") WINE_EXTLIB_FLAGS(GSM, gsm, gsm, "-I$(top_srcdir)/libs/gsm/inc") WINE_EXTLIB_FLAGS(JPEG, jpeg, jpeg, "-I$(top_srcdir)/libs/jpeg")
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- configure.ac | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/configure.ac b/configure.ac index 5c32f71e672..f1eef0a28e8 100644 --- a/configure.ac +++ b/configure.ac @@ -1035,6 +1035,15 @@ dnl **** External libraries ****
if test "x$with_system_dllpath" != "x" -a "$CROSSCC" != "false" then + WINE_MINGW_PACKAGE_FLAGS(FAUDIO,[FAudio],[-lFAudio],,, + [WINE_CHECK_MINGW_HEADER(FAudio.h, + [WINE_CHECK_MINGW_LIB(FAudio,FAudio_CommitOperationSet,[:],[FAUDIO_PE_CFLAGS=""; FAUDIO_PE_LIBS=""],[$FAUDIO_PE_LIBS])], + [FAUDIO_PE_CFLAGS=""; FAUDIO_PE_LIBS=""])]) + if test "x$FAUDIO_PE_LIBS" = "x" + then + WINE_NOTICE([FAudio ${notice_platform}MinGW development files not found (or too old); using bundled version.]) + fi + WINE_MINGW_PACKAGE_FLAGS(ZLIB,[zlib],[-lz],,, [WINE_CHECK_MINGW_HEADER(zlib.h, [WINE_CHECK_MINGW_LIB(z,inflate,[:],[ZLIB_PE_CFLAGS=""; ZLIB_PE_LIBS=""],[$ZLIB_PE_LIBS])],
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- configure.ac | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/configure.ac b/configure.ac index f1eef0a28e8..6d357f9a984 100644 --- a/configure.ac +++ b/configure.ac @@ -1044,6 +1044,17 @@ then WINE_NOTICE([FAudio ${notice_platform}MinGW development files not found (or too old); using bundled version.]) fi
+ WINE_MINGW_PACKAGE_FLAGS(JPEG,[libjpeg],,,, + [WINE_CHECK_MINGW_HEADER(jpeglib.h, + [WINE_CHECK_MINGW_LIB(jpeg,jpeg_start_decompress,[:],[JPEG_PE_CFLAGS=""; JPEG_PE_LIBS=""],[$JPEG_PE_LIBS])], + [JPEG_PE_CFLAGS=""; JPEG_PE_LIBS=""], + [#include <stddef.h> + #include <stdio.h>])]) + if test "x$JPEG_PE_LIBS" = "x" + then + WINE_NOTICE([libjpeg ${notice_platform}MinGW development files not found; using bundled version.]) + fi + WINE_MINGW_PACKAGE_FLAGS(ZLIB,[zlib],[-lz],,, [WINE_CHECK_MINGW_HEADER(zlib.h, [WINE_CHECK_MINGW_LIB(z,inflate,[:],[ZLIB_PE_CFLAGS=""; ZLIB_PE_LIBS=""],[$ZLIB_PE_LIBS])],
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- configure.ac | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/configure.ac b/configure.ac index 6d357f9a984..914a178cbf4 100644 --- a/configure.ac +++ b/configure.ac @@ -1055,6 +1055,15 @@ then WINE_NOTICE([libjpeg ${notice_platform}MinGW development files not found; using bundled version.]) fi
+ WINE_MINGW_PACKAGE_FLAGS(LCMS2,[lcms2],[-llcms2],,, + [WINE_CHECK_MINGW_HEADER(lcms2.h, + [WINE_CHECK_MINGW_LIB(lcms2,cmsOpenProfileFromFile,[:],[LCMS2_PE_CFLAGS=""; LCMS2_PE_LIBS=""],[$LCMS2_PE_LIBS])], + [LCMS2_PE_CFLAGS=""; LCMS2_PE_LIBS=""])]) + if test "x$LCMS2_PE_LIBS" = "x" + then + WINE_NOTICE([liblcms2 ${notice_platform}MinGW development files not found; using bundled version.]) + fi + WINE_MINGW_PACKAGE_FLAGS(ZLIB,[zlib],[-lz],,, [WINE_CHECK_MINGW_HEADER(zlib.h, [WINE_CHECK_MINGW_LIB(z,inflate,[:],[ZLIB_PE_CFLAGS=""; ZLIB_PE_LIBS=""],[$ZLIB_PE_LIBS])],
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- configure.ac | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/configure.ac b/configure.ac index 914a178cbf4..4a4810ae471 100644 --- a/configure.ac +++ b/configure.ac @@ -1064,6 +1064,15 @@ then WINE_NOTICE([liblcms2 ${notice_platform}MinGW development files not found; using bundled version.]) fi
+ WINE_MINGW_PACKAGE_FLAGS(MPG123,[libmpg123],[-lmpg123],,, + [WINE_CHECK_MINGW_HEADER(mpg123.h, + [WINE_CHECK_MINGW_LIB(mpg123,mpg123_feed,[:],[MPG123_PE_CFLAGS=""; MPG123_PE_LIBS=""],[$MPG123_PE_LIBS])], + [MPG123_PE_CFLAGS=""; MPG123_PE_LIBS=""])]) + if test "x$MPG123_PE_LIBS" = "x" + then + WINE_NOTICE([libmpg123 ${notice_platform}MinGW development files not found (or too old); using bundled version.]) + fi + WINE_MINGW_PACKAGE_FLAGS(ZLIB,[zlib],[-lz],,, [WINE_CHECK_MINGW_HEADER(zlib.h, [WINE_CHECK_MINGW_LIB(z,inflate,[:],[ZLIB_PE_CFLAGS=""; ZLIB_PE_LIBS=""],[$ZLIB_PE_LIBS])],