Skip to content

Commit 5721101

Browse files
author
Aleksandr Parfenov
committed
Merge branch 'master' into pgpro-1103-flexible-fts
2 parents d19a9cb + 1fd8690 commit 5721101

File tree

714 files changed

+51120
-13594
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

714 files changed

+51120
-13594
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Global excludes across all subdirectories
22
*.o
33
*.obj
4+
*.bc
45
*.so
56
*.so.[0-9]
67
*.so.[0-9].[0-9]

aclocal.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ m4_include([config/c-library.m4])
77
m4_include([config/docbook.m4])
88
m4_include([config/general.m4])
99
m4_include([config/libtool.m4])
10+
m4_include([config/llvm.m4])
1011
m4_include([config/perl.m4])
1112
m4_include([config/pkg.m4])
1213
m4_include([config/programs.m4])

config/c-compiler.m4

Lines changed: 93 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -428,26 +428,40 @@ fi])# PGAC_C_VA_ARGS
428428

429429

430430

431-
# PGAC_PROG_CC_CFLAGS_OPT
431+
# PGAC_PROG_VARCC_VARFLAGS_OPT
432432
# -----------------------
433-
# Given a string, check if the compiler supports the string as a
434-
# command-line option. If it does, add the string to CFLAGS.
435-
AC_DEFUN([PGAC_PROG_CC_CFLAGS_OPT],
436-
[define([Ac_cachevar], [AS_TR_SH([pgac_cv_prog_cc_cflags_$1])])dnl
437-
AC_CACHE_CHECK([whether $CC supports $1], [Ac_cachevar],
433+
# Given a compiler, variable name and a string, check if the compiler
434+
# supports the string as a command-line option. If it does, add the
435+
# string to the given variable.
436+
AC_DEFUN([PGAC_PROG_VARCC_VARFLAGS_OPT],
437+
[define([Ac_cachevar], [AS_TR_SH([pgac_cv_prog_$1_cflags_$3])])dnl
438+
AC_CACHE_CHECK([whether ${$1} supports $3, for $2], [Ac_cachevar],
438439
[pgac_save_CFLAGS=$CFLAGS
439-
CFLAGS="$pgac_save_CFLAGS $1"
440+
pgac_save_CC=$CC
441+
CC=${$1}
442+
CFLAGS="${$2} $3"
440443
ac_save_c_werror_flag=$ac_c_werror_flag
441444
ac_c_werror_flag=yes
442445
_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
443446
[Ac_cachevar=yes],
444447
[Ac_cachevar=no])
445448
ac_c_werror_flag=$ac_save_c_werror_flag
446-
CFLAGS="$pgac_save_CFLAGS"])
449+
CFLAGS="$pgac_save_CFLAGS"
450+
CC="$pgac_save_CC"])
447451
if test x"$Ac_cachevar" = x"yes"; then
448-
CFLAGS="$CFLAGS $1"
452+
$2="${$2} $3"
449453
fi
450454
undefine([Ac_cachevar])dnl
455+
])# PGAC_PROG_VARCC_VARFLAGS_OPT
456+
457+
458+
459+
# PGAC_PROG_CC_CFLAGS_OPT
460+
# -----------------------
461+
# Given a string, check if the compiler supports the string as a
462+
# command-line option. If it does, add the string to CFLAGS.
463+
AC_DEFUN([PGAC_PROG_CC_CFLAGS_OPT], [
464+
PGAC_PROG_VARCC_VARFLAGS_OPT(CC, CFLAGS, $1)
451465
])# PGAC_PROG_CC_CFLAGS_OPT
452466

453467

