mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-13 07:34:28 +08:00
libbacktrace: Support the case that clock_gettime is in librt
libbacktrace/ PR other/67165 * Makefile.am: Append the content of clock_gettime_link to ztest_LDADD. * configure.ac: Test for the case that clock_gettime is in librt. * Makefile.in: Regenerate. * configure: Likewise. From-SVN: r253345
This commit is contained in:
parent
dbc31f20d3
commit
dd954c67ab
@ -1,5 +1,12 @@
|
||||
2017-10-02 Thomas Schwinge <thomas@codesourcery.com>
|
||||
|
||||
PR other/67165
|
||||
* Makefile.am: Append the content of clock_gettime_link to
|
||||
ztest_LDADD.
|
||||
* configure.ac: Test for the case that clock_gettime is in librt.
|
||||
* Makefile.in: Regenerate.
|
||||
* configure: Likewise.
|
||||
|
||||
PR other/67165
|
||||
* configure.ac: Check for clock_gettime.
|
||||
* config.h.in: Regenerate.
|
||||
|
@ -108,6 +108,7 @@ ztest_LDADD = libbacktrace.la
|
||||
if HAVE_ZLIB
|
||||
ztest_LDADD += -lz
|
||||
endif
|
||||
ztest_LDADD += $(clock_gettime_link)
|
||||
|
||||
check_PROGRAMS += ztest
|
||||
|
||||
|
@ -165,7 +165,7 @@ ttest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
@NATIVE_TRUE@ ztest-testlib.$(OBJEXT)
|
||||
ztest_OBJECTS = $(am_ztest_OBJECTS)
|
||||
@NATIVE_TRUE@ztest_DEPENDENCIES = libbacktrace.la \
|
||||
@NATIVE_TRUE@ $(am__DEPENDENCIES_1)
|
||||
@NATIVE_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
ztest_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
||||
--mode=link $(CCLD) $(ztest_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
||||
$(LDFLAGS) -o $@
|
||||
@ -287,6 +287,7 @@ build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
clock_gettime_link = @clock_gettime_link@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
@ -383,7 +384,8 @@ TESTS = $(check_PROGRAMS) $(am__append_4)
|
||||
@NATIVE_TRUE@stest_LDADD = libbacktrace.la
|
||||
@NATIVE_TRUE@ztest_SOURCES = ztest.c testlib.c
|
||||
@NATIVE_TRUE@ztest_CFLAGS = -DSRCDIR=\"$(srcdir)\"
|
||||
@NATIVE_TRUE@ztest_LDADD = libbacktrace.la $(am__append_2)
|
||||
@NATIVE_TRUE@ztest_LDADD = libbacktrace.la $(am__append_2) \
|
||||
@NATIVE_TRUE@ $(clock_gettime_link)
|
||||
@NATIVE_TRUE@edtest_SOURCES = edtest.c edtest2_build.c testlib.c
|
||||
@NATIVE_TRUE@edtest_LDADD = libbacktrace.la
|
||||
@HAVE_PTHREAD_TRUE@@NATIVE_TRUE@ttest_SOURCES = ttest.c testlib.c
|
||||
|
56
libbacktrace/configure
vendored
56
libbacktrace/configure
vendored
@ -614,6 +614,7 @@ HAVE_ZLIB_TRUE
|
||||
HAVE_PTHREAD_FALSE
|
||||
HAVE_PTHREAD_TRUE
|
||||
PTHREAD_CFLAGS
|
||||
clock_gettime_link
|
||||
BACKTRACE_USES_MALLOC
|
||||
ALLOC_FILE
|
||||
VIEW_FILE
|
||||
@ -11145,7 +11146,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11148 "configure"
|
||||
#line 11149 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -11251,7 +11252,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11254 "configure"
|
||||
#line 11255 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -12759,6 +12760,57 @@ _ACEOF
|
||||
fi
|
||||
done
|
||||
|
||||
clock_gettime_link=
|
||||
# At least for glibc, clock_gettime is in librt. But don't
|
||||
# pull that in if it still doesn't give us the function we want. This
|
||||
# test is copied from libgomp, and modified to not link in -lrt as
|
||||
# we're using this for test timing only.
|
||||
if test "$ac_cv_func_clock_gettime" = no; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
|
||||
$as_echo_n "checking for clock_gettime in -lrt... " >&6; }
|
||||
if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lrt $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 clock_gettime ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return clock_gettime ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
ac_cv_lib_rt_clock_gettime=yes
|
||||
else
|
||||
ac_cv_lib_rt_clock_gettime=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_rt_clock_gettime" >&5
|
||||
$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; }
|
||||
if test "x$ac_cv_lib_rt_clock_gettime" = x""yes; then :
|
||||
clock_gettime_link=-lrt
|
||||
|
||||
$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -pthread is supported" >&5
|
||||
$as_echo_n "checking whether -pthread is supported... " >&6; }
|
||||
|
@ -390,6 +390,18 @@ fi
|
||||
|
||||
# Check for the clock_gettime function.
|
||||
AC_CHECK_FUNCS(clock_gettime)
|
||||
clock_gettime_link=
|
||||
# At least for glibc, clock_gettime is in librt. But don't
|
||||
# pull that in if it still doesn't give us the function we want. This
|
||||
# test is copied from libgomp, and modified to not link in -lrt as
|
||||
# we're using this for test timing only.
|
||||
if test "$ac_cv_func_clock_gettime" = no; then
|
||||
AC_CHECK_LIB(rt, clock_gettime,
|
||||
[clock_gettime_link=-lrt
|
||||
AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
|
||||
[Define to 1 if you have the `clock_gettime' function.])])
|
||||
fi
|
||||
AC_SUBST(clock_gettime_link)
|
||||
|
||||
dnl Test whether the compiler supports the -pthread option.
|
||||
AC_CACHE_CHECK([whether -pthread is supported],
|
||||
|
Loading…
Reference in New Issue
Block a user