This is far from optimal, but I just found a FreeBSD system without
[asterisk/asterisk.git] / build_tools / make_buildopts_h
1 #!/bin/sh
2
3 cat << END
4 /*
5  * buildopts.h 
6  * Automatically generated
7  */
8
9 END
10 TMP=`${GREP} -e "^MENUSELECT_CFLAGS" menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
11 for x in ${TMP}; do
12         echo "#define ${x} 1"
13         if test "x${BUILDOPTS}" != "x" ; then
14                 BUILDOPTS="${BUILDOPTS}, ${x}"
15         else
16                 BUILDOPTS="${x}"
17         fi
18 done
19 TMP=`${GREP} -e "^MENUSELECT_BUILD_DEPS" menuselect.makeopts | sed 's/MENUSELECT_BUILD_DEPS\=//g'`
20 for x in ${TMP}; do
21         x2=`echo ${x} | tr a-z A-Z`
22         echo "#define AST_MODULE_${x2} 1"
23 done
24 if ${GREP} "AST_DEVMODE" makeopts | ${GREP} -q "yes"
25 then
26         echo "#define AST_DEVMODE 1"
27         TMP="${TMP} AST_DEVMODE"
28 fi
29 for x in md5 digest md5sum gmd5sum; do
30         BUILDSUM=`echo ${TMP} | $x 2> /dev/null`
31         if [ $? = 0 ]; then
32                 BUILDSUM=`echo ${BUILDSUM} | cut -c1-32`
33                 break;
34         fi
35 done
36
37 echo "#define AST_BUILDOPT_SUM \"${BUILDSUM}\""
38 echo "#define AST_BUILDOPTS \"${BUILDOPTS}\""