From fc098dfc3389a3b7c1ebd7ac8f4da2e8058085dc Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 23 Jun 2009 03:46:00 +0000 Subject: [PATCH] Fix the makefiles to fail cleanly if Perl is needed but not present. This used to work as intended, but got broken some time ago (a quoted empty string is not an empty string), and got broken some more by the changes to generate ecpg's preproc.y automatically. Given all the unprotected uses of $(PERL) elsewhere, it seems best to make use of the $(missing) script rather than trying to ensure each such use is protected individually. Also fix various bits of documentation that omitted to mention Perl as a requirement for building from a CVS pull. Per a complaint from Robert Haas. --- README.CVS | 6 +++--- config/missing | 23 +++++++++++++++++++++-- doc/src/sgml/cvs.sgml | 1 + doc/src/sgml/installation.sgml | 14 +++++++++++++- src/Makefile.global.in | 8 ++++++-- src/bin/psql/Makefile | 5 ----- 6 files changed, 44 insertions(+), 13 deletions(-) diff --git a/README.CVS b/README.CVS index 37daaf6bc3..4eb8377a50 100644 --- a/README.CVS +++ b/README.CVS @@ -8,7 +8,7 @@ If you are using CVS, you can view the most recent install instructions at: and the current release notes at: http://developer.postgresql.org/docs/postgres/release.html -Users compiling from CVS will also need compatible versions of Bison and -Flex, as discussed in the install documentation. Bison and Flex are not +Users compiling from CVS will also need compatible versions of Bison, Flex, +and Perl, as discussed in the install documentation. These programs are not needed when using a tarball, since the files they are needed to build are -already present in the tarball. +already present in the tarball. (On Windows, however, you need Perl anyway.) diff --git a/config/missing b/config/missing index 1c8bd8af96..896a33c200 100755 --- a/config/missing +++ b/config/missing @@ -17,7 +17,7 @@ case $1 in WARNING: \`$1' is missing on your system. You should only need it if you changed the file \`$input'; these changes will not take effect. You can get $1 from a GNU mirror site. -***" +***" >&2 echo "touch $output" touch "$output" exit 0 @@ -28,8 +28,27 @@ ERROR: \`$1' is missing on your system. It is needed to create the file \`$output'. You can either get $1 from a GNU mirror site or download an official distribution of PostgreSQL, which contains pre-packaged $1 output. -***" +***" >&2 exit 1 fi ;; + + perl) + # `missing perl' + echo "\ +*** +ERROR: Perl is missing on your system. It is needed unless you are building +from an unmodified official distribution of PostgreSQL. +***" >&2 + exit 1 + ;; + + *) + # `missing something-or-other' + echo "\ +*** +ERROR: \`$1' is missing on your system. +***" >&2 + exit 1 + ;; esac diff --git a/doc/src/sgml/cvs.sgml b/doc/src/sgml/cvs.sgml index 0b19b00e5d..003e4e7760 100644 --- a/doc/src/sgml/cvs.sgml +++ b/doc/src/sgml/cvs.sgml @@ -171,6 +171,7 @@ cvs update pull requires reasonably up-to-date versions of bison and flex, which are not needed to build from a distribution tarball because the files made with them are pre-built in a tarball. + You will need Perl as well. Otherwise the tool requirements are the same as building from source. diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml index 2c053e4147..c058141079 100644 --- a/doc/src/sgml/installation.sgml +++ b/doc/src/sgml/installation.sgml @@ -294,13 +294,25 @@ su - postgres GNU Flex and Bison - are needed to build a CVS checkout or if you changed the actual + are needed to build from a CVS checkout, or if you changed the actual scanner and parser definition files. If you need them, be sure to get Flex 2.5.4 or later and Bison 1.875 or later. Other lex and yacc programs cannot be used. + + + + perl + + + Perl is also needed to build from a CVS 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 + Perl in any case. + + diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 829ce7218d..6244e8ac8c 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -248,8 +248,12 @@ X = @EXEEXT@ # Perl -# quoted for pathname with spaces -PERL = "@PERL@" +ifneq (@PERL@,) + # quoted to protect pathname with spaces + PERL = "@PERL@" +else + PERL = $(missing) perl +endif perl_archlibexp = @perl_archlibexp@ perl_privlibexp = @perl_privlibexp@ perl_useshrplib = @perl_useshrplib@ diff --git a/src/bin/psql/Makefile b/src/bin/psql/Makefile index cc7d42ec4e..1d82caf8d0 100644 --- a/src/bin/psql/Makefile +++ b/src/bin/psql/Makefile @@ -40,13 +40,8 @@ dumputils.c keywords.c: % : $(top_srcdir)/src/bin/pg_dump/% kwlookup.c: % : $(top_srcdir)/src/backend/parser/% rm -f $@ && $(LN_S) $< . -ifdef PERL $(srcdir)/sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml) $(PERL) $< $(REFDOCDIR) $@ -else -$(srcdir)/sql_help.h: - @echo "*** Perl is needed to build psql help." -endif $(srcdir)/psqlscan.c: psqlscan.l ifdef FLEX -- 2.39.5