Subject: bug#7698: aclocal generates too strict a check for name-lister

From: Ximin Luo <[email-masked]>
Date: Tue, 21 Dec 2010 03:52:35 +0000

I have a core2 system, and have been trying to compile GMP 5.0.1 optimised for
other x86 CPUs, by doing (e.g.)

$ ./configure --host=pentium4-$(./config.guess | cut -d- -f2-)

However, these fail with an obscure error message about `link -dump -symbols`
(see snippet 1). After a convoluted path of debugging, I've worked out that the
cause is ./configure not detecting the presence of "/usr/bin/nm -B", in the
case where $build != $host.

The responsible code is the following snippet:
  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then

which occurs twice in GMP 5.0.1's ./configure, and once in aclocal.m4, so the
source seems to be automake's aclocal program. If you remove all occurrences of
the second test, the build works fine.

I have some test code at [1]. Note the WORKAROUND on line 232 - removing it
will cause builds such as

$ ./build-all-multi.sh pentium4

to fail when run on a core2.

I don't know much about how automake works, but it seems to me that the check
is too strict - nm shouldn't change with the CPU. If really necessary, maybe
only the last part of $build/$host could be matched instead?

Ximin

[1]
https://github.com/freenet/contrib-staging/blob/master/NativeBigInteger/build-all-multi.sh

----> snippet 1 <----

checking if globals are prefixed by underscore... link: invalid option -- 'd'
Try `link --help' for more information.
unknown
configure: WARNING: +----------------------------------------------------------
configure: WARNING: | Cannot determine global symbol prefix.
configure: WARNING: | link -dump -symbols output doesn't contain a global data
symbol.
configure: WARNING: | Will proceed with no underscore.
configure: WARNING: | If this is wrong then you'll get link errors referring
configure: WARNING: | to ___gmpn_add_n (note three underscores).
configure: WARNING: | In this case do a fresh build with an override,
configure: WARNING: |     ./configure gmp_cv_asm_underscore=yes
configure: WARNING: +----------------------------------------------------------
checking how to switch to read-only data section... 	.section	.rodata
checking for assembler .type directive... .type	$1,@$2
checking for assembler .size directive... .size	$1,$2
checking for assembler local label prefix... configure: WARNING: "link -dump
-symbols" failure
configure: WARNING: cannot determine local label, using default L
L
checking for assembler byte directive... .byte
checking how to define a 32-bit word... link: invalid option -- 'd'
Try `link --help' for more information.
link: invalid option -- 'd'
Try `link --help' for more information.
configure: error: cannot determine how to define a 32-bit word

Failed to configure for libjbigi-linux-pentium4; maybe it isn't supported on
your build environment.

Error building libjbigi-linux-pentium4!

-- 
GPG: 4096R/5FBBDBCE