winlin

support module

  1 +#!/bin/bash
  2 +
  3 +# output variables:
  4 +# SRS_AUTO_HEADERS_H: the auto generated header file.
  5 +
  6 +SRS_AUTO_HEADERS_H="${SRS_OBJS}/srs_auto_headers.hpp"
  7 +
  8 +# write user options to headers
  9 +echo "// auto generated by configure" > $SRS_AUTO_HEADERS_H
  10 +echo "#ifndef SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H
  11 +echo "#define SRS_AUTO_HEADER_HPP" >> $SRS_AUTO_HEADERS_H
  12 +echo "" >> $SRS_AUTO_HEADERS_H
  13 +
  14 +echo "#define SRS_AUTO_BUILD_TS \"`date +%s`\"" >> $SRS_AUTO_HEADERS_H
  15 +echo "#define SRS_AUTO_BUILD_DATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $SRS_AUTO_HEADERS_H
  16 +echo "#define SRS_AUTO_UNAME \"`uname -a`\"" >> $SRS_AUTO_HEADERS_H
  17 +echo "#define SRS_AUTO_USER_CONFIGURE \"${SRS_AUTO_USER_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H
  18 +echo "#define SRS_AUTO_CONFIGURE \"${SRS_AUTO_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H
  19 +
  20 +# new empty line to auto headers file.
  21 +echo "" >> $SRS_AUTO_HEADERS_H
  22 +
  23 +#####################################################################################
  24 +# generate auto headers file, depends on the finished of options.sh
  25 +#####################################################################################
  26 +if [ $SRS_ARM_UBUNTU12 = YES ]; then
  27 + __SrsArmCC="arm-linux-gnueabi-gcc";
  28 + __SrsArmGCC="arm-linux-gnueabi-gcc";
  29 + __SrsArmCXX="arm-linux-gnueabi-g++";
  30 + __SrsArmAR="arm-linux-gnueabi-ar";
  31 + __SrsArmLD="arm-linux-gnueabi-ld";
  32 + __SrsArmRANDLIB="arm-linux-gnueabi-ranlib";
  33 +fi
  34 +if [ $SRS_MIPS_UBUNTU12 = YES ]; then
  35 + __SrsArmCC="mipsel-openwrt-linux-gcc";
  36 + __SrsArmGCC="mipsel-openwrt-linux-gcc";
  37 + __SrsArmCXX="mipsel-openwrt-linux-g++";
  38 + __SrsArmAR="mipsel-openwrt-linux-ar";
  39 + __SrsArmLD="mipsel-openwrt-linux-ld";
  40 + __SrsArmRANDLIB="mipsel-openwrt-linux-ranlib";
  41 +fi
  42 +# the arm-ubuntu12 options for make for depends
  43 +if [[ -z $SrsArmCC ]]; then SrsArmCC=$__SrsArmCC; fi
  44 +if [[ -z $SrsArmGCC ]]; then SrsArmGCC=$__SrsArmGCC; fi
  45 +if [[ -z $SrsArmCXX ]]; then SrsArmCXX=$__SrsArmCXX; fi
  46 +if [[ -z $SrsArmAR ]]; then SrsArmAR=$__SrsArmAR; fi
  47 +if [[ -z $SrsArmLD ]]; then SrsArmLD=$__SrsArmLD; fi
  48 +if [[ -z $SrsArmRANDLIB ]]; then SrsArmRANDLIB=$__SrsArmRANDLIB; fi
  49 +# write to source file
  50 +if [ $SRS_EMBEDED_CPU = YES ]; then
  51 + echo "cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB"
  52 + echo "#define SRS_AUTO_EMBEDED_TOOL_CHAIN \"cc=$SrsArmCC gcc=$SrsArmGCC g++=$SrsArmCXX ar=$SrsArmAR ld=$SrsArmLD randlib=$SrsArmRANDLIB\"" >> $SRS_AUTO_HEADERS_H
  53 +else
  54 + echo "#define SRS_AUTO_EMBEDED_TOOL_CHAIN \"normal x86/x64 gcc\"" >> $SRS_AUTO_HEADERS_H
  55 +fi
  56 +echo "" >> $SRS_AUTO_HEADERS_H
  57 +
  58 +# auto headers in depends.
  59 +if [ $SRS_HTTP_PARSER = YES ]; then
  60 + echo "#define SRS_AUTO_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H
  61 +else
  62 + echo "#undef SRS_AUTO_HTTP_PARSER" >> $SRS_AUTO_HEADERS_H
  63 +fi
  64 +
  65 +if [ $SRS_HTTP_SERVER = YES ]; then
  66 + echo "#define SRS_AUTO_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H
  67 +else
  68 + echo "#undef SRS_AUTO_HTTP_SERVER" >> $SRS_AUTO_HEADERS_H
  69 +fi
  70 +
  71 +if [ $SRS_STREAM_CASTER = YES ]; then
  72 + echo "#define SRS_AUTO_STREAM_CASTER" >> $SRS_AUTO_HEADERS_H
  73 +else
  74 + echo "#undef SRS_AUTO_STREAM_CASTER" >> $SRS_AUTO_HEADERS_H
  75 +fi
  76 +
  77 +if [ $SRS_HTTP_API = YES ]; then
  78 + echo "#define SRS_AUTO_HTTP_API" >> $SRS_AUTO_HEADERS_H
  79 +else
  80 + echo "#undef SRS_AUTO_HTTP_API" >> $SRS_AUTO_HEADERS_H
  81 +fi
  82 +
  83 +if [ $SRS_NGINX = YES ]; then
  84 + echo "#define SRS_AUTO_NGINX" >> $SRS_AUTO_HEADERS_H
  85 +else
  86 + echo "#undef SRS_AUTO_NGINX" >> $SRS_AUTO_HEADERS_H
  87 +fi
  88 +
  89 +if [ $SRS_DVR = YES ]; then
  90 + echo "#define SRS_AUTO_DVR" >> $SRS_AUTO_HEADERS_H
  91 +else
  92 + echo "#undef SRS_AUTO_DVR" >> $SRS_AUTO_HEADERS_H
  93 +fi
  94 +
  95 +if [ $SRS_HLS = YES ]; then
  96 + echo "#define SRS_AUTO_HLS" >> $SRS_AUTO_HEADERS_H
  97 +else
  98 + echo "#undef SRS_AUTO_HLS" >> $SRS_AUTO_HEADERS_H
  99 +fi
  100 +
  101 +if [ $SRS_HTTP_CALLBACK = YES ]; then
  102 + echo "#define SRS_AUTO_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H
  103 +else
  104 + echo "#undef SRS_AUTO_HTTP_CALLBACK" >> $SRS_AUTO_HEADERS_H
  105 +fi
  106 +
  107 +if [ $SRS_SSL = YES ]; then
  108 + echo "#define SRS_AUTO_SSL" >> $SRS_AUTO_HEADERS_H
  109 +else
  110 + echo "#undef SRS_AUTO_SSL" >> $SRS_AUTO_HEADERS_H
  111 +fi
  112 +
  113 +# whether compile ffmpeg tool
  114 +if [ $SRS_FFMPEG_TOOL = YES ]; then
  115 + echo "#define SRS_AUTO_FFMPEG_TOOL" >> $SRS_AUTO_HEADERS_H
  116 +else
  117 + echo "#undef SRS_AUTO_FFMPEG_TOOL" >> $SRS_AUTO_HEADERS_H
  118 +fi
  119 +
  120 +# whatever the FFMPEG tools, if transcode and ingest specified,
  121 +# srs always compile the FFMPEG tool stub which used to start the FFMPEG process.
  122 +if [ $SRS_FFMPEG_STUB = YES ]; then
  123 + echo "#define SRS_AUTO_FFMPEG_STUB" >> $SRS_AUTO_HEADERS_H
  124 +else
  125 + echo "#undef SRS_AUTO_FFMPEG_STUB" >> $SRS_AUTO_HEADERS_H
  126 +fi
  127 +
  128 +if [ $SRS_TRANSCODE = YES ]; then
  129 + echo "#define SRS_AUTO_TRANSCODE" >> $SRS_AUTO_HEADERS_H
  130 +else
  131 + echo "#undef SRS_AUTO_TRANSCODE" >> $SRS_AUTO_HEADERS_H
  132 +fi
  133 +
  134 +if [ $SRS_INGEST = YES ]; then
  135 + echo "#define SRS_AUTO_INGEST" >> $SRS_AUTO_HEADERS_H
  136 +else
  137 + echo "#undef SRS_AUTO_INGEST" >> $SRS_AUTO_HEADERS_H
  138 +fi
  139 +
  140 +# for statistic.
  141 +if [ $SRS_STAT = YES ]; then
  142 + echo "#define SRS_AUTO_STAT" >> $SRS_AUTO_HEADERS_H
  143 +else
  144 + echo "#undef SRS_AUTO_STAT" >> $SRS_AUTO_HEADERS_H
  145 +fi
  146 +
  147 +if [ $SRS_GPERF = YES ]; then
  148 + echo "#define SRS_AUTO_GPERF" >> $SRS_AUTO_HEADERS_H
  149 +else
  150 + echo "#undef SRS_AUTO_GPERF" >> $SRS_AUTO_HEADERS_H
  151 +fi
  152 +if [ $SRS_GPERF_MC = YES ]; then
  153 + echo "#define SRS_AUTO_GPERF_MC" >> $SRS_AUTO_HEADERS_H
  154 +else
  155 + echo "#undef SRS_AUTO_GPERF_MC" >> $SRS_AUTO_HEADERS_H
  156 +fi
  157 +if [ $SRS_GPERF_MP = YES ]; then
  158 + echo "#define SRS_AUTO_GPERF_MP" >> $SRS_AUTO_HEADERS_H
  159 +else
  160 + echo "#undef SRS_AUTO_GPERF_MP" >> $SRS_AUTO_HEADERS_H
  161 +fi
  162 +if [ $SRS_GPERF_CP = YES ]; then
  163 + echo "#define SRS_AUTO_GPERF_CP" >> $SRS_AUTO_HEADERS_H
  164 +else
  165 + echo "#undef SRS_AUTO_GPERF_CP" >> $SRS_AUTO_HEADERS_H
  166 +fi
  167 +
  168 +#####################################################################################
  169 +# for embeded.
  170 +#####################################################################################
  171 +if [ $SRS_EMBEDED_CPU = YES ]; then
  172 + echo "#define SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H
  173 +else
  174 + echo "#undef SRS_AUTO_EMBEDED_CPU" >> $SRS_AUTO_HEADERS_H
  175 +fi
  176 +
  177 +# arm
  178 +if [ $SRS_ARM_UBUNTU12 = YES ]; then
  179 + echo "#define SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H
  180 +else
  181 + echo "#undef SRS_AUTO_ARM_UBUNTU12" >> $SRS_AUTO_HEADERS_H
  182 +fi
  183 +
  184 +# mips
  185 +if [ $SRS_MIPS_UBUNTU12 = YES ]; then
  186 + echo "#define SRS_AUTO_MIPS_UBUNTU12" >> $SRS_AUTO_HEADERS_H
  187 +else
  188 + echo "#undef SRS_AUTO_MIPS_UBUNTU12" >> $SRS_AUTO_HEADERS_H
  189 +fi
  190 +
  191 +echo "" >> $SRS_AUTO_HEADERS_H
  192 +# for log level compile settings
  193 +if [ $SRS_LOG_VERBOSE = YES ]; then
  194 + echo "#define SRS_AUTO_VERBOSE" >> $SRS_AUTO_HEADERS_H
  195 +else
  196 + echo "#undef SRS_AUTO_VERBOSE" >> $SRS_AUTO_HEADERS_H
  197 +fi
  198 +if [ $SRS_LOG_INFO = YES ]; then
  199 + echo "#define SRS_AUTO_INFO" >> $SRS_AUTO_HEADERS_H
  200 +else
  201 + echo "#undef SRS_AUTO_INFO" >> $SRS_AUTO_HEADERS_H
  202 +fi
  203 +if [ $SRS_LOG_TRACE = YES ]; then
  204 + echo "#define SRS_AUTO_TRACE" >> $SRS_AUTO_HEADERS_H
  205 +else
  206 + echo "#undef SRS_AUTO_TRACE" >> $SRS_AUTO_HEADERS_H
  207 +fi
  208 +
  209 +# prefix
  210 +echo "" >> $SRS_AUTO_HEADERS_H
  211 +echo "#define SRS_AUTO_PREFIX \"${SRS_PREFIX}\"" >> $SRS_AUTO_HEADERS_H
  212 +
  213 +echo "" >> $SRS_AUTO_HEADERS_H
  214 +
  215 +#####################################################################################
  216 +# generated the contributors from AUTHORS.txt
  217 +#####################################################################################
  218 +SRS_CONSTRIBUTORS=`cat ../AUTHORS.txt|grep "*"|awk '{print $2}'`
  219 +echo "#define SRS_AUTO_CONSTRIBUTORS \"\\" >> $SRS_AUTO_HEADERS_H
  220 +for CONTRIBUTOR in $SRS_CONSTRIBUTORS; do
  221 + echo "${CONTRIBUTOR} \\" >> $SRS_AUTO_HEADERS_H
  222 +done
  223 +echo "\"" >> $SRS_AUTO_HEADERS_H
  224 +
  225 +# new empty line to auto headers file.
  226 +echo "" >> $SRS_AUTO_HEADERS_H
  227 +
  228 +# auto header EOF.
  229 +echo "#endif" >> $SRS_AUTO_HEADERS_H
  230 +echo "" >> $SRS_AUTO_HEADERS_H
  231 +