Skip to content

Commit 6869b4f

Browse files
committed
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/[email protected]
1 parent a364dfa commit 6869b4f

File tree

6 files changed

+1013
-11
lines changed

6 files changed

+1013
-11
lines changed

config/c-compiler.m4

+40
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,46 @@ AC_DEFUN([PGAC_PROG_CC_VAR_OPT],
477477

478478

479479

480+
# PGAC_PROG_VARCXX_VARFLAGS_OPT
481+
# -----------------------
482+
# Given a compiler, variable name and a string, check if the compiler
483+
# supports the string as a command-line option. If it does, add the
484+
# string to the given variable.
485+
AC_DEFUN([PGAC_PROG_VARCXX_VARFLAGS_OPT],
486+
[define([Ac_cachevar], [AS_TR_SH([pgac_cv_prog_$1_cxxflags_$3])])dnl
487+
AC_CACHE_CHECK([whether ${$1} supports $3, for $2], [Ac_cachevar],
488+
[pgac_save_CXXFLAGS=$CXXFLAGS
489+
pgac_save_CXX=$CXX
490+
CXX=${$1}
491+
CXXFLAGS="${$2} $3"
492+
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
493+
ac_cxx_werror_flag=yes
494+
AC_LANG_PUSH(C++)
495+
_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
496+
[Ac_cachevar=yes],
497+
[Ac_cachevar=no])
498+
AC_LANG_POP([])
499+
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
500+
CXXFLAGS="$pgac_save_CXXFLAGS"
501+
CXX="$pgac_save_CXX"])
502+
if test x"$Ac_cachevar" = x"yes"; then
503+
$2="${$2} $3"
504+
fi
505+
undefine([Ac_cachevar])dnl
506+
])# PGAC_PROG_VARCXX_VARFLAGS_OPT
507+
508+
509+
510+
# PGAC_PROG_CXX_CFLAGS_OPT
511+
# -----------------------
512+
# Given a string, check if the compiler supports the string as a
513+
# command-line option. If it does, add the string to CXXFLAGS.
514+
AC_DEFUN([PGAC_PROG_CXX_CFLAGS_OPT],
515+
[PGAC_PROG_VARCXX_VARFLAGS_OPT(CXX, CXXFLAGS, $1)
516+
])# PGAC_PROG_CXX_VAR_OPT
517+
518+
519+
480520
# PGAC_PROG_CC_LDFLAGS_OPT
481521
# ------------------------
482522
# Given a string, check if the compiler supports the string as a

0 commit comments

Comments
 (0)