Identify build and source directory of postgres we're compiling against.

That's useful when trying to rely on files only present in source and/or
build directories, not in the normal installation. E.g. the
isolationtester binary, or the valgrind suppression files.
pull/917/head
Andres Freund 2016-10-26 05:07:08 -07:00
parent c3e1d49e34
commit ce73ffdf2e
3 changed files with 27 additions and 0 deletions

View File

@ -11,6 +11,9 @@
citus_abs_srcdir:=@abs_top_srcdir@/${citus_subdir}
citus_abs_top_srcdir:=@abs_top_srcdir@
postgres_abs_srcdir:=@POSTGRES_SRCDIR@
postgres_abs_builddir:=@POSTGRES_BUILDDIR@
PG_CONFIG:=@PG_CONFIG@
PGXS:=$(shell $(PG_CONFIG) --pgxs)

14
configure vendored
View File

@ -586,6 +586,8 @@ PACKAGE_URL=''
ac_subst_vars='LTLIBOBJS
LIBOBJS
POSTGRES_BUILDDIR
POSTGRES_SRCDIR
CITUS_CFLAGS
OBJEXT
EXEEXT
@ -2540,6 +2542,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
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
@ -2938,6 +2948,10 @@ fi
CITUS_CFLAGS="$CITUS_CFLAGS"
POSTGRES_SRCDIR="$POSTGRES_SRCDIR"
POSTGRES_BUILDDIR="$POSTGRES_BUILDDIR"
ac_config_files="$ac_config_files Makefile.global"

View File

@ -63,6 +63,14 @@ 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
@ -102,6 +110,8 @@ CITUSAC_PROG_CC_CFLAGS_OPT([-Wmissing-declarations])
CITUSAC_PROG_CC_CFLAGS_OPT([-Wmissing-prototypes])
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])