configure: Add support for using an external libunwind.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-08-29 14:46:00 +02:00
parent 2002c22afa
commit d2e4a6fae0
5 changed files with 167 additions and 19 deletions

136
configure vendored
View File

@ -662,6 +662,8 @@ FAUDIO_LIBS
FAUDIO_CFLAGS FAUDIO_CFLAGS
SDL2_LIBS SDL2_LIBS
SDL2_CFLAGS SDL2_CFLAGS
UNWIND_LIBS
UNWIND_CFLAGS
UDEV_LIBS UDEV_LIBS
UDEV_CFLAGS UDEV_CFLAGS
OSS4_CFLAGS OSS4_CFLAGS
@ -874,6 +876,7 @@ with_sane
with_sdl with_sdl
with_tiff with_tiff
with_udev with_udev
with_unwind
with_v4l2 with_v4l2
with_vkd3d with_vkd3d
with_vulkan with_vulkan
@ -1852,6 +1855,8 @@ GSTREAMER_CFLAGS
GSTREAMER_LIBS GSTREAMER_LIBS
UDEV_CFLAGS UDEV_CFLAGS
UDEV_LIBS UDEV_LIBS
UNWIND_CFLAGS
UNWIND_LIBS
SDL2_CFLAGS SDL2_CFLAGS
SDL2_LIBS SDL2_LIBS
FAUDIO_CFLAGS FAUDIO_CFLAGS
@ -2559,6 +2564,8 @@ Optional Packages:
--without-sdl do not use SDL --without-sdl do not use SDL
--without-tiff do not use TIFF --without-tiff do not use TIFF
--without-udev do not use udev (plug and play support) --without-udev do not use udev (plug and play support)
--without-unwind do not use the libunwind library (exception
handling)
--without-v4l2 do not use v4l2 (video capture) --without-v4l2 do not use v4l2 (video capture)
--without-vkd3d do not use vkd3d (Direct3D 12 support) --without-vkd3d do not use vkd3d (Direct3D 12 support)
--without-vulkan do not use Vulkan --without-vulkan do not use Vulkan
@ -2640,6 +2647,9 @@ Some influential environment variables:
gstreamer-audio-1.0, overriding pkg-config gstreamer-audio-1.0, overriding pkg-config
UDEV_CFLAGS C compiler flags for libudev, overriding pkg-config UDEV_CFLAGS C compiler flags for libudev, overriding pkg-config
UDEV_LIBS Linker flags for libudev, overriding pkg-config UDEV_LIBS Linker flags for libudev, overriding pkg-config
UNWIND_CFLAGS
C compiler flags for libunwind, overriding pkg-config
UNWIND_LIBS Linker flags for libunwind, overriding pkg-config
SDL2_CFLAGS C compiler flags for sdl2, overriding pkg-config SDL2_CFLAGS C compiler flags for sdl2, overriding pkg-config
SDL2_LIBS Linker flags for sdl2, overriding pkg-config SDL2_LIBS Linker flags for sdl2, overriding pkg-config
FAUDIO_CFLAGS FAUDIO_CFLAGS
@ -4075,6 +4085,12 @@ if test "${with_udev+set}" = set; then :
fi fi
# Check whether --with-unwind was given.
if test "${with_unwind+set}" = set; then :
withval=$with_unwind;
fi
# Check whether --with-v4l2 was given. # Check whether --with-v4l2 was given.
if test "${with_v4l2+set}" = set; then : if test "${with_v4l2+set}" = set; then :
withval=$with_v4l2; withval=$with_v4l2;
@ -5590,6 +5606,7 @@ $as_echo "$wine_cv_cc_m32" >&6; }
PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig} PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig}
export PKG_CONFIG_PATH export PKG_CONFIG_PATH
enable_win16=${enable_win16:-yes} enable_win16=${enable_win16:-yes}
with_unwind=${with_unwind:-no}
else else
if test "x${GCC}" = "xyes" if test "x${GCC}" = "xyes"
then then
@ -5736,6 +5753,7 @@ $as_echo "$wine_cv_builtin_ms_va_list" >&6; }
;; ;;
i[3456789]86*) i[3456789]86*)
enable_win16=${enable_win16:-yes} enable_win16=${enable_win16:-yes}
with_unwind=${with_unwind:-no}
;; ;;
esac esac
@ -8254,18 +8272,6 @@ fi
;; ;;
darwin*|macosx*) darwin*|macosx*)
for ac_header in libunwind.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "libunwind.h" "ac_cv_header_libunwind_h" "$ac_includes_default"
if test "x$ac_cv_header_libunwind_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBUNWIND_H 1
_ACEOF
fi
done
ac_ext=m ac_ext=m
ac_cpp='$OBJCPP $CPPFLAGS' ac_cpp='$OBJCPP $CPPFLAGS'
ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@ -14823,6 +14829,110 @@ esac
fi fi
if test "x$with_unwind" != xno
then
if ${UNWIND_CFLAGS:+false} :; then :
if ${PKG_CONFIG+:} false; then :
UNWIND_CFLAGS=`$PKG_CONFIG --cflags libunwind 2>/dev/null`
fi
fi
if ${UNWIND_LIBS:+false} :; then :
if ${PKG_CONFIG+:} false; then :
UNWIND_LIBS=`$PKG_CONFIG --libs libunwind 2>/dev/null`
fi
fi
UNWIND_LIBS=${UNWIND_LIBS:-"-lunwind"}
$as_echo "$as_me:${as_lineno-$LINENO}: libunwind cflags: $UNWIND_CFLAGS" >&5
$as_echo "$as_me:${as_lineno-$LINENO}: libunwind libs: $UNWIND_LIBS" >&5
ac_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $UNWIND_CFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for unw_getcontext" >&5
$as_echo_n "checking for unw_getcontext... " >&6; }
if ${wine_cv_have_unw_getcontext+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define UNW_LOCAL_ONLY
#include <libunwind.h>
int
main ()
{
unw_context_t context; unw_getcontext( &context );
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
wine_cv_have_unw_getcontext="yes"
else
wine_cv_have_unw_getcontext="no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wine_cv_have_unw_getcontext" >&5
$as_echo "$wine_cv_have_unw_getcontext" >&6; }
if test "$wine_cv_have_unw_getcontext" = no -a -n "$UNWIND_LIBS"
then
save_libs=$LIBS
LIBS="$UNWIND_LIBS $LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for unw_getcontext in libunwind" >&5
$as_echo_n "checking for unw_getcontext in libunwind... " >&6; }
if ${wine_cv_have_libunwind_unw_getcontext+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define UNW_LOCAL_ONLY
#include <libunwind.h>
int
main ()
{
unw_context_t context; unw_getcontext( &context );
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
wine_cv_have_libunwind_unw_getcontext="yes"
else
wine_cv_have_libunwind_unw_getcontext="no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wine_cv_have_libunwind_unw_getcontext" >&5
$as_echo "$wine_cv_have_libunwind_unw_getcontext" >&6; }
test "$wine_cv_have_libunwind_unw_getcontext" = yes || UNWIND_LIBS=""
LIBS=$save_libs
fi
if test "x$wine_cv_have_unw_getcontext$wine_cv_have_libunwind_unw_getcontext" != xnono
then
$as_echo "#define HAVE_LIBUNWIND 1" >>confdefs.h
fi
CPPFLAGS=$ac_save_CPPFLAGS
test -z "$UNWIND_CFLAGS" || UNWIND_CFLAGS=`echo " $UNWIND_CFLAGS" | sed 's/ -I\([^/]\)/ -I\$(top_builddir)\/\1/g'`
test -z "$UNWIND_LIBS" || UNWIND_LIBS=`echo " $UNWIND_LIBS" | sed 's/ -L\([^/]\)/ -L\$(top_builddir)\/\1/g'`
fi
case $host in
aarch64*|*-darwin*)
if test "x$wine_cv_have_unw_getcontext$wine_cv_have_libunwind_unw_getcontext" != xnono; then :
case "x$with_unwind" in
x) as_fn_append wine_notices "|libunwind ${notice_platform}development files not found, stack unwinding won't work." ;;
xno) ;;
*) as_fn_error $? "libunwind ${notice_platform}development files not found, stack unwinding won't work.
This is an error since --with-unwind was requested." "$LINENO" 5 ;;
esac
fi ;;
esac
if test "x$with_sdl" != "xno" if test "x$with_sdl" != "xno"
then then
if ${SDL2_CFLAGS:+false} :; then : if ${SDL2_CFLAGS:+false} :; then :
@ -19717,6 +19827,8 @@ ALSA_LIBS = $ALSA_LIBS
OSS4_CFLAGS = $OSS4_CFLAGS OSS4_CFLAGS = $OSS4_CFLAGS
UDEV_CFLAGS = $UDEV_CFLAGS UDEV_CFLAGS = $UDEV_CFLAGS
UDEV_LIBS = $UDEV_LIBS UDEV_LIBS = $UDEV_LIBS
UNWIND_CFLAGS = $UNWIND_CFLAGS
UNWIND_LIBS = $UNWIND_LIBS
SDL2_CFLAGS = $SDL2_CFLAGS SDL2_CFLAGS = $SDL2_CFLAGS
SDL2_LIBS = $SDL2_LIBS SDL2_LIBS = $SDL2_LIBS
FAUDIO_CFLAGS = $FAUDIO_CFLAGS FAUDIO_CFLAGS = $FAUDIO_CFLAGS

