Re: [HACKERS] PL_stashcache, or, what's our minimum Perl version?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] PL_stashcache, or, what's our minimum Perl version?
Дата
Msg-id 8923.1501546636@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] PL_stashcache, or, what's our minimum Perl version?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I wrote:
> If we need to fix things so that AC_PATH_PROG will honor a non-path
> input value, then let's do that.  But let's not make the build system
> shakier/less reproducible than it is already.

> I suggest that we could inject logic like this:

>   if VARIABLE-is-set-and-value-isn't-already-absolute; then
>     VARIABLE=`which $VARIABLE 2>/dev/null`
>   fi

> in front of the existing logic for AC_PATH_PROG(VARIABLE,...).
> Maybe "which" isn't the best tool for the job, not sure.

Concretely, how about something like the attached?

BTW, I haven't done it here, but I wonder whether we should not make
PGAC_PATH_PROGS invoke AC_ARG_VAR on the target variable, so that
configure knows that it should be treated as affecting results caching.

            regards, tom lane

diff --git a/config/docbook.m4 b/config/docbook.m4
index c485eaf..f9307f3 100644
*** a/config/docbook.m4
--- b/config/docbook.m4
***************
*** 3,9 ****
  # PGAC_PROG_NSGMLS
  # ----------------
  AC_DEFUN([PGAC_PROG_NSGMLS],
! [AC_PATH_PROGS([NSGMLS], [onsgmls nsgmls])])


  # PGAC_CHECK_DOCBOOK(VERSION)
--- 3,9 ----
  # PGAC_PROG_NSGMLS
  # ----------------
  AC_DEFUN([PGAC_PROG_NSGMLS],
! [PGAC_PATH_PROGS(NSGMLS, [onsgmls nsgmls])])


  # PGAC_CHECK_DOCBOOK(VERSION)
diff --git a/config/perl.m4 b/config/perl.m4
index 9706c4d..e44ca94 100644
*** a/config/perl.m4
--- b/config/perl.m4
***************
*** 4,13 ****
  # PGAC_PATH_PERL
  # --------------
  AC_DEFUN([PGAC_PATH_PERL],
! [# Let the user override the search
! if test -z "$PERL"; then
!   AC_PATH_PROG(PERL, perl)
! fi

  if test "$PERL"; then
    pgac_perl_version=`$PERL -v 2>/dev/null | sed -n ['s/This is perl.*v[a-z ]*\([0-9]\.[0-9][0-9.]*\).*$/\1/p']`
--- 4,10 ----
  # PGAC_PATH_PERL
  # --------------
  AC_DEFUN([PGAC_PATH_PERL],
! [PGAC_PATH_PROGS(PERL, perl)

  if test "$PERL"; then
    pgac_perl_version=`$PERL -v 2>/dev/null | sed -n ['s/This is perl.*v[a-z ]*\([0-9]\.[0-9][0-9.]*\).*$/\1/p']`
diff --git a/config/programs.m4 b/config/programs.m4
index b7deb86..0b0098e 100644
*** a/config/programs.m4
--- b/config/programs.m4
***************
*** 1,6 ****
--- 1,23 ----
  # config/programs.m4


+ # PGAC_PATH_PROGS
+ # ---------------
+ # This wrapper for AC_PATH_PROGS behaves like that macro except in the case
+ # where VARIABLE is already set but is not set to an absolute path.  We will
+ # attempt to make it into an absolute path using "which".  If that fails,
+ # we ignore the existing value, which is the behavior of AC_PATH_PROGS.
+
+ AC_DEFUN([PGAC_PATH_PROGS],
+ [# If user is trying to override the search for $1, make sure that
+ # the variable's value is an absolute path.
+ if test -n "$$1"; then
+   $1=`which "$$1" 2>/dev/null`
+ fi
+ AC_PATH_PROGS($@)dnl
+ ])
+
+
  # PGAC_PATH_BISON
  # ---------------
  # Look for Bison, set the output variable BISON to its path if found.
***************
*** 8,17 ****
  # Note we do not accept other implementations of yacc.

  AC_DEFUN([PGAC_PATH_BISON],
! [# Let the user override the search
! if test -z "$BISON"; then
!   AC_PATH_PROGS(BISON, bison)
! fi

  if test "$BISON"; then
    pgac_bison_version=`$BISON --version 2>/dev/null | sed q`
--- 25,31 ----
  # Note we do not accept other implementations of yacc.

  AC_DEFUN([PGAC_PATH_BISON],
! [PGAC_PATH_PROGS(BISON, bison)

  if test "$BISON"; then
    pgac_bison_version=`$BISON --version 2>/dev/null | sed q`
*************** if test -z "$BISON"; then
*** 41,47 ****
  *** PostgreSQL then you do not need to worry about this, because the Bison
  *** output is pre-generated.)])
  fi
! # We don't need AC_SUBST(BISON) because AC_PATH_PROG did it
  AC_SUBST(BISONFLAGS)
  ])# PGAC_PATH_BISON

--- 55,61 ----
  *** PostgreSQL then you do not need to worry about this, because the Bison
  *** output is pre-generated.)])
  fi
