Permalink
Browse files

Fix libtool building of tcov

After digging a while with the linker and libtool it seems like
it's just a bug in libtool that eats off -xprofile=tcov when
building a shared library (but it pass it to normal linking)

Change-Id: Ic6fc546427d2c858c26b902baa9da573117d9e6d
Reviewed-on: http://review.couchbase.org/15935
Reviewed-by: Chiyoung Seo <chiyoung.seo@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information...
1 parent 03030c2 commit 80581c314c7fdc85c114f156949c5a9c7c230f55 @trondn trondn committed May 11, 2012
Showing with 10 additions and 9 deletions.
  1. +4 −3 Makefile.am
  2. +6 −6 m4/couchbase.m4
View
@@ -24,8 +24,9 @@ pkginclude_HEADERS = \
libcbio_la_CPPFLAGS = $(AM_CPPFLAGS) -DLIBCBIO_INTERNAL=1
libcbio_la_SOURCES = src/document.c src/error.c src/instance.c src/internal.h
-libcbio_la_LDFLAGS = $(AM_LDFLAGS) $(AM_PROFILE_C_LDFLAGS) -lcouchstore \
- -version-info $(LIBCBIO_API_CURRENT):$(LIBCBIO_API_REVISION):$(LIBCBIO_API_AGE) -no-undefined
+libcbio_la_LDFLAGS = $(AM_LDFLAGS) -lcouchstore $(AM_PROFILE_SOLDFLAGS) \
+ -version-info $(LIBCBIO_API_CURRENT):$(LIBCBIO_API_REVISION):$(LIBCBIO_API_AGE) \
+ -no-undefined
check_PROGRAMS =
@@ -40,7 +41,7 @@ tests_cbio_unit_tests_SOURCES = tests/cbio_unit_tests.cc \
tests/strerror_unit_tests.cc \
tests/instance_unit_tests.cc
tests_cbio_unit_tests_DEPENDENCIES = libcbio.la
-tests_cbio_unit_tests_LDFLAGS = $(AM_PROFILE_CXX_LDFLAGS) -lgtest libcbio.la
+tests_cbio_unit_tests_LDADD = -lgtest libcbio.la
LINTFLAGS=-Iinclude -b -c -errchk=%all \
-erroff=E_INCL_NUSD,E_CAST_INT_TO_SMALL_INT,E_PTRDIFF_OVERFLOW \
View
@@ -161,19 +161,19 @@ AC_DEFUN([COUCHBASE_GENERIC_COMPILER], [
AS_IF([test "$ac_cv_enable_gcov" = "yes"],
[
AM_CPPFLAGS="$AM_CPPFLAGS -fprofile-arcs -ftest-coverage"
- AM_PROFILE_C_LDFLAGS="-lgcov"
- AM_PROFILE_CXX_LDFLAGS="-lgcov"
+ AM_LDFLAGS="$AM_LDFLAGS -lgcov"
])
dnl tcov settings
AS_IF([test "$ac_cv_enable_tcov" = "yes"],
[
AM_CPPFLAGS="$AM_CPPFLAGS -xprofile=tcov"
- AM_PROFILE_C_LDFLAGS="-Wc,-xprofile=tcov"
- AM_PROFILE_CXX_LDFLAGS="-xprofile=tcov"
+ AM_LDFLAGS="$AM_LDFLAGS -xprofile=tcov"
+ dnl due to the stupid libtool it's dropping -xprofile when
+ dnl building shared objects.. let's fool it..
+ AM_PROFILE_SOLDFLAGS="-Wc,-xprofile=tcov"
])
- AC_SUBST(AM_PROFILE_C_LDFLAGS)
- AC_SUBST(AM_PROFILE_CXX_LDFLAGS)
+ AC_SUBST(AM_PROFILE_SOLDFLAGS)
dnl Export GCC variables
AC_SUBST(GCC_NO_WERROR)

0 comments on commit 80581c3

Please sign in to comment.