Skip to content
Snippets Groups Projects
configure.ac 139 KiB
Newer Older
WINE_NOTICE_WITH(mingw,[test "x$CROSSTARGET" = "x"],
                 [MinGW compiler not found, cross-compiling PE files won't be supported.])
  aarch64*) test "x$CROSSTARGET" != x || AC_MSG_ERROR([PE cross-compilation is required for ARM64, please install clang/llvm-dlltool/lld, or llvm-mingw.]) ;;
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(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(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(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(PNG,[libpng],,
        [WINE_CHECK_MINGW_HEADER(png.h,
            [WINE_CHECK_MINGW_LIB(png,png_create_read_struct,[:],[PNG_PE_CFLAGS=""; PNG_PE_LIBS=""],[$PNG_PE_LIBS])],
            [PNG_PE_CFLAGS=""; PNG_PE_LIBS=""])])
    if test "x$PNG_PE_LIBS" = "x"
    then
        WINE_NOTICE([libpng ${notice_platform}MinGW development files not found; using bundled version.])
    fi

    WINE_MINGW_PACKAGE_FLAGS(TIFF,[libtiff-4],,
        [WINE_CHECK_MINGW_HEADER(tiffio.h,
            [WINE_CHECK_MINGW_LIB(tiff,TIFFClientOpen,[:],[TIFF_PE_CFLAGS=""; TIFF_PE_LIBS=""],[$TIFF_PE_LIBS])],
            [TIFF_PE_CFLAGS=""; TIFF_PE_LIBS=""])])
    if test "x$TIFF_PE_LIBS" = "x"
    then
        WINE_NOTICE([libtiff ${notice_platform}MinGW development files not found; using bundled version.])
    fi

    WINE_MINGW_PACKAGE_FLAGS(XML2,[libxml-2.0],[-lxml2],
        [WINE_CHECK_MINGW_HEADER(libxml/parser.h)
        WINE_CHECK_MINGW_HEADER(libxml/xmlsave.h)
        WINE_CHECK_MINGW_HEADER(libxml/SAX2.h)
        if test "$ac_cv_mingw_header_libxml_parser_h" = "yes" -a "$ac_cv_mingw_header_libxml_xmlsave_h" = "yes" -a "$ac_cv_mingw_header_libxml_SAX2_h" = "yes"
        then
            WINE_CHECK_MINGW_LIB(xml2,xmlFirstElementChild,[:],[XML2_PE_CFLAGS=""; XML2_PE_LIBS=""],[$XML2_PE_LIBS])
        else
            XML2_PE_CFLAGS=""
            XML2_PE_LIBS=""
        fi])
    if test "x$XML2_PE_LIBS" = "x"
    then
        WINE_NOTICE([libxml2 ${notice_platform}MinGW development files not found (or too old); using bundled version.])
    fi

    WINE_MINGW_PACKAGE_FLAGS(XSLT,[libxslt],[-lxslt],
        [WINE_CHECK_MINGW_HEADER(libxslt/pattern.h)
        WINE_CHECK_MINGW_HEADER(libxslt/transform.h)
        if test "$ac_cv_mingw_header_libxslt_pattern_h" = "yes" -a "$ac_cv_mingw_header_libxslt_transform_h" = "yes"
        then
            WINE_CHECK_MINGW_LIB(xslt,xsltCompilePattern,[:],[XSLT_PE_CFLAGS=""; XSLT_PE_LIBS=""],[$XSLT_PE_LIBS])
        else
            XSLT_PE_CFLAGS=""
            XSLT_PE_LIBS=""
        fi])
    if test "x$XSLT_PE_LIBS" = "x"
    then
        WINE_NOTICE([libxslt ${notice_platform}MinGW development files not found; using bundled version.])
    fi

    WINE_MINGW_PACKAGE_FLAGS(VKD3D,[libvkd3d libvkd3d-shader],[-lvkd3d -lvkd3d-shader],
        [WINE_CHECK_MINGW_HEADER(vkd3d.h)
        WINE_CHECK_MINGW_HEADER(vkd3d_shader.h)
        if test "$ac_cv_mingw_header_vkd3d_h" = "yes" -a "$ac_cv_mingw_header_vkd3d_shader_h" = "yes"
        then
            WINE_CHECK_MINGW_LIB(vkd3d,vkd3d_serialize_versioned_root_signature,[:],[:],[$VKD3D_PE_LIBS])
            WINE_CHECK_MINGW_LIB(vkd3d-shader,vkd3d_shader_compile,[:],[:],[$VKD3D_PE_LIBS])
            if test "$ac_cv_mingw_lib_vkd3d" = "no" -o "$ac_cv_mingw_lib_vkd3d_shader" = "no"
            then
                VKD3D_PE_CFLAGS=""
                VKD3D_PE_LIBS=""
            fi
        else
            VKD3D_PE_CFLAGS=""
            VKD3D_PE_LIBS=""
        fi])
    if test "x$VKD3D_PE_LIBS" = "x"
    then
        WINE_NOTICE([libvkd3d ${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])],
            [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")
WINE_EXTLIB_FLAGS(JXR, jxr, jxr, "-I\$(top_srcdir)/libs/jxr/jxrgluelib -I\$(top_srcdir)/libs/jxr/image/sys")
WINE_EXTLIB_FLAGS(LCMS2, lcms2, lcms2, "-I\$(top_srcdir)/libs/lcms2/include")
WINE_EXTLIB_FLAGS(MPG123, mpg123, mpg123, "-I\$(top_srcdir)/libs/mpg123/src/libmpg123")
WINE_EXTLIB_FLAGS(PNG, png, "png \$(ZLIB_PE_LIBS)", "-I\$(top_srcdir)/libs/png")
WINE_EXTLIB_FLAGS(TIFF, tiff, "tiff \$(ZLIB_PE_LIBS)", "-I\$(top_srcdir)/libs/tiff/libtiff")
WINE_EXTLIB_FLAGS(VKD3D, vkd3d, vkd3d, "-I\$(top_srcdir)/libs/vkd3d/include")
WINE_EXTLIB_FLAGS(XML2, xml2, xml2, "-I\$(top_srcdir)/libs/xml2/include -DLIBXML_STATIC")
WINE_EXTLIB_FLAGS(XSLT, xslt, xslt, "-I\$(top_srcdir)/libs/xslt/libxslt -I\$(top_srcdir)/libs/xslt -DLIBXSLT_STATIC")
WINE_EXTLIB_FLAGS(ZLIB, zlib, z, "-I\$(top_srcdir)/libs/zlib -DFAR= -DZ_SOLO")

dnl **** Check for pthread ****

if test "$ac_cv_header_pthread_h" = "yes"
then
    AC_CHECK_FUNC(pthread_create,,[AC_CHECK_LIB(pthread,pthread_create,[AC_SUBST(PTHREAD_LIBS,"-lpthread")])])
WINE_ERROR_WITH(pthread,[test "x$ac_cv_func_pthread_create" != xyes -a "x$PTHREAD_LIBS" = x],
[pthread ${notice_platform}development files not found.
Wine cannot support threads without libpthread.])

    ac_save_CPPFLAGS="$CPPFLAGS"
    CPPFLAGS="$CPPFLAGS $X_CFLAGS"
    WINE_CHECK_SONAME(X11,XCreateWindow,,,[$X_LIBS $X_EXTRA_LIBS])
    WINE_CHECK_SONAME(Xext,XextCreateExtension,[X_LIBS="$X_LIBS -lXext"],,[$X_LIBS -lX11 $X_EXTRA_LIBS])
    X_LIBS="$X_LIBS -lX11"
    dnl *** All of the following tests require X11/Xlib.h
    AC_CHECK_HEADERS([X11/Xlib.h \
                      X11/XKBlib.h \
                      X11/Xutil.h \
                      X11/Xcursor/Xcursor.h \
                      X11/extensions/shape.h \
                      X11/extensions/XInput.h \
                      X11/extensions/XInput2.h \
                      X11/extensions/Xcomposite.h \
                      X11/extensions/Xfixes.h \
                      X11/extensions/Xinerama.h \
                      X11/extensions/Xrandr.h \
                      X11/extensions/Xrender.h \
                      X11/extensions/xf86vmode.h \
                      X11/extensions/xf86vmproto.h],,,
[#ifdef HAVE_X11_XLIB_H
# include <X11/Xlib.h>
#endif
#ifdef HAVE_X11_XUTIL_H
# include <X11/Xutil.h>
#endif])
        dnl *** Check for X keyboard extension
        if test "$ac_cv_header_X11_XKBlib_h" = "yes"
        then
              AC_CHECK_LIB(X11, XkbQueryExtension,
              AC_DEFINE(HAVE_XKB, 1, [Define if you have the XKB extension]),,[$X_LIBS $X_EXTRA_LIBS])
        dnl *** Check for X cursor
        if test "$ac_cv_header_X11_Xcursor_Xcursor_h" = "yes"
        then
            WINE_CHECK_SONAME(Xcursor,XcursorImageLoadCursor,,,[$X_LIBS $X_EXTRA_LIBS])
        WINE_NOTICE_WITH(xcursor,[test "x$ac_cv_lib_soname_Xcursor" = "x"],
                         [libxcursor ${notice_platform}development files not found, the Xcursor extension won't be supported.])
        dnl *** Check for X input extension
        if test "$ac_cv_header_X11_extensions_XInput_h" = "yes"
        then
            WINE_CHECK_SONAME(Xi,XOpenDevice,,,[$X_LIBS $X_EXTRA_LIBS])
        WINE_NOTICE_WITH(xinput,[test "x$ac_cv_lib_soname_Xi" = "x"],
                         [libxi ${notice_platform}development files not found, the Xinput extension won't be supported.])
        dnl *** Check for X input 2 extension
        if test "x$ac_cv_lib_soname_Xi" != x
        then
            WINE_NOTICE_WITH(xinput2,[test "$ac_cv_header_X11_extensions_XInput2_h" != "yes"],
                             [XInput2 headers not found, the XInput 2 extension won't be supported.])
        fi

        dnl *** Check for X Shm extension
        if test "$ac_cv_header_X11_extensions_XShm_h" = "yes"
        then
              AC_CHECK_LIB(Xext, XShmQueryExtension,
              AC_DEFINE(HAVE_LIBXXSHM, 1, [Define if you have the X Shm extension]),,[$X_LIBS $X_EXTRA_LIBS])
        fi
        WINE_NOTICE_WITH(xshm,[test "$ac_cv_lib_Xext_XShmQueryExtension" != "yes"],
                         [XShm ${notice_platform}development files not found, X Shared Memory won't be supported.])

        dnl *** Check for X shape extension
        if test "$ac_cv_header_X11_extensions_shape_h" = "yes"
        then
              AC_CHECK_LIB(Xext,XShapeQueryExtension,
	      AC_DEFINE(HAVE_LIBXSHAPE, 1, [Define if you have the X Shape extension]),,[$X_LIBS $X_EXTRA_LIBS])
        WINE_NOTICE_WITH(xshape,[test "$ac_cv_lib_Xext_XShapeQueryExtension" != "yes"],
                         [XShape ${notice_platform}development files not found, XShape won't be supported.])
        dnl *** Check for XFree86 VMODE extension
        if test "$ac_cv_header_X11_extensions_xf86vmode_h" = "yes" -o "$ac_cv_header_X11_extensions_xf86vmproto_h" = "yes"
            WINE_CHECK_SONAME(Xxf86vm,XF86VidModeQueryExtension,,,[$X_LIBS $X_EXTRA_LIBS])
        WINE_NOTICE_WITH(xxf86vm,[test "x$ac_cv_lib_soname_Xxf86vm" = "x"],
                         [libXxf86vm ${notice_platform}development files not found, XFree86 Vidmode won't be supported.])
        dnl *** Check for Transform functions in Xrender
        if test "$ac_cv_header_X11_extensions_Xrender_h" = "yes" -a "x$ac_cv_lib_soname_X11" != "x"
            WINE_CHECK_SONAME(Xrender,XRenderQueryExtension,
              [AC_CHECK_LIB(Xrender,XRenderSetPictureTransform,
                [AC_DEFINE(HAVE_XRENDERSETPICTURETRANSFORM, 1,
                 [Define if Xrender has the XRenderSetPictureTransform function])],,[$X_LIBS $X_EXTRA_LIBS])
               AC_CHECK_LIB(Xrender,XRenderCreateLinearGradient,
                [AC_DEFINE(HAVE_XRENDERCREATELINEARGRADIENT, 1,
                 [Define if Xrender has the XRenderCreateLinearGradient function])],,[$X_LIBS $X_EXTRA_LIBS])],,[$X_LIBS $X_EXTRA_LIBS])
        WINE_WARNING_WITH(xrender,[test "x$ac_cv_lib_soname_Xrender" = "x"],
                         [libxrender ${notice_platform}development files not found, XRender won't be supported.])

        dnl *** Check for X RandR extension
        if test "$ac_cv_header_X11_extensions_Xrandr_h" = "yes" -a "x$ac_cv_lib_soname_Xrender" != "x"
        then
                AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>]], [[static typeof(XRRSetScreenConfigAndRate) * func; if (func) return 0;]])],
                  [WINE_CHECK_SONAME(Xrandr,XRRQueryExtension,
                    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>]], [[static typeof(XRRGetProviderResources) *f; if (f) return 0;]])],
                      [AC_DEFINE(HAVE_XRRGETPROVIDERRESOURCES, 1,
                        [Define if Xrandr has the XRRGetProviderResources function])],
                      [WINE_NOTICE([libxrandr ${notice_platform}development files too old, XRandR display device handler won't be supported.])])],,[$X_LIBS $X_EXTRA_LIBS])])
        WINE_NOTICE_WITH(xrandr,[test "x$ac_cv_lib_soname_Xrandr" = "x"],
                         [libxrandr ${notice_platform}development files not found, XRandr won't be supported.])
        dnl *** Check for Xfixes extension
        if test "$ac_cv_header_X11_extensions_Xfixes_h" = "yes"
        then
                AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>
#include <X11/extensions/Xfixes.h>]], [[static typeof(XFixesQueryVersion) * func; if (func) return 0;]])],
                  [WINE_CHECK_SONAME(Xfixes,XFixesQueryVersion,,,[$X_LIBS $X_EXTRA_LIBS])])
        fi
        WINE_NOTICE_WITH(xfixes,[test "x$ac_cv_lib_soname_Xfixes" = "x"],
                         [libxfixes ${notice_platform}development files not found, Xfixes won't be supported.])

        dnl *** Check for Xinerama extension
        if test "$ac_cv_header_X11_extensions_Xinerama_h" = "yes"
        then
                AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>
#include <X11/extensions/Xinerama.h>]], [[static typeof(XineramaQueryScreens) * func; if (func) return 0;]])],
                  [WINE_CHECK_SONAME(Xinerama,XineramaQueryScreens,,,[$X_LIBS $X_EXTRA_LIBS])])
        WINE_NOTICE_WITH(xinerama,[test "x$ac_cv_lib_soname_Xinerama" = "x"],
                         [libxinerama ${notice_platform}development files not found, multi-monitor setups won't be supported.])
        dnl *** Check for X Composite extension
        if test "$ac_cv_header_X11_extensions_Xcomposite_h" = "yes"
        then
            WINE_CHECK_SONAME(Xcomposite,XCompositeRedirectWindow,,,[$X_LIBS $X_EXTRA_LIBS])
        WINE_NOTICE_WITH(xcomposite,[test "x$ac_cv_lib_soname_Xcomposite" = "x"],
                         [libxcomposite ${notice_platform}development files not found, Xcomposite won't be supported.])
        dnl *** Check for XICCallback struct
        AC_CHECK_MEMBERS([XICCallback.callback, XEvent.xcookie],,,
[#ifdef HAVE_X11_XLIB_H
#include <X11/Xlib.h>
#endif])

Lionel Ulmer's avatar
Lionel Ulmer committed
    dnl Check for the presence of OpenGL
    if test "x$with_opengl" != "xno"
	WINE_CHECK_SONAME(GL,glXCreateContext,
		     [OPENGL_LIBS="-lGL"],
                     [WINE_CHECK_SONAME(GL,glXCreateContext,
			    [OPENGL_LIBS="-Xlinker -dylib_file -Xlinker /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib -lGL"],
			    [if test -f /usr/X11R6/lib/libGL.a
                            then
	                        opengl_msg="/usr/X11R6/lib/libGL.a is present on your system.
This probably prevents linking to OpenGL. Try deleting the file and restarting configure."
                            else
                                opengl_msg="No OpenGL library found on this system."
                            fi],
			    $X_LIBS -lm $X_EXTRA_LIBS -dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib)],
		     $X_LIBS -lm $X_EXTRA_LIBS)
            WINE_CHECK_SONAME(OSMesa,OSMesaGetProcAddress,,,[$X_LIBS -lm $X_EXTRA_LIBS])
            WINE_NOTICE_WITH(osmesa,[test "x$ac_cv_lib_soname_OSMesa" = "x"],
                             [libOSMesa ${notice_platform}development files not found (or too old), OpenGL rendering in bitmaps won't be supported.])
        fi
    WINE_WARNING_WITH(opengl,[test -n "$opengl_msg"],[$opengl_msg
OpenGL and Direct3D won't be supported.])
    CPPFLAGS="$ac_save_CPPFLAGS"
if test "$enable_wineandroid_drv$enable_winemac_drv" = "nono"
then
    WINE_ERROR_WITH(x,[test "x$X_LIBS" = "x"],
[X ${notice_platform}development files not found. Wine will be built
without X support, which probably isn't what you want. You will need
to install ${notice_platform}development packages of Xlib at the very least.],
                    [enable_winex11_drv])
else
    WINE_NOTICE_WITH(x,[test "x$X_LIBS" = "x"],
                     [X ${notice_platform}development files not found, the X11 driver won't be supported.],
                     [enable_winex11_drv])
fi
dnl **** Check for OpenCL ****
if test "$ac_cv_header_CL_cl_h" = "yes"
    AC_CHECK_LIB(OpenCL,clGetPlatformInfo,[AC_SUBST(OPENCL_LIBS,["-lOpenCL"])])
fi
WINE_NOTICE_WITH(opencl,[test "x$ac_cv_lib_OpenCL_clGetPlatformInfo" != xyes],
                 [OpenCL ${notice_platform}development files not found, OpenCL won't be supported.],
                 [enable_opencl])
dnl **** Check for libpcap ****
if test "$ac_cv_header_pcap_pcap_h" = "yes"
then
    AC_CHECK_LIB(pcap,pcap_create,[AC_SUBST(PCAP_LIBS,["-lpcap"])])
fi
WINE_NOTICE_WITH(pcap,[test "x$ac_cv_lib_pcap_pcap_create" != xyes],
                 [pcap ${notice_platform}development files not found, wpcap won't be supported.],
                 [enable_wpcap])
dnl **** Check for inotify ****
if test "x$with_inotify" != "xno"
then
    WINE_PACKAGE_FLAGS(INOTIFY,[libinotify],,,,
        [AC_CHECK_HEADERS([sys/inotify.h])
         AC_CHECK_LIB(inotify,inotify_add_watch,[:],[INOTIFY_LIBS=""],[$INOTIFY_LIBS])])
fi
WINE_NOTICE_WITH(inotify,[test "$ac_cv_header_sys_inotify_h" != "yes"],
                 [libinotify ${notice_platform}development files not found (or too old), filesystem change notifications won't be supported.])

dnl **** Check for libdbus ****
if test "x$with_dbus" != "xno"
then
    WINE_PACKAGE_FLAGS(DBUS,[dbus-1],,,,
        [AC_CHECK_HEADER([dbus/dbus.h],
            [WINE_CHECK_SONAME(dbus-1, dbus_connection_close,,[DBUS_CFLAGS=""],[$DBUS_LIBS])],
            [DBUS_CFLAGS=""])])
fi
WINE_NOTICE_WITH(dbus,[test "x$ac_cv_lib_soname_dbus_1" = "x" -a \
                            "x$ac_cv_header_DiskArbitration_DiskArbitration_h" != "xyes"],
                 [libdbus ${notice_platform}development files not found, no dynamic device support.])

dnl **** Check for libgnutls ****
    WINE_PACKAGE_FLAGS(GNUTLS,[gnutls],[-lgnutls],,,
        [AC_CHECK_HEADER(gnutls/gnutls.h,
            [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>]], [[static typeof(gnutls_mac_get_key_size) *func; if (func) return 0;]])],
                [WINE_CHECK_SONAME(gnutls,gnutls_global_init,,[GNUTLS_CFLAGS=""],[$GNUTLS_LIBS],[[libgnutls\\(-deb0\\)\\{0,1\\}]])
                 WINE_CHECK_LIB_FUNCS(gnutls_cipher_init,[$GNUTLS_LIBS],,
                                      [WINE_NOTICE([libgnutls ${notice_platform}development files too old, bcrypt encryption won't be supported.])])])],
WINE_WARNING_WITH(gnutls,[test "x$ac_cv_lib_soname_gnutls" = "x"],
                 [libgnutls ${notice_platform}development files not found, no schannel support.])
dnl **** Check for SANE ****
    WINE_PACKAGE_FLAGS(SANE,[sane-backends],,[`${SANE_CONFIG:-sane-config} --cflags 2>/dev/null`],[`${SANE_CONFIG:-sane-config} --ldflags 2>/dev/null`],
            [AC_CHECK_LIB(sane,sane_init,[:],,[$SANE_LIBS])])])
WINE_NOTICE_WITH(sane,[test "$ac_cv_lib_sane_sane_init" != "yes"],
                 [libsane ${notice_platform}development files not found, scanners won't be supported.],
                 [enable_sane_ds])
dnl **** Check for libusb ****
if test "x$with_usb" != "xno"
then
    WINE_PACKAGE_FLAGS(USB,[libusb-1.0],[-lusb-1.0],,,
        [AC_CHECK_HEADER([libusb.h],
            [AC_CHECK_LIB(usb-1.0,libusb_interrupt_event_handler,[:],[USB_LIBS=""],[$USB_LIBS])],
            [USB_LIBS=""])])
fi
WINE_NOTICE_WITH(usb,[test "$ac_cv_lib_usb_1_0_libusb_interrupt_event_handler" != "yes"],
                 [libusb-1.0 ${notice_platform}development files not found (or too old), USB devices won't be supported.],
                 [enable_wineusb_sys])

Zebediah Figura's avatar
Zebediah Figura committed
dnl **** Check for libv4l2 ****
if test "x$with_v4l2" != "xno"
Zebediah Figura's avatar
Zebediah Figura committed
    WINE_CHECK_SONAME(v4l2,v4l2_open)
Zebediah Figura's avatar
Zebediah Figura committed
WINE_NOTICE_WITH(v4l2,[test "x$ac_cv_lib_soname_v4l2" = "x"],
                 [libv4l2 ${notice_platform}development files not found.])
    WINE_PACKAGE_FLAGS(GPHOTO2,[libgphoto2],[-lgphoto2],
                       [`${GPHOTO2_CONFIG:-gphoto2-config} --cflags 2>/dev/null`],[`${GPHOTO2_CONFIG:-gphoto2-config} --libs 2>/dev/null`],
                        [AC_CHECK_LIB(gphoto2,gp_camera_new,[:],,[$GPHOTO2_LIBS])])])
    WINE_PACKAGE_FLAGS(GPHOTO2_PORT,[libgphoto2_port],[-lgphoto2_port],
                       [`${GPHOTO2_PORT_CONFIG:-gphoto2-port-config} --cflags 2>/dev/null`],
                       [`${GPHOTO2_PORT_CONFIG:-gphoto2-port-config} --libs 2>/dev/null`],
        [AC_CHECK_HEADER(gphoto2-port.h,
                        [AC_CHECK_LIB(gphoto2_port,gp_port_info_list_new,
                                      [AC_DEFINE(HAVE_GPHOTO2_PORT, 1, [Define if we have the libgphoto2_port development environment])],
                                      [GPHOTO2_PORT_LIBS=""; GPHOTO2_PORT_CFLAGS=""],
                                      [$GPHOTO2_PORT_LIBS])],
                        [GPHOTO2_PORT_LIBS=""; GPHOTO2_PORT_CFLAGS=""])])
WINE_NOTICE_WITH(gphoto,[test "$ac_cv_lib_gphoto2_gp_camera_new" != "yes"],
                 [libgphoto2 ${notice_platform}development files not found, digital cameras won't be supported.],
                 [enable_gphoto2_ds])
WINE_NOTICE_WITH(gphoto,[test "$ac_cv_lib_gphoto2_port_gp_port_info_list_new" != "yes"],
                 [libgphoto2_port ${notice_platform}development files not found, digital cameras won't be auto-detected.])
dnl **** Check for resolver library ***
if test "$ac_cv_header_resolv_h" = "yes"
then
    AC_CACHE_CHECK([for resolver library], ac_cv_have_resolv,
      [ac_save_LIBS="$LIBS"
       for lib in '' -lresolv
       do
         LIBS="$lib $ac_save_LIBS"
         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include <resolv.h>]],[[if (!(_res.options & RES_INIT)) res_init(); res_query("foo",ns_c_in,0,0,0); ns_initparse(0,0,0)]])],
           [ac_cv_have_resolv=${lib:-"none required"}],[ac_cv_have_resolv="not found"])
         test "x$ac_cv_have_resolv" = "xnot found" || break
       done
       LIBS="$ac_save_LIBS"])

    case "$ac_cv_have_resolv" in
      "not found") ;;
      "none required")
        AC_DEFINE(HAVE_RESOLV, 1, [Define if you have the resolver library and header]) ;;
      *)
        AC_DEFINE(HAVE_RESOLV, 1)
        AC_SUBST(RESOLV_LIBS,$ac_cv_have_resolv) ;;
    esac

    if test "x$ac_cv_have_resolv" != "xnot found"
    then
        AC_CACHE_CHECK([for res_getservers], ac_cv_have_res_getservers,
                       [ac_save_LIBS="$LIBS"
                        LIBS="$RESOLV_LIBS $LIBS"
                        AC_LINK_IFELSE([AC_LANG_PROGRAM(
        [[#include <resolv.h>]],[[res_getservers(NULL, NULL, 0);]])],[ac_cv_have_res_getservers=yes],[ac_cv_have_res_getservers=no])
	                 LIBS="$ac_save_LIBS"])
        if test "$ac_cv_have_res_getservers" = "yes"
        then
          AC_DEFINE(HAVE_RES_GETSERVERS, 1, [Define to 1 if you have the `res_getservers' function.])
        fi
    fi
dnl **** Check for FreeType 2 ****
    WINE_PACKAGE_FLAGS(FREETYPE,[freetype2],[-lfreetype],
                       [`(${FREETYPE_CONFIG:-freetype-config} --cflags || ${FREETYPE2_CONFIG:-freetype2-config} --cflags) 2>/dev/null`],
                       [`(${FREETYPE_CONFIG:-freetype-config} --libs || ${FREETYPE2_CONFIG:-freetype2-config} --libs) 2>/dev/null`],
        [AC_CHECK_HEADERS([ft2build.h])
        if test "$ac_cv_header_ft2build_h" = "yes"
            WINE_CHECK_SONAME(freetype,FT_Init_FreeType,
                [AC_DEFINE(HAVE_FREETYPE, 1, [Define if FreeType 2 is installed])
                 AC_CHECK_TYPES(FT_TrueTypeEngineType,,,[#include <ft2build.h>
#include FT_MODULE_H])],
                [FREETYPE_LIBS=""],[$FREETYPE_LIBS])
WINE_ERROR_WITH(freetype,[test "x$ac_cv_lib_soname_freetype" = x],
                [FreeType ${notice_platform}development files not found. Fonts will not be built.],
                [enable_fonts])
dnl **** Check for pthread functions ****
        pthread_getthreadid_np,
dnl **** Check for gettextpo ****
if test "x$enable_tools" != xno -a "x$with_gettextpo" = xyes
then
    if test "$ac_cv_header_gettext_po_h" = "yes"
    then
        AC_CHECK_LIB(gettextpo,po_message_msgctxt,
                     [AC_DEFINE(HAVE_LIBGETTEXTPO,1,[Define to 1 if you have the `gettextpo' library (-lgettextpo).])
    WINE_NOTICE_WITH(gettextpo,[test "x$GETTEXTPO_LIBS" = "x"],
      [GetText ${notice_platform}development files not found (or too old), po files can't be rebuilt.])
    WINE_NOTICE_WITH(gettextpo,[test "$srcdir" != .],
      [Rebuilding po files is not supported for out of tree builds.])
dnl **** Check for PulseAudio ****
if test "x$with_pulse" != "xno";
then
    WINE_PACKAGE_FLAGS(PULSE,[libpulse],,,,
        [AC_CHECK_HEADERS(pulse/pulseaudio.h,
            [AC_CHECK_LIB(pulse, pa_stream_is_corked,[:],[PULSE_LIBS=""],[$PULSE_LIBS])],
            [PULSE_LIBS=""])])
WINE_NOTICE_WITH(pulse, [test -z "$PULSE_LIBS"],
        [libpulse ${notice_platform}development files not found or too old, Pulse won't be supported.],
        [enable_winepulse_drv])
dnl **** Check for gstreamer ****
if test "x$with_gstreamer" != "xno"
then
    WINE_PACKAGE_FLAGS(GSTREAMER,[gstreamer-1.0 gstreamer-video-1.0 gstreamer-audio-1.0],,,,
            [AC_MSG_CHECKING([whether gint64 defined by gst/gst.h is indeed 64-bit])
              AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gst/gst.h>]],
                                                 [[static int a[sizeof(gint64) > 4 ? 1 : -1]; if (a[0]) return 0;]])],
                [AC_MSG_RESULT([yes])
                 AC_CHECK_LIB(gstreamer-1.0,gst_pad_new,[:],,[$GSTREAMER_LIBS])],
                [AC_MSG_RESULT([no])
                 ac_glib2_broken=yes
                 WINE_NOTICE([glib-2.0 pkgconfig configuration is for the wrong architecture, winegstreamer won't be built.])])])])
WINE_NOTICE_WITH(gstreamer,[test "x$ac_glib2_broken" != xyes -a "x$ac_cv_lib_gstreamer_1_0_gst_pad_new" != xyes],
                 [gstreamer-1.0 base plugins ${notice_platform}development files not found, GStreamer won't be supported.],
                 [enable_winegstreamer])
dnl **** Check for ALSA 1.x ****
if test "x$with_alsa" != "xno"
    AC_CHECK_LIB(asound,snd_pcm_hw_params_get_access_mask,
        [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <alsa/asoundlib.h>]], [[snd_pcm_hw_params_get_access_mask(NULL, NULL)]])],
test -n "$ALSA_LIBS" || enable_winealsa_drv=${enable_winealsa_drv:-no}
dnl **** Check for OSSv4 ****
if test "x$with_oss" != xno
    ac_save_CPPFLAGS="$CPPFLAGS"
    if test -f /etc/oss.conf
    then
        . /etc/oss.conf
    fi
    ac_oss_incl="-I${OSSLIBDIR:-/usr/lib/oss}/include"
    CPPFLAGS="$CPPFLAGS $ac_oss_incl"
    AC_CHECK_HEADER([sys/soundcard.h],
        [AC_CHECK_MEMBERS([oss_sysinfo.numaudioengines],
            [AC_SUBST(OSS4_CFLAGS,"$ac_oss_incl")
             AC_CHECK_LIB(ossaudio,_oss_ioctl,
                 [AC_SUBST(OSS4_LIBS,"-lossaudio")])],,
            [#include <sys/soundcard.h>])])
    CPPFLAGS="$ac_save_CPPFLAGS"
WINE_NOTICE_WITH(oss,[test "x$ac_cv_member_oss_sysinfo_numaudioengines" != xyes],
                 [OSS sound system found but too old (OSSv4 needed), OSS won't be supported.],
                 [enable_wineoss_drv])
dnl **** Check for libudev ****
if test "x$with_udev" != "xno"
then
    WINE_PACKAGE_FLAGS(UDEV,[libudev],[-ludev],,,
        [AC_CHECK_HEADERS(libudev.h,
            [AC_CHECK_LIB(udev,udev_new,
                AC_DEFINE(HAVE_UDEV,1,[Define to 1 if you have the `udev' library (-ludev).]),
                [UDEV_LIBS=""],[$UDEV_LIBS])],
            [UDEV_LIBS=""])])
fi
WINE_NOTICE_WITH(udev,[test "x$UDEV_LIBS" = "x"],
                 [libudev ${notice_platform}development files not found, plug and play won't be supported.])

dnl **** Check for libunwind ****
if test "x$with_unwind" != xno
then
    WINE_PACKAGE_FLAGS(UNWIND,[libunwind],[-lunwind],,,
       [AC_CACHE_CHECK([for unw_step],wine_cv_have_unw_step,
           [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define UNW_LOCAL_ONLY
#include <libunwind.h>]],
                [[unw_cursor_t cursor; unw_step( &cursor );]])],
                [wine_cv_have_unw_step="yes"],[wine_cv_have_unw_step="no"])])
        if test "$wine_cv_have_unw_step" = no -a -n "$UNWIND_LIBS"
            dnl Force static libgcc, libunwind breaks libgcc_s unwinding
            UNWIND_LIBS="-static-libgcc $UNWIND_LIBS"
            AC_CACHE_CHECK([for unw_step in libunwind],wine_cv_have_libunwind_unw_step,
               [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define UNW_LOCAL_ONLY
#include <libunwind.h>]],
                    [[unw_cursor_t cursor; unw_step( &cursor );]])],
                    [wine_cv_have_libunwind_unw_step="yes"],
                    [wine_cv_have_libunwind_unw_step="no"])])
        test "$wine_cv_have_libunwind_unw_step" = yes || UNWIND_LIBS=""
        if test "x$wine_cv_have_unw_step$wine_cv_have_libunwind_unw_step" != xnono
        then
            AC_DEFINE(HAVE_LIBUNWIND,1,[Define to 1 if you have the `unwind' library (-lunwind).])
        fi])
fi
case $host in
  aarch64*|*-darwin*)
    WINE_NOTICE_WITH(unwind,[test "x$wine_cv_have_unw_step$wine_cv_have_libunwind_unw_step" = xnono],
                     [libunwind ${notice_platform}development files not found, stack unwinding won't work.]) ;;
esac

dnl **** Check for libSDL2 ****
if test "x$with_sdl" != "xno"
then
    WINE_PACKAGE_FLAGS(SDL2,[sdl2],[-lSDL2],,,
        [AC_CHECK_HEADERS([SDL.h],
            [WINE_CHECK_SONAME(SDL2,SDL_Init,,,[$SDL2_LIBS],[[libSDL2-2.0*]])])])
WINE_NOTICE_WITH(sdl,[test "x$ac_cv_lib_soname_SDL2" = "x"],
                 [libSDL2 ${notice_platform}development files not found, SDL2 won't be supported.])

dnl **** Check for capi4linux ****
if test "x$with_capi" != "xno"
    WINE_PACKAGE_FLAGS(CAPI20,[capi20],,,,
     dnl Check for broken kernel header that doesn't define __user
    [AC_CHECK_HEADERS([capi20.h linux/capi.h],,,[#define __user])
    if test "$ac_cv_header_capi20_h" = "yes" -a "$ac_cv_header_linux_capi_h" = "yes"
    then
        AC_CHECK_LIB(capi20,capi20_register,[:],[CAPI20_LIBS=""],[$CAPI20_LIBS])
WINE_NOTICE_WITH(capi,[test "x$ac_cv_lib_capi20_capi20_register" != xyes],
                 [libcapi20 ${notice_platform}development files not found, ISDN won't be supported.],
                 [enable_capi2032])
if test "x$with_cups" != "xno"
    WINE_PACKAGE_FLAGS(CUPS,[cups],[-lcups],
                       [`${CUPS_CONFIG:-cups-config} --cflags 2>/dev/null`],
                       [`${CUPS_CONFIG:-cups-config} --libs 2>/dev/null`],
                       [AC_CHECK_HEADERS(cups/cups.h cups/ppd.h)
                        if test "$ac_cv_header_cups_cups_h" = "yes"
                        then
                            WINE_CHECK_SONAME(cups,cupsGetDefault,,[CUPS_LIBS=""],[$CUPS_LIBS])
                        else
                            CUPS_CFLAGS=""
                            CUPS_LIBS=""
                        fi])
WINE_NOTICE_WITH(cups,[test "x$ac_cv_lib_soname_cups" = "x"],
                 [libcups ${notice_platform}development files not found, CUPS won't be supported.])
if test "x$with_fontconfig" != "xno"
    WINE_PACKAGE_FLAGS(FONTCONFIG,[fontconfig],,[$X_CFLAGS],[$X_LIBS],
        [AC_CHECK_HEADERS([fontconfig/fontconfig.h])
        if test "$ac_cv_header_fontconfig_fontconfig_h" = "yes"
        then
            WINE_CHECK_SONAME(fontconfig,FcInit,,[FONTCONFIG_CFLAGS=""],[$FONTCONFIG_LIBS])
        else
            FONTCONFIG_CFLAGS=""
        fi])
WINE_NOTICE_WITH(fontconfig,[test "x$ac_cv_lib_soname_fontconfig" = "x"],
                 [fontconfig ${notice_platform}development files not found, fontconfig won't be supported.])
dnl **** Check for krb5 ****
if test "x$with_krb5" != "xno"
then
    WINE_PACKAGE_FLAGS(KRB5,[krb5],,
                       [`${KRB5_CONFIG:-krb5-config} --cflags 2>/dev/null`],
                       [`${KRB5_CONFIG:-krb5-config} --libs 2>/dev/null`],
        [AC_CHECK_HEADERS([krb5/krb5.h])
         if test "$ac_cv_header_krb5_krb5_h" = "yes"
         then
             WINE_CHECK_SONAME(krb5,krb5_is_config_principal,,[KRB5_CFLAGS=""],[$KRB5_LIBS])
         else
             KRB5_CFLAGS=""
         fi])
fi
WINE_NOTICE_WITH(krb5,[test "x$ac_cv_lib_soname_krb5" = "x"],
                 [libkrb5 ${notice_platform}development files not found (or too old), Kerberos won't be supported.])
test "x$ac_cv_lib_soname_krb5" != "x" || with_gssapi=${with_gssapi:-no}
dnl **** Check for gssapi ****
if test "x$with_gssapi" != "xno"
then
    WINE_PACKAGE_FLAGS(GSSAPI,[krb5-gssapi],,
                       [`${KRB5_CONFIG:-krb5-config} --cflags gssapi 2>/dev/null`],
                       [`${KRB5_CONFIG:-krb5-config} --libs gssapi 2>/dev/null`],
        [AC_CHECK_HEADERS([gssapi/gssapi.h gssapi/gssapi_ext.h])
        if test "$ac_cv_header_gssapi_gssapi_h" = "yes" -a "$ac_cv_header_gssapi_gssapi_ext_h" = "yes"
        then
            WINE_CHECK_SONAME(gssapi_krb5, gss_init_sec_context,,[GSSAPI_CFLAGS=""],[$GSSAPI_LIBS])
        else
            GSSAPI_CFLAGS=""
        fi])
fi
WINE_NOTICE_WITH(gssapi,[test "x$ac_cv_lib_soname_gssapi_krb5" = "x"],
                 [libgssapi_krb5 ${notice_platform}development files not found (or too old), no Kerberos SSP support.])

dnl **** Check for OpenAL 1.1 ****
if test "$ac_cv_header_AL_al_h" = "yes"
then
    WINE_CHECK_SONAME(openal,alGetSource3i,[AC_SUBST(OPENAL_LIBS,"-lopenal")
                      ac_cv_lib_openal=yes
                      AC_DEFINE_UNQUOTED(HAVE_OPENAL,1,[Define to 1 if OpenAL is available])],,)
WINE_NOTICE_WITH(openal,[test "x$ac_cv_lib_openal" != xyes],
                 [libopenal ${notice_platform}development files not found (or too old), OpenAL won't be supported.],
dnl **** Check for libprocstat ****
if test "$ac_cv_header_libprocstat_h" = "yes"
then
    AC_CHECK_LIB(procstat,procstat_open_sysctl,
                 [AC_DEFINE(HAVE_LIBPROCSTAT, 1, [Define to 1 if you have the `procstat' library (-lprocstat).])
dnl **** Check for libodbc ****
WINE_CHECK_SONAME(odbc,SQLConnect,,[AC_DEFINE_UNQUOTED(SONAME_LIBODBC,["libodbc.$LIBEXT"])])

dnl **** Check for libnetapi ****
if test "x$with_netapi" != "xno"
then
    WINE_PACKAGE_FLAGS(NETAPI,[netapi],,,,
      [WINE_CHECK_SONAME(netapi,libnetapi_init,,[AC_DEFINE_UNQUOTED(SONAME_LIBNETAPI,["libnetapi.$LIBEXT"])],[$NETAPI_LIBS])])
WINE_NOTICE_WITH(netapi,[test "x$ac_cv_lib_soname_netapi" = "x"],
                 [libnetapi not found, Samba NetAPI won't be supported.],
                 [enable_netapi])

if test "x$enable_winealsa_drv$enable_winecoreaudio_drv$enable_winepulse_drv$enable_wineoss_drv$enable_wineandroid_drv" = xnonononono -a \
        "x$with_alsa$with_coreaudio$with_oss$with_pulse" != xnononono
then
    WINE_WARNING([No sound system was found. Windows applications will be silent.])
fi
dnl *** Check for Vulkan ***
if test "x$with_vulkan" != "xno"
then
    WINE_CHECK_SONAME(vulkan, vkGetInstanceProcAddr)
    if test "x$ac_cv_lib_soname_vulkan" = "x"
    then
        WINE_CHECK_SONAME(MoltenVK, vkGetInstanceProcAddr)
    fi
WINE_NOTICE_WITH(vulkan,[test "x$ac_cv_lib_soname_vulkan" = "x" -a "x$ac_cv_lib_soname_MoltenVK" = "x"],
                 [libvulkan and libMoltenVK ${notice_platform}development files not found, Vulkan won't be supported.])
dnl **** Check for gcc specific options ****
Alexandre Julliard's avatar
Alexandre Julliard committed

if test "x${GCC}" = "xyes"
then
  dnl Check for some compiler flags
  dnl clang needs to be told to fail on unknown options
  saved_CFLAGS=$CFLAGS
  WINE_TRY_CFLAGS([-Werror=unknown-warning-option],[CFLAGS="$CFLAGS -Werror=unknown-warning-option"])
  WINE_TRY_CFLAGS([-Werror=unused-command-line-argument],[CFLAGS="$CFLAGS -Werror=unused-command-line-argument"])
  WINE_TRY_CFLAGS([-Werror=ignored-optimization-argument],[CFLAGS="$CFLAGS -Werror=ignored-optimization-argument"])
  WINE_TRY_CFLAGS([-fcf-protection=none])
  WINE_TRY_CFLAGS([-fno-stack-protector])
  WINE_TRY_CFLAGS([-fno-strict-aliasing])
  WINE_TRY_CFLAGS([-Wdeclaration-after-statement])
  WINE_TRY_CFLAGS([-Wempty-body])
  WINE_TRY_CFLAGS([-Wignored-qualifiers])
  WINE_TRY_CFLAGS([-Winit-self])
  WINE_TRY_CFLAGS([-Wpacked-not-aligned],[EXTRACFLAGS="$EXTRACFLAGS -Wno-packed-not-aligned"])
  WINE_TRY_CFLAGS([-Wpragma-pack],[EXTRACFLAGS="$EXTRACFLAGS -Wno-pragma-pack"])
  WINE_TRY_CFLAGS([-Wshift-overflow=2])
  WINE_TRY_CFLAGS([-Wstrict-prototypes])
  WINE_TRY_CFLAGS([-Wtype-limits])
  WINE_TRY_CFLAGS([-Wunused-but-set-parameter])
  WINE_TRY_CFLAGS([-Wvla])
  WINE_TRY_CFLAGS([-Wwrite-strings])
  if test -z "$CROSSTARGET"
  then
    WINE_TRY_CFLAGS([-fexcess-precision=standard],[AC_SUBST(EXCESS_PRECISION_CFLAGS,"-fexcess-precision=standard")])
  fi

  dnl Check for noisy string.h
  WINE_TRY_CFLAGS([-Wpointer-arith],
     [saved_string_h_CFLAGS=$CFLAGS
      CFLAGS="$CFLAGS -Wpointer-arith -Werror"
      AC_CACHE_CHECK([for broken string.h that generates warnings with -Wpointer-arith], ac_cv_c_string_h_warnings,
          AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>]])],[ac_cv_c_string_h_warnings=no],[ac_cv_c_string_h_warnings=yes]))
      test "$ac_cv_c_string_h_warnings" = yes || EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith"
      CFLAGS=$saved_string_h_CFLAGS])

  dnl Check for noisy string.h on logical ops
  WINE_TRY_CFLAGS([-Wlogical-op],
     [saved_string_h_CFLAGS=$CFLAGS
      CFLAGS="$CFLAGS -Wlogical-op -Werror"
      AC_CACHE_CHECK([for broken string.h that generates warnings with -Wlogical-op], ac_cv_c_logicalop_noisy,
          AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>
char*f(const char *h,char n) {return strchr(h,n);}]])],[ac_cv_c_logicalop_noisy=no],[ac_cv_c_logicalop_noisy=yes]))
      CFLAGS=$saved_string_h_CFLAGS
      test "$ac_cv_c_logicalop_noisy" = yes || EXTRACFLAGS="$EXTRACFLAGS -Wlogical-op"])

  dnl Check for 64-bit compare-and-swap
  AC_CACHE_CHECK([for flags needed for 64-bit compare-and-swap support], wine_cv_64bit_compare_swap,
      [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
#error no
#endif]])],
          [wine_cv_64bit_compare_swap="none needed"],
          [case $host_cpu in
            *i[[3456]]86*) wine_cv_64bit_compare_swap="-march=i586" ;;
            *arm*)         wine_cv_64bit_compare_swap="-march=armv7-a" ;;
            *)             wine_cv_64bit_compare_swap="unknown" ;;
           esac
           if test "x$wine_cv_64bit_compare_swap" != xunknown
           then
               dnl try with the new flags
               CFLAGS="$CFLAGS $wine_cv_64bit_compare_swap"
               AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
#error no
#endif]])],,[wine_cv_64bit_compare_swap="unknown"])
               CFLAGS=$saved_CFLAGS
           fi])])
  case "$wine_cv_64bit_compare_swap" in
      unknown) AC_MSG_ERROR([gcc doesn't support 64-bit compare-and-swap on this platform]) ;;
      "none needed") ;;
      *) EXTRACFLAGS="$EXTRACFLAGS $wine_cv_64bit_compare_swap" ;;
  esac

  dnl Determine debug info format
  ac_debug_format_seen=""
  for ac_flag in $CFLAGS; do
    case $ac_flag in
      -gdwarf*)    ac_debug_format_seen=yes ;;
      -g)          ac_debug_format_seen=${ac_debug_format_seen:-default} ;;
  if test "x$ac_debug_format_seen" = xdefault
  then
    WINE_TRY_CFLAGS([-gdwarf-4])
  dnl Disable gcc builtins except for Mingw
    mingw32*)  dnl Check for delayload linker support
       WINE_TRY_CFLAGS([-Wl,-delayload,autoconftest.dll],[AC_SUBST(DELAYLOADFLAG,["-Wl,-delayload,"])]) ;;
    *) MSVCRTFLAGS="-D_WIN32"
       WINE_TRY_CFLAGS([-fno-builtin],[MSVCRTFLAGS="$MSVCRTFLAGS -fno-builtin"])
       WINE_TRY_CFLAGS([-fshort-wchar],[MSVCRTFLAGS="$MSVCRTFLAGS -fshort-wchar"])
       WINE_TRY_CFLAGS([-Wno-format],[MSVCRTFLAGS="$MSVCRTFLAGS -Wno-format"]) ;;
    dnl gcc-4.6+ omits frame pointers by default, breaking some copy protections
    *i[[3456789]]86*) WINE_TRY_CFLAGS([-fno-omit-frame-pointer]) ;;
    *x86_64*)
      case $host_os in
        dnl Mingw uses Windows 64-bit types, not Unix ones
        cygwin*|mingw32*) WINE_TRY_CFLAGS([-Wno-format]) ;;
        dnl Default to ms_abi on 64-bit
        *) if test -z "$CROSSTARGET"
           then
               AC_CACHE_CHECK([for working -mabi=ms], ac_cv_mabi_ms,
                   [CFLAGS="$CFLAGS -mabi=ms"
                    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
int a(int b, ...) { __builtin_ms_va_list list; __builtin_ms_va_start(list,b); }]])],
                       [ac_cv_mabi_ms=yes],[ac_cv_mabi_ms=no])
                    CFLAGS=$saved_CFLAGS])
               test $ac_cv_mabi_ms = yes || AC_MSG_ERROR([The compiler doesn't support -mabi=ms. Use gcc instead of clang, or install mingw-w64.])
           fi
           MSVCRTFLAGS="$MSVCRTFLAGS -mabi=ms" ;;
  dnl Enable -Werror
  if test "x$enable_werror" = "xyes"
  then
      WINE_TRY_CFLAGS([-Werror])
  fi
  if test "x$enable_build_id" = "xyes"
  then
      WINE_TRY_CFLAGS([-Wl,--build-id], [CFLAGS="$CFLAGS -Wl,--build-id"
                      LDFLAGS="$LDFLAGS -Wl,--build-id"])
  fi
dnl **** Disable Fortify, it has too many false positives

AC_CACHE_CHECK([for the need to disable Fortify], ac_cv_c_fortify_enabled,
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <string.h>]],
[[#if (defined(__USE_FORTIFY_LEVEL) && __USE_FORTIFY_LEVEL > 0) || (defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0)
#error Fortify enabled
#endif]])],
        [ac_cv_c_fortify_enabled=no],[ac_cv_c_fortify_enabled=yes]))
if test "$ac_cv_c_fortify_enabled" = yes
then
    CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0"
dnl **** Check for CFI directives support ****
AC_CACHE_CHECK([whether CFI directives are supported in assembly code], ac_cv_c_cfi_support,
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[asm(".text\nac_test:\t.cfi_startproc\n\t.long 0\n\t.cfi_endproc");]])],
                      ac_cv_c_cfi_support="yes",ac_cv_c_cfi_support="no"))
if test "$ac_cv_c_cfi_support" = "yes"
then
   DLLFLAGS="$DLLFLAGS -fasynchronous-unwind-tables"
   LDDLLFLAGS="$LDDLLFLAGS -fasynchronous-unwind-tables"
   UNIXDLLFLAGS="$UNIXDLLFLAGS -fasynchronous-unwind-tables"
   if test "x$enable_win64" = "xyes"
   then
      WINE_WARNING([building 64-bit Wine without support for CFI directives; exception handling will not work properly.])
   fi
case $host_os in
  linux*)
    case $host_cpu in
      *i[[3456789]]86*|x86_64*|*aarch64*|arm*)
        test "$wine_binary" = wine || WINE_IGNORE_FILE("loader/wine-preloader")
        WINELOADER_PROGRAMS="$WINELOADER_PROGRAMS $wine_binary-preloader"
        ;;
dnl **** Check for functions ****

ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $BUILTINFLAG"
	fstatfs \