summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Hasselmann <mathias@openismus.com>2013-03-07 12:23:29 +0100
committerMathias Hasselmann <mathias@openismus.com>2013-03-07 14:05:09 +0100
commitddbef743eee52c7669523884cc43fb27901a5503 (patch)
tree70ef3aa4efcdf853cc0d88a993788d5b577ba52e
parent56bc66ba1dbbf07d92c13c2bb28a64139d94f4be (diff)
downloadevolution-data-server-ddbef743eee52c7669523884cc43fb27901a5503.tar.gz
libebook-contacts: Always use the C linker
Ensure that libebook-contacts always gets linked using the C linker, instead of the C++ automake would prefer, because of the optional e-phone-number-private.cpp file. Without this change linking with explicitly disabled phone number support (--without-phonenumber) would fail because no C++ linker is know. Similarly the library would depend on the C++ standard library if phone number was disabled automatically, because libphonenumber was not found.
-rw-r--r--addressbook/libebook-contacts/Makefile.am23
-rw-r--r--configure.ac4
2 files changed, 21 insertions, 6 deletions
diff --git a/addressbook/libebook-contacts/Makefile.am b/addressbook/libebook-contacts/Makefile.am
index 05fd112dc..863a4c9f6 100644
--- a/addressbook/libebook-contacts/Makefile.am
+++ b/addressbook/libebook-contacts/Makefile.am
@@ -17,6 +17,11 @@ MARSHAL_GENERATED = e-book-contacts-marshal.c e-book-contacts-marshal.h
# The library
lib_LTLIBRARIES = libebook-contacts-1.2.la
+noinst_LTLIBRARIES =
+
+if ENABLE_PHONENUMBER
+noinst_LTLIBRARIES += libephonenumber-private.la
+endif # ENABLE_PHONENUMBER
libebook_contacts_1_2_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
@@ -52,12 +57,6 @@ libebook_contacts_1_2_la_LIBADD = \
$(EVOLUTION_ADDRESSBOOK_LIBS) \
$(CAMEL_LIBS)
-if ENABLE_PHONENUMBER
-libebook_contacts_1_2_la_SOURCES += e-phone-number-private.cpp
-libebook_contacts_1_2_la_CPPFLAGS += $(PHONENUMBER_INCLUDES)
-libebook_contacts_1_2_la_LIBADD += $(PHONENUMBER_LIBS)
-endif # ENABLE_PHONENUMBER
-
libebook_contacts_1_2_la_LDFLAGS = \
-version-info $(LIBEBOOK_CONTACTS_CURRENT):$(LIBEBOOK_CONTACTS_REVISION):$(LIBEBOOK_CONTACTS_AGE) $(NO_UNDEFINED) \
$(CODE_COVERAGE_LDFLAGS) \
@@ -77,6 +76,18 @@ libebookcontactsinclude_HEADERS = \
e-phone-number.h \
e-source-backend-summary-setup.h
+if ENABLE_PHONENUMBER
+
+# We put the C++ code into a separate static library, so that we can use
+# the C linker for libebook-contacts. This avoids that libebook-contacts
+# depends on the C++ Standard Library, even if phone number support is
+# disabled.
+libephonenumber_private_la_SOURCES = e-phone-number-private.cpp
+libephonenumber_private_la_CPPFLAGS = $(libebook_contacts_1_2_la_CPPFLAGS) $(PHONENUMBER_INCLUDES)
+libebook_contacts_1_2_la_LIBADD += @predeps_CXX@ libephonenumber-private.la $(PHONENUMBER_LIBS) @postdeps_CXX@
+
+endif # ENABLE_PHONENUMBER
+
%-$(API_VERSION).pc: %.pc
cp $< $@
diff --git a/configure.ac b/configure.ac
index 88d1c2219..511d03b7f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -231,6 +231,10 @@ else
am__fastdepCXX_FALSE=
fi
+dnl Permits linking of C++ based libraries using the C linker if needed.
+AC_SUBST([predeps_CXX])
+AC_SUBST([postdeps_CXX])
+
dnl *******************************
dnl Check for --enable-strict
dnl *******************************