v5-0001-Make-bison-flex-perl-hard-build-requirements.patch

text/plain

Filename: v5-0001-Make-bison-flex-perl-hard-build-requirements.patch
Type: text/plain
Part: 0
Message: Re: Remove distprep

Patch

Format: format-patch
Series: patch v5-0001
Subject: Make bison, flex, perl hard build requirements
File+
config/perl.m4 2 7
config/programs.m4 4 17
configure 9 53
doc/src/sgml/installation.sgml 35 45
doc/src/sgml/sourcerepo.sgml 0 10
src/Makefile.global.in 2 14
From 9b4504ce0e247b840b8cef424e44d922bc7cde88 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Thu, 5 Oct 2023 17:39:24 +0200
Subject: [PATCH v5 1/2] Make bison, flex, perl hard build requirements

... see next patch
---
 config/perl.m4                 |  9 +---
 config/programs.m4             | 21 ++-------
 configure                      | 62 ++++----------------------
 doc/src/sgml/installation.sgml | 80 +++++++++++++++-------------------
 doc/src/sgml/sourcerepo.sgml   | 10 -----
 src/Makefile.global.in         | 16 +------
 6 files changed, 52 insertions(+), 146 deletions(-)

diff --git a/config/perl.m4 b/config/perl.m4
index 8126e79f67..1a3bb55649 100644
--- a/config/perl.m4
+++ b/config/perl.m4
@@ -13,19 +13,14 @@ if test "$PERL"; then
   if echo "$pgac_perl_version" | sed ['s/[.a-z_]/ /g'] | \
     $AWK '{ if ([$]1 == 5 && ([$]2 >= 14)) exit 1; else exit 0;}'
   then
-    AC_MSG_WARN([
+    AC_MSG_ERROR([
 *** The installed version of Perl, $PERL, is too old to use with PostgreSQL.
 *** Perl version 5.14 or later is required, but this is $pgac_perl_version.])
-    PERL=""
   fi
 fi
 
 if test -z "$PERL"; then
-  AC_MSG_WARN([
-*** Without Perl you will not be able to build PostgreSQL from Git.
-*** You can obtain Perl from any CPAN mirror site.
-*** (If you are using the official distribution of PostgreSQL then you do not
-*** need to worry about this, because the Perl output is pre-generated.)])
+  AC_MSG_ERROR([Perl not found])
 fi
 ])# PGAC_PATH_PERL
 
diff --git a/config/programs.m4 b/config/programs.m4
index 8a118b4e03..490ec9fe9f 100644
--- a/config/programs.m4
+++ b/config/programs.m4
@@ -33,10 +33,9 @@ if test "$BISON"; then
   AC_MSG_NOTICE([using $pgac_bison_version])
   if echo "$pgac_bison_version" | $AWK '{ if ([$]4 < 2.3) exit 0; else exit 1;}'
   then
