[tex-k] $SELFAUTODIR considered harmful

Olaf Weber olaf at infovore.xs4all.nl
Thu Aug 19 07:05:37 CEST 2004


Eddie Kohler writes:

> Hi all,
> I was just flummoxed for a while by $SELFAUTODIR in texmf.cnf.  In
> particular, I'm building a package that links with -lkpathsea, but is
> not part of web2c/teTeX.  I want lcdf-typetools to find the correct
> TEXMF directories, but I can't guarantee that it will be installed
> under teTeX's --prefix.  So, the default $SELFAUTODIR setup is exactly
> wrong!  I couldn't run otftotfm because it thought TeX was installed
> in its own build directory.

> So, is there some way to tell kpathsea to look elsewhere for
> $SELFAUTODIR?  Is there any chance that the default teTeX install
> could use something other than $SELFAUTODIR?  In general it seems
> pretty tricky.

Assuming kpsewhich is installed in a place where _it_ can find the
config files, something like this will get the right value.

	char selfautodir[MAXPATHLEN];
	FILE *self;
	/* With newer kpsewhich you can use -var-value=SELFAUTODIR */
	self = popen("kpsewhich -expand-var='$SELFAUTODIR'", "r");
	if (!self)
		...
	if (!fgets(selfautodir, MAXPATHLEN, self))
		...
	fclose(self);

The SELFAUTO* values are calculated once, and if you put new values
into the environment after that (using putenv) they'll be used
instead.

In my experience, SELFAUTO* is wonderful when you install a complete
teTeX or TeX-live distribution, and things work without having to
change (or even being able to write!) configuration files.

It is a pain if you have binaries living in different locations that
result in conflicting values.

I'm not sure at this point what the best solution would be.

-- 
Olaf Weber

               (This space left blank for technical reasons.)



More information about the tex-k mailing list