@@ -458,22 +472,48 @@ undefine([Ac_cachevar])dnl
458472
# the string as a command-line option. If it does, add the string to
459473
# the given variable.
460474
AC_DEFUN([PGAC_PROG_CC_VAR_OPT],
461-
[define([Ac_cachevar], [AS_TR_SH([pgac_cv_prog_cc_cflags_$2])])dnl
462-
AC_CACHE_CHECK([whether $CC supports $2], [Ac_cachevar],
463-
[pgac_save_CFLAGS=$CFLAGS
464-
CFLAGS="$pgac_save_CFLAGS $2"
465-
ac_save_c_werror_flag=$ac_c_werror_flag
466-
ac_c_werror_flag=yes
475+
[PGAC_PROG_VARCC_VARFLAGS_OPT(CC, $1, $2)
476+
])# PGAC_PROG_CC_VAR_OPT
477+
478+
479+
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++)
467495
_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
468496
[Ac_cachevar=yes],
469497
[Ac_cachevar=no])
470-
ac_c_werror_flag=$ac_save_c_werror_flag
471-
CFLAGS="$pgac_save_CFLAGS"])
498+
AC_LANG_POP([])
499+
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
500+
CXXFLAGS="$pgac_save_CXXFLAGS"
501+
CXX="$pgac_save_CXX"])
472502
if test x"$Ac_cachevar" = x"yes"; then
473-
$1="${$1} $2"
503+
$2="${$2} $3"
474504
fi
475505
undefine([Ac_cachevar])dnl
476-
])# PGAC_PROG_CC_VAR_OPT
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
477517

478518

479519

@@ -627,3 +667,37 @@ if test x"$Ac_cachevar" = x"yes"; then
627667
fi
628668
undefine([Ac_cachevar])dnl
629669
])# PGAC_SSE42_CRC32_INTRINSICS
670+
671+
672+
# PGAC_ARMV8_CRC32C_INTRINSICS
673+
# -----------------------
674+
# Check if the compiler supports the CRC32C instructions using the __crc32cb,
675+
# __crc32ch, __crc32cw, and __crc32cd intrinsic functions. These instructions
676+
# were first introduced in ARMv8 in the optional CRC Extension, and became
677+
# mandatory in ARMv8.1.
678+
#
679+
# An optional compiler flag can be passed as argument (e.g.
680+
# -march=armv8-a+crc). If the intrinsics are supported, sets
681+
# pgac_armv8_crc32c_intrinsics, and CFLAGS_ARMV8_CRC32C.
682+
AC_DEFUN([PGAC_ARMV8_CRC32C_INTRINSICS],
683+
[define([Ac_cachevar], [AS_TR_SH([pgac_cv_armv8_crc32c_intrinsics_$1])])dnl
684+
AC_CACHE_CHECK([for __crc32cb, __crc32ch, __crc32cw, and __crc32cd with CFLAGS=$1], [Ac_cachevar],
685+
[pgac_save_CFLAGS=$CFLAGS
686+
CFLAGS="$pgac_save_CFLAGS $1"
687+
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <arm_acle.h>],
688+
[unsigned int crc = 0;
689+
crc = __crc32cb(crc, 0);
690+
crc = __crc32ch(crc, 0);
691+
crc = __crc32cw(crc, 0);
692+
crc = __crc32cd(crc, 0);
693+
/* return computed value, to prevent the above being optimized away */
694+
return crc == 0;])],
695+
[Ac_cachevar=yes],
696+
[Ac_cachevar=no])
697+
CFLAGS="$pgac_save_CFLAGS"])
698+
if test x"$Ac_cachevar" = x"yes"; then
699+
CFLAGS_ARMV8_CRC32C="$1"
700+
pgac_armv8_crc32c_intrinsics=yes
701+
fi
702+
undefine([Ac_cachevar])dnl
703+
])# PGAC_ARMV8_CRC32C_INTRINSICS

