curl-library
Bug in libcurl.m4?
Date: Tue, 9 May 2006 05:53:08 +0200
Hello everybody,
I am new to this list and to libcurl but I've found it a really cool and
very useful library.
But I believe to have found a bug in libcurl.m4 provided on the libcurl
website.
When configuring my GNU autotools project, which optionally
(default=yes) uses libcurl on a system without a (usable) libcurl
installation, but not specifying `--without-libcurl', configure
determines correctly that no libcurl is available, however, the LIBCURL
variable gets expanded to `LIBCURL = -lcurl' in the resulting
Makefiles.
I figured this is because of the test whether libcurl is available
through a user-supplied link line:
Quoting from libcurl.m4:
# we didn't find curl-config, so let's see if the user-supplied
# link line (or failing that, "-lcurl") is enough.
LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"}
Here the LIBCURL variable get set to `-lcurl' and is never reset again,
thus making it's way into the resulting Makefile. Although I don't
really see how this happens since when libcurl is detected to be
unusable no calls to AC_SUBST(LIBCURL) are made, as far as I could see.
NB: I am quite new to developing with GNU autotools and m4 has always
been a bit of black magic to me so I please forgive me if I am wrong
here.
Compiling the project with such a Makefile naturally results in an error
where the linker complains that it cannot find `-lcurl'.
Please find attached a small patch I created that fixed this bug for me,
at least on the systems I configure my autotools project on. The patch
also contains the definition of an AM_CONDITIONAL called `USE_LIBCURL'
to be used in a Makefile.am to be able to determine whether to include
certain source files in the build process or not, depending on the
availability of libcurl.
If I am wrong and this is not a bug but an error on my side please tell
me where I went wrong and how to avoid this problem. And disregard the
patch of course :) (although the conditional would certainly be useful
to others as well I guess?)
Thanks,
kind regards
Andreas
-- Andreas "daff" Ntaflos daff AT dword DOT org Vienna, Austria GPG Fingerprint: 6234 2E8E 5C81 C6CB E5EC 7E65 397C E2A8 090C A9B4 GPG Public Key ID: 090CA9B4 GPG Public Key: http://daffit.meownz.info/publickey/andreas_ntaflos.asc
- text/x-diff attachment: libcurl_m4_patch