[cairo-commit] 2 commits - build/configure.ac.features configure.ac src/Makefile.am src/Makefile.am.analysis src/Makefile.sources

Benjamin Otte company at kemper.freedesktop.org
Fri Jul 9 03:40:00 PDT 2010


 build/configure.ac.features |    8 ++++++--
 configure.ac                |   10 ++++++++++
 src/Makefile.am             |   21 +++++++++++++++++++--
 src/Makefile.am.analysis    |    4 ++--
 src/Makefile.sources        |    6 +++---
 5 files changed, 40 insertions(+), 9 deletions(-)

New commits:
commit f7fc8569a797356d5e93ad67aae4eca31e6835cd
Author: Benjamin Otte <otte at redhat.com>
Date:   Fri Jul 9 12:29:35 2010 +0200

    build: Fix C++ issues with automake
    
    This is an attempt to fix the broken situation we've been in where
    automake links libcairo.la with c++ because it might potentially maybe
    include C++ files.
    
    Those potential files only exist in Chris' throwaway backends (skia, qt)
    and the BeOS backend, so for 99.99% of cases, these backends are not
    needed and linking with c++ is overkill. Also, no one wants to have
    libcairo.so link to libstdc++.
    
    This patch fixes that in mutliple steps:
    1) Add build infrastructure to distinguish between C and C++ backends.
       This is done by allowing to specify backend_sources as well as
       backend_cxx_sources variables in Makefile.sources.
    2) Optionally build a libcairo_cxx.la noinst library
       This intermediate library is built for C++ backends only and therefor
       linked using c++. It is then linked into the final libcairo.la. This
       does not require c++, so the linking of libcairo.la is done with cc.
    
    This also works around various weirdnesses that the current build system
    exposes, where it assumes cisms when in fact using c++ semantics, like
    not detecting c++ properly or:
    https://bugzilla.redhat.com/show_bug.cgi?id=606523

diff --git a/build/configure.ac.features b/build/configure.ac.features
index 203d2bf..d349a84 100644
--- a/build/configure.ac.features
+++ b/build/configure.ac.features
@@ -83,15 +83,16 @@ CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,no,!,
 dnl Collect list of source files for all public features
 CAIRO_MAKEFILE_ACCUMULATE(*,
 [dnl
-all_$1_files = $(all_$1_headers) $(all_$1_private) $(all_$1_sources)
 all_$1_headers = $($1_headers)
 all_$1_private = $($1_private)
+all_$1_cxx_sources = $($1_cxx_sources)
 all_$1_sources = $($1_sources)
 ])dnl
 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,*,!,
 [dnl
 all_$1_headers += $($1_$2_headers)
 all_$1_private += $($1_$2_private)
+all_$1_cxx_sources += $($1_$2_cxx_sources)
 all_$1_sources += $($1_$2_sources)]dnl
 )dnl
 
@@ -100,12 +101,14 @@ CAIRO_MAKEFILE_ACCUMULATE(*,
 [dnl
 enabled_$1_headers = $($1_headers)
 enabled_$1_private = $($1_private)
+enabled_$1_cxx_sources = $($1_cxx_sources)
 enabled_$1_sources = $($1_sources)
 ])dnl
 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,yes,*,!,
 [dnl
 enabled_$1_headers += $($1_$2_headers)
 enabled_$1_private += $($1_$2_private)
+enabled_$1_cxx_sources += $($1_$2_cxx_sources)
 enabled_$1_sources += $($1_$2_sources)]dnl
 )dnl
 
@@ -115,6 +118,7 @@ dnl Collect list of source files for all private features
 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,*,*,,
 [dnl
 all_$1_private += $($1_$2_private) $($1_$2_headers)
+all_$1_cxx_sources += $($1_$2_cxx_sources)
 all_$1_sources += $($1_$2_sources)]dnl
 )dnl
 
@@ -122,6 +126,7 @@ dnl Collect list of source files for enabled private features
 CAIRO_MAKEFILE_ACCUMULATE_FEATURE(*,yes,*,,
 [dnl
 enabled_$1_private += $($1_$2_private) $($1_$2_headers)
+enabled_$1_cxx_sources += $($1_$2_cxx_sources)
 enabled_$1_sources += $($1_$2_sources)]dnl
 )dnl
 
diff --git a/configure.ac b/configure.ac
index 8d2c007..cb32d7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -777,6 +777,16 @@ fi
 
 dnl ===========================================================================
 
+dnl Extra stuff we need to do when building C++ code
+need_cxx="no"
+AS_IF([test "x$use_skia" = "xyes"], [need_cxx="yes"])
+AS_IF([test "x$use_qt" = "xyes"], [need_cxx="yes"])
+AS_IF([test "x$use_beos" = "xyes"], [need_cxx="yes"])
+
+AM_CONDITIONAL(BUILD_CXX, test "x$need_cxx" = "xyes")
+
+dnl ===========================================================================
+
 # We use GTK+ for some utility/debugging tools
 PKG_CHECK_MODULES(gtk, "gtk+-2.0",have_gtk=yes, have_gtk=no)
 AM_CONDITIONAL(HAVE_GTK, test "x$have_gtk" = "xyes")
diff --git a/src/Makefile.am b/src/Makefile.am
index a97c13e..b934498 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,13 +24,31 @@ cairoinclude_HEADERS = $(enabled_cairo_headers)
 
 lib_LTLIBRARIES = libcairo.la
 
