Re: flex [was mod_python 3.2.0-BETA available for testing]

2005-08-26 Thread Jim Gallacher

Gregory (Grisha) Trubetskoy wrote:


OK, here is the flex scoop - as the the docs point out, anything before 
2.5.31 is not reentrant and I think even uses a slightly different 
interface so older flex won't even process the psp_parser.l file correctly.


Looking at Fedora Core 4, it still has flex 2.5.4a. (Note that 2.5.31  
2.5.4 because 31  4 - I for a while had trouble seeing that for some 
reason), so the new flex is still not commonplace.


So until reentrant flex becomes commonplace, the solution was to include
a pre-parsed psp_parser.c so that you woudln't need flex at all to 
compile mod_python. Looks like this still should be the case.


The ./configure should just print a warning that if flex is not found or 
too old, should you need to rebuild psp_parser.c you will need to get 
the right version of flex.




I've made the changes to configure.in, but before I commit I wanted to 
get some feedback. Are the following configure messages unclear or too 
verbose?


For the case of the missing flex, ./configure will generate:
...
checking for --with-flex... no
checking for flex... no
configure: WARNING: flex  not found
  You can generally ignore this warning unless you need to regenerate
  psp_parser.c from psp_parse.l. If you do need regenerate psp_parser.c,
  use --with-flex to specify the location of flex.
  See the README for more information.
...

For the case of the wrong flex version, ./configure will generate:
...
checking for --with-flex... no
checking for flex... /usr/local/sbin/flex
found /usr/local/sbin/flex, we'll use this. Use --with-flex to specify 
another.

checking flex version... configure: WARNING: Flex version 2.5.4 found.
  Version 2.5.31 or greater is required.
  You can generally ignore this warning unless you need to regenerate
  psp_parser.c from psp_parse.l. If you do need regenerate psp_parser.c,
  use --with-flex to specify the location of the correct flex version.
  See the README for more information.
...

Any comments?

Jim


Re: flex [was mod_python 3.2.0-BETA available for testing]

2005-08-26 Thread Nick

Jim,

I don't think it's too verbose, but maybe you could delay it to the end of 
the configure script so you don't have to either interrupt with control-C or 
scroll back to see what went wrong.


Here's another idea: Fail the flex test fairly silently (e.g. just no), 
but fall back to a script that generates a nice, verbose error message 
explaining the situation.  That way, when the user tries to call make 
after modifying the .l file, the fake flex alternative script gets called, 
displays the message, and exits with status 1.


Nick

Jim Gallacher wrote:

Gregory (Grisha) Trubetskoy wrote:



OK, here is the flex scoop - as the the docs point out, anything 
before 2.5.31 is not reentrant and I think even uses a slightly 
different interface so older flex won't even process the psp_parser.l 
file correctly.


Looking at Fedora Core 4, it still has flex 2.5.4a. (Note that 2.5.31 
 2.5.4 because 31  4 - I for a while had trouble seeing that for 
some reason), so the new flex is still not commonplace.


So until reentrant flex becomes commonplace, the solution was to include
a pre-parsed psp_parser.c so that you woudln't need flex at all to 
compile mod_python. Looks like this still should be the case.


The ./configure should just print a warning that if flex is not found 
or too old, should you need to rebuild psp_parser.c you will need to 
get the right version of flex.




I've made the changes to configure.in, but before I commit I wanted to 
get some feedback. Are the following configure messages unclear or too 
verbose?


For the case of the missing flex, ./configure will generate:
...
checking for --with-flex... no
checking for flex... no
configure: WARNING: flex  not found
  You can generally ignore this warning unless you need to regenerate
  psp_parser.c from psp_parse.l. If you do need regenerate psp_parser.c,
  use --with-flex to specify the location of flex.
  See the README for more information.
...

For the case of the wrong flex version, ./configure will generate:
...
checking for --with-flex... no
checking for flex... /usr/local/sbin/flex
found /usr/local/sbin/flex, we'll use this. Use --with-flex to specify 
another.

