Subject: bug#40751: Libtool bug: Resolving host_os correctly?

From: Andreas Wiesinger <[email-masked]>
Date: Tue, 21 Apr 2020 21:13:45 +0200

Hello,

TL;DR:

case $host_os in cygwin*) does not work when $host_os resolves to
"x86_64-pc-cygwin", but should step into the case statement imo.
Probably   case $host_os in *cygwin*) would resolve it (pay attention
to the extra * )?

Long version:

OS: Windows 10 (64bit)
Cygwin Terminal x64

Aim: Trying to build gmp-6.2.0
Gmp comes with a configure file. This configure file seems to be a
fork from libtool's configure file as the same lines (which I address
in this report) are contained in both files, the gmp's and libtool's.

First step: run "./configure --disable-static --enable-shared" in the
cygwin terminal in the directory where the gmp source was unzipped.

Next, run "make".
I did not build because in my case the configuration file chose the
wrong line for archive_cmds, because it did not recognize that I'm
running on cygwin, but instead used the *) glob for the case
statement.

I don't know how the configure file is actually being generated, but
it contains the following line (in my version of libtool: 2.4.6):

case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)

(in my case in the line 9638 in libtool's original configure-file, but
it depends on the project in which this configuration is being used).

However, you should be able to find that line with the search function.

scrolling down a bit, I have the line

cygwin* | mingw* | pw32* | cegcc*)

And here is the actual problem:

When I run "./configure --disable-static --enable-shared" I can
clearly see the output that the host_os variable is in my case
"x86_64-pc-cygwin":

Version:           GNU MP 6.2.0
  Host type:         x86_64-pc-cygwin
  ABI:               64
  Install prefix:    /usr/local
  Compiler:          gcc
  Static libraries:  no
  Shared libraries:  yes

But that is not recognized by the case condition "cygwin*". in my case
it should probably be "*cygwin*" instead.

Kind regards
Andreas