+if BUILD_CXX
+cairo_cxx_lib = libcairo_cxx.la
+else
+cairo_cxx_lib = libcairo_cxx.la
+endif
+
+noinst_LTLIBRARIES = $(cairo_cxx_lib)
+libcairo_cxx_la_SOURCES = \
+	$(enabled_cairo_headers) \
+	$(enabled_cairo_private) \
+	$(enabled_cairo_cxx_sources) \
+	$(NULL)
+libcairo_cxx_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(CAIRO_LIBTOOL_VERSION_INFO) -no-undefined $(export_symbols)
+libcairo_cxx_la_LIBADD = $(CAIRO_LIBS)
+libcairo_cxx_la_DEPENDENCIES = $(cairo_def_dependency)
+
+
 libcairo_la_SOURCES = \
 	$(enabled_cairo_headers) \
 	$(enabled_cairo_private) \
 	$(enabled_cairo_sources) \
 	$(NULL)
 libcairo_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(CAIRO_LIBTOOL_VERSION_INFO) -no-undefined $(export_symbols)
-libcairo_la_LIBADD = $(CAIRO_LIBS)
+libcairo_la_LIBADD = $(CAIRO_LIBS) \
+	$(enabled_cairo_cxx_lib)
 libcairo_la_DEPENDENCIES = $(cairo_def_dependency)
 
 # Special headers
diff --git a/src/Makefile.am.analysis b/src/Makefile.am.analysis
index ea9caec..2822320 100644
--- a/src/Makefile.am.analysis
+++ b/src/Makefile.am.analysis
@@ -2,7 +2,7 @@
 SPARSE = sparse
 sparse:
 	@echo Checking enabled sources with sparse checker
-	@status=true; for f in $(enabled_cairo_sources); do \
+	@status=true; for f in $(enabled_cairo_sources) $(enabled_cairo_cxx_sources); do \
 		echo $(SPARSE) $(PREPROCESS_ARGS) $(srcdir)/$$f; \
 		$(SPARSE) $(PREPROCESS_ARGS) $(srcdir)/$$f || status=false; \
 	done; $$status
@@ -10,7 +10,7 @@ sparse:
 SPLINT = splint -badflag
 splint:
 	@echo Checking enabled sources with splint checker
-	@status=true; for f in $(enabled_cairo_sources); do \
+	@status=true; for f in $(enabled_cairo_sources) $(enabled_cairo_cxx_sources); do \
 		echo $(SPLINT) $(PREPROCESS_ARGS) $(srcdir)/$$f; \
 		$(SPLINT) $(PREPROCESS_ARGS) $(srcdir)/$$f || status=false; \
 	done; $$status
diff --git a/src/Makefile.sources b/src/Makefile.sources
index 68befae..cbb59fb 100644
--- a/src/Makefile.sources
+++ b/src/Makefile.sources
@@ -285,7 +285,7 @@ cairo_xcb_sources += \
 endif
 
 cairo_qt_headers = cairo-qt.h
-cairo_qt_sources = cairo-qt-surface.cpp
+cairo_qt_cxx_sources = cairo-qt-surface.cpp
 
 cairo_quartz_headers = cairo-quartz.h
 cairo_quartz_private = cairo-quartz-private.h
@@ -303,7 +303,7 @@ cairo_win32_sources = cairo-win32-surface.c cairo-win32-printing-surface.c
 cairo_win32_font_sources = cairo-win32-font.c
 
 cairo_skia_headers = cairo-skia.h
-cairo_skia_sources = cairo-skia-surface.cpp
+cairo_skia_cxx_sources = cairo-skia-surface.cpp
 
 cairo_os2_headers = cairo-os2.h
 cairo_os2_private = cairo-os2-private.h
@@ -312,7 +312,7 @@ cairo_os2_sources = cairo-os2-surface.c
 # automake is stupid enough to always use c++ linker if we enable the
 # following lines, even if beos surface is not enabled.  Disable it for now.
 cairo_beos_headers = cairo-beos.h
-#cairo_beos_sources = cairo-beos-surface.cpp
+cairo_beos_cxx_sources = cairo-beos-surface.cpp
 
 cairo_gl_headers = cairo-gl.h
 cairo_gl_private = cairo-gl-private.h \
commit df6d49f6eaf334d5a2de8bdd90919278071ab868
Author: Benjamin Otte <otte at redhat.com>
Date:   Fri Jul 9 10:29:30 2010 +0200

    build: Get rid of $(foo_files) Makefile.am variables
    
    They're unused, and less variables make the build system easier to
    understand.

diff --git a/build/configure.ac.features b/build/configure.ac.features
index 1473bd7..203d2bf 100644
--- a/build/configure.ac.features
+++ b/build/configure.ac.features
@@ -98,7 +98,6 @@ all_$1_sources += $($1_$2_sources)]dnl
 dnl Collect list of source files for enabled public features
 CAIRO_MAKEFILE_ACCUMULATE(*,
 [dnl
-enabled_$1_files = $(enabled_$1_headers) $(enabled_$1_private) $(enabled_$1_sources)
 enabled_$1_headers = $($1_headers)
 enabled_$1_private = $($1_private)
 enabled_$1_sources = $($1_sources)
diff --git a/src/Makefile.am b/src/Makefile.am
index b6f8c57..a97c13e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -67,7 +67,6 @@ TESTS_ENVIRONMENT = \
 	all_cairo_headers="$(all_cairo_headers)" \
 	all_cairo_private="$(all_cairo_private)" \
 	all_cairo_sources="$(all_cairo_sources)" \
-	enabled_cairo_files="$(enabled_cairo_files)" \
 	enabled_cairo_headers="$(enabled_cairo_headers)" \
 	enabled_cairo_private="$(enabled_cairo_private)" \
 	enabled_cairo_sources="$(enabled_cairo_sources)" \


More information about the cairo-commit mailing list