checking flex version... configure: WARNING: Flex version 2.5.4 found.
  Version 2.5.31 or greater is required.
  You can generally ignore this warning unless you need to regenerate
  psp_parser.c from psp_parse.l. If you do need regenerate psp_parser.c,
  use --with-flex to specify the location of the correct flex version.
  See the README for more information.
...

Any comments?

Jim




Re: flex [was mod_python 3.2.0-BETA available for testing]

2005-08-26 Thread Gregory (Grisha) Trubetskoy


On Fri, 26 Aug 2005, Nick wrote:

Here's another idea: Fail the flex test fairly silently (e.g. just no), but 
fall back to a script that generates a nice, verbose error message explaining 
the situation.  That way, when the user tries to call make after modifying 
the .l file, the fake flex alternative script gets called, displays the 
message, and exits with status 1.


Yep, you probably don't need a separate script - it can all fit in the 
Makefile somewhere. That is how it worked originally, sort of, 'cept there 
was no message - it just failed if flex wasn't there ;-)


But I'm also perfectly fine with what Jim already has in configure.in, if 
we don't have time for these refinements, I'd leave it as it is, no 
biggie.


Grisha


Re: flex [was mod_python 3.2.0-BETA available for testing]

2005-08-18 Thread Jim Gallacher

Gregory (Grisha) Trubetskoy wrote:


OK, here is the flex scoop - as the the docs point out, anything before 
2.5.31 is not reentrant and I think even uses a slightly different 
interface so older flex won't even process the psp_parser.l file correctly.


Looking at Fedora Core 4, it still has flex 2.5.4a. (Note that 2.5.31  
2.5.4 because 31  4 - I for a while had trouble seeing that for some 
reason), so the new flex is still not commonplace.


This is true. I took a quick survey when I was adding the --with-flex 
option, and 2.5.4 was the most common. Oh, and the version numbering 
confused me for a while as well, but the configure script does take it 
into account when deciding if it has the correct flex.



So until reentrant flex becomes commonplace, the solution was to include
a pre-parsed psp_parser.c so that you woudln't need flex at all to 
compile mod_python. Looks like this still should be the case.


The ./configure should just print a warning that if flex is not found or 
too old, should you need to rebuild psp_parser.c you will need to get 
the right version of flex.


When I added the flex detection I had not considered the case where 
there was *no* flex on the system... just tested for the correct 
version. :-(


Also, I wasn't sure how verbose to make the configure message. I just 
figured that people would see the WARNING and then go to the README to 
see what the deal was, which would have been the perfect plan... if I 
had actually updated the README accordingly.


I'll make the fixes to configure and the README. Is the explanation in 
doc-html/inst-configure.html clear or does it need to be revised as well?


Jim



See doc-html/inst-configure.html:

   Attempts to locate flex and determine its version. If flex 
cannot be found in your PATH configure  will fail. If the wrong 
version is found configure will generate a warning. You can generally 
ignore this warning unless you need to re-create src/psp_parser.c.


The parser used by psp (See 4.9) is written in C generated using flex. 
This requires a reentrant version of flex which at this time is 
2.5.31. Most platforms however ship with version 2.5.4 which is not 
suitable, so a pre-generated copy of psp_parser.c is included with the 
source. If you do need to compile src/psp_parser.c you must get the 
correct flex version.


 If the first flex binary in the path is not suitable or not the one 
desired you can specify an alternative location with the --with-flex 
option, e.g:


   $ ./configure --with-flex=/usr/local/bin/flex



I'll copy this into the README as well.

In 3.1.x the path to flex was hard coded to /usr/local/bin, which 
caused compilation to fail and required the user to edit the Makefile 
manually. Other than the detection of the flex path, the behaviour is 
the same as 3.1.x. The previous warning about needing the correct flex 
version was just a comment in the Makefile. Any suggestions on how to 
make this clearer are welcome.