[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using autoconf-lib-link outside gettext

From: Hrvoje Niksic
Subject: Re: Using autoconf-lib-link outside gettext
Date: Fri, 24 Jun 2005 17:09:27 +0200
User-agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (Jumbo Shrimp, linux)

Thanks *a lot* for your support.  Thanks to you Wget's CVS (ok,
subversion) code is now rid of Libtool and has switched to
AC_LIB_HAVE_LINKFLAGS for detection of OpenSSL libraries.  It now
looks like this:

dnl Check for OpenSSL
if test x"$with_ssl" != x"no"
  dnl As of this writing (OpenSSL 0.9.6), the libcrypto shared library
  dnl doesn't record its dependency on libdl, so we need to make sure
  dnl -ldl ends up in LIBS on systems that have it.  Most OSes use
  dnl dlopen(), but HP-UX uses dnl shl_load().
  AC_CHECK_LIB(dl, dlopen, [], [
    AC_CHECK_LIB(dl, shl_load)

  dnl Now actually check for -lssl
  AC_LIB_HAVE_LINKFLAGS([ssl], [crypto], [
#include <openssl/ssl.h>
#include <openssl/x509.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include <openssl/des.h>
#include <openssl/md4.h>
#include <openssl/md5.h>
  ], [SSL_library_init ()])
  if test x"$LIBSSL" != x
    AC_MSG_NOTICE([compiling in support for SSL])
              [Define if SSL support should be compiled in.])

That may seem hairy, but compared to 200 lines of old code and the
complexity incurred by using Libtool (which is now removed), the above
is a breeze!

If we add more than one so detected library, we might need an option
to provide a generic include and library path for systems who put
third-party software in a specific location.  I'm aware that
AC_LIB_HAVE_LINKFLAGS searches for $prefix, but that won't work when
Wget's prefix is different from the prefix of the libraries.

In other words, instead of saying:

    ./configure --prefix=$HOME \
                --with-libssl-prefix=/opt/gnu \
                --with-libz-prefix=/opt/gnu \
                --with-libexpat-prefix=/opt/gnu \
                --with-librecord-prefix=/opt/gnu \

I'd like the user to be able to say:

    ./configure --prefix=$HOME --site-stuff=/opt/gnu

(Except it'd use a name better than `--site-stuff'.)  Does that make
sense?  Or am I missing a way to achieve this with current

> If you want to test for the presence of the library at the same time as
> you locate it, use the macro
>   AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
> It searches for libname and the libraries corresponding to explicit and
> implicit dependencies, together with the specified include files and
> the ability to compile and link the specified testcode.

What about running an example code?  For example, GCC on Solaris
implicitly uses -L/usr/local/lib, but not -R/usr/local/lib, producing
executables that simply don't run.  (At least not without setting
LD_LIBRARY_PATH, which is not a desirable quality.)  Will
AC_LIB_HAVE_LINKFLAGS trip on that problem?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]