headerscheck in C++ mode (cpluspluscheck) previously hardcoded
CXXFLAGS and documented that you might need to override them manually
from the environment. Now that we have better C++ support in the
build system, we can just get CXXFLAGS from Makefile.global, like we
do for other variables.
Furthermore, this is necessary in some configurations to make
cpluspluscheck work under meson, because under meson, some -I options
end up in CXXFLAGS where under make they would be in CPPFLAGS.
Therefore, getting the correct CXXFLAGS is required in those cases.
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAMSWrt-PoQt4sHryWrB1ViuGBJF_PpbjoSGrWR2Ry47bHNLDqg%40mail.gmail.com
When using meson, run "meson compile -C build cpluspluscheck" or
"ninja -C build cpluspluscheck".
-If you are using a non-g++-compatible C++ compiler, you may need to
-override the script's CXXFLAGS setting by setting a suitable environment
-value.
-
A limitation of the current script is that it doesn't know exactly which
headers are for frontend or backend; when in doubt it uses postgres.h as
prerequisite, even if postgres_fe.h or c.h would be more appropriate.
me=`basename $0`
-# These switches are g++ specific, you may override if necessary.
-CXXFLAGS=${CXXFLAGS:- -fsyntax-only -Wall}
-
# Pull some info from configure's results.
MGLOB="$builddir/src/Makefile.global"
CPPFLAGS=`sed -n 's/^CPPFLAGS[ ]*=[ ]*//p' "$MGLOB"`
CFLAGS=`sed -n 's/^CFLAGS[ ]*=[ ]*//p' "$MGLOB"`
+CXXFLAGS=`sed -n 's/^CXXFLAGS[ ]*=[ ]*//p' "$MGLOB"`
ICU_CFLAGS=`sed -n 's/^ICU_CFLAGS[ ]*=[ ]*//p' "$MGLOB"`
LLVM_CPPFLAGS=`sed -n 's/^LLVM_CPPFLAGS[ ]*=[ ]*//p' "$MGLOB"`
CC=`sed -n 's/^CC[ ]*=[ ]*//p' "$MGLOB"`