summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiarhei Siamashka <siarhei.siamashka@gmail.com>2012-12-16 06:17:20 +0200
committerSiarhei Siamashka <siarhei.siamashka@gmail.com>2012-12-16 06:49:06 +0200
commit362353866525e3bbdef45b121beda1740112f6b4 (patch)
tree824ec775b1537d5908a90578a5db3ffcd3501cf1
parent10a0281264cb8ad9d8611bd0af3916df95fe01bb (diff)
New option to build pixman as C++ code (--enable-enforced-cplusplus)
First of all, there is no intention to start relying on any C++ features for the normal production builds of pixman which are shipped to end users. The C programming language is just fine. However building pixman as C++ code may be sometimes useful for testing and development purposes. C++ is particularly anal about type safety and also allows defining classes for custom data types with operators overloading. It may be handy for the special debugging builds where we can enforce strict rules about what and how can be done with pixman_fixed_t and pixman_fixed_48_16_t, forbid uncontrolled casts between integer and fixed point types, implement custom checks at runtime for detecting overflows or any other potential problems.
-rw-r--r--configure.ac14
-rw-r--r--pixman/Makefile.am2
2 files changed, 16 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 529ed0a..43a1ddb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -754,6 +754,20 @@ fi
AC_SUBST(TESTPROGS_EXTRA_LDFLAGS)
dnl ==============================================
+dnl Force compilation of pixman library in C++ mode (for testing/debugging)
+
+AC_ARG_ENABLE(enforced-cplusplus,
+ [AC_HELP_STRING([--enable-enforced-cplusplus],
+ [unsupported C++ test build [default=no]])],
+ [enable_enforced_cplusplus=$enableval], [enable_enforced_cplusplus=no])
+
+PIXMAN_EXTRA_CPPFLAGS=
+if test "x$enable_enforced_cplusplus" = "xyes" ; then
+ PIXMAN_EXTRA_CPPFLAGS="$PIXMAN_EXTRA_CPPFLAGS -xc++"
+fi
+AC_SUBST(PIXMAN_EXTRA_CPPFLAGS)
+
+dnl ==============================================
dnl Timers
AC_ARG_ENABLE(timers,
diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index cbed085..b0ce7fa 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -1,5 +1,7 @@
include $(top_srcdir)/pixman/Makefile.sources
+AM_CPPFLAGS = $(PIXMAN_EXTRA_CPPFLAGS)
+
lib_LTLIBRARIES = libpixman-1.la
libpixman_1_la_LDFLAGS = -version-info $(LT_VERSION_INFO) -no-undefined @PTHREAD_LDFLAGS@