! # We don't need AC_SUBST(BISON) because PGAC_PATH_PROGS did it
  AC_SUBST(BISONFLAGS)
  ])# PGAC_PATH_BISON

*************** AC_DEFUN([PGAC_CHECK_GETTEXT],
*** 229,235 ****
                   [AC_MSG_ERROR([a gettext implementation is required for NLS])])
    AC_CHECK_HEADER([libintl.h], [],
                    [AC_MSG_ERROR([header file <libintl.h> is required for NLS])])
!   AC_PATH_PROGS(MSGFMT, msgfmt)
    if test -z "$MSGFMT"; then
      AC_MSG_ERROR([msgfmt is required for NLS])
    fi
--- 243,249 ----
                   [AC_MSG_ERROR([a gettext implementation is required for NLS])])
    AC_CHECK_HEADER([libintl.h], [],
                    [AC_MSG_ERROR([header file <libintl.h> is required for NLS])])
!   PGAC_PATH_PROGS(MSGFMT, msgfmt)
    if test -z "$MSGFMT"; then
      AC_MSG_ERROR([msgfmt is required for NLS])
    fi
*************** AC_DEFUN([PGAC_CHECK_GETTEXT],
*** 238,245 ****
      pgac_cv_msgfmt_flags=-c
  fi])
    AC_SUBST(MSGFMT_FLAGS, $pgac_cv_msgfmt_flags)
!   AC_PATH_PROGS(MSGMERGE, msgmerge)
!   AC_PATH_PROGS(XGETTEXT, xgettext)
  ])# PGAC_CHECK_GETTEXT


--- 252,259 ----
      pgac_cv_msgfmt_flags=-c
  fi])
    AC_SUBST(MSGFMT_FLAGS, $pgac_cv_msgfmt_flags)
!   PGAC_PATH_PROGS(MSGMERGE, msgmerge)
!   PGAC_PATH_PROGS(XGETTEXT, xgettext)
  ])# PGAC_CHECK_GETTEXT


diff --git a/config/python.m4 b/config/python.m4
index 953d709..f3c7642 100644
*** a/config/python.m4
--- b/config/python.m4
***************
*** 6,15 ****

  # PGAC_PATH_PYTHON
  # ----------------