View File

@ -82,6 +82,7 @@ AC_ARG_WITH(sane, AS_HELP_STRING([--without-sane],[do not use SANE (scanner
AC_ARG_WITH(sdl, AS_HELP_STRING([--without-sdl],[do not use SDL])) AC_ARG_WITH(sdl, AS_HELP_STRING([--without-sdl],[do not use SDL]))
AC_ARG_WITH(tiff, AS_HELP_STRING([--without-tiff],[do not use TIFF])) AC_ARG_WITH(tiff, AS_HELP_STRING([--without-tiff],[do not use TIFF]))
AC_ARG_WITH(udev, AS_HELP_STRING([--without-udev],[do not use udev (plug and play support)])) AC_ARG_WITH(udev, AS_HELP_STRING([--without-udev],[do not use udev (plug and play support)]))
AC_ARG_WITH(unwind, AS_HELP_STRING([--without-unwind],[do not use the libunwind library (exception handling)]))
AC_ARG_WITH(v4l2, AS_HELP_STRING([--without-v4l2],[do not use v4l2 (video capture)])) AC_ARG_WITH(v4l2, AS_HELP_STRING([--without-v4l2],[do not use v4l2 (video capture)]))
AC_ARG_WITH(vkd3d, AS_HELP_STRING([--without-vkd3d],[do not use vkd3d (Direct3D 12 support)])) AC_ARG_WITH(vkd3d, AS_HELP_STRING([--without-vkd3d],[do not use vkd3d (Direct3D 12 support)]))
AC_ARG_WITH(vulkan, AS_HELP_STRING([--without-vulkan],[do not use Vulkan])) AC_ARG_WITH(vulkan, AS_HELP_STRING([--without-vulkan],[do not use Vulkan]))
@ -161,6 +162,7 @@ case $host in
PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig} PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig}
export PKG_CONFIG_PATH export PKG_CONFIG_PATH
enable_win16=${enable_win16:-yes} enable_win16=${enable_win16:-yes}
with_unwind=${with_unwind:-no}
else else
if test "x${GCC}" = "xyes" if test "x${GCC}" = "xyes"
then then
@ -214,6 +216,7 @@ case $host in
;; ;;
i[[3456789]]86*) i[[3456789]]86*)
enable_win16=${enable_win16:-yes} enable_win16=${enable_win16:-yes}
with_unwind=${with_unwind:-no}
;; ;;
esac esac
@ -743,7 +746,6 @@ case $host_os in
;; ;;
darwin*|macosx*) darwin*|macosx*)
AC_CHECK_HEADERS(libunwind.h)
AC_LANG_PUSH([Objective C]) AC_LANG_PUSH([Objective C])
AC_CHECK_HEADERS(Metal/Metal.h) AC_CHECK_HEADERS(Metal/Metal.h)
AC_LANG_POP([Objective C]) AC_LANG_POP([Objective C])
@ -1676,6 +1678,39 @@ fi
WINE_NOTICE_WITH(udev,[test "x$UDEV_LIBS" = "x"], WINE_NOTICE_WITH(udev,[test "x$UDEV_LIBS" = "x"],
[libudev ${notice_platform}development files not found, plug and play won't be supported.]) [libudev ${notice_platform}development files not found, plug and play won't be supported.])
dnl **** Check for libuwind ****
if test "x$with_unwind" != xno
then
WINE_PACKAGE_FLAGS(UNWIND,[libunwind],[-lunwind],,,
[AC_CACHE_CHECK([for unw_getcontext],wine_cv_have_unw_getcontext,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define UNW_LOCAL_ONLY
#include <libunwind.h>]],
[[unw_context_t context; unw_getcontext( &context );]])],
[wine_cv_have_unw_getcontext="yes"],[wine_cv_have_unw_getcontext="no"])])
if test "$wine_cv_have_unw_getcontext" = no -a -n "$UNWIND_LIBS"
then
save_libs=$LIBS
LIBS="$UNWIND_LIBS $LIBS"
AC_CACHE_CHECK([for unw_getcontext in libunwind],wine_cv_have_libunwind_unw_getcontext,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define UNW_LOCAL_ONLY
#include <libunwind.h>]],
[[unw_context_t context; unw_getcontext( &context );]])],
[wine_cv_have_libunwind_unw_getcontext="yes"],
[wine_cv_have_libunwind_unw_getcontext="no"])])
test "$wine_cv_have_libunwind_unw_getcontext" = yes || UNWIND_LIBS=""
LIBS=$save_libs
fi
if test "x$wine_cv_have_unw_getcontext$wine_cv_have_libunwind_unw_getcontext" != 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_getcontext$wine_cv_have_libunwind_unw_getcontext" != xnono],
[libunwind ${notice_platform}development files not found, stack unwinding won't work.]) ;;
esac
dnl **** Check for libSDL2 **** dnl **** Check for libSDL2 ****
if test "x$with_sdl" != "xno" if test "x$with_sdl" != "xno"
then then

View File

@ -2,7 +2,8 @@ EXTRADEFS = -D_NTSYSTEM_
MODULE = ntdll.dll MODULE = ntdll.dll
IMPORTLIB = ntdll IMPORTLIB = ntdll
IMPORTS = winecrt0 IMPORTS = winecrt0
EXTRALIBS = $(IOKIT_LIBS) $(RT_LIBS) $(PTHREAD_LIBS) EXTRAINCL = $(UNWIND_CFLAGS)
EXTRALIBS = $(IOKIT_LIBS) $(RT_LIBS) $(PTHREAD_LIBS) $(UNWIND_LIBS)
EXTRADLLFLAGS = -nodefaultlibs -Wl,--image-base,0x7bc00000 EXTRADLLFLAGS = -nodefaultlibs -Wl,--image-base,0x7bc00000
C_SRCS = \ C_SRCS = \

View File

@ -51,7 +51,7 @@
#ifdef HAVE_SYS_UCONTEXT_H #ifdef HAVE_SYS_UCONTEXT_H
# include <sys/ucontext.h> # include <sys/ucontext.h>
#endif #endif
#ifdef HAVE_LIBUNWIND_H #ifdef HAVE_LIBUNWIND
# define UNW_LOCAL_ONLY # define UNW_LOCAL_ONLY
# include <libunwind.h> # include <libunwind.h>
#endif #endif
@ -1409,7 +1409,7 @@ static NTSTATUS dwarf_virtual_unwind( ULONG64 ip, ULONG64 *frame,CONTEXT *contex
} }
#ifdef HAVE_LIBUNWIND_H #ifdef HAVE_LIBUNWIND
/*********************************************************************** /***********************************************************************
* libunwind_set_cursor_from_context * libunwind_set_cursor_from_context
*/ */
@ -1629,7 +1629,7 @@ static NTSTATUS virtual_unwind( ULONG type, DISPATCHER_CONTEXT *dispatch, CONTEX
if (status != STATUS_SUCCESS) return status; if (status != STATUS_SUCCESS) return status;
got_info = TRUE; got_info = TRUE;
} }
#ifdef HAVE_LIBUNWIND_H #ifdef HAVE_LIBUNWIND
else else
{ {
status = libunwind_virtual_unwind( context->Rip, &got_info, &dispatch->EstablisherFrame, status = libunwind_virtual_unwind( context->Rip, &got_info, &dispatch->EstablisherFrame,

View File

@ -419,8 +419,8 @@
/* Define to 1 if you have the <libudev.h> header file. */ /* Define to 1 if you have the <libudev.h> header file. */
#undef HAVE_LIBUDEV_H #undef HAVE_LIBUDEV_H
/* Define to 1 if you have the <libunwind.h> header file. */ /* Define to 1 if you have the `unwind' library (-lunwind). */
#undef HAVE_LIBUNWIND_H #undef HAVE_LIBUNWIND
/* Define if you have the libxml2 library */ /* Define if you have the libxml2 library */
#undef HAVE_LIBXML2 #undef HAVE_LIBXML2