bug-gawk
[Top][All Lists]
Advanced

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

Re: AWKPATH and AWKLIBPATH: default values different from documentation


From: Andrew J. Schorr
Subject: Re: AWKPATH and AWKLIBPATH: default values different from documentation (gawk 5.0.1)
Date: Sat, 22 Feb 2020 14:14:41 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Feb 22, 2020 at 10:08:41AM +0100, Jannick wrote:
> the default values of AWKPATH and AWKLIBPATH are documented to be
> /usr/local/share/awk and /usr/local/lib/gawk, resp. (gawk 5.0.1).  However
> the paths .:/usr/share/awk and /usr/lib/gawk are compiled into gawk 5.0.1
> (built with ./configure && make), i.e., the fragment /local is dropped from
> the documented paths.
> 
> At least for AWKPATH I would expect the default value (without redefining
> them in the environment) to contain a sub-directory of /usr/local where I
> can put my private awk scripts kept separate from the general installation
> for better maintenance of each of them.  Is that correct - or am I missing
> something here?

In actuality, these path variables are set based on the configure arguments.
The default AWKLIBPATH value is set by main.c to the global deflibpath value,
which is initialized to the DEFLIBPATH define passed in by make.  Similarly,
the AWKPATH value is set to defpath, which is initialized to the DEFPATH define
passed in by make.

In Makefile.am, we see:

pkgdatadir = $(datadir)/awk
DEFPATH='".$(PATH_SEPARATOR)$(pkgdatadir)"'
DEFLIBPATH="\"$(pkgextensiondir)\""

And in configure.ac, we have:
AC_SUBST([pkgextensiondir], ['${pkglibdir}'${EXTENSIONDIR}])

The PATH_SEPARATOR value is platform-dependent, and datadir
and pkgextensiondir are set by the configure/automake magic.
You can learn more by looking in config.log:

datarootdir='${prefix}/share'
datadir='${datarootdir}'
pkgextensiondir='${pkglibdir}'
exec_prefix='${prefix}'
libdir='${exec_prefix}/lib'

And in Makefile.in:

pkglibdir = $(libdir)/@PACKAGE@

The bottom line is that the configure --prefix arg will control this
stuff. I think the default prefix is /usr/local, but distros will use
more suitable values.

Regards,
Andy



reply via email to

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