summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2012-01-25 21:31:28 +0000
committerKevin P. Fleming <kpfleming@digium.com>2012-01-25 21:31:28 +0000
commit9ee8a744617411d33f8c6178ab50361452482111 (patch)
treedbd57acfdaca023594cf30d088004185fc2040e5
parent261cde46759765d56e559c2692a4ac4a176c6842 (diff)
Remove "asterisk/version.h" in favor of "asterisk/ast_version.h".
A long time ago, in a land far far away, we added "asterisk/ast_version.h", which provides the ast_get_version() and ast_get_version_num() functions. These were added so that modules that needed the version information for the Asterisk instance they were loaded in could actually get it (as opposed the version that they were compiled against). We changed everything in the tree to use the new mechanism (although later main/test.c was added using the old method). However, the old mechanism was never removed, and as a result, new code is still trying to use it. This commit removes asterisk/version.h and replaces it with a header that will generate a compile-time error if you try to use it (the error message tells you which header you should use instead). It also removes the Makefile and build_tools bits that generated the file, and it updates main/test.c to use the 'proper' method of getting the Asterisk version information. This is an API change and thus is being committed for trunk only, but it's a fairly minor one and definitely improves the situation for out-of-tree modules. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@352626 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--Makefile8
-rwxr-xr-xbuild_tools/make_version_h36
-rw-r--r--include/asterisk/version.h1
-rw-r--r--main/test.c8
4 files changed, 6 insertions, 47 deletions
diff --git a/Makefile b/Makefile
index dfa1757f4..e1abdd50b 100644
--- a/Makefile
+++ b/Makefile
@@ -386,7 +386,7 @@ makeopts.embed_rules: menuselect.makeopts
+@$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LDFLAGS)
+@$(SUBMAKE) $(MOD_SUBDIRS_EMBED_LIBS)
-$(SUBDIRS): main/version.c include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
+$(SUBDIRS): main/version.c include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
# Non-windows:
@@ -422,11 +422,6 @@ main/version.c: FORCE
@cmp -s $@.tmp $@ || mv $@.tmp $@
@rm -f $@.tmp
-include/asterisk/version.h: FORCE
- @build_tools/make_version_h > $@.tmp
- @cmp -s $@.tmp $@ || mv $@.tmp $@
- @rm -f $@.tmp
-
include/asterisk/buildopts.h: menuselect.makeopts
@build_tools/make_buildopts_h > $@.tmp
@cmp -s $@.tmp $@ || mv $@.tmp $@
@@ -449,7 +444,6 @@ _clean:
rm -f defaults.h
rm -f include/asterisk/build.h
rm -f main/version.c
- rm -f include/asterisk/version.h
@$(MAKE) -C menuselect clean
cp -f .cleancount .lastclean
diff --git a/build_tools/make_version_h b/build_tools/make_version_h
deleted file mode 100755
index 5c74716f2..000000000
--- a/build_tools/make_version_h
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-if test ! -f .flavor ; then
- cat << END
-/*
- * version.h
- * Automatically generated
- */
-#define ASTERISK_VERSION "${ASTERISKVERSION}"
-#define ASTERISK_VERSION_NUM ${ASTERISKVERSIONNUM}
-
-END
-elif test ! -f .version ; then
- aadkflavor=`cat .flavor`
- cat << END
-/*
- * version.h
- * Automatically generated
- */
-#define ASTERISK_VERSION "${ASTERISKVERSION} (${aadkflavor})"
-#define ASTERISK_VERSION_NUM ${ASTERISKVERSIONNUM}
-
-END
-else
- aadkver=`cat .version`
- aadkflavor=`cat .flavor`
- cat << END
-/*
- * version.h
- * Automatically generated
- */
-#define ASTERISK_VERSION "${ASTERISKVERSION} (${aadkflavor} ${aadkver})"
-#define ASTERISK_VERSION_NUM ${ASTERISKVERSIONNUM}
-
-END
-fi
-
diff --git a/include/asterisk/version.h b/include/asterisk/version.h
new file mode 100644
index 000000000..0c6ecb3ee
--- /dev/null
+++ b/include/asterisk/version.h
@@ -0,0 +1 @@
+#error "Do not include 'asterisk/version.h'; use 'asterisk/ast_version.h' instead."
diff --git a/main/test.c b/main/test.c
index 741c0f540..07ddc4d78 100644
--- a/main/test.c
+++ b/main/test.c
@@ -38,7 +38,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$");
#include "asterisk/utils.h"
#include "asterisk/cli.h"
#include "asterisk/term.h"
-#include "asterisk/version.h"
+#include "asterisk/ast_version.h"
#include "asterisk/paths.h"
#include "asterisk/time.h"
#include "asterisk/manager.h"
@@ -386,14 +386,14 @@ static int test_generate_results(const char *name, const char *category, const c
last_results.total_time / 1000, last_results.total_time % 1000,
last_results.total_tests);
fprintf(f_xml, "\t<properties>\n");
- fprintf(f_xml, "\t\t<property name=\"version\" value=\"%s\"/>\n", ASTERISK_VERSION);
+ fprintf(f_xml, "\t\t<property name=\"version\" value=\"%s\"/>\n", ast_get_version());
fprintf(f_xml, "\t</properties>\n");
}
/* txt header information */
if (f_txt) {
- fprintf(f_txt, "Asterisk Version: %s\n", ASTERISK_VERSION);
- fprintf(f_txt, "Asterisk Version Number: %d\n", ASTERISK_VERSION_NUM);
+ fprintf(f_txt, "Asterisk Version: %s\n", ast_get_version());
+ fprintf(f_txt, "Asterisk Version Number: %s\n", ast_get_version_num());
fprintf(f_txt, "Number of Tests: %d\n", last_results.total_tests);
fprintf(f_txt, "Number of Tests Executed: %d\n", (last_results.total_passed + last_results.total_failed));
fprintf(f_txt, "Passed Tests: %d\n", last_results.total_passed);