forked from citusdata/citus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
155 lines (131 loc) · 5.71 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Citus autoconf input script.
#
# Converted into an actual configure script by autogen.sh. This
# conversion only has to be done when configure.in changes. To avoid
# everyone needing autoconf installed, the resulting files are checked
# into the SCM.
AC_INIT([Citus], [6.2.1])
AC_COPYRIGHT([Copyright (c) 2012-2017, Citus Data, Inc.])
# we'll need sed and awk for some of the version commands
AC_PROG_SED
AC_PROG_AWK
# CITUS_VERSION definition
AC_DEFINE_UNQUOTED(CITUS_VERSION, "$PACKAGE_VERSION", [Citus version as a string])
# CITUS_MAJORVERSION definition
[CITUS_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`]
AC_DEFINE_UNQUOTED(CITUS_MAJORVERSION, "$CITUS_MAJORVERSION", [Citus major version as a string])
# CITUS_VERSION_NUM definition
# awk -F is a regex on some platforms, and not on others, so make "." a tab
[CITUS_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |
tr '.' ' ' |
$AWK '{printf "%d%02d%02d", $1, $2, (NF >= 3) ? $3 : 0}'`"]
AC_DEFINE_UNQUOTED(CITUS_VERSION_NUM, $CITUS_VERSION_NUM, [Citus version as a number])
# CITUS_EXTENSIONVERSION definition
[CITUS_EXTENSIONVERSION="`grep '^default_version' $srcdir/src/backend/distributed/citus.control | cut -d\' -f2`"]
AC_DEFINE_UNQUOTED([CITUS_EXTENSIONVERSION], "$CITUS_EXTENSIONVERSION", [Extension version expected by this Citus build])
# Re-check for flex. That allows to compile citus against a postgres
# which was built without flex available (possible because generated
# files are included)
AC_PATH_PROG([FLEX], [flex])
# Locate pg_config binary
AC_ARG_VAR([PG_CONFIG], [Location to find pg_config for target PostgreSQL instalation (default PATH)])
AC_ARG_VAR([PATH], [PATH for target PostgreSQL install pg_config])
if test -z "$PG_CONFIG"; then
AC_PATH_PROG(PG_CONFIG, pg_config)
fi
if test -z "$PG_CONFIG"; then
AC_MSG_ERROR([Could not find pg_config. Set PG_CONFIG or PATH.])
fi
# check we're building against a supported version of PostgreSQL
citusac_pg_config_version=$($PG_CONFIG --version 2>/dev/null)
version_num=$(echo "$citusac_pg_config_version"|
$SED -e 's/^PostgreSQL \([[0-9]]*\)\.\([[0-9]]*\)\([[a-zA-Z0-9.]]*\)$/\1.\2/')
if test -z "$version_num"; then
AC_MSG_ERROR([Could not detect PostgreSQL version from pg_config.])
fi
if test "$version_num" != '9.5' -a "$version_num" != '9.6'; then
AC_MSG_ERROR([Citus is not compatible with the detected PostgreSQL version ${version_num}.])
else
AC_MSG_NOTICE([building against PostgreSQL $version_num])
fi;
# Check whether we're building inside the source tree, if not, prepare
# the build directory.
if test "$srcdir" -ef '.' ; then
vpath_build=no
else
vpath_build=yes
_AS_ECHO_N([preparing build tree... ])
citusac_abs_top_srcdir=`cd "$srcdir" && pwd`
$SHELL "$citusac_abs_top_srcdir/prep_buildtree" "$citusac_abs_top_srcdir" "." \
|| AC_MSG_ERROR(failed)
AC_MSG_RESULT(done)
fi
AC_SUBST(vpath_build)
# Allow to overwrite the C compiler, default to the one postgres was
# compiled with. We don't want autoconf's default CFLAGS though, so save
# those.
SAVE_CFLAGS="$CFLAGS"
AC_PROG_CC([$($PG_CONFIG --cc)])
CFLAGS="$SAVE_CFLAGS"
# Locate source and build directory of the postgres we're building
# against. Can't rely on either still being present, but e.g. optional
# test infrastructure can rely on it.
POSTGRES_SRCDIR=$(grep ^abs_top_srcdir $(dirname $($PG_CONFIG --pgxs))/../Makefile.global|cut -d ' ' -f3-)
POSTGRES_BUILDDIR=$(grep ^abs_top_builddir $(dirname $($PG_CONFIG --pgxs))/../Makefile.global|cut -d ' ' -f3-)
# check for a number of CFLAGS that make development easier
# CITUSAC_PROG_CC_CFLAGS_OPT
# -----------------------
# Given a string, check if the compiler supports the string as a
# command-line option. If it does, add the string to CFLAGS.
AC_DEFUN([CITUSAC_PROG_CC_CFLAGS_OPT],
[define([Ac_cachevar], [AS_TR_SH([citusac_cv_prog_cc_cflags_$1])])dnl
AC_CACHE_CHECK([whether $CC supports $1], [Ac_cachevar],
[citusac_save_CFLAGS=$CFLAGS
CFLAGS="$citusac_save_CFLAGS $1"
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
[Ac_cachevar=yes],
[Ac_cachevar=no])
ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="$citusac_save_CFLAGS"])
if test x"$Ac_cachevar" = x"yes"; then
CITUS_CFLAGS="$CITUS_CFLAGS $1"
fi
undefine([Ac_cachevar])dnl
])# CITUSAC_PROG_CC_CFLAGS_OPT
CITUSAC_PROG_CC_CFLAGS_OPT([-Wall])
CITUSAC_PROG_CC_CFLAGS_OPT([-Wextra])
# disarm options included in the above, which are too noisy for now
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-unused-parameter])
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-sign-compare])
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-missing-field-initializers])
CITUSAC_PROG_CC_CFLAGS_OPT([-Wno-clobbered])
# And add a few extra warnings
CITUSAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement])
CITUSAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
CITUSAC_PROG_CC_CFLAGS_OPT([-Wmissing-format-attribute])
CITUSAC_PROG_CC_CFLAGS_OPT([-Wmissing-declarations])
CITUSAC_PROG_CC_CFLAGS_OPT([-Wmissing-prototypes])
#
# --enable-coverage enables generation of code coverage metrics with gcov
#
AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage], [build with coverage testing instrumentation]))
if test "$enable_coverage" = yes; then
CITUS_CFLAGS="$CITUS_CFLAGS -fprofile-arcs -ftest-coverage"
fi
AC_SUBST(CITUS_CFLAGS, "$CITUS_CFLAGS")
AC_SUBST(POSTGRES_SRCDIR, "$POSTGRES_SRCDIR")
AC_SUBST(POSTGRES_BUILDDIR, "$POSTGRES_BUILDDIR")
AC_CONFIG_FILES([Makefile.global])
AC_CONFIG_HEADERS([src/include/citus_config.h] [src/include/citus_version.h])
AH_TOP([
/*
* citus_config.h.in is generated by autoconf/autoheader and
* converted into citus_config.h by configure. Include when code needs to
* depend on determinations made by configure.
*
* Do not manually edit!
*/
])
AC_OUTPUT