! # Look for Python and set the output variable 'PYTHON'
! # to 'python' if found, empty otherwise.
  AC_DEFUN([PGAC_PATH_PYTHON],
! [AC_PATH_PROG(PYTHON, python)
  if test x"$PYTHON" = x""; then
    AC_MSG_ERROR([Python not found])
  fi
--- 6,15 ----

  # PGAC_PATH_PYTHON
  # ----------------
! # Look for Python and set the output variable 'PYTHON' if found,
! # fail otherwise.
  AC_DEFUN([PGAC_PATH_PYTHON],
! [PGAC_PATH_PROGS(PYTHON, python)
  if test x"$PYTHON" = x""; then
    AC_MSG_ERROR([Python not found])
  fi
diff --git a/config/tcl.m4 b/config/tcl.m4
index 907deb9..a4bf231 100644
*** a/config/tcl.m4
--- b/config/tcl.m4
***************
*** 4,10 ****


  AC_DEFUN([PGAC_PATH_TCLSH],
! [AC_PATH_PROGS(TCLSH, [tclsh tcl tclsh8.6 tclsh86 tclsh8.5 tclsh85 tclsh8.4 tclsh84])
  if test x"$TCLSH" = x""; then
    AC_MSG_ERROR([Tcl shell not found])
  fi
--- 4,10 ----


  AC_DEFUN([PGAC_PATH_TCLSH],
! [PGAC_PATH_PROGS(TCLSH, [tclsh tcl tclsh8.6 tclsh86 tclsh8.5 tclsh85 tclsh8.4 tclsh84])
  if test x"$TCLSH" = x""; then
    AC_MSG_ERROR([Tcl shell not found])
  fi
diff --git a/configure.in b/configure.in
index abfc7b5..a0f0f85 100644
*** a/configure.in
--- b/configure.in
*************** PGAC_ARG_BOOL(enable, profiling, no,
*** 218,232 ****
  #
  PGAC_ARG_BOOL(enable, coverage, no,
                [build with coverage testing instrumentation],
! [AC_PATH_PROGS(GCOV, gcov)
  if test -z "$GCOV"; then
    AC_MSG_ERROR([gcov not found])
  fi
! AC_PATH_PROGS(LCOV, lcov)
  if test -z "$LCOV"; then
    AC_MSG_ERROR([lcov not found])
  fi
! AC_PATH_PROGS(GENHTML, genhtml)
  if test -z "$GENHTML"; then
    AC_MSG_ERROR([genhtml not found])
  fi])
--- 218,232 ----
  #
  PGAC_ARG_BOOL(enable, coverage, no,
                [build with coverage testing instrumentation],
! [PGAC_PATH_PROGS(GCOV, gcov)
  if test -z "$GCOV"; then
    AC_MSG_ERROR([gcov not found])
  fi
! PGAC_PATH_PROGS(LCOV, lcov)
  if test -z "$LCOV"; then
    AC_MSG_ERROR([lcov not found])
  fi
! PGAC_PATH_PROGS(GENHTML, genhtml)
  if test -z "$GENHTML"; then
    AC_MSG_ERROR([genhtml not found])
  fi])
*************** AC_SUBST(enable_coverage)
*** 237,243 ****
  #
  PGAC_ARG_BOOL(enable, dtrace, no,
                [build with DTrace support],
! [AC_PATH_PROGS(DTRACE, dtrace)
  if test -z "$DTRACE"; then
    AC_MSG_ERROR([dtrace not found])
  fi
--- 237,243 ----
  #
  PGAC_ARG_BOOL(enable, dtrace, no,
                [build with DTrace support],
! [PGAC_PATH_PROGS(DTRACE, dtrace)
  if test -z "$DTRACE"; then
    AC_MSG_ERROR([dtrace not found])
  fi
*************** PGAC_ARG_BOOL(with, libxml, no, [build w
*** 816,822 ****
                [AC_DEFINE([USE_LIBXML], 1, [Define to 1 to build with XML support. (--with-libxml)])])

  if test "$with_libxml" = yes ; then
!   AC_PATH_PROGS(XML2_CONFIG, xml2-config)
    if test -n "$XML2_CONFIG"; then
      for pgac_option in `$XML2_CONFIG --cflags`; do
        case $pgac_option in
--- 816,822 ----
                [AC_DEFINE([USE_LIBXML], 1, [Define to 1 to build with XML support. (--with-libxml)])])

  if test "$with_libxml" = yes ; then
!   PGAC_PATH_PROGS(XML2_CONFIG, xml2-config)
    if test -n "$XML2_CONFIG"; then
      for pgac_option in `$XML2_CONFIG --cflags`; do
        case $pgac_option in
*************** case $INSTALL in
*** 912,918 ****
  esac
  AC_SUBST(install_bin)

! AC_PATH_PROG(TAR, tar)
  AC_PROG_LN_S
  AC_PROG_AWK
  AC_PROG_MKDIR_P
--- 912,918 ----
  esac
  AC_SUBST(install_bin)

! PGAC_PATH_PROGS(TAR, tar)
  AC_PROG_LN_S
  AC_PROG_AWK
  AC_PROG_MKDIR_P
*************** if test "$with_python" = yes; then
*** 948,954 ****
  fi

  if test "$cross_compiling" = yes && test -z "$with_system_tzdata"; then
!   AC_PATH_PROG(ZIC, zic)
    if test -z "$ZIC"; then
      AC_MSG_ERROR([
  When cross-compiling, either use the option --with-system-tzdata to use
--- 948,954 ----
  fi

  if test "$cross_compiling" = yes && test -z "$with_system_tzdata"; then
!   PGAC_PATH_PROGS(ZIC, zic)
    if test -z "$ZIC"; then
      AC_MSG_ERROR([
  When cross-compiling, either use the option --with-system-tzdata to use
*************** fi
*** 2119,2135 ****
  #
  PGAC_PROG_NSGMLS
  PGAC_CHECK_DOCBOOK(4.2)
! AC_PATH_PROGS(DBTOEPUB, dbtoepub)
! AC_PATH_PROGS(XMLLINT, xmllint)
! AC_PATH_PROGS(XSLTPROC, xsltproc)
! AC_PATH_PROGS(OSX, [osx sgml2xml sx])
! AC_PATH_PROGS(FOP, fop)

  #
  # Check for test tools
  #
  if test "$enable_tap_tests" = yes; then
!   AC_PATH_PROGS(PROVE, prove)
    if test -z "$PROVE"; then
      AC_MSG_ERROR([prove not found])
    fi
--- 2119,2135 ----
  #
  PGAC_PROG_NSGMLS
  PGAC_CHECK_DOCBOOK(4.2)
! PGAC_PATH_PROGS(DBTOEPUB, dbtoepub)
! PGAC_PATH_PROGS(XMLLINT, xmllint)
! PGAC_PATH_PROGS(XSLTPROC, xsltproc)
! PGAC_PATH_PROGS(OSX, [osx sgml2xml sx])
! PGAC_PATH_PROGS(FOP, fop)

  #
  # Check for test tools
  #
  if test "$enable_tap_tests" = yes; then
!   PGAC_PATH_PROGS(PROVE, prove)
    if test -z "$PROVE"; then
      AC_MSG_ERROR([prove not found])
    fi

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Steve Singer
Дата:
Сообщение: Re: [HACKERS] 10 beta docs: different replication solutions
Следующее
От: Masahiko Sawada
Дата:
Сообщение: Re: [HACKERS] Fix a typo in pg_upgrade/info.c