backtrace: Refactor ast_bt_get_symbols so it doesn't crash
[asterisk/asterisk.git] / build_tools / make_buildopts_h
1 #!/bin/sh
2
3 GREP=${GREP:-grep}
4 MD5=${MD5:-md5sum}
5
6 cat << END
7 /*
8  * buildopts.h
9  * Automatically generated
10  */
11
12 END
13
14 if ${GREP} "AST_DEVMODE" makeopts | ${GREP} -q "yes"
15 then
16         echo "#define AST_DEVMODE 1"
17         # AST_DEVMODE is no longer an API/ABI affecting option so it no longer
18         # gets added to BUILDOPTS.
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}" = "AO2_DEBUG" \
24                         -o "${x}" = "BETTER_BACKTRACES" \
25                         -o "${x}" = "BUILD_NATIVE" \
26                         -o "${x}" = "COMPILE_DOUBLE" \
27                         -o "${x}" = "DEBUG_CHAOS" \
28                         -o "${x}" = "DEBUG_SCHEDULER" \
29                         -o "${x}" = "DETECT_DEADLOCKS" \
30                         -o "${x}" = "DONT_OPTIMIZE" \
31                         -o "${x}" = "DUMP_SCHEDULER" \
32                         -o "${x}" = "LOTS_OF_SPANS" \
33                         -o "${x}" = "MALLOC_DEBUG" \
34                         -o "${x}" = "RADIO_RELAX" \
35                         -o "${x}" = "REBUILD_PARSERS" \
36                         -o "${x}" = "REF_DEBUG" \
37                         -o "${x}" = "USE_HOARD_ALLOCATOR" ; then
38                 # These options are only for specific sources and have no effect on public ABI.
39                 # Keep them out of buildopts.h so ccache does not invalidate all sources.
40                 continue
41         fi
42
43         echo "#define ${x} 1"
44         if test "${x}" = "LOW_MEMORY" ; then
45                 # LOW_MEMORY isn't an ABI affecting option but it is used in many sources
46                 # so it gets defined globally but is not included in AST_BUILTOPTS.
47                 continue
48         fi
49         if test "x${BUILDOPTS}" != "x" ; then
50                 BUILDOPTS="${BUILDOPTS}, ${x}"
51         else
52                 BUILDOPTS="${x}"
53         fi
54 done
55
56 BUILDSUM=`echo ${BUILDOPTS} | ${MD5} | cut -c1-32`
57
58 echo "#define AST_BUILDOPT_SUM \"${BUILDSUM}\""
59 echo "#define AST_BUILDOPTS \"${BUILDOPTS}\""