[evolution-data-server] libebook-contacts: Always use the C linker



commit ddbef743eee52c7669523884cc43fb27901a5503
Author: Mathias Hasselmann <mathias openismus com>
Date:   Thu Mar 7 12:23:29 2013 +0100

    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.

 addressbook/libebook-contacts/Makefile.am |   23 +++++++++++++++++------
 configure.ac                              |    4 ++++
 2 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/addressbook/libebook-contacts/Makefile.am b/addressbook/libebook-contacts/Makefile.am
index 05fd112..863a4c9 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 88d1c22..511d03b 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 *******************************


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]