menuselect: Remove ineffective weak attribute detection.
[asterisk/asterisk.git] / build_tools / make_version_c
1 #!/bin/sh
2
3 GREP=${GREP:-grep}
4
5 if test ! -f .flavor ; then
6     EXTRA=""
7 elif test ! -f .version ; then
8         aadkflavor=`cat .flavor`
9     EXTRA=" (${aadkflavor})"
10 else
11     aadkver=`cat .version`
12     aadkflavor=`cat .flavor`
13     EXTRA=" (${aadkflavor} ${aadkver})"
14 fi
15
16 if ${GREP} "AST_DEVMODE" makeopts | ${GREP} -q "yes"
17 then
18         BUILDOPTS="AST_DEVMODE"
19 fi
20
21 TMP=`${GREP} -e "^MENUSELECT_CFLAGS" menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
22 for x in ${TMP}; do
23         if test "x${BUILDOPTS}" != "x" ; then
24                 BUILDOPTS="${BUILDOPTS}, ${x}"
25         else
26                 BUILDOPTS="${x}"
27         fi
28 done
29
30 cat << END
31 /*
32  * version.c
33  * Automatically generated
34  */
35
36 #include "asterisk.h"
37
38 #include "asterisk/ast_version.h"
39
40 static const char asterisk_version[] = "${ASTERISKVERSION}${EXTRA}";
41
42 static const char asterisk_version_num[] = "${ASTERISKVERSIONNUM}";
43
44 static const char asterisk_build_opts[] = "${BUILDOPTS}";
45
46 const char *ast_get_version(void)
47 {
48         return asterisk_version;
49 }
50
51 const char *ast_get_version_num(void)
52 {
53         return asterisk_version_num;
54 }
55
56 const char *ast_get_build_opts(void)
57 {
58         return asterisk_build_opts;
59 }
60
61 END