Skip to content
Snippets Groups Projects
configure.ac 134 KiB
Newer Older
      AC_CACHE_CHECK(whether we can build a UnixWare (Solaris) dll, ac_cv_c_dll_unixware,
          [WINE_TRY_SHLIB_FLAGS([-fPIC -Wl,-G,-h,conftest.so.1.0,-B,symbolic],
                                ac_cv_c_dll_unixware="yes",ac_cv_c_dll_unixware="no")])
      if test "$ac_cv_c_dll_unixware" = "yes"
      then
        LDSHARED="\$(CC) -Wl,-G,-h,libwine.so.$libwine_soversion"
    libwine_targets="libwine.so libwine.so.$libwine_soversion libwine.so.$libwine_version"
OBJS = \$(C_SRCS:.c=.o) \$(EXTRA_OBJS)

libwine.so.$libwine_version: \$(OBJS) \$(srcdir)/wine.map
	$LDSHARED \$(OBJS) \$(EXTRALIBS) \$(LDFLAGS) \$(LIBS) -o \$@

libwine.so.$libwine_soversion: libwine.so.$libwine_version
	\$(RM) \$@ && \$(LN_S) libwine.so.$libwine_version \$@
libwine.so: libwine.so.$libwine_soversion
	\$(RM) \$@ && \$(LN_S) libwine.so.$libwine_soversion \$@
install install-lib:: libwine.so.$libwine_version
	\$(INSTALL_PROGRAM) libwine.so.$libwine_version \$(DESTDIR)\$(libdir)/libwine.so.$libwine_version
	cd \$(DESTDIR)\$(libdir) && \$(RM) libwine.so.$libwine_soversion && \$(LN_S) libwine.so.$libwine_version libwine.so.$libwine_soversion
	cd \$(DESTDIR)\$(libdir) && \$(RM) libwine.so && \$(LN_S) libwine.so.$libwine_version libwine.so
	-cd \$(DESTDIR)\$(libdir) && \$(RM) libwine.so libwine.so.$libwine_soversion libwine.so.$libwine_version

    AS_VAR_APPEND([LOADER_RULES],["
	\$(CC) -o \$@ $LDEXECFLAGS main.o \$(LIBWINE) \$(LIBPORT) \$(EXTRALIBS) \$(LDFLAGS) \$(LDRPATH_LOCAL)

	\$(CC) -o \$@ $LDEXECFLAGS main.o \$(LIBWINE) \$(LIBPORT) \$(EXTRALIBS) \$(LDFLAGS) \$(LDRPATH_INSTALL)
"])
    if test -z "$with_wine64"
    then
        AS_VAR_APPEND([LOADER_RULES],["
install install-lib::
	\$(INSTALL_DATA) \$(srcdir)/wine.desktop \$(DESTDIR)\$(datadir)/applications/wine.desktop
uninstall::
	\$(RM) \$(DESTDIR)\$(datadir)/applications/wine.desktop
"])
    fi
AS_VAR_APPEND([LIBWINE_RULES],["
EXTRA_TARGETS = $libwine_targets
"])

enable_wineqtdecoder=${enable_wineqtdecoder:-no}
enable_winemac_drv=${enable_winemac_drv:-no}
dnl Check for cross compiler to build test programs
if test "$cross_compiling" = "no" -a "x$enable_tests" != xno -a "$LIBEXT" != "dll"
then
    WINE_CHECK_MINGW_PROG(CROSSCC,gcc,false)
    if test "$CROSSCC" != "false"
    then
        ac_save_CC="$CC"
        CC="$CROSSCC"
        AC_MSG_CHECKING([whether $CROSSCC works])
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
                          [AC_MSG_RESULT([yes])
                           set x $CROSSCC
                           shift
                           while test $# -ge 1
                           do
                               case "$1" in
                                 *-gcc) CROSSTARGET=`expr "$1" : '\(.*\)-gcc'` ;;
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/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(XRRGetScreenResources) *f; if (f) return 0;]])],
                      [AC_DEFINE(HAVE_XRRGETSCREENRESOURCES, 1,
                        [Define if Xrandr has the XRRGetScreenResources function])])],,[$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 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)
            AC_CHECK_LIB(GLU,gluLookAt,[:],,[$OPENGL_LIBS $X_LIBS -lm $X_EXTRA_LIBS])
            WINE_NOTICE_WITH(glu,[test "x$ac_cv_lib_GLU_gluLookAt" != xyes],
                             [libGLU ${notice_platform}development files not found, GLU won't be supported.])
        fi

        if test "x$with_osmesa" != "xno"
        then
            WINE_CHECK_SONAME(OSMesa,glAccum,,,[$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"
    enable_winex11_drv=${enable_winex11_drv:-no}
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/Xfree86 at the very least.])
test "x$ac_cv_lib_GLU_gluLookAt" != xyes && enable_glu32=${enable_glu32:-no}

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.])
test "x$ac_cv_lib_OpenCL_clGetPlatformInfo" != xyes && enable_opencl=${enable_opencl:-no}

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.])
test "x$ac_cv_lib_pcap_pcap_create" != xyes && enable_wpcap=${enable_wpcap:-no}