-    AC_MSG_WARN([
+    AC_MSG_ERROR([
 *** The installed version of Bison, $BISON, is too old to use with PostgreSQL.
 *** Bison version 2.3 or later is required, but this is $pgac_bison_version.])
-    BISON=""
   fi
   # Bison >=3.0 issues warnings about %name-prefix="base_yy", instead
   # of the now preferred %name-prefix "base_yy", but the latter
@@ -49,12 +48,7 @@ if test "$BISON"; then
 fi
 
 if test -z "$BISON"; then
-  AC_MSG_WARN([
-*** Without Bison you will not be able to build PostgreSQL from Git nor
-*** change any of the parser definition files.  You can obtain Bison from
-*** a GNU mirror site.  (If you are using the official distribution of
-*** PostgreSQL then you do not need to worry about this, because the Bison
-*** output is pre-generated.)])
+  AC_MSG_ERROR([bison not found])
 fi
 dnl We don't need AC_SUBST(BISON) because PGAC_PATH_PROGS did it
 AC_SUBST(BISONFLAGS)
@@ -95,7 +89,7 @@ else
             pgac_cv_path_flex=$pgac_candidate
             break 2
           else
-            AC_MSG_WARN([
+            AC_MSG_ERROR([
 *** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
 *** Flex version 2.5.35 or later is required, but this is $pgac_flex_version.])
           fi
@@ -109,14 +103,7 @@ fi
 ])[]dnl AC_CACHE_CHECK
 
 if test x"$pgac_cv_path_flex" = x"no"; then
-  AC_MSG_WARN([
-*** Without Flex you will not be able to build PostgreSQL from Git nor
-*** change any of the scanner definition files.  You can obtain Flex from
-*** a GNU mirror site.  (If you are using the official distribution of
-*** PostgreSQL then you do not need to worry about this because the Flex
-*** output is pre-generated.)])
-
-  FLEX=
+  AC_MSG_ERROR([flex not found])
 else
   FLEX=$pgac_cv_path_flex
   pgac_flex_version=`$FLEX --version 2>/dev/null`
diff --git a/configure b/configure
index d47e0f8b26..514cee190d 100755
--- a/configure
+++ b/configure
@@ -10160,13 +10160,9 @@ if test "$BISON"; then
 $as_echo "$as_me: using $pgac_bison_version" >&6;}
   if echo "$pgac_bison_version" | $AWK '{ if ($4 < 2.3) exit 0; else exit 1;}'
   then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
-*** The installed version of Bison, $BISON, is too old to use with PostgreSQL.
-*** Bison version 2.3 or later is required, but this is $pgac_bison_version." >&5
-$as_echo "$as_me: WARNING:
+    as_fn_error $? "
 *** The installed version of Bison, $BISON, is too old to use with PostgreSQL.
-*** Bison version 2.3 or later is required, but this is $pgac_bison_version." >&2;}
-    BISON=""
+*** Bison version 2.3 or later is required, but this is $pgac_bison_version." "$LINENO" 5
   fi
   # Bison >=3.0 issues warnings about %name-prefix="base_yy", instead
   # of the now preferred %name-prefix "base_yy", but the latter
@@ -10179,18 +10175,7 @@ $as_echo "$as_me: WARNING:
 fi
 
 if test -z "$BISON"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
-*** Without Bison you will not be able to build PostgreSQL from Git nor
-*** change any of the parser definition files.  You can obtain Bison from
-*** a GNU mirror site.  (If you are using the official distribution of
-*** PostgreSQL then you do not need to worry about this, because the Bison
-*** output is pre-generated.)" >&5
-$as_echo "$as_me: WARNING:
-*** Without Bison you will not be able to build PostgreSQL from Git nor
-*** change any of the parser definition files.  You can obtain Bison from
-*** a GNU mirror site.  (If you are using the official distribution of
-*** PostgreSQL then you do not need to worry about this, because the Bison
-*** output is pre-generated.)" >&2;}
+  as_fn_error $? "bison not found" "$LINENO" 5
 fi
 
 
@@ -10223,12 +10208,9 @@ else
             pgac_cv_path_flex=$pgac_candidate
             break 2
           else
-            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
-*** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
-*** Flex version 2.5.35 or later is required, but this is $pgac_flex_version." >&5
-$as_echo "$as_me: WARNING:
+            as_fn_error $? "
 *** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
-*** Flex version 2.5.35 or later is required, but this is $pgac_flex_version." >&2;}
+*** Flex version 2.5.35 or later is required, but this is $pgac_flex_version." "$LINENO" 5
           fi
         fi
       fi
@@ -10242,20 +10224,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_path_flex" >&5
 $as_echo "$pgac_cv_path_flex" >&6; }
 if test x"$pgac_cv_path_flex" = x"no"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
