[Asterisk-Dev] Re: Makefile changes in CVS HEAD

Tony Mountifield tony at softins.clara.co.uk
Mon Jun 6 12:09:59 MST 2005


In article <532822EF-62C6-4FA7-B42F-E5F4D2EE950A at mac.com>,
Brian West <brian.west at mac.com> wrote:
> How about some way to show all module cvs version numbers with a CLI  
> command... I have asked for this before... one cli command can dump  
> all this and be more helpful than the date/time it was compiled.

How about something like this as a starting point...

In a common file such as asterisk.h:

#ifdef __GNUC__
#define AST_CVSID(x) \
	static const char cvsid[] = x; \
	static void __attribute__((constructor)) initcvsid(void) \
	{ \
		ast_register_cvsid(cvsid); \
	}
#else
#define AST_CVSID(x) static const char cvsid[] = x;
#endif

And then in each .c file you could have:

#include "asterisk.h" /* if not already included */
AST_CVSID("$Id$")

And finally implement ast_register_cvsid(const char *cvsid) to collect up
all the strings and make them available via a CLI command.

Using GCC file-scope constructors allows the ids to be registered
without needing explicit init calls for each file.

Using another compiler (how commonly is that done?) would still define
the strings for use with the "ident" command, even if it couldn't
register them for a CLI command.

Not sure what to do about the .h files....

Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-dev mailing list