bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MinGw port of gawkextlib


From: Eli Zaretskii
Subject: Re: MinGw port of gawkextlib
Date: Tue, 17 May 2022 15:36:59 +0300

> Date: Tue, 17 May 2022 08:17:29 -0400
> From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>
> Cc: Manuel Collado <mcollado2011@gmail.com>, bug-gawk@gnu.org
> 
> On Tue, May 17, 2022 at 02:53:46PM +0300, Eli Zaretskii wrote:
> > I don't think it's reasonable to ask users to remember the prefix used
> > when installing Gawk.  They might not even know that if they didn't
> > build Gawk themselves.  And MS-Windows users are likely not to grasp
> > the notion of "install prefix" as easily as Unix users.  By contrast,
> > "directory where you have Gawk" is easily understood and relatively
> > easily discovered if not known in advance.
> 
> The issue here is that we also need to know where to find the "gawkapi.h"
> header file that is bundled with gawk, in addition to locating the gawk 
> binary.
> That's why it's a directory instead of just the path of the gawk binary. In a
> typical installation, the header file might go in /usr/include/gawkapi.h, and
> the binary in /usr/bin/gawk. So in that case, the implicit argument is
> "--with-gawk=/usr".

Why the assumption that gawkapi.h and the Gawk executable are under
the same PREFIX?  That might be so on Unix, where installation trees
are standardized, but not on Windows.  gawkapi.h should be where the C
compiler looks for includes files, whereas the gawk executable should
be somewhere on PATH.  On Windows, it is customary to have many
different directories on PATH, and some people even go to the extreme
of installing every package's executables in a separate bin directory
that they add to PATH.

> I think the idea is that if somebody chooses to install gawk in
> a non-standard location, then yes, the burden is on that user to
> remember what the --prefix argument was that he/she used to install gawk.

Everything is basically "non-standard" on Windows in this regard.

But there's one more aspect of this to be aware of.  The problem when
building Gawk extensions with MinGW is that the build and the test
suite run using MSYS tools, and those tools include an MSYS build of
Gawk.  MSYS tools have a separate installation tree, and their Gawk is
in /bin/gawk, which is at the beginning of the MSYS PATH.

But one cannot ask the MSYS Gawk to load and run extensions built for
the MinGW Gawk, even if both MSYS and MinGW Gawk's are of the same
version -- they are binary-incompatible and use different C runtimes.
So whenever I must force the use of the MiNGW Gawk, as in this case, I
have no choice but to override the location of the Gawk executable.
Which is why I used that option in the first place.

The other files related to Gawk, such as gawkapi.h etc., don't need to
have their places overridden, since they pertain to the GCC
installation, and GCC is a MinGW program, not an MSYS program, so it
follows the MinGW installation tree.

IOW, the --with-gawk= option was perhaps introduced with Unix users in
mind, where it is reasonable to expect both the executable and the
headers/libraries to share the same root prefix, that is not so on
Windows when using MinGW and MSYS.  If this means you prefer a
separate configure-time option for this MinGW-specific issue, I'm okay
with that.  I just want to express my opinion that using --with-gawk
and documenting it as providing the "prefix of the Gawk installation"
will be more confusing and easier to make mistakes than my suggestion.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]