Re: [PATCH] Link ocount with librt for clock_gettime only when needed
Carl Love <[email protected]>
| Newsgroups | gmane.linux.oprofile |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 2014-08-08 at 10:45 -0500, Maynard Johnson wrote: > Link ocount with librt for clock_gettime only when needed > > With GLIBC 2.17, the clock_* functions were moved from librt > to libc. The ocount tool uses clock_gettime. This patch adds > a configure check to determine whether or not to link with > "-lrt". > > Signed-off-by: Maynard Johnson <[email protected]> Acked-by: Carl Love <[email protected]> I don't see any issues with the patch. I tested on a PPC64 BE. It checked out fine. Carl Love > --- > configure.ac | 6 ++++++ > pe_counting/Makefile.am | 4 ++-- > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/configure.ac b/configure.ac > index d80ec1b..a84c9be 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -395,6 +395,12 @@ AM_CONDITIONAL(CHECK_ACCOUNT, test "x$enable_account_check" = "xyes") > AC_SUBST(OP_CFLAGS) > AC_SUBST(OP_CXXFLAGS) > > +AC_CHECK_FUNC(clock_gettime, [], [ > + AC_CHECK_LIB(rt, clock_gettime, RT_LIB="-lrt", > + AC_MSG_ERROR(Unable to find clock_gettime function; required by ocount))]) > +AC_SUBST(RT_LIB) > + > + > # fixups for config.h > if test "$prefix" = "NONE"; then > my_op_prefix="$ac_default_prefix" > diff --git a/pe_counting/Makefile.am b/pe_counting/Makefile.am > index c46fd74..fadd4d9 100644 > --- a/pe_counting/Makefile.am > +++ b/pe_counting/Makefile.am > @@ -1,4 +1,4 @@ > -LIBS=@LIBERTY_LIBS@ @PFM_LIB@ > +LIBS=@LIBERTY_LIBS@ @PFM_LIB@ @RT_LIB@ > if BUILD_FOR_PERF_EVENT > > AM_CPPFLAGS = \ > @@ -19,7 +19,7 @@ AM_CXXFLAGS = @OP_CXXFLAGS@ > AM_LDFLAGS = @OP_LDFLAGS@ > > bin_PROGRAMS = ocount > -ocount_LDADD = -lrt ../libpe_utils/libpe_utils.a \ > +ocount_LDADD = ../libpe_utils/libpe_utils.a \ > ../libpe_utils/libpe_utils.a \ > ../libop/libop.a \ > ../libutil/libutil.a \ ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds