Reproduced on Linux (x86) and Mac OS X (PPC and x86): $ LD="ld" AR="foo" ./configure Running the above command results in Autoconf incorrectly setting the AR variable in the generated Makefile. Setting CC instead of LD causes the same issue, while only specifying AR works without issue.
It works for me: $ env LD=/tmp/xxld AR=/tmp/har ./configure ... $ egrep "^(LD|AR)=" Makefile LD=/tmp/xxld AR=/tmp/har
I pulled the tarball from ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-5.1p1.tar.gz to generate the error. Did you use that as well?
$ env LD=/tmp/xxld AR=/tmp/har ./configure $ egrep "^(LD|AR)=" Makefile LD=/tmp/xxld AR=/tmp/har $ env LD="ld" AR="foo" ./configure $ egrep "^(LD|AR)=" Makefile LD=ld AR=/usr/bin/ar For some reason, the command on top works differently than the one on bottom.
do you really have a semi-functional ar-replacement called "foo" in your path? autoconf checks that the selected linker at least exists and is executable. Furthermore if the linker exists, but is not functional, then it will cause configure test failures. Try copying your /usr/bin/ar to a different path (e.g. /tmp/har) and trying it.
I need to compile with LLVM, which requires pointing AR to llvm-ar (which exists). That's how I encountered the bug in the first place. What I posted just serves as an example test case of the issue.
It is an invalid testcase for the reasons that I just described. If you are trying to use llvm-ar then why not show an example with llvm-ar? You can look at the details of what searches are being performed in config.log.
$ env CC="llvm-gcc" LD="llvm-ld" AR="llvm-ar" RANLIB="llvm-ranlib" ./configure $ egrep "^(CC|LD|AR|RANLIB)=" Makefile CC=llvm-gcc LD=llvm-ld AR=/usr/bin/ar RANLIB=llvm-ranlib $ llvm-ar llvm-ar: Not enough positional command line arguments specified! Must specify at least 2 positional arguments: See: llvm-ar --help After running the above commands, I combed through config.log for llvm-ar, but nothing shows up. I've included what seems like the relevant lines from config.log. What else should I look for to debug this? $ egrep "( |\W)(ar|ranlib)\W*$" config.log configure:4038: checking for ranlib configure:4065: result: llvm-ranlib configure:4256: checking for ar configure:4274: found /usr/bin/ar configure:4286: result: /usr/bin/ar ac_cv_path_AR=/usr/bin/ar ac_cv_prog_ac_ct_RANLIB=llvm-ranlib AR='/usr/bin/ar' RANLIB='llvm-ranlib'
Try an absolute path for AR (I have no idea why autoconf demands this)
Thanks, setting AR to the absolute path of llvm-ar works. It still seems like a bug with Autoconf though. There's no reason for it to require absolute paths, especially because it perfectly detects them for the other environment variables (like RANLIB). Can you do anything about it?
Probably not - it is buried deep in the guts of autoconf (... and you thought this thing smelt bad on the outside). I'd suggest filing a but on them.
Since there's a workaround and the problem is in autoconf generated file we're not going to try to bodge around it. Thanks for the report, sorry we couldn't help. Closing.
Mass move of RESOLVED bugs to CLOSED now that 5.3 is out.