Self-implemented review feedback

The use of a bare src/ rather than $srcdir caused configure to fail
during VPATH builds. With our additional dependency upon AWK, we need
to call AC_PROG_AWK, otherwise environments may not have $AWK set.
Finally, citus_version.h should be in .gitignore.
pull/1277/head
Jason Petersen 2017-04-03 22:18:58 -06:00
parent 087d8427e3
commit 1c2056ec74
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
5 changed files with 93 additions and 42 deletions

112
configure vendored
View File

@ -600,6 +600,7 @@ vpath_build
PATH
PG_CONFIG
FLEX
AWK
SED
target_alias
host_alias
@ -1750,39 +1751,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# CITUS_MAJORVERSION definition
CITUS_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`
cat >>confdefs.h <<_ACEOF
#define CITUS_MAJORVERSION "$CITUS_MAJORVERSION"
_ACEOF
# CITUS_VERSION definition
cat >>confdefs.h <<_ACEOF
#define CITUS_VERSION "$PACKAGE_VERSION"
_ACEOF
# CITUS_VERSION_NUM definition
CITUS_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |
tr '.' ' ' |
$AWK '{printf "%d%02d%02d", $1, $2, (NF >= 3) ? $3 : 0}'`"
cat >>confdefs.h <<_ACEOF
#define CITUS_VERSION_NUM $CITUS_VERSION_NUM
_ACEOF
# CITUS_EXTENSIONVERSION definition
citus_extensionversion=$(grep "^default_version" src/backend/distributed/citus.control | cut -d\' -f2)
cat >>confdefs.h <<_ACEOF
#define CITUS_EXTENSIONVERSION "$citus_extensionversion"
_ACEOF
# we'll need sed and awk for some of the version commands
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
$as_echo_n "checking for a sed that does not truncate output... " >&6; }
if ${ac_cv_path_SED+:} false; then :
@ -1852,6 +1821,82 @@ $as_echo "$ac_cv_path_SED" >&6; }
SED="$ac_cv_path_SED"
rm -f conftest.sed
for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_AWK+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AWK"; then
ac_cv_prog_AWK="$AWK" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AWK="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
AWK=$ac_cv_prog_AWK
if test -n "$AWK"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
$as_echo "$AWK" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$AWK" && break
done
# CITUS_VERSION definition
cat >>confdefs.h <<_ACEOF
#define CITUS_VERSION "$PACKAGE_VERSION"
_ACEOF
# CITUS_MAJORVERSION definition
CITUS_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\.[0-9][0-9]*\)'`
cat >>confdefs.h <<_ACEOF
#define CITUS_MAJORVERSION "$CITUS_MAJORVERSION"
_ACEOF
# 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}'`"
cat >>confdefs.h <<_ACEOF
#define CITUS_VERSION_NUM $CITUS_VERSION_NUM
_ACEOF
# CITUS_EXTENSIONVERSION definition
CITUS_EXTENSIONVERSION="`grep '^default_version' $srcdir/src/backend/distributed/citus.control | cut -d\' -f2`"
cat >>confdefs.h <<_ACEOF
#define CITUS_EXTENSIONVERSION "$CITUS_EXTENSIONVERSION"
_ACEOF
# Re-check for flex. That allows to compile citus against a postgres
# which was built without flex available (possible because generated
@ -3588,6 +3633,7 @@ gives unlimited permission to copy, distribute and modify it."
ac_pwd='$ac_pwd'
srcdir='$srcdir'
AWK='$AWK'
test -n "\$AWK" || AWK=awk
_ACEOF

View File

@ -8,24 +8,27 @@
AC_INIT([Citus], [6.2devel])
AC_COPYRIGHT([Copyright (c) 2012-2017, Citus Data, Inc.])
# 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])
# 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" src/backend/distributed/citus.control | cut -d\' -f2)
AC_DEFINE_UNQUOTED([CITUS_EXTENSIONVERSION], "$citus_extensionversion", [so the shared-library knows its own version])
AC_PROG_SED
[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

View File

@ -2,3 +2,5 @@
/stamp-ext-h
/citus_config.h
/citus_config.h.in~
/citus_version.h
/citus_version.h.in~

View File

@ -10,7 +10,7 @@
*/
/* so the shared-library knows its own version */
/* Extension version expected by this Citus build */
#undef CITUS_EXTENSIONVERSION
/* Citus major version as a string */

View File

@ -1,6 +1,6 @@
/* This file is created manually */
/* so the shared-library knows its own version */
/* Extension version expected by this Citus build */
#undef CITUS_EXTENSIONVERSION
/* Citus major version as a string */