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-20 04:01:23 +0200
commit5a7cafaf54225b0adaf17467b4dd42b9ece9a93d (patch)
treee8d30819542204fd128c06e95e3a88240ca5aa4f
parent2cfe188ebd7d1af0d19b7612059202e9f96eee38 (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.ac17
-rw-r--r--pixman/Makefile.am3
2 files changed, 20 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 529ed0a..fe62bef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -754,6 +754,23 @@ 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=
+PIXMAN_EXTRA_CCASFLAGS=
+if test "x$enable_enforced_cplusplus" = "xyes" ; then
+ PIXMAN_EXTRA_CPPFLAGS="$PIXMAN_EXTRA_CPPFLAGS -xc++"
+ PIXMAN_EXTRA_CCASFLAGS="$PIXMAN_EXTRA_CCASFLAGS -xnone"
+fi
+AC_SUBST(PIXMAN_EXTRA_CPPFLAGS)
+AC_SUBST(PIXMAN_EXTRA_CCASFLAGS)
+
+dnl ==============================================
dnl Timers
AC_ARG_ENABLE(timers,
diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index cbed085..6b654fe 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -1,5 +1,8 @@
include $(top_srcdir)/pixman/Makefile.sources
+AM_CPPFLAGS = $(PIXMAN_EXTRA_CPPFLAGS)
+AM_CCASFLAGS = $(PIXMAN_EXTRA_CCASFLAGS)
+
lib_LTLIBRARIES = libpixman-1.la
libpixman_1_la_LDFLAGS = -version-info $(LT_VERSION_INFO) -no-undefined @PTHREAD_LDFLAGS@