Thread: Re: [BUGS] Detecting proper bison version before make

Re: [BUGS] Detecting proper bison version before make

From
Bruce Momjian
Date:
Here is an applied patch to check for bison version >= 1.875 and print a
warning.  I piggybacks on the existing bison warning.

---------------------------------------------------------------------------

Greg Sabino Mullane wrote:
[ There is text before PGP section. ]
>
[ PGP not available, raw data follows ]
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> I just installed Postgres on an older machine and was surprised
> that configure did not throw an error about running an old version
> of bison, but let me get a bit into the whole 'make' cycle before
> a cryptic error was thrown. Can the configure script be made to check
> for a proper version of bison?
>
> - --
> Greg Sabino Mullane greg@turnstep.com
> PGP Key: 0x14964AC8 200306012154
> -----BEGIN PGP SIGNATURE-----
> Comment: http://www.turnstep.com/pgp.html
>
> iD8DBQE+2q7qvJuQZxSWSsgRAjmqAKDOWFXmckpYnvrIXSKVY7CQNWcn2gCbBb7b
> il6Rrr+MmQ4fUrFNN4dRNyM=
> =2Y3s
> -----END PGP SIGNATURE-----
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
[ Decrypting message... End of raw data. ]

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: configure
===================================================================
RCS file: /cvsroot/pgsql-server/configure,v
retrieving revision 1.263
diff -c -c -r1.263 configure
*** configure    27 May 2003 16:36:50 -0000    1.263
--- configure    6 Jun 2003 19:09:29 -0000
***************
*** 4424,4429 ****
--- 4424,4442 ----
    test -n "$YACC" && break
  done

+
+ if test "$YACC"; then
+   if bison --version | sed q | $AWK '{ if ($4 < 1.875) exit 0; else exit 1;}'; then
+     { echo "$as_me:$LINENO: WARNING:
+ *** The installed version of Bison is too old.  PostgreSQL needs
+ *** Bison version 1.875 or later." >&5
+ echo "$as_me: WARNING:
+ *** The installed version of Bison is too old.  PostgreSQL needs
+ *** Bison version 1.875 or later." >&2;}
+     unset YACC
+   fi
+ fi
+
  if test -z "$YACC"; then
    { echo "$as_me:$LINENO: WARNING:
  *** Without Bison you will not be able to build PostgreSQL from CVS or
Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql-server/configure.in,v
retrieving revision 1.254
diff -c -c -r1.254 configure.in
*** configure.in    27 May 2003 16:36:50 -0000    1.254
--- configure.in    6 Jun 2003 19:09:30 -0000
***************
*** 585,590 ****
--- 585,600 ----
  PGAC_CHECK_STRIP

  AC_CHECK_PROGS(YACC, ['bison -y'])
+
+ if test "$YACC"; then
+   if bison --version | sed q | $AWK '{ if ($4 < 1.875) exit 0; else exit 1;}'; then
+     AC_MSG_WARN([
+ *** The installed version of Bison is too old.  PostgreSQL needs
+ *** Bison version 1.875 or later.])
+     unset YACC
+   fi
+ fi
+
  if test -z "$YACC"; then
    AC_MSG_WARN([
  *** Without Bison you will not be able to build PostgreSQL from CVS or

Re: [BUGS] Detecting proper bison version before make

From
Peter Eisentraut
Date:
Bruce Momjian writes:

> Here is an applied patch to check for bison version >= 1.875 and print a
> warning.  I piggybacks on the existing bison warning.

Instead of 'bison --version' you need to check the executable that was
actually detected by configure.

--
Peter Eisentraut   peter_e@gmx.net


Re: [BUGS] Detecting proper bison version before make

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
>   AC_CHECK_PROGS(YACC, ['bison -y'])
> +
> + if test "$YACC"; then
> +   if bison --version | sed q | $AWK '{ if ($4 < 1.875) exit 0; else exit 1;}'; then
> +     AC_MSG_WARN([

Should this not be making at least some effort to use the particular
program found by the AC_CHECK_PROGS macro?  ie, why not $YACC --version ...

            regards, tom lane

Re: [BUGS] Detecting proper bison version before make

From
Bruce Momjian
Date:
Peter Eisentraut wrote:
> Bruce Momjian writes:
>
> > Here is an applied patch to check for bison version >= 1.875 and print a
> > warning.  I piggybacks on the existing bison warning.
>
> Instead of 'bison --version' you need to check the executable that was
> actually detected by configure.

I have since changed it to $YACC, per suggestion from Tom.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073