dnl **** Check for libxml2 ****

    WINE_PACKAGE_FLAGS(XML2,[libxml-2.0],[-lxml2],
                       [`xml2-config --cflags 2>/dev/null`],[`xml2-config --libs 2>/dev/null`],
        [AC_CHECK_HEADERS([libxml/parser.h libxml/xmlsave.h libxml/SAX2.h])
        if test "$ac_cv_header_libxml_parser_h" = "yes" -a "$ac_cv_header_libxml_xmlsave_h" = "yes" -a "$ac_cv_header_libxml_SAX2_h" = "yes"
        then
            AC_CHECK_LIB(xml2, xmlParseMemory,
                [AC_DEFINE(HAVE_LIBXML2, 1, [Define if you have the libxml2 library])],[XML2_LIBS=""],[$XML2_LIBS])
            AC_CHECK_LIB(xml2, xmlReadMemory,
                [AC_DEFINE(HAVE_XMLREADMEMORY,1,[Define if libxml2 has the xmlReadMemory function])],,[$XML2_LIBS])
            AC_CHECK_LIB(xml2, xmlNewDocPI,
                [AC_DEFINE(HAVE_XMLNEWDOCPI,1,[Define if libxml2 has the xmlNewDocPI function])],,[$XML2_LIBS])
            AC_CHECK_LIB(xml2, xmlSchemaSetParserStructuredErrors,
                [AC_DEFINE(HAVE_XMLSCHEMASSETPARSERSTRUCTUREDERRORS,1,[Define if libxml2 has the xmlSchemaSetParserStructuredErrors function])],,[$XML2_LIBS])
            AC_CHECK_LIB(xml2, xmlSchemaSetValidStructuredErrors,
                [AC_DEFINE(HAVE_XMLSCHEMASSETVALIDSTRUCTUREDERRORS,1,[Define if libxml2 has the xmlSchemaSetValidStructuredErrors function])],,[$XML2_LIBS])
            AC_CHECK_LIB(xml2, xmlFirstElementChild,
                [AC_DEFINE(HAVE_XMLFIRSTELEMENTCHILD,1,[Define if libxml2 has the xmlFirstElementChild function])],,[$XML2_LIBS])
            AC_CHECK_TYPE([xmlDocProperties],
                [AC_DEFINE(HAVE_XMLDOC_PROPERTIES,1,[Define if libxml2 has the xmlDocProperties enum])],,[[#include <libxml/tree.h>]])
        else
            XML2_CFLAGS=""
            XML2_LIBS=""
        fi])
WINE_WARNING_WITH(xml,[test "$ac_cv_lib_xml2_xmlParseMemory" != "yes"],
                 [libxml2 ${notice_platform}development files not found (or too old), XML won't be supported.])
    WINE_PACKAGE_FLAGS(XSLT,[libxslt],[-lxml2],
                       [`xslt-config --cflags 2>/dev/null`],[`xslt-config --libs 2>/dev/null`],
        [AC_CHECK_HEADERS([libxslt/pattern.h libxslt/transform.h],,,
        [#ifdef HAVE_LIBXSLT_PATTERN_H
# include <libxslt/pattern.h>
#endif])
        if test "$ac_cv_header_libxslt_transform_h" = "yes"
        then
            WINE_CHECK_SONAME(xslt,xsltCompilePattern,,,[$XSLT_LIBS])
        else
            XSLT_CFLAGS=""
        fi])
WINE_WARNING_WITH(xslt,[test "x$ac_cv_lib_soname_xslt" = "x"],
                 [libxslt ${notice_platform}development files not found, xslt 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 libhal ****
if test "x$with_hal" != "xno" -a "x$ac_cv_lib_soname_dbus_1" != x
    WINE_PACKAGE_FLAGS(HAL,[hal],[-ldbus-1],,,
        [AC_CHECK_HEADER([hal/libhal.h],
            [WINE_CHECK_SONAME(hal, libhal_ctx_new,,[HAL_CFLAGS=""],[$HAL_LIBS])],
            [HAL_CFLAGS=""])])
    WINE_NOTICE_WITH(hal,[test "x$ac_cv_lib_soname_hal" = "x" -a \
                               "x$ac_cv_header_DiskArbitration_DiskArbitration_h" != "xyes"],
                     [libhal ${notice_platform}development files not found, no legacy dynamic device support.])
dnl **** Check for libgnutls ****
    WINE_PACKAGE_FLAGS(GNUTLS,[gnutls],,,,
        [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_WARNING_WITH(gnutls,[test "x$ac_cv_lib_soname_gnutls" = "x"],
                 [libgnutls ${notice_platform}development files not found, no schannel support.])
dnl **** Check which curses lib to use ***
if test "$ac_cv_header_ncurses_h" = "yes"
    WINE_CHECK_SONAME(ncurses,waddch,[CURSES_LIBS="-lncurses"],,,[[libncursesw\\{0,1\\}]])
elif test "$ac_cv_header_curses_h" = "yes"
then
    WINE_CHECK_SONAME(curses,waddch,[CURSES_LIBS="-lcurses"])
AC_CHECK_FUNCS(mousemask)
LIBS="$ac_save_LIBS"
WINE_NOTICE_WITH(curses,[test "x$ac_cv_lib_soname_curses$ac_cv_lib_soname_ncurses" = "x"],
                 [lib(n)curses ${notice_platform}development files not found, curses won't be supported.])
dnl **** Check for SANE ****
    WINE_PACKAGE_FLAGS(SANE,[libsane],,[`sane-config --cflags 2>/dev/null`],[`sane-config --ldflags 2>/dev/null`],
        [AC_CHECK_HEADER(sane/sane.h,
            [WINE_CHECK_SONAME(sane,sane_init,,[SANE_CFLAGS=""],[$SANE_LIBS])],
            [SANE_CFLAGS=""])])
WINE_NOTICE_WITH(sane,[test "x$ac_cv_lib_soname_sane" = "x"],
                 [libsane ${notice_platform}development files not found, scanners won't be supported.])
dnl **** Check for libv4l1 ****
if test "x$with_v4l" != "xno"
then
    WINE_CHECK_SONAME(v4l1,v4l1_open,,,)
fi
WINE_NOTICE_WITH(v4l,[test "x$ac_cv_lib_soname_v4l1" = "x"],
                 [libv4l ${notice_platform}development files not found.])

    WINE_PACKAGE_FLAGS(GPHOTO2,[libgphoto2],[-lgphoto2],
                       [`gphoto2-config --cflags 2>/dev/null`],[`gphoto2-config --libs 2>/dev/null`],
        [AC_CHECK_HEADER(gphoto2-camera.h,
                        [AC_CHECK_LIB(gphoto2,gp_camera_new,
                                      [AC_DEFINE(HAVE_GPHOTO2, 1, [Define if we have the libgphoto2 development environment])],
                                      [GPHOTO2_LIBS=""; GPHOTO2_CFLAGS=""],
                                      [$GPHOTO2_LIBS])],
                        [GPHOTO2_LIBS=""; GPHOTO2_CFLAGS=""])])
    WINE_PACKAGE_FLAGS(GPHOTO2_PORT,[libgphoto2_port],[-lgphoto2_port],
                       [`gphoto2-port-config --cflags 2>/dev/null`],
                       [`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.])
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)]])],
           [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
dnl **** Check for LittleCMS ***
if test "x$with_cms" != "xno"
    WINE_PACKAGE_FLAGS(LCMS2,[lcms2],[-llcms2],,,
        [AC_CHECK_HEADERS([lcms2.h])
        if test "$ac_cv_header_lcms2_h" = "yes"
        then
            AC_CHECK_LIB(lcms2, cmsOpenProfileFromFile,
                [AC_DEFINE(HAVE_LCMS2, 1, [Define if you have the LittleCMS development environment])],[LCMS2_LIBS=""],[$LCMS2_LIBS])
Hans Leidekker's avatar
Hans Leidekker committed
WINE_NOTICE_WITH(cms,[test "$ac_cv_lib_lcms2_cmsOpenProfileFromFile" != "yes"],
                 [liblcms2 ${notice_platform}development files not found, Color Management won't be supported.])
dnl **** Check for FreeType 2 ****
    WINE_PACKAGE_FLAGS(FREETYPE,[freetype2],[-lfreetype],
                       [`(freetype-config --cflags || freetype2-config --cflags) 2>/dev/null`],
                       [`(freetype-config --libs || 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.])
test "x$ac_cv_lib_soname_freetype" = x && enable_fonts=${enable_fonts:-no}
dnl **** Check for parport (currently Linux only) ****
AC_CACHE_CHECK([for parport header/ppdev.h], ac_cv_c_ppdev,
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
#include <linux/ppdev.h>]], [[ioctl (1,PPCLAIM,0)]])],
    [ac_cv_c_ppdev="yes"],[ac_cv_c_ppdev="no"]))
if test "$ac_cv_c_ppdev" = "yes"
then
    AC_DEFINE(HAVE_PPDEV, 1, [Define if we can use ppdev.h for parallel port access])
dnl **** Check for pthread functions ****
        pthread_attr_get_np \
        pthread_getthreadid_np \
dnl **** Check for zlib ****
if test "$ac_cv_header_zlib_h" = "yes"
then
    AC_CHECK_LIB(z,inflate,[AC_DEFINE(HAVE_ZLIB,1,[Define to 1 if you have the `z' library (-lz).])
WINE_NOTICE_WITH(zlib,[test "x$Z_LIBS" = "x"],[libz ${notice_platform}development files not found, data compression won't be supported.])
dnl **** Check for gettextpo ****
if test "x$enable_tools" != xno
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).])
    test "x$with_gettextpo" != xyes || 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.])
dnl **** Check for gstreamer ****
if test "x$with_gstreamer" != "xno"
then
    WINE_PACKAGE_FLAGS(GSTREAMER,[gstreamer-app-0.10],,,,
        [ac_gst_incl=""
        for i in $GSTREAMER_CFLAGS
        do
            case "$i" in
                -I*) ac_gst_incl="$ac_gst_incl $i";;
            esac
        done
        GSTREAMER_CFLAGS=$ac_gst_incl
        CPPFLAGS="$ac_save_CPPFLAGS $GSTREAMER_CFLAGS"
        AC_CHECK_HEADER([gst/gstpad.h],
            [AC_CHECK_HEADER([gst/app/gstappsink.h],
                 [AC_MSG_CHECKING([whether gint64 defined by gst/app/gstappsink.h is indeed 64-bit])
                  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gst/app/gstappsink.h>]],
                                                     [[static int a[sizeof(gint64) > 4 ? 1 : -1]; if (a[0]) return 0;]])],
                    [AC_MSG_RESULT([yes])
                     AC_CHECK_LIB(gstreamer-0.10,gst_pad_get_caps_reffed,
                       [AC_CHECK_LIB(gstapp-0.10,gst_app_buffer_new,[:],,[$GSTREAMER_LIBS])])],
                    [AC_MSG_RESULT([no])])])],
            [GSTREAMER_CFLAGS=""])])
WINE_NOTICE_WITH(gstreamer,[test "x$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" != xyes -a "x$ac_cv_header_QuickTime_ImageCompression_h" != xyes],
                 [gstreamer-0.10 base plugins ${notice_platform}development files not found, gstreamer support disabled])
test "x$ac_cv_lib_gstapp_0_10_gst_app_buffer_new" = xyes || enable_winegstreamer=${enable_winegstreamer:-no}

dnl **** Check for ALSA 1.x ****
if test "$ac_cv_header_sys_asoundlib_h" = "yes" -o "$ac_cv_header_alsa_asoundlib_h" = "yes"
    AC_CHECK_LIB(asound,snd_pcm_hw_params_get_access_mask,
        [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef HAVE_ALSA_ASOUNDLIB_H
#include <alsa/asoundlib.h>
#elif defined(HAVE_SYS_ASOUNDLIB_H)
#include <sys/asoundlib.h>
#endif]], [[snd_pcm_hw_params_get_access_mask(NULL, NULL)]])],
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],
                          [#include <sys/soundcard.h>])])
    CPPFLAGS="$ac_save_CPPFLAGS"
    if test "x$ac_cv_member_oss_sysinfo_numaudioengines" != xyes
    then
        WINE_NOTICE([OSS sound system found but too old (OSSv4 needed), OSS won't be supported.])
    fi
fi

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
        WINE_CHECK_SONAME(capi20,capi20_register,,,[$CAPI20_LIBS])
    fi])
WINE_NOTICE_WITH(capi,[test "x$ac_cv_lib_soname_capi20" = "x"],
                 [libcapi20 ${notice_platform}development files not found, ISDN won't be supported.])
if test "x$with_cups" != "xno"
    ac_save_CPPFLAGS="$CPPFLAGS"
    ac_cups_cflags=`cups-config --cflags 2>/dev/null`
    ac_cups_libs=`cups-config --ldflags 2>/dev/null`
    CPPFLAGS="$CPPFLAGS $ac_cups_cflags"
    AC_CHECK_HEADERS(cups/cups.h,
            [WINE_CHECK_SONAME(cups,cupsGetDefault,
                       [$ac_cups_libs])])
    CPPFLAGS="$ac_save_CPPFLAGS"
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 gsm codec ****
if test "$ac_cv_header_gsm_h" = "yes" -o "$ac_cv_header_gsm_gsm_h" = "yes"
then
    WINE_CHECK_SONAME(gsm,gsm_create)
fi
WINE_NOTICE_WITH(gsm,[test "x$ac_cv_lib_soname_gsm" = "x"],
                 [libgsm ${notice_platform}development files not found, gsm 06.10 codec won't be supported.])

if test "x$with_jpeg" != "xno"
    WINE_PACKAGE_FLAGS(JPEG,[libjpeg],,,,
        [AC_CHECK_HEADERS([jpeglib.h])
        if test "$ac_cv_header_jpeglib_h" = "yes"
        then
            WINE_CHECK_SONAME(jpeg,jpeg_start_decompress,,[JPEG_CFLAGS=""],[$JPEG_LIBS])
        else
            JPEG_CFLAGS=""
        fi])
WINE_WARNING_WITH(jpeg,[test "x$ac_cv_lib_soname_jpeg" = "x"],
                 [libjpeg ${notice_platform}development files not found, JPEG won't be supported.])
dnl **** Check for libpng ****
if test "x$with_png" != "xno"
    WINE_PACKAGE_FLAGS(PNG,[libpng],,[$X_CFLAGS],[$X_LIBS],
        [AC_CHECK_HEADERS([png.h])
        if test "$ac_cv_header_png_h" = "yes"
        then
            WINE_CHECK_SONAME(png,png_create_read_struct,
                [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <png.h>]],[[typeof(png_set_expand_gray_1_2_4_to_8) *p]])],
                    [AC_DEFINE(HAVE_PNG_SET_EXPAND_GRAY_1_2_4_TO_8,1,[Define to 1 if libpng has the png_set_expand_gray_1_2_4_to_8 function.])])],
                [PNG_CFLAGS=""],[$PNG_LIBS -lm -lz],[[libpng[[0-9]]*]])
        else
            PNG_CFLAGS=""
        fi])
WINE_WARNING_WITH(png,[test "x$ac_cv_lib_soname_png" = "x"],
                 [libpng ${notice_platform}development files not found, PNG won't be supported.])
dnl **** Check for libtiff ****
if test "x$with_tiff" != "xno"
    WINE_PACKAGE_FLAGS(TIFF,[libtiff],,,,
        [AC_CHECK_HEADERS([tiffio.h])
        if test "$ac_cv_header_tiffio_h" = "yes"
        then
            WINE_CHECK_SONAME(tiff,TIFFClientOpen,,,[$TIFF_LIBS])
        fi])
fi
WINE_NOTICE_WITH(tiff,[test "x$ac_cv_lib_soname_tiff" = "x"],
                 [libtiff ${notice_platform}development files not found, TIFF won't be supported.])

dnl **** Check for mpg123 ****
if test "x$with_mpg123" != "xno"
    WINE_PACKAGE_FLAGS(MPG123,[libmpg123],[-lmpg123],,,
        [AC_CHECK_HEADERS([mpg123.h])
        if test "$ac_cv_header_mpg123_h" = "yes"
        then
            AC_CHECK_LIB(mpg123,mpg123_feed,[:],[MPG123_LIBS=""],[$MPG123_LIBS])
        else
            MPG123_CFLAGS=""
            MPG123_LIBS=""
        fi])
WINE_NOTICE_WITH(mpg123,[test "x$ac_cv_lib_mpg123_mpg123_feed" != xyes -a x"$ac_cv_header_CoreAudio_CoreAudio_h" != xyes],
                 [libmpg123 ${notice_platform}development files not found (or too old), mp3 codec won't be supported.])
test "x$ac_cv_lib_mpg123_mpg123_feed" = xyes -o "x$ac_cv_header_AudioToolbox_AudioConverter_h" = xyes || enable_winemp3_acm=${enable_winemp3_acm:-no}
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])
test "x$ac_cv_lib_openal" = xyes || enable_openal32=${enable_openal32:-no}

dnl **** Check for openal-soft ****
if test "x$ac_cv_lib_openal" = xyes
then
    AC_CACHE_CHECK([for openal-soft], ac_cv_have_openalsoft,
        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
            [[#include <AL/alext.h>
LPALCRENDERSAMPLESSOFT x;]])],[ac_cv_have_openalsoft=yes],[ac_cv_have_openalsoft=no]))
fi
if test "x$ac_cv_have_openalsoft" != xyes
then
    WINE_NOTICE([openal-soft ${notice_platform}development files not found (or too old), XAudio2 won't be supported])
    enable_xaudio2_7=${enable_xaudio2_7:-no}
fi
dnl **** Check for libkstat ****
if test "$ac_cv_header_kstat_h" = "yes"
then
    AC_CHECK_LIB(kstat,kstat_open,
                 [AC_DEFINE(HAVE_LIBKSTAT, 1, [Define to 1 if you have the `kstat' library (-lkstat).])
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_CHECK_SONAME(netapi,libnetapi_init,,[AC_DEFINE_UNQUOTED(SONAME_LIBNETAPI,["libnetapi.$LIBEXT"])])
fi

dnl **** Disable unsupported winmm drivers ****
test -n "$ALSA_LIBS" || enable_winealsa_drv=${enable_winealsa_drv:-no}
test -n "$COREAUDIO_LIBS" || enable_winecoreaudio_drv=${enable_winecoreaudio_drv:-no}
test "x$ac_cv_member_oss_sysinfo_numaudioengines" = xyes || enable_wineoss_drv=${enable_wineoss_drv:-no}
test "$ac_cv_header_linux_joystick_h" = "yes" -o "$ac_cv_header_IOKit_hid_IOHIDLib_h" = "yes" || enable_winejoystick_drv=${enable_winejoystick_drv:-no}
if test "x$ALSA_LIBS$COREAUDIO_LIBS" = "x" -a \
        "x$ac_cv_member_oss_sysinfo_numaudioengines" != xyes -a \
        "x$with_alsa$with_coreaudio$with_oss" != xnonono
then
    WINE_WARNING([No sound system was found. Windows applications will be silent.])
fi
dnl **** Check for gcc specific options ****
Alexandre Julliard's avatar
Alexandre Julliard committed
if test "x${GCC}" = "xyes"
then
  EXTRACFLAGS="-Wall -pipe"
  AC_CACHE_CHECK( [for gcc strength-reduce bug], ac_cv_c_gcc_strength_bug,
                  AC_RUN_IFELSE([AC_LANG_PROGRAM([[int L[[4]] = {0,1,2,3};]],
[[static int Array[[3]];
Alexandre Julliard's avatar
Alexandre Julliard committed
  unsigned int B = 3;
  int i;
Alexandre Julliard's avatar
Alexandre Julliard committed
  for(i=0; i<B; i++) Array[[i]] = i - 3;
  for(i=0; i<4 - 1; i++) L[[i]] = L[[i + 1]];
  L[[i]] = 4;
  return (Array[[1]] != -2 || L[[2]] != 3)]])],
    [ac_cv_c_gcc_strength_bug="no"],[ac_cv_c_gcc_strength_bug="yes"],[ac_cv_c_gcc_strength_bug="no"]) )
Alexandre Julliard's avatar
Alexandre Julliard committed
  if test "$ac_cv_c_gcc_strength_bug" = "yes"
  then
    EXTRACFLAGS="$EXTRACFLAGS -fno-strength-reduce"
Alexandre Julliard's avatar
Alexandre Julliard committed
  fi
  dnl Check for some compiler flags
  WINE_TRY_CFLAGS([-fno-builtin],[AC_SUBST(BUILTINFLAG,"-fno-builtin")])
  WINE_TRY_CFLAGS([-fno-strict-aliasing])
  WINE_TRY_CFLAGS([-fexcess-precision=standard],[AC_SUBST(EXCESS_PRECISION_CFLAGS,"-fexcess-precision=standard")])
  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([-Wdeclaration-after-statement])
  WINE_TRY_CFLAGS([-Wempty-body])
  WINE_TRY_CFLAGS([-Wignored-qualifiers])
  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])
  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"])

  CFLAGS=$saved_CFLAGS

  dnl Default to dwarf-2 debug info
  for ac_flag in $CFLAGS; do
    case $ac_flag in
      -g) WINE_TRY_CFLAGS([-gdwarf-2])
          WINE_TRY_CFLAGS([-gstrict-dwarf]) ;;
  dnl gcc-4.6+ omits frame pointers by default, breaking some copy protections
  case $host_cpu in
    *i[[3456789]]86*) WINE_TRY_CFLAGS([-fno-omit-frame-pointer]) ;;
  esac

  dnl mingw uses Windows 64-bit types, not Unix ones
  case $host in
    x86_64-*mingw32*|x86_64-*cygwin*) WINE_TRY_CFLAGS([-Wno-format]) ;;
  esac

  dnl Enable -Werror for maintainer mode
  if test "x$enable_maintainer_mode" = "xyes"
  then
      WINE_TRY_CFLAGS([-Werror])
  fi

  dnl Check for ms_hook_prologue support
  saved_CFLAGS="$CFLAGS"
  CFLAGS="$CFLAGS -Werror"
  AC_CACHE_CHECK([for ms_hook_prologue attribute], ac_cv_have_ms_hook_prologue,
                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int __attribute__((__ms_hook_prologue__)) test(void) { return 0; }]])],
                                   [ac_cv_have_ms_hook_prologue="yes"],[ac_cv_have_ms_hook_prologue="no"]))
  CFLAGS="$saved_CFLAGS"
  if test "$ac_cv_have_ms_hook_prologue" = "yes"
  then
      AC_DEFINE(DECLSPEC_HOTPATCH, [__attribute__((__ms_hook_prologue__))],
                [Define to a function attribute for Microsoft hotpatch assembly prefix.])
  else
      AC_DEFINE(DECLSPEC_HOTPATCH, [/* */])
  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 underscore on external symbols ****

AC_CACHE_CHECK([whether external symbols need an underscore prefix], ac_cv_c_extern_prefix,
    WINE_TRY_ASM_LINK([".globl _ac_test\n_ac_test:\t.long 0"],
                      [extern int ac_test;],
                      [if (ac_test) return 1],
                      ac_cv_c_extern_prefix="yes",ac_cv_c_extern_prefix="no"))

case $host_cpu in
  *i[[3456789]]86*)
    AC_CACHE_CHECK([whether external symbols need stdcall decoration], ac_cv_c_stdcall_suffix,
        WINE_TRY_ASM_LINK(["jmp _ac_test@4"],
[#ifndef _MSC_VER
#define __stdcall __attribute__((__stdcall__))
#endif
int __stdcall ac_test(int i) { return i; }],
                          [if (ac_test(1)) return 1],
                          ac_cv_c_stdcall_suffix="yes",ac_cv_c_stdcall_suffix="no")) ;;
  *) ac_cv_c_stdcall_suffix="no" ;;
esac

AH_TEMPLATE(__ASM_NAME,[Define to a macro to generate an assembly name from a C symbol])
if test "$ac_cv_c_extern_prefix" = "yes"
then
    AC_DEFINE([__ASM_NAME(name)], ["_" name])
    asm_name_prefix="_"
else
    AC_DEFINE([__ASM_NAME(name)], [name])
    asm_name_prefix=""
fi

AH_TEMPLATE(__ASM_STDCALL,[Define to a macro to generate an stdcall suffix])
if test "$ac_cv_c_stdcall_suffix" = "yes"
then
    AC_DEFINE([__ASM_STDCALL(args)],["@" #args])
else
    AC_DEFINE([__ASM_STDCALL(args)],[""])
fi

dnl **** Check how to define a function in assembly code ****

AC_CACHE_CHECK([how to define a function in assembly code], ac_cv_asm_func_def,
  WINE_TRY_ASM_LINK(
      ["\t.globl _ac_test\n\t.def _ac_test; .scl 2; .type 32; .endef\n_ac_test:\t.long 0"],,,
      ac_cv_asm_func_def=".def",
    [WINE_TRY_ASM_LINK(["\t.globl _ac_test\n\t.type _ac_test,@function\n_ac_test:\t.long 0"],,,
      ac_cv_asm_func_def=".type @function",
    [WINE_TRY_ASM_LINK(["\t.globl _ac_test\n\t.type _ac_test,2\n_ac_test:\t.long 0"],,,
      ac_cv_asm_func_def=".type 2",
      ac_cv_asm_func_def="unknown")])]))

AH_TEMPLATE(__ASM_FUNC,[Define to a macro to generate an assembly function directive])
case "$ac_cv_asm_func_def" in
  ".def")
     AC_DEFINE([__ASM_FUNC(name)], [".def " __ASM_NAME(name) "; .scl 2; .type 32; .endef"])
     asm_func_header=".def $asm_name_prefix\" #name suffix \"; .scl 2; .type 32; .endef" ;;
     AC_DEFINE([__ASM_FUNC(name)], [".type " __ASM_NAME(name) ",@function"])
     asm_func_header=".type $asm_name_prefix\" #name suffix \",@function" ;;
     AC_DEFINE([__ASM_FUNC(name)], [".type " __ASM_NAME(name) ",2"])
     asm_func_header=".type $asm_name_prefix\" #name suffix \",2" ;;
     AC_DEFINE([__ASM_FUNC(name)], [""])
     asm_func_header="" ;;
AC_CACHE_CHECK([whether asm() works outside of functions], ac_cv_c_asm_outside_funcs,
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[asm(".text\n\t.long 0");]],)],
                      ac_cv_c_asm_outside_funcs="yes",ac_cv_c_asm_outside_funcs="no"))
AC_CACHE_CHECK([whether .previous is supported in assembly code], ac_cv_c_dot_previous,
    WINE_TRY_ASM_LINK([".text\nac_test:\t.long 0\n\t.previous"],,,
                      ac_cv_c_dot_previous="yes",ac_cv_c_dot_previous="no"))
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"))

asm_func_header=".globl $asm_name_prefix\" #name suffix \"\\n\\t$asm_func_header\\n$asm_name_prefix\" #name suffix \":\\n\\t"