config/c-library.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ AC_DEFUN([PGAC_STRUCT_ADDRINFO],
177177
# handle ll, q, and I64. The result is in shell variable
178178
# LONG_LONG_INT_MODIFIER.
179179
#
180-
# MinGW uses '%I64d', though gcc throws an warning with -Wall,
180+
# MinGW uses '%I64d', though gcc throws a warning with -Wall,
181181
# while '%lld' doesn't generate a warning, but doesn't work.
182182
#
183183
AC_DEFUN([PGAC_FUNC_SNPRINTF_LONG_LONG_INT_MODIFIER],

config/llvm.m4

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# config/llvm.m4
2+
3+
# PGAC_LLVM_SUPPORT
4+
# ---------------
5+
#
6+
# Look for the LLVM installation, check that it's new enough, set the
7+
# corresponding LLVM_{CFLAGS,CXXFLAGS,BINPATH} and LDFLAGS
8+
# variables. Also verifies that CLANG is available, to transform C
9+
# into bitcode.
10+
#
11+
AC_DEFUN([PGAC_LLVM_SUPPORT],
12+
[
13+
AC_REQUIRE([AC_PROG_AWK])
14+
15+
AC_ARG_VAR(LLVM_CONFIG, [path to llvm-config command])
16+
PGAC_PATH_PROGS(LLVM_CONFIG, llvm-config llvm-config-6.0 llvm-config-5.0 llvm-config-4.0 llvm-config-3.9)
17+
18+
# no point continuing if llvm wasn't found
19+
if test -z "$LLVM_CONFIG"; then
20+
AC_MSG_ERROR([llvm-config not found, but required when compiling --with-llvm, specify with LLVM_CONFIG=])
21+
fi
22+
# check if detected $LLVM_CONFIG is executable
23+
pgac_llvm_version="$($LLVM_CONFIG --version 2> /dev/null || echo no)"
24+
if test "x$pgac_llvm_version" = "xno"; then
25+
AC_MSG_ERROR([$LLVM_CONFIG does not work])
26+
fi
27+
# and whether the version is supported
28+
if echo $pgac_llvm_version | $AWK -F '.' '{ if ([$]1 >= 4 || ([$]1 == 3 && [$]2 >= 9)) exit 1; else exit 0;}';then
29+
AC_MSG_ERROR([$LLVM_CONFIG version is $pgac_llvm_version but at least 3.9 is required])
30+
fi
31+
32+
# need clang to create some bitcode files
33+
AC_ARG_VAR(CLANG, [path to clang compiler to generate bitcode])
34+
PGAC_PATH_PROGS(CLANG, clang clang-6.0 clang-5.0 clang-4.0 clang-3.9)
35+
if test -z "$CLANG"; then
36+
AC_MSG_ERROR([clang not found, but required when compiling --with-llvm, specify with CLANG=])
37+
fi
38+
# make sure clang is executable
39+
if test "x$($CLANG --version 2> /dev/null || echo no)" = "xno"; then
40+
AC_MSG_ERROR([$CLANG does not work])
41+
fi
42+
# Could check clang version, but it doesn't seem that
43+
# important. Systems with a new enough LLVM version are usually
44+
# going to have a decent clang version too. It's also not entirely
45+
# clear what the minimum version is.
46+
47+
# Collect compiler flags necessary to build the LLVM dependent
48+
# shared library.
49+
for pgac_option in `$LLVM_CONFIG --cppflags`; do
50+
case $pgac_option in
51+
-I*|-D*) LLVM_CPPFLAGS="$pgac_option $LLVM_CPPFLAGS";;
52+
esac
53+
done
54+
55+
for pgac_option in `$LLVM_CONFIG --ldflags`; do
56+
case $pgac_option in
57+
-L*) LDFLAGS="$LDFLAGS $pgac_option";;
58+
esac
59+
done
60+
61+
# ABI influencing options, standard influencing options
62+
for pgac_option in `$LLVM_CONFIG --cxxflags`; do
63+
case $pgac_option in
64+
-fno-rtti*) LLVM_CXXFLAGS="$LLVM_CXXFLAGS $pgac_option";;
65+
-std=*) LLVM_CXXFLAGS="$LLVM_CXXFLAGS $pgac_option";;
66+
esac
67+
done
68+
69+
# Look for components we're interested in, collect necessary
70+
# libs. As some components are optional, we can't just list all of
71+
# them as it'd raise an error.
72+
pgac_components='';
73+
for pgac_component in `$LLVM_CONFIG --components`; do
74+
case $pgac_component in
75+
engine) pgac_components="$pgac_components $pgac_component";;
76+
debuginfodwarf) pgac_components="$pgac_components $pgac_component";;
77+
orcjit) pgac_components="$pgac_components $pgac_component";;
78+
passes) pgac_components="$pgac_components $pgac_component";;
79+
perfjitevents) pgac_components="$pgac_components $pgac_component";;
80+
esac
81+
done;
82+
83+
# And then get the libraries that need to be linked in for the
84+
# selected components. They're large libraries, we only want to
85+
# link them into the LLVM using shared library.
86+
for pgac_option in `$LLVM_CONFIG --libs --system-libs $pgac_components`; do
87+
case $pgac_option in
88+
-l*) LLVM_LIBS="$LLVM_LIBS $pgac_option";;
89+
esac
90+
done
91+
92+
LLVM_BINPATH=`$LLVM_CONFIG --bindir`
93+
94+
# Check which functionality is present
95+
SAVE_CPPFLAGS="$CPPFLAGS"
96+
CPPFLAGS="$CPPFLAGS $LLVM_CPPFLAGS"
97+
AC_CHECK_DECLS([LLVMOrcGetSymbolAddressIn, LLVMOrcRegisterGDB, LLVMOrcRegisterPerf], [], [], [[#include <llvm-c/OrcBindings.h>]])
98+
AC_CHECK_DECLS([LLVMGetHostCPUName], [], [], [[#include <llvm-c/TargetMachine.h>]])
99+
CPPFLAGS="$SAVE_CPPFLAGS"
100+
101+
# LLVM_CONFIG, CLANG are already output via AC_ARG_VAR
102+
AC_SUBST(LLVM_LIBS)
103+
AC_SUBST(LLVM_CPPFLAGS)
104+
AC_SUBST(LLVM_CFLAGS)
105+
AC_SUBST(LLVM_CXXFLAGS)
106+
AC_SUBST(LLVM_BINPATH)
107+
108+
])# PGAC_LLVM_SUPPORT

config/python.m4

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ fi
2222
# as well as the Python version.
2323
AC_DEFUN([_PGAC_CHECK_PYTHON_DIRS],
2424
[AC_REQUIRE([PGAC_PATH_PYTHON])
25+
python_fullversion=`${PYTHON} -c "import sys; print(sys.version)" | sed q`
26+
AC_MSG_NOTICE([using python $python_fullversion])
27+
# python_fullversion is typically n.n.n plus some trailing junk
28+
python_majorversion=`echo "$python_fullversion" | sed '[s/^\([0-9]*\).*/\1/]'`
29+
python_minorversion=`echo "$python_fullversion" | sed '[s/^[0-9]*\.\([0-9]*\).*/\1/]'`
30+
python_version=`echo "$python_fullversion" | sed '[s/^\([0-9]*\.[0-9]*\).*/\1/]'`
31+
# Reject unsupported Python versions as soon as practical.
32+
if test "$python_majorversion" -lt 3 -a "$python_minorversion" -lt 4; then
33+
AC_MSG_ERROR([Python version $python_version is too old (version 2.4 or later is required)])
34+
fi
35+
2536
AC_MSG_CHECKING([for Python distutils module])
2637
if "${PYTHON}" -c 'import distutils' 2>&AS_MESSAGE_LOG_FD
2738
then
@@ -30,18 +41,11 @@ else
3041
AC_MSG_RESULT(no)
3142
AC_MSG_ERROR([distutils module not found])
3243
fi
44+
3345
AC_MSG_CHECKING([Python configuration directory])
34-
python_majorversion=`${PYTHON} -c "import sys; print(sys.version[[0]])"`
35-
python_minorversion=`${PYTHON} -c "import sys; print(sys.version[[2]])"`
36-
python_version=`${PYTHON} -c "import sys; print(sys.version[[:3]])"`
3746
python_configdir=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('LIBPL'))))"`
3847
AC_MSG_RESULT([$python_configdir])
3948
40-
# Reject unsupported Python versions as soon as practical.
41-
if test "$python_majorversion" -lt 3 -a "$python_minorversion" -lt 4; then
42-
AC_MSG_ERROR([Python version $python_version is too old (version 2.4 or later is required)])
43-
fi
44-
4549
AC_MSG_CHECKING([Python include directories])
4650
python_includespec=`${PYTHON} -c "
4751
import distutils.sysconfig

0 commit comments

Comments
 (0)