Adding another (external) library to the makefile?

Mikael Magnusson mikma264 at gmail.com
Mon Jun 11 11:17:03 CEST 2007


On Mon, Jun 11, 2007 at 08:52:59AM +0200, Mikael Svensson wrote:
> Hello
> 
> I'm working on adding basic LDAP support for Minisip using the OpenLDAP 
> library. The problem is that I don't know how to alter the "make files" 
> in order to include libldap when compiling.
> 
> Does anyone on the mailing list know about these things? How to work the 
>   bootstrap and configure scripts!?
> 
> Regards
> Mikael Svensson

You don't have to modify bootstrap, but both configure.ac and Makefile.am.
Often pkg-config or m4 scripts or a custom config script is distributed with
libraries, but not for openldap AFAIK.

Which means a little more work. You need to detect if the ldap header and
library are present. 

You can for example modify the autoconf lines which check for libgsm:

dnl Check for libgsm
AC_CHECK_HEADER([gsm.h],
        [
                AC_CHECK_LIB([gsm], [gsm_encode],
                        [GSM_LIBS="-lgsm"
                         AC_DEFINE(HAS_GSM, [], [Use the GSM CODEC])])
                         HAS_GSM="yes"
        ]
)
AM_CONDITIONAL(HAS_GSM, test "${HAS_GSM}" = "yes")
AC_SUBST(GSM_LIBS)


And maybe use AC_ARG_ENABLE to allow the user to disable ldap support.
Add LDAP_LIBS to the LIBADD variable of the library or plug-in you want to
link against openldap.  

You should avoid to include openldap header files in header files installed
by minisip.

Mikael



More information about the Minisip-devel mailing list