df506edbe1f83f472bb79c5988334e424e255d56
[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 TMP=`${GREP} -e "^MENUSELECT_CFLAGS" menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
14 for x in ${TMP}; do
15         echo "#define ${x} 1"
16         if test "${x}" = "DONT_OPTIMIZE" \
17                         -o "${x}" = "BETTER_BACKTRACES" \
18                         -o "${x}" = "LOTS_OF_SPANS" \
19                         -o "${x}" = "BUILD_NATIVE" \
20                         -o "${x}" = "REF_DEBUG" \
21                         -o "${x}" = "AO2_DEBUG" \
22                         -o "${x}" = "REBUILD_PARSERS" \
23                         -o "${x}" = "RADIO_RELAX" \
24                         -o "${x}" = "DEBUG_SCHEDULER" \
25                         -o "${x}" = "DETECT_DEADLOCKS" \
26                         -o "${x}" = "DUMP_SCHEDULER" ; then
27                 # These aren't ABI affecting options, keep them out of AST_BUILDOPTS
28                 continue
29         fi
30         if test "x${BUILDOPTS}" != "x" ; then
31                 BUILDOPTS="${BUILDOPTS}, ${x}"
32         else
33                 BUILDOPTS="${x}"
34         fi
35 done
36 TMP=`${GREP} -e "^MENUSELECT_BUILD_DEPS" menuselect.makeopts | sed 's/MENUSELECT_BUILD_DEPS\=//g'`
37 for x in ${TMP}; do
38         x2=`echo ${x} | tr a-z A-Z`
39         echo "#define AST_MODULE_${x2} 1"
40 done
41 if ${GREP} "AST_DEVMODE" makeopts | ${GREP} -q "yes"
42 then
43         echo "#define AST_DEVMODE 1"
44         TMP="${TMP} AST_DEVMODE"
45 fi
46
47 BUILDSUM=`echo ${TMP} | ${MD5} | cut -c1-32`
48
49 echo "#define AST_BUILDOPT_SUM \"${BUILDSUM}\""
50 echo "#define AST_BUILDOPTS \"${BUILDOPTS}\""