From 55233c3382ed5b9981f232e2f43003dab84c3925 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 7 Jan 2010 01:41:11 +0000 Subject: [PATCH] Make configure check the version of Perl we're building with, and reject versions < 5.8. Also, if there's no Perl, emit a warning informing the user that he won't be able to build from a CVS pull. This is exactly the same treatment we give Bison and Perl, and for the same reasons. --- config/perl.m4 | 29 +++++++++++++++++++++++++++-- configure | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/config/perl.m4 b/config/perl.m4 index b42a04fbfd..ad64379e5a 100644 --- a/config/perl.m4 +++ b/config/perl.m4 @@ -1,10 +1,35 @@ -# $PostgreSQL: pgsql/config/perl.m4,v 1.5 2009/09/08 18:15:55 tgl Exp $ +# $PostgreSQL: pgsql/config/perl.m4,v 1.6 2010/01/07 01:41:11 tgl Exp $ # PGAC_PATH_PERL # -------------- AC_DEFUN([PGAC_PATH_PERL], -[AC_PATH_PROG(PERL, 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 ]*//p'] | sed ['s/ .*//']` + AC_MSG_NOTICE([using perl $pgac_perl_version]) + if echo "$pgac_perl_version" | sed ['s/[.a-z_]/ /g'] | \ + $AWK '{ if ([$]1 = 5 && [$]2 >= 8) exit 1; else exit 0;}' + then + AC_MSG_WARN([ +*** The installed version of Perl, $PERL, is too old to use with PostgreSQL. +*** Perl version 5.8 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 CVS. +*** 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.)]) +fi +])# PGAC_PATH_PERL # PGAC_CHECK_PERL_CONFIG(NAME) diff --git a/configure b/configure index d1f710de1b..88689be1ed 100755 --- a/configure +++ b/configure @@ -6822,7 +6822,9 @@ fi -# Extract the first word of "perl", so it can be a program name with args. +# Let the user override the search +if test -z "$PERL"; then + # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } @@ -6862,6 +6864,38 @@ $as_echo "no" >&6; } fi +fi + +if test "$PERL"; then + pgac_perl_version=`$PERL -v 2>/dev/null | sed -n 's/This is perl, v[a-z ]*//p' | sed 's/ .*//'` + { $as_echo "$as_me:$LINENO: using perl $pgac_perl_version" >&5 +$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 >= 8) exit 1; else exit 0;}' + then + { $as_echo "$as_me:$LINENO: WARNING: +*** The installed version of Perl, $PERL, is too old to use with PostgreSQL. +*** Perl version 5.8 or later is required, but this is $pgac_perl_version." >&5 +$as_echo "$as_me: WARNING: +*** The installed version of Perl, $PERL, is too old to use with PostgreSQL. +*** Perl version 5.8 or later is required, but this is $pgac_perl_version." >&2;} + PERL="" + fi +fi + +if test -z "$PERL"; then + { $as_echo "$as_me:$LINENO: WARNING: +*** Without Perl you will not be able to build PostgreSQL from CVS. +*** 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 CVS. +*** 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;} +fi + if test "$with_perl" = yes; then { $as_echo "$as_me:$LINENO: checking for Perl archlibexp" >&5 -- 2.40.0