Sylvain Beucler <b...@beuc.net> writes:

> Hi,
>
> I'm trying to implement simply a '--with-mylib=/path/to/mylib' option
> in 'configure', and I'm wondering if the 'havelib' would help.

Hi.  I believe it does.

> However I don't really understand how it's meant to be
> used. Apparently its m4 macros need to be used within a macro
> definition?
>
> Can you explain me basically what it does and how to use it?
> (is it even meant for external use?)

I'm using it in some projects which aren't using gnulib otherwise, such
as for example libssh2:

http://www.libssh2.org/wiki/index.php/Main_Page
http://libssh2.cvs.sourceforge.net/viewvc/libssh2/libssh2/

Typically you add the lib-ld.m4, lib-link.m4, and lib-prefix.m4 macros
to your project's m4/ directory, and add something like this to
configure.ac:

  AC_LIB_HAVE_LINKFLAGS([ssl], [crypto], [#include <openssl/ssl.h>])
...
  AC_LIB_HAVE_LINKFLAGS([gcrypt], [], [#include <gcrypt.h>])
...
  AC_LIB_HAVE_LINKFLAGS([z], [], [#include <zlib.h>])

Then add to *_LDFLAGS the automake variables, e.g.:

libssh2_la_LDFLAGS = $(VERSION) -no-undefined \
        $(LTLIBGCRYPT) $(LTLIBSSL) $(LTLIBZ)

See complete usage in:

http://libssh2.cvs.sourceforge.net/viewvc/libssh2/libssh2/configure.in?revision=1.63&view=markup
http://libssh2.cvs.sourceforge.net/viewvc/libssh2/libssh2/src/Makefile.am?revision=1.13&view=markup

Of course, you may use gnulib-tool to import the files too, to avoid
manual work.  But the files are relatively stable and have been tested
on many platforms already.

Read the *.m4 files, they contain documentation for the various macros
you may use.

/Simon


Reply via email to