1AC_INIT([repmgr], [5.2.0], [repmgr@googlegroups.com], [repmgr], [https://repmgr.org/]) 2 3AC_COPYRIGHT([Copyright (c) 2010-2020, 2ndQuadrant Ltd.]) 4 5AC_CONFIG_HEADER(config.h) 6 7AC_ARG_VAR([PG_CONFIG], [Location to find pg_config for target PostgreSQL (default PATH)]) 8 9AC_PROG_SED 10 11if test -z "$PG_CONFIG"; then 12 AC_PATH_PROG(PG_CONFIG, pg_config) 13fi 14 15if test -z "$PG_CONFIG"; then 16 AC_MSG_ERROR([could not find pg_config, set PG_CONFIG or PATH]) 17fi 18 19pgac_pg_config_version=$($PG_CONFIG --version 2>/dev/null) 20 21major_version_num=$(echo "$pgac_pg_config_version"| 22 $SED -e 's/^PostgreSQL \([[0-9]]\{1,2\}\).*$/\1/') 23 24if test "$major_version_num" -lt '10'; then 25 version_num=$(echo "$pgac_pg_config_version"| 26 $SED -e 's/^PostgreSQL \([[0-9]]*\)\.\([[0-9]]*\)\([[a-zA-Z0-9.]]*\)$/\1.\2/') 27 28 if test -z "$version_num"; then 29 AC_MSG_ERROR([could not detect the PostgreSQL version, wrong or broken pg_config?]) 30 fi 31 32 version_num_int=$(echo "$version_num"| 33 $SED -e 's/^\([[0-9]]*\)\.\([[0-9]]*\)$/\1\2/') 34 35 if test "$version_num_int" -lt '94'; then 36 AC_MSG_ERROR([repmgr is not compatible with detected PostgreSQL version: $version_num]) 37 fi 38else 39 version_num=$(echo "$pgac_pg_config_version"| 40 $SED -e 's/^PostgreSQL \(.\+\)$/\1/') 41 42 if test -z "$version_num"; then 43 AC_MSG_ERROR([could not detect the PostgreSQL version, wrong or broken pg_config?]) 44 fi 45fi 46 47AC_MSG_NOTICE([building against PostgreSQL $version_num]) 48 49# add includedir to prerequisites, so tests for headers can succeed 50CPPFLAGS="-I$($PG_CONFIG --includedir-server) $CFLAGS" 51 52# check whether we're building inside the source tree. 53if test "$srcdir" -ef '.' ; then 54 vpath_build=no 55else 56 vpath_build=yes 57fi 58AC_SUBST(vpath_build) 59 60AC_CHECK_PROG(HAVE_GNUSED,gnused,yes,no) 61AC_CHECK_PROG(HAVE_GSED,gsed,yes,no) 62AC_CHECK_PROG(HAVE_SED,sed,yes,no) 63 64if test "$HAVE_GNUSED" = yes; then 65 SED=gnused 66else 67 if test "$HAVE_GSED" = yes; then 68 SED=gsed 69 else 70 SED=sed 71 fi 72fi 73AC_SUBST(SED) 74 75 76AC_CONFIG_FILES([Makefile]) 77AC_CONFIG_FILES([Makefile.global]) 78AC_OUTPUT 79 80