[asterisk-dev] Add module dependecy in build system

Rafael Prado Rocchi prado at practis.com.br
Sun Mar 6 17:11:51 CST 2016


Hello,
you are doing the right way, I'll put some basic information with examples to contribute.

When creating a MODULE that needs some dependency, there are two situations to check initially:

1) If the library is already present in configure.ac (and detected when you run ./configure), then you just need to put the dependency inside the Module source using <depend> tag
2) If it is a NEW library not present in configure.ac, then you have to change configure.ac and recreate 'configure' script.


Supposing the new library included was for example 'openr2'
You can do a quick check running:

./configure |grep openr2


The result should make it clear if it was detected or nor detected, like the above example, that would give you this result:

checking for openr2_chan_new in -lopenr2... yes


The result "yes" above means the library was Found and it's ready for use. You correctly modified configure.ac and recreated configure.
If you get a different result or no result, check the paths where the library lives in you linux distro and make the appropriate changes in configure.ac because configure was not able to find them, also check the logfile.
Some types of library install theirselves in different places, and some linux distros have different places for them, special attention for 64bit distros vs 32bit distros.


After succeed with ./configure you can tie dependency in any module source code by using the <depend> tag inside the module you need.

example from chan_dahdi.c :

/*** MODULEINFO
        <depend>res_smdi</depend>
        <depend>dahdi</depend>
        <depend>tonezone</depend>
        <depend>res_features</depend>
        <use>pri</use>
        <use>openr2</use>
 ***/

<depend> means module will NOT compile if dependency is not satisfied.
<use> means module can make use of the library or not, it's not essencial and it WILL compile without the library being detected by ./configure.


I hope you succeed.


Regards,
Rafael Prado



De: <asterisk-dev-bounces at lists.digium.com<mailto:asterisk-dev-bounces at lists.digium.com>> em nome de Catalin Stanciu <catacsdev at gmail.com<mailto:catacsdev at gmail.com>>
Responder para: Asterisk List <asterisk-dev at lists.digium.com<mailto:asterisk-dev at lists.digium.com>>
Data: domingo, 6 de março de 2016 17:56
Para: Asterisk List <asterisk-dev at lists.digium.com<mailto:asterisk-dev at lists.digium.com>>
Assunto: [asterisk-dev] Add module dependecy in build system

Hello,

I am trying to include a module dependency in  the asterisk build system, but after some hours of research I couldn't found any useful information.
To start I have followed the asterisk manual (https://wiki.asterisk.org/wiki/display/AST/Build+System+Architecture)

1. I have used the AST_EXT_LIB_SETUP and AST_EXT_LIB_CHECK functions to configure in configure.ac<http://configure.ac>
2. I have included in build_tools/menuselect-deps.in<http://menuselect-deps.in> the line similar to other dependencies
3. I have included in makeopts.in<http://makeopts.in>  two lines one for LIB and the other for INCLUDE.
4. Finally I have included in the module source code the lines with MODULEINFO

I don't know what I am doing wrong but I think the documentation for build  system architecture must have some examples with explanation of complex cases.

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20160306/c7f31ffd/attachment.html>


More information about the asterisk-dev mailing list