Index: configure.in =================================================================== --- configure.in (revision 170018) +++ configure.in (working copy) @@ -277,6 +277,44 @@ MP_VERSION=`awk '/MPV_STRING/ {print $3}' src/include/mpversion.h` MP_VERSION=`echo $MP_VERSION | sed s/\\"//g` +# check for correct flex version +# requires flex 2.5.31 for reentrant support + +AC_SUBST(LEX) + +AC_MSG_CHECKING(for --with-flex) +AC_ARG_WITH(flex, [--with-flex=PATH Path to specific flex binary], +[ + LEX="$withval" + AC_MSG_RESULT($LEX) +], +AC_MSG_RESULT(no)) + +# check for flex executable +if test -z "$LEX"; then + AC_PATH_PROG(LEX, flex) + if test -z "$LEX"; then + AC_MSG_ERROR(flex binary not found in path) + fi +fi + +if test "$LEX" && test -x "$LEX"; then + AC_MSG_RESULT([found $LEX, we'll use this. Use --with-flex to specify another.]) +else + AC_MSG_ERROR([flex $LEX not found, Use --with-flex to specify another.]) +fi + +AC_MSG_CHECKING(flex version) +FlexVERSION=`$LEX --version | sed 's/version//g' | awk '/flex/ {print $2}'` +Flex_MAJOR_VER=`echo $FlexVERSION| awk -F . '{print $1}'` +Flex_MINOR_VER=`echo $FlexVERSION| awk -F . '{print $2}'` +Flex_SUB_VER=`echo $FlexVERSION| awk -F . '{print $3}'` +if test "$Flex_MAJOR_VER" -eq "2" && test "$Flex_MINOR_VER" -eq "5" && test "$Flex_SUB_VER" -ge "31"; then + AC_MSG_RESULT([$FlexVERSION. Good]) +else + AC_MSG_WARN([Flex version 2.5.31 or greater is required. The one you have seems to be $FlexVERSION. Use --with-flex to specify another.]) +fi + AC_OUTPUT(Makefile src/Makefile Doc/Makefile test/testconf.py dist/setup.py dist/Makefile) Index: src/Makefile.in =================================================================== --- src/Makefile.in (revision 170018) +++ src/Makefile.in (working copy) @@ -21,7 +21,7 @@ MKDEP=@MKDEP@ # requires flex 2.5.31 for reentrant support -LEX=/usr/local/bin/flex +LEX=@LEX@ INCLUDES=@INCLUDES@ LIBS=@LIBS@ LDFLAGS=@LDFLAGS@ Index: README =================================================================== --- README (revision 170018) +++ README (working copy) @@ -6,6 +6,7 @@ 2. New in 3.0 3. Migrating from Mod_Python 2.7.8 4. OS Hints +5. Flex version @@ -151,3 +152,21 @@ I don't know what the *right* solution for this is, but here is a trick that works: define DYLD_FORCE_FLAT_NAMESPACE environment variable prior to launching httpd. + + +5. Flex version + +The parser used by psp is written in C which is generated using flex. +Flex version 2.5.31, which is reentrant, is required to generate +the src/psp_parser.c file from src/psp_parser.l. + +Configure will detect the path and version of flex on your system +and generate a warning if the wrong version is found. Since most +current platforms ship with version 2.5.4, which is not reentrant, +a pre-generated psp_parser.c has been provided, so you can +safely ignore this warning when you run the configure script. + +However, if you make any changes to psp_parser.l, or psp_parser.c +is missing, you will need to install the correct version of flex. +Once installed, use configure --with-flex to specify the alternate +location of flex, eg. ./configure --with-flex=/usr/local/bin/flex. Index: Doc/modpython2.tex =================================================================== --- Doc/modpython2.tex (revision 170018) +++ Doc/modpython2.tex (working copy) @@ -88,7 +88,7 @@ your Python binary. By default, it will use the \program{python} program found in your \envvar{PATH}. - \indexii{./configure}{\longprogramopt{with-python}} If the fist Python + \indexii{./configure}{\longprogramopt{with-python}} If the first Python binary in the path is not suitable or not the one desired for mod_python, you can specify an alternative location with the \longprogramopt{with-python} options, e.g: @@ -98,6 +98,31 @@ \end{verbatim} %$ keep emacs happy +\item + \index{flex} + Attempts to locate \program{flex} and determine its version. + If \program{flex} cannot be found in your \envvar{PATH} \program{configure} + will fail. If the wrong version is found \program{configure} will generate a warning. + You can generally ignore this warning unless you need to re-create + \filenq{src/psp_parser.c}. + + The parser used by psp (See \ref{pyapi-psp}) is written in C generated using + \program{flex}. This requires a reentrant version of \program{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 \filenq{src/psp_parser.c} you + must get the correct \program{flex} version. + + \indexii{./configure}{\longprogramopt{with-flex}} If the first flex + binary in the path is not suitable or not the one desired you can + specify an alternative location with the \longprogramopt{with-flex} + options, e.g: + + \begin{verbatim} + $ ./configure --with-flex=/usr/local/bin/flex + \end{verbatim} + %$ keep emacs happy + \end{itemize} \subsection{Running make\label{inst-make}} @@ -182,7 +207,7 @@ \section{Testing\label{inst-testing}} \strong{Warning :} those instruction are meant to be followed if you are -using mod_python 3.x or later.\If you are using mod_python 2.7.x (namely, +using mod_python 3.x or later. If you are using mod_python 2.7.x (namely, if you are using Apache 1.3.x), please refer to the proper documentation. \begin{enumerate}