-*** Without Flex you will not be able to build PostgreSQL from Git nor
-*** change any of the scanner definition files.  You can obtain Flex from
-*** a GNU mirror site.  (If you are using the official distribution of
-*** PostgreSQL then you do not need to worry about this because the Flex
-*** output is pre-generated.)" >&5
-$as_echo "$as_me: WARNING:
-*** Without Flex you will not be able to build PostgreSQL from Git nor
-*** change any of the scanner definition files.  You can obtain Flex from
-*** a GNU mirror site.  (If you are using the official distribution of
-*** PostgreSQL then you do not need to worry about this because the Flex
-*** output is pre-generated.)" >&2;}
-
-  FLEX=
+  as_fn_error $? "flex not found" "$LINENO" 5
 else
   FLEX=$pgac_cv_path_flex
   pgac_flex_version=`$FLEX --version 2>/dev/null`
@@ -10329,27 +10298,14 @@ $as_echo "$as_me: using perl $pgac_perl_version" >&6;}
   if echo "$pgac_perl_version" | sed 's/[.a-z_]/ /g' | \
     $AWK '{ if ($1 == 5 && ($2 >= 14)) exit 1; else exit 0;}'
   then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
-*** The installed version of Perl, $PERL, is too old to use with PostgreSQL.
-*** Perl version 5.14 or later is required, but this is $pgac_perl_version." >&5
-$as_echo "$as_me: WARNING:
+    as_fn_error $? "
 *** The installed version of Perl, $PERL, is too old to use with PostgreSQL.
-*** Perl version 5.14 or later is required, but this is $pgac_perl_version." >&2;}
-    PERL=""
+*** Perl version 5.14 or later is required, but this is $pgac_perl_version." "$LINENO" 5
   fi
 fi
 
 if test -z "$PERL"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
-*** Without Perl you will not be able to build PostgreSQL from Git.
-*** You can obtain Perl from any CPAN mirror site.
-*** (If you are using the official distribution of PostgreSQL then you do not
-*** need to worry about this, because the Perl output is pre-generated.)" >&5
-$as_echo "$as_me: WARNING:
-*** Without Perl you will not be able to build PostgreSQL from Git.
-*** You can obtain Perl from any CPAN mirror site.
-*** (If you are using the official distribution of PostgreSQL then you do not
-*** need to worry about this, because the Perl output is pre-generated.)" >&2;}
+  as_fn_error $? "Perl not found" "$LINENO" 5
 fi
 
 if test "$with_perl" = yes; then
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index f4b1f81189..468759583c 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -102,6 +102,41 @@ <title>Requirements</title>
      </para>
     </listitem>
 
+    <listitem>
+     <para>
+      <indexterm>
+       <primary>flex</primary>
+      </indexterm>
+      <indexterm>
+       <primary>lex</primary>
+      </indexterm>
+      <indexterm>
+       <primary>bison</primary>
+      </indexterm>
+      <indexterm>
+       <primary>yacc</primary>
+      </indexterm>
+
+      <application>Flex</application> 2.5.35 or later and
+      <application>Bison</application> 2.3 or later are required.  Other
+      <application>lex</application> and <application>yacc</application>
+      programs cannot be used.
+     </para>
+    </listitem>
+
+    <listitem>
+     <para>
+      <indexterm>
+       <primary>perl</primary>
+      </indexterm>
+
+      <application>Perl</application> 5.14 or later is needed during the build
+      process and to run some test suites.  (This requirement is separate from
+      the requirements for building <application>PL/Perl</application>; see
+      below.)
+     </para>
+    </listitem>
+
     <listitem>
      <para>
       <indexterm>
@@ -315,51 +350,6 @@ <title>Requirements</title>
    </itemizedlist>
   </para>
 
