[asterisk-dev] ASTERISK_VERSION_NUM

George Joseph gjoseph at sangoma.com
Mon Nov 1 08:10:28 CDT 2021


On Mon, Nov 1, 2021 at 1:44 AM Alexander Traud <pabstraud at compuserve.com>
wrote:

> Not at runtime but at compile-time, how does the compiler of a module
> detect which version is used? Before Asterisk 11, I included
> <asterisk/version.h> and the preprocessor macro ASTERISK_VERSION_NUM was
> available, see [1]. How do I solve that today?
>
> My workaround, because I build in-tree anyway, I patched its Makefile as
> well: _ASTCFLAGS+=-DASTERISK_VERSION_NUM=$(ASTERISKVERSIONNUM).
>
>
I was thinking about calling build_tools/make_version from configure.ac and
having it exported to autoconfig.h but it could get stale if you did a git
pull on the same branch and didn't re-run ./configure.  The issue I have
with the -DASTERISK_VERSION_NUM is that IDEs won't detect that and will
probably show the code as if it weren't defined.   I think the best way to
do this may be to have configure.ac run make_version but then have the
Makefile also run it and if it's different, just run sed on autoconfig.h to
replace the version.

You'd have to update:
configure.ac
autoconfig.h.in
makeopts.in
Makefile.in

Should be fairly easy though.











> [1] <https://github.com/asterisk/asterisk/commit/9ee8a74>
>
>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20211101/22ac7276/attachment.html>


More information about the asterisk-dev mailing list