bug-gnulib
[Top][All Lists]
Advanced

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

Re: Gnulib on Windows (native / mingw32) / VMS / etc.


From: Bruno Haible
Subject: Re: Gnulib on Windows (native / mingw32) / VMS / etc.
Date: Wed, 16 May 2018 19:43:03 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-119-generic; KDE/5.18.0; x86_64; ; )

Paul Eggert wrote:
> If you can't assume 'sed', you can compile and run 
> a simple program that does the "@" replacement.

Yes, given that the uses of 'sed' in gnulib are nearly all of the form
  sed -e 's/@VAR1@/VALUE1/g' ... -e 's/@VARn@/VALUEn/g' FILE
you could write a program 'atsubst' such that
  atsubst VAR1 VALUE1 ... VARn VALUEn FILE
is equivalent to
  sed -e 's/@VAR1@/VALUE1/g' ... -e 's/@VARn@/VALUEn/g' FILE

This 'atsubst' program is simple enough that it fits in a single file
(like 'envsubst' in GNU gettext); it can be a prerequisite single command
for anyone who builds 'make'.

> Alternatively, we could change Gnulib to use "_GLat" instead of "@" 
> uniformly, so that you don't need to do the "@" replacement in GNU Make;

I don't think this would fully work. Regarding @INCLUDE_NEXT@ for example:
You can't have a C macro that expands to either #include or #include_next.

So, Paul would probably have to generate foo.halfsubsted.h from foo.in.h
where @GUARD_PREFIX@, @INCLUDE_NEXT@, @PRAGMA_SYSTEM_HEADER@, @PRAGMA_COLUMNS@
and @NEXT_FOO_H@ have been already substituted, and use C preprocessor
expansion (i.e. HAVE_FOO instead of @HAVE_FOO@) for the other symbols.

I would see this machinery as being in GNU make only (no modifications in
gnulib), unless/until the GNU bash, coreutils, grep, gawk, sed projects want
to use it as well.

Bruno




reply via email to

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