Commit 640a4ba0 authored by Tom Lane's avatar Tom Lane

Postpone LLVM-related uses of AC_CHECK_DECLS.

Calling AC_CHECK_DECLS before we've finished setting up the compiler's
CFLAGS seems like a pretty risky proposition, especially now that the
first use of that macro will result in a test to see whether the compiler
gives warning or error for undeclared built-in functions.  That answer
could very easily get changed later than where PGAC_LLVM_SUPPORT is
called; furthermore, it's hardly unlikely that flags such as -D_GNU_SOURCE
could change visibility of declarations.  Hence, be a little less cavalier
about where to do LLVM-related tests.  This results in v11 and HEAD doing
the warning-or-error check at the same place in the script as older
branches are doing it, which seems like a good thing.

Per further thought about commits 0b59b0e8 and 16fbac39.
parent 6e5f8d48
# config/llvm.m4 # config/llvm.m4
# PGAC_LLVM_SUPPORT # PGAC_LLVM_SUPPORT
# --------------- # -----------------
# #
# Look for the LLVM installation, check that it's new enough, set the # Look for the LLVM installation, check that it's new enough, set the
# corresponding LLVM_{CFLAGS,CXXFLAGS,BINPATH} and LDFLAGS # corresponding LLVM_{CFLAGS,CXXFLAGS,BINPATH} and LDFLAGS
# variables. Also verifies that CLANG is available, to transform C # variables. Also verify that CLANG is available, to transform C
# into bitcode. # into bitcode.
# #
AC_DEFUN([PGAC_LLVM_SUPPORT], AC_DEFUN([PGAC_LLVM_SUPPORT],
...@@ -91,14 +91,6 @@ AC_DEFUN([PGAC_LLVM_SUPPORT], ...@@ -91,14 +91,6 @@ AC_DEFUN([PGAC_LLVM_SUPPORT],
LLVM_BINPATH=`$LLVM_CONFIG --bindir` LLVM_BINPATH=`$LLVM_CONFIG --bindir`
# Check which functionality is present
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $LLVM_CPPFLAGS"
AC_CHECK_DECLS([LLVMOrcGetSymbolAddressIn], [], [], [[#include <llvm-c/OrcBindings.h>]])
AC_CHECK_DECLS([LLVMGetHostCPUName, LLVMGetHostCPUFeatures], [], [], [[#include <llvm-c/TargetMachine.h>]])
AC_CHECK_DECLS([LLVMCreateGDBRegistrationListener, LLVMCreatePerfJITEventListener], [], [], [[#include <llvm-c/ExecutionEngine.h>]])
CPPFLAGS="$SAVE_CPPFLAGS"
# LLVM_CONFIG, CLANG are already output via AC_ARG_VAR # LLVM_CONFIG, CLANG are already output via AC_ARG_VAR
AC_SUBST(LLVM_LIBS) AC_SUBST(LLVM_LIBS)
AC_SUBST(LLVM_CPPFLAGS) AC_SUBST(LLVM_CPPFLAGS)
...@@ -107,3 +99,22 @@ AC_DEFUN([PGAC_LLVM_SUPPORT], ...@@ -107,3 +99,22 @@ AC_DEFUN([PGAC_LLVM_SUPPORT],
AC_SUBST(LLVM_BINPATH) AC_SUBST(LLVM_BINPATH)
])# PGAC_LLVM_SUPPORT ])# PGAC_LLVM_SUPPORT
# PGAC_CHECK_LLVM_FUNCTIONS
# -------------------------
#
# Check presence of some optional LLVM functions.
# (This shouldn't happen until we're ready to run AC_CHECK_DECLS tests;
# because PGAC_LLVM_SUPPORT runs very early, it's not an appropriate place.)
#
AC_DEFUN([PGAC_CHECK_LLVM_FUNCTIONS],
[
# Check which functionality is present
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $LLVM_CPPFLAGS"
AC_CHECK_DECLS([LLVMOrcGetSymbolAddressIn], [], [], [[#include <llvm-c/OrcBindings.h>]])
AC_CHECK_DECLS([LLVMGetHostCPUName, LLVMGetHostCPUFeatures], [], [], [[#include <llvm-c/TargetMachine.h>]])
AC_CHECK_DECLS([LLVMCreateGDBRegistrationListener, LLVMCreatePerfJITEventListener], [], [], [[#include <llvm-c/ExecutionEngine.h>]])
CPPFLAGS="$SAVE_CPPFLAGS"
])# PGAC_CHECK_LLVM_FUNCTIONS
This diff is collapsed.
...@@ -1832,6 +1832,10 @@ if test "$with_icu" = yes; then ...@@ -1832,6 +1832,10 @@ if test "$with_icu" = yes; then
CPPFLAGS=$ac_save_CPPFLAGS CPPFLAGS=$ac_save_CPPFLAGS
fi fi
if test "$with_llvm" = yes; then
PGAC_CHECK_LLVM_FUNCTIONS()
fi
# Lastly, restore full LIBS list and check for readline/libedit symbols # Lastly, restore full LIBS list and check for readline/libedit symbols
LIBS="$LIBS_including_readline" LIBS="$LIBS_including_readline"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment