summaryrefslogtreecommitdiff
path: root/config/c-compiler.m4
diff options
context:
space:
mode:
authorAndres Freund2018-03-20 22:41:15 +0000
committerAndres Freund2018-03-20 22:48:48 +0000
commit6869b4f2584787d9e4cefaab8a4bae1ecbe63766 (patch)
tree10ac7cef67cfbc6f906d754b48b6b4f4a9a1e02c /config/c-compiler.m4
parenta364dfa4ac7337743050256c6eb17b5db5430173 (diff)
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 'config/c-compiler.m4')
-rw-r--r--config/c-compiler.m440
1 files changed, 40 insertions, 0 deletions
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4
index 30b270185b1..b518851441b 100644
--- a/config/c-compiler.m4
+++ b/config/c-compiler.m4
@@ -477,6 +477,46 @@ AC_DEFUN([PGAC_PROG_CC_VAR_OPT],
+# PGAC_PROG_VARCXX_VARFLAGS_OPT
+# -----------------------
+# Given a compiler, variable name and a string, check if the compiler
+# supports the string as a command-line option. If it does, add the
+# string to the given variable.
+AC_DEFUN([PGAC_PROG_VARCXX_VARFLAGS_OPT],
+[define([Ac_cachevar], [AS_TR_SH([pgac_cv_prog_$1_cxxflags_$3])])dnl
+AC_CACHE_CHECK([whether ${$1} supports $3, for $2], [Ac_cachevar],
+[pgac_save_CXXFLAGS=$CXXFLAGS
+pgac_save_CXX=$CXX
+CXX=${$1}
+CXXFLAGS="${$2} $3"
+ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ac_cxx_werror_flag=yes
+AC_LANG_PUSH(C++)
+_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
+ [Ac_cachevar=yes],
+ [Ac_cachevar=no])
+AC_LANG_POP([])
+ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+CXXFLAGS="$pgac_save_CXXFLAGS"
+CXX="$pgac_save_CXX"])
+if test x"$Ac_cachevar" = x"yes"; then
+ $2="${$2} $3"
+fi
+undefine([Ac_cachevar])dnl
+])# PGAC_PROG_VARCXX_VARFLAGS_OPT
+
+
+
+# PGAC_PROG_CXX_CFLAGS_OPT
+# -----------------------
+# Given a string, check if the compiler supports the string as a
+# command-line option. If it does, add the string to CXXFLAGS.
+AC_DEFUN([PGAC_PROG_CXX_CFLAGS_OPT],
+[PGAC_PROG_VARCXX_VARFLAGS_OPT(CXX, CXXFLAGS, $1)
+])# PGAC_PROG_CXX_VAR_OPT
+
+
+
# PGAC_PROG_CC_LDFLAGS_OPT
# ------------------------
# Given a string, check if the compiler supports the string as a