added libunwind detection to configure.ac

This commit is contained in:
hyunghwan.chung 2018-04-25 15:25:53 +00:00
parent a18f4bec7d
commit a7df146e9e
6 changed files with 82 additions and 7 deletions

View File

@ -307,6 +307,7 @@ SOCKET_LIBS = @SOCKET_LIBS@
STRIP = @STRIP@
TERMINAL_LIBS = @TERMINAL_LIBS@
UNICOWS_LIBS = @UNICOWS_LIBS@
UNWIND_LIBS = @UNWIND_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@

64
moo/configure vendored
View File

@ -673,6 +673,7 @@ QUADMATH_LIBS
UNICOWS_LIBS
SOCKET_LIBS
TERMINAL_LIBS
UNWIND_LIBS
DYNCALL_LIBS
LTDL_LIBS
DL_LIBS
@ -18263,12 +18264,13 @@ fi
done
for ac_header in dyncall.h
for ac_header in netinet/in.h sys/un.h netpacket/packet.h net/if_dl.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "dyncall.h" "ac_cv_header_dyncall_h" "$ac_includes_default"
if test "x$ac_cv_header_dyncall_h" = xyes; then :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_DYNCALL_H 1
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
@ -18287,7 +18289,7 @@ fi
done
for ac_header in netinet/in.h sys/un.h netpacket/packet.h net/if_dl.h
for ac_header in dyncall.h libunwind.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@ -18566,6 +18568,58 @@ fi
if test "x${ac_cv_header_libunwind_h}" = "xyes"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for unw_backtrace in -lunwind" >&5
$as_echo_n "checking for unw_backtrace in -lunwind... " >&6; }
if ${ac_cv_lib_unwind_unw_backtrace+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lunwind $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char unw_backtrace ();
int
main ()
{
return unw_backtrace ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_unwind_unw_backtrace=yes
else
ac_cv_lib_unwind_unw_backtrace=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_unwind_unw_backtrace" >&5
$as_echo "$ac_cv_lib_unwind_unw_backtrace" >&6; }
if test "x$ac_cv_lib_unwind_unw_backtrace" = xyes; then :
UNWIND_LIBS="-lunwind"
$as_echo "#define HAVE_UNWIND_LIB 1" >>confdefs.h
fi
fi
save_LIBS="$LIBS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing setupterm" >&5
$as_echo_n "checking for library containing setupterm... " >&6; }

View File

@ -129,9 +129,9 @@ AC_CHECK_HEADERS([stddef.h wchar.h wctype.h errno.h signal.h fcntl.h dirent.h])
AC_CHECK_HEADERS([time.h sys/time.h utime.h spawn.h execinfo.h ucontext.h])
AC_CHECK_HEADERS([dlfcn.h ltdl.h sys/mman.h])
AC_CHECK_HEADERS([sys/devpoll.h sys/epoll.h poll.h])
AC_CHECK_HEADERS([dyncall.h])
AC_CHECK_HEADERS([xcb/xcb.h])
AC_CHECK_HEADERS([netinet/in.h sys/un.h netpacket/packet.h net/if_dl.h])
AC_CHECK_HEADERS([xcb/xcb.h])
AC_CHECK_HEADERS([dyncall.h libunwind.h])
dnl check data types
dnl AC_CHECK_TYPE([wchar_t],
@ -179,6 +179,18 @@ AC_CHECK_LIB([dyncall_s], [dcNewCallVM],
)
AC_SUBST(DYNCALL_LIBS)
if test "x${ac_cv_header_libunwind_h}" = "xyes"
then
AC_CHECK_LIB([unwind], [unw_backtrace],
[
UNWIND_LIBS="-lunwind"
AC_DEFINE([HAVE_UNWIND_LIB], [1], [libunwind is available])
]
)
AC_SUBST(UNWIND_LIBS)
fi
save_LIBS="$LIBS"
AC_SEARCH_LIBS([setupterm], [tinfo termcap curses ncurses ncursesw], [TERMINAL_LIBS="$ac_cv_search_setupterm"])
LIBS="$save_LIBS"

View File

@ -350,6 +350,7 @@ SOCKET_LIBS = @SOCKET_LIBS@
STRIP = @STRIP@
TERMINAL_LIBS = @TERMINAL_LIBS@
UNICOWS_LIBS = @UNICOWS_LIBS@
UNWIND_LIBS = @UNWIND_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@

View File

@ -99,6 +99,9 @@
/* labels as values */
#undef HAVE_LABELS_AS_VALUES
/* Define to 1 if you have the <libunwind.h> header file. */
#undef HAVE_LIBUNWIND_H
/* Define to 1 if you have the `log10q' function. */
#undef HAVE_LOG10Q
@ -243,6 +246,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* libunwind is available */
#undef HAVE_UNWIND_LIB
/* Define to 1 if you have the `usleep' function. */
#undef HAVE_USLEEP

View File

@ -376,6 +376,7 @@ SOCKET_LIBS = @SOCKET_LIBS@
STRIP = @STRIP@
TERMINAL_LIBS = @TERMINAL_LIBS@
UNICOWS_LIBS = @UNICOWS_LIBS@
UNWIND_LIBS = @UNWIND_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@