-  <para>
-   If you are building from a <productname>Git</productname> tree instead of
-   using a released source package, or if you want to do server development,
-   you also need the following packages:
-
-   <itemizedlist>
-    <listitem>
-     <para>
-      <indexterm>
-       <primary>flex</primary>
-      </indexterm>
-      <indexterm>
-       <primary>lex</primary>
-      </indexterm>
-      <indexterm>
-       <primary>bison</primary>
-      </indexterm>
-      <indexterm>
-       <primary>yacc</primary>
-      </indexterm>
-
-      <application>Flex</application> and <application>Bison</application>
-      are needed to build from a Git checkout, or if you changed the actual
-      scanner and parser definition files. If you need them, be sure
-      to get <application>Flex</application> 2.5.35 or later and
-      <application>Bison</application> 2.3 or later. Other <application>lex</application>
-      and <application>yacc</application> programs cannot be used.
-     </para>
-    </listitem>
-    <listitem>
-     <para>
-      <indexterm>
-       <primary>perl</primary>
-      </indexterm>
-
-      <application>Perl</application> 5.14 or later is needed to build from a Git checkout,
-      or if you changed the input files for any of the build steps that
-      use Perl scripts.  If building on Windows you will need
-      <application>Perl</application> in any case.  <application>Perl</application> is
-      also required to run some test suites.
-     </para>
-    </listitem>
-   </itemizedlist>
-  </para>
-
   <para>
    If you need to get a <acronym>GNU</acronym> package, you can find
    it at your local <acronym>GNU</acronym> mirror site (see <ulink
diff --git a/doc/src/sgml/sourcerepo.sgml b/doc/src/sgml/sourcerepo.sgml
index 07b003a794..6c13c5a30c 100644
--- a/doc/src/sgml/sourcerepo.sgml
+++ b/doc/src/sgml/sourcerepo.sgml
@@ -16,16 +16,6 @@ <title>The Source Code Repository</title>
   has some discussion on working with Git.
  </para>
 
-  <para>
-   Note that building <productname>PostgreSQL</productname> from the source
-   repository requires reasonably up-to-date versions of <application>bison</application>,
-   <application>flex</application>, and <application>Perl</application>.
-   These tools are not needed to build from a distribution tarball, because
-   the files generated with these tools are included in the tarball.
-   Other tool requirements
-   are the same as shown in <xref linkend="install-requirements"/>.
-  </para>
-
  <sect1 id="git">
   <title>Getting the Source via <productname>Git</productname></title>
 
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 7b66590801..985b3ea62b 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -319,12 +319,8 @@ X = @EXEEXT@
 
 # Perl
 
-ifneq (@PERL@,)
-    # quoted to protect pathname with spaces
-    PERL		= '@PERL@'
-else
-    PERL		= $(missing) perl
-endif
+# quoted to protect pathname with spaces
+PERL		= '@PERL@'
 perl_archlibexp		= @perl_archlibexp@
 perl_privlibexp		= @perl_privlibexp@
 perl_includespec	= @perl_includespec@
@@ -777,21 +773,13 @@ TAS         = @TAS@
 # Global targets and rules
 
 %.c: %.l
-ifdef FLEX
 	$(FLEX) $(if $(FLEX_NO_BACKUP),-b) $(FLEXFLAGS) -o'$@' $<
 	@$(if $(FLEX_NO_BACKUP),if [ `wc -l <lex.backup` -eq 1 ]; then rm lex.backup; else echo "Scanner requires backup; see lex.backup." 1>&2; exit 1; fi)
 	$(if $(FLEX_FIX_WARNING),$(PERL) $(top_srcdir)/src/tools/fix-old-flex-code.pl '$@')
-else
-	@$(missing) flex $< '$@'
-endif
 
 %.c: %.y
 	$(if $(BISON_CHECK_CMD),$(BISON_CHECK_CMD))
-ifdef BISON
 	$(BISON) $(BISONFLAGS) -o $@ $<
-else
-	@$(missing) bison $< $@
-endif
 
 %.i: %.c
 	$(CPP) $(CPPFLAGS) -o $@ $<
-- 
2.42.0