bug-gnulib
[Top][All Lists]
Advanced

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

getprogname and libtool


From: Bruno Haible
Subject: getprogname and libtool
Date: Tue, 18 Oct 2016 16:26:17 +0200
User-agent: KMail/4.8.5 (Linux/3.8.0-44-generic; KDE/4.8.5; x86_64; ; )

Daiki Ueno wrote:
> On a related note, this new test also fails when it is invoked as a
> libtool wrapper script, because of the "lt-" prefix.
> 
> $ ./gnulib-tool --create-testdir --dir t --libtool getprogname
> $ cd t && ./configure
> $ sed -i 's/^noinst_LTLIBRARIES +=/lib_LTLIBRARIES =/' gllib/Makefile.am
> $ make && make check
> 
> FAIL: test-getprogname
> ======================
> 
> lt-test-getprogname: test-getprogname.c:29: main: Assertion `STREQ (p, 
> "test-getprogname" EXEEXT)' failed.
> FAIL test-getprogname (exit status: 134)

This is not only a problem with the test. It's a problem with the deprecation
of the 'progname' module.

Previously, GNU gettext and other packages were using the idiom

int
main (int argc, char **argv)
{
  set_program_name (argv[0]);
  ...
  if (...)
    {
      printf (_("Usage: %s [OPTION] ARGUMENT...), program_name);
      ...
    }
  ...
}

Now, the recommended idiom is

int
main (int argc, char **argv)
{
  ...
  if (...)
    {
      printf (_("Usage: %s [OPTION] ARGUMENT...), getprogname ());
      ...
    }
  ...
}

The consequence is that in packages that use GNU libtool, such programs will
print "lt-prog" instead of "prog" in their usage message and other messages.
This will disturb
  * the hacker who uses the programs before doing "make install",
  * the test suite.

What are the possible solutions? I can see these:
  a) Modify the 'getprogname' module to strip a leading 'lt-' prefix
     (even on BSD and Cygwin platforms).
  b) Create a distinct module that is like 'getprogname' but also strips the
     'lt-' prefix, and change the recommended idiom accordingly.
  c) Modify libtool to store the executables as .libs/lt/prog${EXEEXT} rather
     than .libs/lt-prog${EXEEXT}.

Bruno
--
Im memoriam Gisi Fleischmann <http://en.wikipedia.org/wiki/Gisi_Fleischmann>




reply via email to

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