]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix cli display of build options. 64/1564/1
authorCorey Farrell <git@cfware.com>
Sat, 31 Oct 2015 03:57:58 +0000 (23:57 -0400)
committerCorey Farrell <git@cfware.com>
Wed, 4 Nov 2015 14:24:00 +0000 (09:24 -0500)
A previous commit reduced the AST_BUILDOPTS compiler define to
only include options that affected ABI.  This included some options
that were previously displayed by cli "core show settings".  This
change corrects the CLI display while still restricting buildopts.h
to ABI effecting options only.

ASTERISK-25434 #close
Reported by: Rusty Newton

Change-Id: Id07af6bedd1d7d325878023e403fbd9d3607e325

Makefile
build_tools/make_version_c
include/asterisk/ast_version.h
main/asterisk.c

index ac9830f491603c528731e41bd098ebd71dee4b9f..d4ae9fd61687bca9771708edfdb7b9e643a3918b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -400,7 +400,7 @@ defaults.h: makeopts .lastclean build_tools/make_defaults_h
        @cmp -s $@.tmp $@ || mv $@.tmp $@
        @rm -f $@.tmp
 
-main/version.c: FORCE .lastclean
+main/version.c: FORCE menuselect.makeopts .lastclean
        @build_tools/make_version_c > $@.tmp
        @cmp -s $@.tmp $@ || mv $@.tmp $@
        @rm -f $@.tmp
index 3fea6cea2d5b5bafcc2dadc75ee9382236d7aae7..fcbd94ef2be8fcfd7b0a1dce8aa3662bcd54865f 100755 (executable)
@@ -1,4 +1,7 @@
 #!/bin/sh
+
+GREP=${GREP:-grep}
+
 if test ! -f .flavor ; then
     EXTRA=""
 elif test ! -f .version ; then
@@ -9,6 +12,21 @@ else
     aadkflavor=`cat .flavor`
     EXTRA=" (${aadkflavor} ${aadkver})"
 fi
+
+if ${GREP} "AST_DEVMODE" makeopts | ${GREP} -q "yes"
+then
+       BUILDOPTS="AST_DEVMODE"
+fi
+
+TMP=`${GREP} -e "^MENUSELECT_CFLAGS" menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
+for x in ${TMP}; do
+       if test "x${BUILDOPTS}" != "x" ; then
+               BUILDOPTS="${BUILDOPTS}, ${x}"
+       else
+               BUILDOPTS="${x}"
+       fi
+done
+
 cat << END
 /*
  * version.c
@@ -23,6 +41,8 @@ static const char asterisk_version[] = "${ASTERISKVERSION}${EXTRA}";
 
 static const char asterisk_version_num[] = "${ASTERISKVERSIONNUM}";
 
+static const char asterisk_build_opts[] = "${BUILDOPTS}";
+
 const char *ast_get_version(void)
 {
        return asterisk_version;
@@ -33,4 +53,9 @@ const char *ast_get_version_num(void)
        return asterisk_version_num;
 }
 
+const char *ast_get_build_opts(void)
+{
+       return asterisk_build_opts;
+}
+
 END
index 51ff48102283f256598043317948f79a53da0efd..1ceac30fe3f9b63df567bab77e32d1177caf4780 100644 (file)
@@ -41,4 +41,7 @@ const char *ast_get_version(void);
  */
 const char *ast_get_version_num(void);
 
+/*! Retreive the Asterisk build options */
+const char *ast_get_build_opts(void);
+
 #endif /* __AST_VERSION_H */
index a9c6d0fa8c33694c0676e230884f44fea0a9bc82..cf0a595379459f09a3301dcf930a86813fa28540 100644 (file)
@@ -617,7 +617,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", ast_get_version());
-       ast_cli(a->fd, "  Build Options:               %s\n", S_OR(AST_BUILDOPTS, "(none)"));
+       ast_cli(a->fd, "  Build Options:               %s\n", S_OR(ast_get_build_opts(), "(none)"));
        if (ast_option_maxcalls)
                ast_cli(a->fd, "  Maximum calls:               %d (Current %d)\n", ast_option_maxcalls, ast_active_channels());
        else