I would like to install bison to a machine where I don't have root privileges. When I tried to use configure then I got the following error:

checking for GNU M4 that supports accurate traces... configure: error: no acceptable m4 could be found in $PATH.
GNU M4 1.4.6 or later is required; 1.4.16 or newer is recommended.
GNU M4 1.4.15 uses a buggy replacement strstr on some systems.
Glibc 2.9 - 2.12 and GNU M4 1.4.11 - 1.4.15 have another strstr bug.

I found out that my version of M4 is 1.4.13. I installed a newer version (1.4.17) to my home folder and wanted configure to use this local version, to do that I found this in configure script:

M4          Location of GNU M4 1.4.6 or later. Defaults to the first program
            of 'm4', 'gm4', or 'gnum4' on PATH that meets Autoconf needs.

So I used the command:

../configure --prefix=$HOME/local/bison M4='$HOME/local/m4/bin/'

Which I assume was OK to do (correct me if I'm wrong).

After this I got this error:

checking for flex... flex
checking whether lex is flex... no
checking lex output file root... lex.yy
checking lex library... none needed
checking whether yytext is a pointer... no
configure: error: Flex is required

I installed flex locally into $HOME/local/flex and tried to modify the PATH variable.

PATH=$HOME/local/flex/bin/:$PATH

, but I still got the same error. So I don't know how to tell configure to use this location. I don't think this time there are options for it like there was for m4. And even if there would be, I would still be interested if it is possible to specify a location(s) for configure to look for arbitrary programs (with preferably higher priority than /usr/bin)?

up vote 2 down vote accepted

You're close.

First, the M4 variable needs to be set to the path to the actual M4 program file, not to the directory it lives in. Probably a more common use for this variable than your case is to select among multiple M4 programs that are already in the PATH, so you need to name the actual executable. It's common on BSD type OSes to have the platform m4 and then a GNU M4 program, perhaps called gm4, for example. You might wish to use the GNU version of M4 while building GNU Bison, and this variable lets you do that. The script would otherwise find the BSD version first, in our example system.

Second, I think your PATH modification is being ignored. Unless you export the PATH, the new value will only be available to the shell. You have two ways to fix this:

 export PATH=$HOME/local/flex/bin/:$PATH

or:

 PATH=$HOME/local/flex/bin/:$PATH ../configure --flags-and-stuff-here

The second version makes the change only for the configure script. Any programs that script launches won't see the changed PATH, unless it exports the new value.

Personally, I'd do it the first way in one of your startup scripts (e.g. ~/.bash_profile) because you're going to want your personal version of Flex available to you after you get Bison installed, too. Log out, then back in, and try to run flex to test it. If that works, the Bison configure script should find that version first, too.

  • Thank you for the explanation, I got it working now. One thing was that I also had to add $HOME/local/m4/bin to the path (and could delete the M4 option, since the name was the same, thanks for clearing that up too). – user1335014 Dec 12 '14 at 18:56

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.