summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2008-01-05 22:09:06 +0000
committerRussell Bryant <russell@russellbryant.com>2008-01-05 22:09:06 +0000
commit54bc2c20b66d919f1df26faa637774ad40b343f1 (patch)
tree243c62517db25a0b199483928c97afce6ce2a3d4 /main
parent3e28c57081b1c9bf5a9c5fcacad51e7538d1a91e (diff)
Now that the version.h file was getting properly regenerated every time the svn
revision changed, every module that used the version was getting rebuilt after every svn update. This severly annoyed me pretty quickly, so I have improved the situation. Now, instead of generating version.h, main/version.c is generated. version.c includes the version information, as well as a couple of API calls for modules to retrieve the version. So now, only version.c will get rebuilt, and the main asterisk binary relinked, which is must faster than rebuilding http.c, manager.c, asterisk.c, relinking the asterisk binary, chan_sip.c, func_version.c, res_agi ... The only minor change in behavior here is that the version information reported by chan_sip, for example, is the version of the Asterisk core, and not necessarily the Asterisk version that the chan_sip module came from. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@96717 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/Makefile2
-rw-r--r--main/asterisk.c14
-rw-r--r--main/http.c4
-rw-r--r--main/manager.c2
4 files changed, 11 insertions, 11 deletions
diff --git a/main/Makefile b/main/Makefile
index 364cf3169..93a306e8e 100644
--- a/main/Makefile
+++ b/main/Makefile
@@ -29,7 +29,7 @@ OBJS= io.o sched.o logger.o frame.o loader.o config.o channel.o \
netsock.o slinfactory.o ast_expr2.o ast_expr2f.o \
cryptostub.o sha1.o http.o fixedjitterbuf.o abstract_jb.o \
strcompat.o threadstorage.o dial.o event.o adsistub.o audiohook.o \
- astobj2.o hashtab.o global_datastores.o $(RESAMPLE_OBJS)
+ astobj2.o hashtab.o global_datastores.o $(RESAMPLE_OBJS) version.o
# we need to link in the objects statically, not as a library, because
# otherwise modules will not have them available if none of the static
diff --git a/main/asterisk.c b/main/asterisk.c
index 5d995c9a7..e1b2f6acf 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -135,7 +135,7 @@ int daemon(int, int); /* defined in libresolv of all places */
/*! \brief Welcome message when starting a CLI interface */
#define WELCOME_MESSAGE \
- ast_verbose("Asterisk " ASTERISK_VERSION ", Copyright (C) 1999 - 2007 Digium, Inc. and others.\n" \
+ ast_verbose("Asterisk %s, Copyright (C) 1999 - 2007 Digium, Inc. and others.\n" \
"Created by Mark Spencer <markster@digium.com>\n" \
"Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.\n" \
"This is free software, with components licensed under the GNU General Public\n" \
@@ -143,7 +143,7 @@ int daemon(int, int); /* defined in libresolv of all places */
"certain conditions. Type 'core show license' for details.\n" \
"=========================================================================\n" \
"NOTE: This is a development version of Asterisk, and should not be used in\n" \
- "production installations.\n");
+ "production installations.\n", ast_get_version());
/*! \defgroup main_options Main Configuration Options
* \brief Main configuration options from asterisk.conf or OS command line on starting Asterisk.
@@ -394,7 +394,7 @@ static char *handle_show_settings(struct ast_cli_entry *e, int cmd, struct ast_c
ast_cli(a->fd, "\nPBX Core settings\n");
ast_cli(a->fd, "-----------------\n");
- ast_cli(a->fd, " Version: %s\n", "" ASTERISK_VERSION "" );
+ ast_cli(a->fd, " Version: %s\n", ast_get_version());
if (option_maxcalls)
ast_cli(a->fd, " Max. calls: %d (Current %d)\n", option_maxcalls, ast_active_channels());
else
@@ -980,7 +980,7 @@ static void *netconsole(void *vconsole)
if (gethostname(hostname, sizeof(hostname)-1))
ast_copy_string(hostname, "<Unknown>", sizeof(hostname));
- snprintf(tmp, sizeof(tmp), "%s/%ld/%s\n", hostname, (long)ast_mainpid, ASTERISK_VERSION);
+ snprintf(tmp, sizeof(tmp), "%s/%ld/%s\n", hostname, (long)ast_mainpid, ast_get_version());
fdprint(con->fd, tmp);
for (;;) {
fds[0].fd = con->fd;
@@ -1515,7 +1515,7 @@ static char *handle_version(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
if (a->argc != 3)
return CLI_SHOWUSAGE;
ast_cli(a->fd, "Asterisk %s built by %s @ %s on a %s running %s on %s\n",
- ASTERISK_VERSION, ast_build_user, ast_build_hostname,
+ ast_get_version(), ast_build_user, ast_build_hostname,
ast_build_machine, ast_build_os, ast_build_date);
return CLI_SUCCESS;
}
@@ -2387,12 +2387,12 @@ static void ast_remotecontrol(char * data)
static int show_version(void)
{
- printf("Asterisk " ASTERISK_VERSION "\n");
+ printf("Asterisk %s\n", ast_get_version());
return 0;
}
static int show_cli_help(void) {
- printf("Asterisk " ASTERISK_VERSION ", Copyright (C) 1999 - 2007, Digium, Inc. and others.\n");
+ printf("Asterisk %s, Copyright (C) 1999 - 2007, Digium, Inc. and others.\n", ast_get_version());
printf("Usage: asterisk [OPTIONS]\n");
printf("Valid Options:\n");
printf(" -V Display version number and exit\n");
diff --git a/main/http.c b/main/http.c
index 485211192..c7ea804fc 100644
--- a/main/http.c
+++ b/main/http.c
@@ -186,7 +186,7 @@ static struct ast_str *static_callback(struct server_instance *ser, const char *
"Cache-Control: no-cache, no-store\r\n"
"Content-Length: %d\r\n"
"Content-type: %s\r\n\r\n",
- ASTERISK_VERSION, buf, (int) st.st_size, mtype);
+ ast_get_version(), buf, (int) st.st_size, mtype);
while ((len = read(fd, buf, sizeof(buf))) > 0)
fwrite(buf, 1, len, ser->f);
@@ -847,7 +847,7 @@ static void *httpd_helper_thread(void *data)
"Date: %s\r\n"
"Connection: close\r\n"
"%s",
- status, title ? title : "OK", ASTERISK_VERSION, timebuf,
+ status, title ? title : "OK", ast_get_version(), timebuf,
static_content ? "" : "Cache-Control: no-cache, no-store\r\n");
if (!contentlength) { /* opaque body ? just dump it hoping it is properly formatted */
fprintf(ser->f, "%s", out->str);
diff --git a/main/manager.c b/main/manager.c
index 30e5247d0..f57d35b68 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -2222,7 +2222,7 @@ static int action_coresettings(struct mansession *s, const struct message *m)
,
idText,
AMI_VERSION,
- ASTERISK_VERSION,
+ ast_get_version(),
ast_config_AST_SYSTEM_NAME,
option_maxcalls,
option_maxload,