Using a specific version of program in configure
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.
Related videos on Youtube
user1335014
Updated on September 18, 2022Comments
-
user1335014 over 1 year
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 thePATH
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) forconfigure
to look for arbitrary programs (with preferably higher priority than/usr/bin
)? -
user1335014 over 9 yearsThank 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 theM4
option, since the name was the same, thanks for clearing that up too).