aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2018-03-20 15:41:15 -0700
committerAndres Freund <andres@anarazel.de>2018-03-20 15:48:48 -0700
commit6869b4f2584787d9e4cefaab8a4bae1ecbe63766 (patch)
tree10ac7cef67cfbc6f906d754b48b6b4f4a9a1e02c /src
parenta364dfa4ac7337743050256c6eb17b5db5430173 (diff)
downloadpostgresql-6869b4f2584787d9e4cefaab8a4bae1ecbe63766.tar.gz
postgresql-6869b4f2584787d9e4cefaab8a4bae1ecbe63766.zip
Add C++ support to configure.
This is an optional dependency. It'll be used for the upcoming LLVM based just in time compilation support, which needs to wrap a few LLVM C++ APIs so they're accessible from C.. For now test for C++ compilers unconditionally, without failing if not present, to ensure wide buildfarm coverage. If we're bothered by the additional test times (which are quite short) or verbosity, we can later make the tests conditional on --with-llvm. Author: Andres Freund Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.global.in10
-rw-r--r--src/Makefile.shlib1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 15c14951e86..1ac18e45936 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -249,9 +249,11 @@ endif # not PGXS
CC = @CC@
GCC = @GCC@
SUN_STUDIO_CC = @SUN_STUDIO_CC@
+CXX = @CXX@
CFLAGS = @CFLAGS@
CFLAGS_VECTOR = @CFLAGS_VECTOR@
CFLAGS_SSE42 = @CFLAGS_SSE42@
+CXXFLAGS = @CXXFLAGS@
# Kind-of compilers
@@ -813,6 +815,10 @@ ifndef COMPILE.c
COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
endif
+ifndef COMPILE.cc
+COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c
+endif
+
DEPDIR = .deps
ifeq ($(GCC), yes)
@@ -822,6 +828,10 @@ ifeq ($(GCC), yes)
@if test ! -d $(DEPDIR); then mkdir -p $(DEPDIR); fi
$(COMPILE.c) -o $@ $< -MMD -MP -MF $(DEPDIR)/$(*F).Po
+%.o : %.cpp
+ @if test ! -d $(DEPDIR); then mkdir -p $(DEPDIR); fi
+ $(COMPILE.cc) -o $@ $< -MMD -MP -MF $(DEPDIR)/$(*F).Po
+
endif # GCC
# Include all the dependency files generated for the current
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 0ce6d2a145d..0839f37e0f5 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -100,6 +100,7 @@ endif
# Try to keep the sections in some kind of order, folks...
override CFLAGS += $(CFLAGS_SL)
+override CXXFLAGS += $(CFLAGS_SL)
ifdef SO_MAJOR_VERSION
# libraries ought to use this to refer to versioned gettext domain names
override CPPFLAGS += -DSO_MAJOR_VERSION=$(SO_MAJOR_VERSION)