curl-library
Re: libcurl in configure.in
Date: Tue, 10 Apr 2001 08:20:38 +0200 (MET DST)
On Tue, 10 Apr 2001, Andrés García wrote:
> I have been trying to include a test in a configure.in so that, if
> libcurl isn't detected, the script fails with an error message.
Good idea! ;-)
> But they both fail even though libcurl is installed in /usr/local/lib and
> I can link programs to it without a problem.
>
> Any suggestions?
Yes.
First, libcurl may itself depend on a couple of libraries. Like on Solaris,
it needs -lsocket, -lnsl and usually -ldl. To make configure work with these,
you better check for those libraries before you check for libcurl.
Secondly, libcurl may need the OpenSSL libraries. They're trickier to find
(as they're not system default libraries), but my example autoconf snippet
below tries the default install lib path to see.
While my example below isn't at all complete, it does detect libcurl properly
on my test system. It will probably still need tweaking.
------------ snart of snippet ---------------
AC_INIT(app.c)
AC_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_CPP
dnl gethostbyname in the nsl lib?
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
dnl socket lib?
AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
dnl dl lib?
AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen))
AC_CHECK_LIB(curl, curl_version, libcurl=yes, libcurl=no)
if test "x$libcurl" = xno ; then
AC_MSG_CHECKING([checking for curl with SSL])
LIBS="$LIBS -lcurl -L/usr/local/ssl/lib -lssl -lcrypto"
AC_TRY_LINK([#include <curl/curl.h>], [curl_version();], libcurl=yes,
libcurl=no)
if test "x$libcurl" = xno ; then
AC_MSG_RESULT(no)
AC_MSG_ERROR([libcurl required..go to http://curl.haxx.se/ to
download and then install it first])
else
AC_MSG_RESULT(yes)
fi
fi
AC_OUTPUT( Makefile )
-- Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/ _______________________________________________ Curl-library mailing list Curl-library_at_lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/curl-libraryReceived on 2001-04-10