winlin

add configure preset, add test for configure

@@ -536,10 +536,7 @@ fi @@ -536,10 +536,7 @@ fi
536 536
537 # whatever the FFMPEG tools, if transcode and ingest specified, 537 # whatever the FFMPEG tools, if transcode and ingest specified,
538 # srs always compile the FFMPEG tool stub which used to start the FFMPEG process. 538 # srs always compile the FFMPEG tool stub which used to start the FFMPEG process.
539 -__SRS_FFMPEG_STUB=NO  
540 -if [ $SRS_TRANSCODE = YES ]; then __SRS_FFMPEG_STUB=YES; fi  
541 -if [ $SRS_INGEST = YES ]; then __SRS_FFMPEG_STUB=YES; fi  
542 -if [ $__SRS_FFMPEG_STUB = YES ]; then 539 +if [ $SRS_FFMPEG_STUB = YES ]; then
543 echo "#define SRS_AUTO_FFMPEG" >> $SRS_AUTO_HEADERS_H 540 echo "#define SRS_AUTO_FFMPEG" >> $SRS_AUTO_HEADERS_H
544 else 541 else
545 echo "#undef SRS_AUTO_FFMPEG" >> $SRS_AUTO_HEADERS_H 542 echo "#undef SRS_AUTO_FFMPEG" >> $SRS_AUTO_HEADERS_H
@@ -20,7 +20,6 @@ SRS_SSL=RESERVED @@ -20,7 +20,6 @@ SRS_SSL=RESERVED
20 SRS_FFMPEG_TOOL=RESERVED 20 SRS_FFMPEG_TOOL=RESERVED
21 SRS_TRANSCODE=RESERVED 21 SRS_TRANSCODE=RESERVED
22 SRS_INGEST=RESERVED 22 SRS_INGEST=RESERVED
23 -SRS_HTTP_PARSER=RESERVED  
24 SRS_HTTP_CALLBACK=RESERVED 23 SRS_HTTP_CALLBACK=RESERVED
25 SRS_HTTP_SERVER=RESERVED 24 SRS_HTTP_SERVER=RESERVED
26 SRS_HTTP_API=RESERVED 25 SRS_HTTP_API=RESERVED
@@ -40,6 +39,9 @@ SRS_GPERF_CP=RESERVED @@ -40,6 +39,9 @@ SRS_GPERF_CP=RESERVED
40 # gprof 39 # gprof
41 SRS_GPROF=RESERVED 40 SRS_GPROF=RESERVED
42 # 41 #
  42 +# libraries
  43 +SRS_FFMPEG_STUB=RESERVED
  44 +SRS_HTTP_PARSER=RESERVED
43 # arguments 45 # arguments
44 SRS_PREFIX=/usr/local/srs 46 SRS_PREFIX=/usr/local/srs
45 SRS_JOBS=1 47 SRS_JOBS=1
@@ -54,6 +56,12 @@ SRS_ARM_UBUNTU12=NO @@ -54,6 +56,12 @@ SRS_ARM_UBUNTU12=NO
54 SRS_DEV=NO 56 SRS_DEV=NO
55 # raspberry-pi, open hls/ssl/static 57 # raspberry-pi, open hls/ssl/static
56 SRS_PI=NO 58 SRS_PI=NO
  59 +# the most fast compile, nothing, only support vp6 RTMP.
  60 +SRS_FAST=NO
  61 +# only support RTMP with ssl.
  62 +SRS_PURE_RTMP=NO
  63 +# only support RTMP+HLS with ssl.
  64 +SRS_RTMP_HLS=NO
57 65
58 ##################################################################################### 66 #####################################################################################
59 # menu 67 # menu
@@ -117,13 +125,16 @@ Options: @@ -117,13 +125,16 @@ Options:
117 used for make in the configure, for example, to make ffmpeg. 125 used for make in the configure, for example, to make ffmpeg.
118 126
119 Presets: 127 Presets:
120 - --x86_x64 [default] for x86/x64 cpu, common pc and servers. 128 + --x86-x64 [default] for x86/x64 cpu, common pc and servers.
121 --pi for raspberry-pi(directly build), open features hls/ssl/static. 129 --pi for raspberry-pi(directly build), open features hls/ssl/static.
122 --arm alias for --with-arm-ubuntu12 130 --arm alias for --with-arm-ubuntu12
123 --dev for dev, open all features, no gperf/gprof/arm. 131 --dev for dev, open all features, no gperf/gprof/arm.
  132 + --fast the most fast compile, nothing, only support vp6 RTMP.
  133 + --pure-rtmp only support RTMP with ssl.
  134 + --rtmp-hls only support RTMP+HLS with ssl.
124 135
125 Conflicts: 136 Conflicts:
126 - 1. --dev/x86_x64 vs --static: 137 + 1. --dev/x86-x64 vs --static:
127 the --static only for arm cpus. 138 the --static only for arm cpus.
128 2. --with-gmc vs --with-gmp: 139 2. --with-gmc vs --with-gmp:
129 @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html 140 @see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html
@@ -192,10 +203,13 @@ function parse_user_option() { @@ -192,10 +203,13 @@ function parse_user_option() {
192 --prefix) SRS_PREFIX=${value} ;; 203 --prefix) SRS_PREFIX=${value} ;;
193 --static) SRS_STATIC=YES ;; 204 --static) SRS_STATIC=YES ;;
194 205
195 - --dev) SRS_DEV=YES ;;  
196 - --x86_x64) SRS_X86_X64=YES ;; 206 + --x86-x64) SRS_X86_X64=YES ;;
197 --arm) SRS_ARM_UBUNTU12=YES ;; 207 --arm) SRS_ARM_UBUNTU12=YES ;;
198 --pi) SRS_PI=YES ;; 208 --pi) SRS_PI=YES ;;
  209 + --dev) SRS_DEV=YES ;;
  210 + --fast) SRS_FAST=YES ;;
  211 + --pure-rtmp) SRS_PURE_RTMP=YES ;;
  212 + --rtmp-hls) SRS_RTMP_HLS=YES ;;
199 213
200 *) 214 *)
201 echo "$0: error: invalid option \"$option\"" 215 echo "$0: error: invalid option \"$option\""
@@ -204,15 +218,7 @@ function parse_user_option() { @@ -204,15 +218,7 @@ function parse_user_option() {
204 esac 218 esac
205 } 219 }
206 220
207 -#####################################################################################  
208 -# parse preset options  
209 -#####################################################################################  
210 -opt=  
211 -  
212 -for option  
213 -do  
214 - opt="$opt `echo $option | sed -e \"s/\(--[^=]*=\)\(.* .*\)/\1'\2'/\"`"  
215 - 221 +function parse_user_option_to_value_and_option() {
216 case "$option" in 222 case "$option" in
217 -*=*) 223 -*=*)
218 value=`echo "$option" | sed -e 's|[-_a-zA-Z0-9/]*=||'` 224 value=`echo "$option" | sed -e 's|[-_a-zA-Z0-9/]*=||'`
@@ -220,23 +226,120 @@ do @@ -220,23 +226,120 @@ do
220 ;; 226 ;;
221 *) value="" ;; 227 *) value="" ;;
222 esac 228 esac
  229 +}
223 230
  231 +#####################################################################################
  232 +# parse preset options
  233 +#####################################################################################
  234 +opt=
  235 +
  236 +for option
  237 +do
  238 + opt="$opt `echo $option | sed -e \"s/\(--[^=]*=\)\(.* .*\)/\1'\2'/\"`"
  239 + parse_user_option_to_value_and_option
224 parse_user_option 240 parse_user_option
225 done 241 done
226 242
227 -# set default preset if not specifies  
228 -if [ $SRS_DEV = NO ]; then 243 +if [ $help = yes ]; then
  244 + show_help
  245 + exit 0
  246 +fi
  247 +
  248 +function apply_user_presets() {
  249 + # set default preset if not specifies
  250 + if [ $SRS_RTMP_HLS = NO ]; then
  251 + if [ $SRS_PURE_RTMP = NO ]; then
  252 + if [ $SRS_FAST = NO ]; then
  253 + if [ $SRS_DEV = NO ]; then
229 if [ $SRS_ARM_UBUNTU12 = NO ]; then 254 if [ $SRS_ARM_UBUNTU12 = NO ]; then
230 if [ $SRS_PI = NO ]; then 255 if [ $SRS_PI = NO ]; then
231 if [ $SRS_X86_X64 = NO ]; then 256 if [ $SRS_X86_X64 = NO ]; then
232 - SRS_X86_X64=YES; opt="--x86_x64 $opt"; 257 + SRS_X86_X64=YES; opt="--x86-x64 $opt";
233 fi 258 fi
234 fi 259 fi
235 fi 260 fi
236 -fi 261 + fi
  262 + fi
  263 + fi
  264 + fi
  265 +
  266 + # all disabled.
  267 + if [ $SRS_FAST = YES ]; then
  268 + SRS_HLS=NO
  269 + SRS_DVR=NO
  270 + SRS_NGINX=NO
  271 + SRS_SSL=NO
  272 + SRS_FFMPEG_TOOL=NO
  273 + SRS_TRANSCODE=NO
  274 + SRS_INGEST=NO
  275 + SRS_HTTP_PARSER=NO
  276 + SRS_HTTP_CALLBACK=NO
  277 + SRS_HTTP_SERVER=NO
  278 + SRS_HTTP_API=NO
  279 + SRS_LIBRTMP=NO
  280 + SRS_BWTC=NO
  281 + SRS_RESEARCH=NO
  282 + SRS_UTEST=NO
  283 + SRS_GPERF=NO
  284 + SRS_GPERF_MC=NO
  285 + SRS_GPERF_MP=NO
  286 + SRS_GPERF_CP=NO
  287 + SRS_GPROF=NO
  288 + SRS_STATIC=NO
  289 + fi
237 290
238 -# if arm specified, set some default to disabled.  
239 -if [ $SRS_ARM_UBUNTU12 = YES ]; then 291 + # all disabled.
  292 + if [ $SRS_RTMP_HLS = YES ]; then
  293 + SRS_HLS=YES
  294 + SRS_DVR=NO
  295 + SRS_NGINX=NO
  296 + SRS_SSL=YES
  297 + SRS_FFMPEG_TOOL=NO
  298 + SRS_TRANSCODE=NO
  299 + SRS_INGEST=NO
  300 + SRS_HTTP_PARSER=NO
  301 + SRS_HTTP_CALLBACK=NO
  302 + SRS_HTTP_SERVER=NO
  303 + SRS_HTTP_API=NO
  304 + SRS_LIBRTMP=NO
  305 + SRS_BWTC=NO
  306 + SRS_RESEARCH=NO
  307 + SRS_UTEST=NO
  308 + SRS_GPERF=NO
  309 + SRS_GPERF_MC=NO
  310 + SRS_GPERF_MP=NO
  311 + SRS_GPERF_CP=NO
  312 + SRS_GPROF=NO
  313 + SRS_STATIC=NO
  314 + fi
  315 +
  316 + # only ssl for RTMP with complex handshake.
  317 + if [ $SRS_PURE_RTMP = YES ]; then
  318 + SRS_HLS=NO
  319 + SRS_DVR=NO
  320 + SRS_NGINX=NO
  321 + SRS_SSL=YES
  322 + SRS_FFMPEG_TOOL=NO
  323 + SRS_TRANSCODE=NO
  324 + SRS_INGEST=NO
  325 + SRS_HTTP_PARSER=NO
  326 + SRS_HTTP_CALLBACK=NO
  327 + SRS_HTTP_SERVER=NO
  328 + SRS_HTTP_API=NO
  329 + SRS_LIBRTMP=NO
  330 + SRS_BWTC=NO
  331 + SRS_RESEARCH=NO
  332 + SRS_UTEST=NO
  333 + SRS_GPERF=NO
  334 + SRS_GPERF_MC=NO
  335 + SRS_GPERF_MP=NO
  336 + SRS_GPERF_CP=NO
  337 + SRS_GPROF=NO
  338 + SRS_STATIC=NO
  339 + fi
  340 +
  341 + # if arm specified, set some default to disabled.
  342 + if [ $SRS_ARM_UBUNTU12 = YES ]; then
240 SRS_HLS=YES 343 SRS_HLS=YES
241 SRS_DVR=YES 344 SRS_DVR=YES
242 SRS_NGINX=NO 345 SRS_NGINX=NO
@@ -258,10 +361,10 @@ if [ $SRS_ARM_UBUNTU12 = YES ]; then @@ -258,10 +361,10 @@ if [ $SRS_ARM_UBUNTU12 = YES ]; then
258 SRS_GPERF_CP=NO 361 SRS_GPERF_CP=NO
259 SRS_GPROF=NO 362 SRS_GPROF=NO
260 SRS_STATIC=YES 363 SRS_STATIC=YES
261 -fi 364 + fi
262 365
263 -# defaults for x86/x64  
264 -if [ $SRS_X86_X64 = YES ]; then 366 + # defaults for x86/x64
  367 + if [ $SRS_X86_X64 = YES ]; then
265 SRS_HLS=YES 368 SRS_HLS=YES
266 SRS_DVR=YES 369 SRS_DVR=YES
267 SRS_NGINX=NO 370 SRS_NGINX=NO
@@ -283,10 +386,10 @@ if [ $SRS_X86_X64 = YES ]; then @@ -283,10 +386,10 @@ if [ $SRS_X86_X64 = YES ]; then
283 SRS_GPERF_CP=NO 386 SRS_GPERF_CP=NO
284 SRS_GPROF=NO 387 SRS_GPROF=NO
285 SRS_STATIC=NO 388 SRS_STATIC=NO
286 -fi 389 + fi
287 390
288 -# if dev specified, open features if possible.  
289 -if [ $SRS_DEV = YES ]; then 391 + # if dev specified, open features if possible.
  392 + if [ $SRS_DEV = YES ]; then
290 SRS_HLS=YES 393 SRS_HLS=YES
291 SRS_DVR=YES 394 SRS_DVR=YES
292 SRS_NGINX=NO 395 SRS_NGINX=NO
@@ -308,10 +411,10 @@ if [ $SRS_DEV = YES ]; then @@ -308,10 +411,10 @@ if [ $SRS_DEV = YES ]; then
308 SRS_GPERF_CP=NO 411 SRS_GPERF_CP=NO
309 SRS_GPROF=NO 412 SRS_GPROF=NO
310 SRS_STATIC=NO 413 SRS_STATIC=NO
311 -fi 414 + fi
312 415
313 -# if raspberry-pi specified, open ssl/hls/static features  
314 -if [ $SRS_PI = YES ]; then 416 + # if raspberry-pi specified, open ssl/hls/static features
  417 + if [ $SRS_PI = YES ]; then
315 SRS_HLS=YES 418 SRS_HLS=YES
316 SRS_DVR=YES 419 SRS_DVR=YES
317 SRS_NGINX=NO 420 SRS_NGINX=NO
@@ -333,85 +436,101 @@ if [ $SRS_PI = YES ]; then @@ -333,85 +436,101 @@ if [ $SRS_PI = YES ]; then
333 SRS_GPERF_CP=NO 436 SRS_GPERF_CP=NO
334 SRS_GPROF=NO 437 SRS_GPROF=NO
335 SRS_STATIC=YES 438 SRS_STATIC=YES
336 -fi 439 + fi
  440 +}
  441 +apply_user_presets
337 442
338 ##################################################################################### 443 #####################################################################################
339 # parse detail feature options 444 # parse detail feature options
340 ##################################################################################### 445 #####################################################################################
341 for option 446 for option
342 do 447 do
343 - case "$option" in  
344 - -*=*)  
345 - value=`echo "$option" | sed -e 's|[-_a-zA-Z0-9/]*=||'`  
346 - option=`echo "$option" | sed -e 's|=[-_a-zA-Z0-9/]*||'`  
347 - ;;  
348 - *) value="" ;;  
349 - esac  
350 - 448 + parse_user_option_to_value_and_option
351 parse_user_option 449 parse_user_option
352 done 450 done
353 451
354 -#####################################################################################  
355 -# show help and exit  
356 -#####################################################################################  
357 -if [ $help = yes ]; then  
358 - show_help  
359 - exit 0  
360 -fi  
361 -  
362 -#####################################################################################  
363 -# generate the internal values from user specifies options  
364 -#####################################################################################  
365 -# if transcode specified, try ffmpeg if possible.  
366 -if [ $SRS_TRANSCODE = YES ]; then if [ $SRS_FFMPEG_TOOL = RESERVED ]; then SRS_FFMPEG_TOOL=YES; fi fi  
367 -if [ $SRS_INGEST = YES ]; then if [ $SRS_FFMPEG_TOOL = RESERVED ]; then SRS_FFMPEG_TOOL=YES; fi fi  
368 -  
369 -# if http-xxxx specified, open the SRS_HTTP_PARSER  
370 -SRS_HTTP_PARSER=NO  
371 -if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_HTTP_PARSER=YES; fi  
372 -if [ $SRS_HTTP_SERVER = YES ]; then SRS_HTTP_PARSER=YES; fi  
373 -if [ $SRS_HTTP_API = YES ]; then SRS_HTTP_PARSER=YES; fi  
374 -  
375 -# parse the jobs for make  
376 -if [[ "" -eq SRS_JOBS ]]; then  
377 - export SRS_JOBS="--jobs"  
378 -else 452 +function apply_user_detail_options() {
  453 + # if transcode/ingest specified, requires the ffmpeg stub classes.
  454 + SRS_FFMPEG_STUB=NO
  455 + if [ $SRS_TRANSCODE = YES ]; then SRS_FFMPEG_STUB=YES; fi
  456 + if [ $SRS_INGEST = YES ]; then SRS_FFMPEG_STUB=YES; fi
  457 +
  458 + # if http-xxxx specified, open the SRS_HTTP_PARSER
  459 + SRS_HTTP_PARSER=NO
  460 + if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_HTTP_PARSER=YES; fi
  461 + if [ $SRS_HTTP_SERVER = YES ]; then SRS_HTTP_PARSER=YES; fi
  462 + if [ $SRS_HTTP_API = YES ]; then SRS_HTTP_PARSER=YES; fi
  463 +
  464 + # parse the jobs for make
  465 + if [[ "" -eq SRS_JOBS ]]; then
  466 + export SRS_JOBS="--jobs=1"
  467 + else
379 export SRS_JOBS="--jobs=${SRS_JOBS}" 468 export SRS_JOBS="--jobs=${SRS_JOBS}"
380 -fi  
381 -  
382 -# save all config options to macro to write to auto headers file  
383 -SRS_AUTO_USER_CONFIGURE="$opt" 469 + fi
  470 +}
  471 +apply_user_detail_options
  472 +
  473 +function regenerate_options() {
  474 + # save all config options to macro to write to auto headers file
  475 + SRS_AUTO_USER_CONFIGURE="$opt"
  476 + # regenerate the options for default values.
  477 + SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}"
  478 + if [ $SRS_HLS = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-hls"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-hls"; fi
  479 + if [ $SRS_DVR = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-dvr"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-dvr"; fi
  480 + if [ $SRS_NGINX = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-nginx"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-nginx"; fi
  481 + if [ $SRS_SSL = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-ssl"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-ssl"; fi
  482 + if [ $SRS_FFMPEG_TOOL = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-ffmpeg"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-ffmpeg"; fi
  483 + if [ $SRS_TRANSCODE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-transcode"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-transcode"; fi
  484 + if [ $SRS_INGEST = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-ingest"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-ingest"; fi
  485 + if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-callback"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-callback"; fi
  486 + if [ $SRS_HTTP_SERVER = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-server"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-server"; fi
  487 + if [ $SRS_HTTP_API = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-api"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-api"; fi
  488 + if [ $SRS_LIBRTMP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-librtmp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-librtmp"; fi
  489 + if [ $SRS_BWTC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-bwtc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-bwtc"; fi
  490 + if [ $SRS_RESEARCH = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-research"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-research"; fi
  491 + if [ $SRS_UTEST = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-utest"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-utest"; fi
  492 + if [ $SRS_GPERF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gperf"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gperf"; fi
  493 + if [ $SRS_GPERF_MC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gmc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gmc"; fi
  494 + if [ $SRS_GPERF_MP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gmp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gmp"; fi
  495 + if [ $SRS_GPERF_CP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gcp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gcp"; fi
  496 + if [ $SRS_GPROF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gprof"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gprof"; fi
  497 + if [ $SRS_ARM_UBUNTU12 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-arm-ubuntu12"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-arm-ubuntu12"; fi
  498 + if [ $SRS_STATIC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --static"; fi
  499 + echo "regenerate config: ${SRS_AUTO_CONFIGURE}"
  500 +}
  501 +regenerate_options
384 502
385 ##################################################################################### 503 #####################################################################################
386 # check user options 504 # check user options
387 ##################################################################################### 505 #####################################################################################
388 -__check_ok=YES  
389 -# check conflict  
390 -if [ $SRS_GPERF = NO ]; then 506 +function check_option_conflicts() {
  507 + __check_ok=YES
  508 + # check conflict
  509 + if [ $SRS_GPERF = NO ]; then
391 if [ $SRS_GPERF_MC = YES ]; then echo "gperf-mc depends on gperf, see: ./configure --help"; __check_ok=NO; fi 510 if [ $SRS_GPERF_MC = YES ]; then echo "gperf-mc depends on gperf, see: ./configure --help"; __check_ok=NO; fi
392 if [ $SRS_GPERF_MP = YES ]; then echo "gperf-mp depends on gperf, see: ./configure --help"; __check_ok=NO; fi 511 if [ $SRS_GPERF_MP = YES ]; then echo "gperf-mp depends on gperf, see: ./configure --help"; __check_ok=NO; fi
393 if [ $SRS_GPERF_CP = YES ]; then echo "gperf-cp depends on gperf, see: ./configure --help"; __check_ok=NO; fi 512 if [ $SRS_GPERF_CP = YES ]; then echo "gperf-cp depends on gperf, see: ./configure --help"; __check_ok=NO; fi
394 -fi  
395 -if [ $SRS_GPERF_MC = YES ]; then 513 + fi
  514 + if [ $SRS_GPERF_MC = YES ]; then
396 if [ $SRS_GPERF_MP = YES ]; then 515 if [ $SRS_GPERF_MP = YES ]; then
397 echo "gperf-mc not compatible with gperf-mp, see: ./configure --help"; 516 echo "gperf-mc not compatible with gperf-mp, see: ./configure --help";
398 echo "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html"; 517 echo "@see: http://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html";
399 echo "Note that since the heap-checker uses the heap-profiling framework internally, it is not possible to run both the heap-checker and heap profiler at the same time"; 518 echo "Note that since the heap-checker uses the heap-profiling framework internally, it is not possible to run both the heap-checker and heap profiler at the same time";
400 __check_ok=NO 519 __check_ok=NO
401 fi 520 fi
402 -fi  
403 -# generate the group option: SRS_GPERF  
404 -__gperf_slow=NO  
405 -if [ $SRS_GPERF_MC = YES ]; then SRS_GPERF=YES; __gperf_slow=YES; fi  
406 -if [ $SRS_GPERF_MP = YES ]; then SRS_GPERF=YES; __gperf_slow=YES; fi  
407 -if [ $SRS_GPERF_CP = YES ]; then SRS_GPERF=YES; __gperf_slow=YES; fi  
408 -if [ $__gperf_slow = YES ]; then if [ $SRS_GPROF = YES ]; then 521 + fi
  522 + # generate the group option: SRS_GPERF
  523 + __gperf_slow=NO
  524 + if [ $SRS_GPERF_MC = YES ]; then SRS_GPERF=YES; __gperf_slow=YES; fi
  525 + if [ $SRS_GPERF_MP = YES ]; then SRS_GPERF=YES; __gperf_slow=YES; fi
  526 + if [ $SRS_GPERF_CP = YES ]; then SRS_GPERF=YES; __gperf_slow=YES; fi
  527 + if [ $__gperf_slow = YES ]; then if [ $SRS_GPROF = YES ]; then
409 echo "gmc/gmp/gcp not compatible with gprof, see: ./configure --help"; __check_ok=NO; 528 echo "gmc/gmp/gcp not compatible with gprof, see: ./configure --help"; __check_ok=NO;
410 -fi fi 529 + fi fi
411 530
412 -# check arm, if arm enabled, only allow st/ssl/librtmp,  
413 -# user should disable all other features  
414 -if [ $SRS_ARM_UBUNTU12 = YES ]; then 531 + # check arm, if arm enabled, only allow st/ssl/librtmp,
  532 + # user should disable all other features
  533 + if [ $SRS_ARM_UBUNTU12 = YES ]; then
415 if [ $SRS_FFMPEG_TOOL = YES ]; then echo "ffmpeg for arm is not available, see: ./configure --help"; __check_ok=NO; fi 534 if [ $SRS_FFMPEG_TOOL = YES ]; then echo "ffmpeg for arm is not available, see: ./configure --help"; __check_ok=NO; fi
416 if [ $SRS_BWTC = YES ]; then echo "bwtc for arm is not available, see: ./configure --help"; __check_ok=NO; fi 535 if [ $SRS_BWTC = YES ]; then echo "bwtc for arm is not available, see: ./configure --help"; __check_ok=NO; fi
417 if [ $SRS_RESEARCH = YES ]; then echo "research for arm is not available, see: ./configure --help"; __check_ok=NO; fi 536 if [ $SRS_RESEARCH = YES ]; then echo "research for arm is not available, see: ./configure --help"; __check_ok=NO; fi
@@ -420,62 +539,39 @@ if [ $SRS_ARM_UBUNTU12 = YES ]; then @@ -420,62 +539,39 @@ if [ $SRS_ARM_UBUNTU12 = YES ]; then
420 if [ $SRS_GPERF_MP = YES ]; then echo "gmp for arm is not available, see: ./configure --help"; __check_ok=NO; fi 539 if [ $SRS_GPERF_MP = YES ]; then echo "gmp for arm is not available, see: ./configure --help"; __check_ok=NO; fi
421 if [ $SRS_GPERF_CP = YES ]; then echo "gcp for arm is not available, see: ./configure --help"; __check_ok=NO; fi 540 if [ $SRS_GPERF_CP = YES ]; then echo "gcp for arm is not available, see: ./configure --help"; __check_ok=NO; fi
422 if [ $SRS_GPROF = YES ]; then echo "gprof for arm is not available, see: ./configure --help"; __check_ok=NO; fi 541 if [ $SRS_GPROF = YES ]; then echo "gprof for arm is not available, see: ./configure --help"; __check_ok=NO; fi
423 -fi 542 + fi
424 543
425 -# if x86/x64 or directly build, never use static  
426 -if [ $SRS_ARM_UBUNTU12 = NO ]; then 544 + # if x86/x64 or directly build, never use static
  545 + if [ $SRS_ARM_UBUNTU12 = NO ]; then
427 if [ $SRS_PI = NO ]; then 546 if [ $SRS_PI = NO ]; then
428 if [ $SRS_STATIC = YES ]; then 547 if [ $SRS_STATIC = YES ]; then
429 echo "x86/x64 should never use static, see: ./configure --help"; __check_ok=NO; 548 echo "x86/x64 should never use static, see: ./configure --help"; __check_ok=NO;
430 fi 549 fi
431 fi 550 fi
432 -fi 551 + fi
433 552
434 -# check variable neccessary  
435 -if [ $SRS_HLS = RESERVED ]; then echo "you must specifies the hls, see: ./configure --help"; __check_ok=NO; fi  
436 -if [ $SRS_DVR = RESERVED ]; then echo "you must specifies the dvr, see: ./configure --help"; __check_ok=NO; fi  
437 -if [ $SRS_NGINX = RESERVED ]; then echo "you must specifies the nginx, see: ./configure --help"; __check_ok=NO; fi  
438 -if [ $SRS_SSL = RESERVED ]; then echo "you must specifies the ssl, see: ./configure --help"; __check_ok=NO; fi  
439 -if [ $SRS_FFMPEG_TOOL = RESERVED ]; then echo "you must specifies the ffmpeg, see: ./configure --help"; __check_ok=NO; fi  
440 -if [ $SRS_HTTP_CALLBACK = RESERVED ]; then echo "you must specifies the http-callback, see: ./configure --help"; __check_ok=NO; fi  
441 -if [ $SRS_HTTP_SERVER = RESERVED ]; then echo "you must specifies the http-server, see: ./configure --help"; __check_ok=NO; fi  
442 -if [ $SRS_HTTP_API = RESERVED ]; then echo "you must specifies the http-api, see: ./configure --help"; __check_ok=NO; fi  
443 -if [ $SRS_LIBRTMP = RESERVED ]; then echo "you must specifies the librtmp, see: ./configure --help"; __check_ok=NO; fi  
444 -if [ $SRS_BWTC = RESERVED ]; then echo "you must specifies the bwtc, see: ./configure --help"; __check_ok=NO; fi  
445 -if [ $SRS_RESEARCH = RESERVED ]; then echo "you must specifies the research, see: ./configure --help"; __check_ok=NO; fi  
446 -if [ $SRS_UTEST = RESERVED ]; then echo "you must specifies the utest, see: ./configure --help"; __check_ok=NO; fi  
447 -if [ $SRS_GPERF = RESERVED ]; then echo "you must specifies the gperf, see: ./configure --help"; __check_ok=NO; fi  
448 -if [ $SRS_GPERF_MC = RESERVED ]; then echo "you must specifies the gperf-mc, see: ./configure --help"; __check_ok=NO; fi  
449 -if [ $SRS_GPERF_MP = RESERVED ]; then echo "you must specifies the gperf-mp, see: ./configure --help"; __check_ok=NO; fi  
450 -if [ $SRS_GPERF_CP = RESERVED ]; then echo "you must specifies the gperf-cp, see: ./configure --help"; __check_ok=NO; fi  
451 -if [ $SRS_GPROF = RESERVED ]; then echo "you must specifies the gprof, see: ./configure --help"; __check_ok=NO; fi  
452 -if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then echo "you must specifies the arm-ubuntu12, see: ./configure --help"; __check_ok=NO; fi  
453 -if [[ -z $SRS_PREFIX ]]; then echo "you must specifies the prefix, see: ./configure --prefix"; __check_ok=NO; fi  
454 -if [ $__check_ok = NO ]; then 553 + # check variable neccessary
  554 + if [ $SRS_HLS = RESERVED ]; then echo "you must specifies the hls, see: ./configure --help"; __check_ok=NO; fi
  555 + if [ $SRS_DVR = RESERVED ]; then echo "you must specifies the dvr, see: ./configure --help"; __check_ok=NO; fi
  556 + if [ $SRS_NGINX = RESERVED ]; then echo "you must specifies the nginx, see: ./configure --help"; __check_ok=NO; fi
  557 + if [ $SRS_SSL = RESERVED ]; then echo "you must specifies the ssl, see: ./configure --help"; __check_ok=NO; fi
  558 + if [ $SRS_FFMPEG_TOOL = RESERVED ]; then echo "you must specifies the ffmpeg, see: ./configure --help"; __check_ok=NO; fi
  559 + if [ $SRS_HTTP_CALLBACK = RESERVED ]; then echo "you must specifies the http-callback, see: ./configure --help"; __check_ok=NO; fi
  560 + if [ $SRS_HTTP_SERVER = RESERVED ]; then echo "you must specifies the http-server, see: ./configure --help"; __check_ok=NO; fi
  561 + if [ $SRS_HTTP_API = RESERVED ]; then echo "you must specifies the http-api, see: ./configure --help"; __check_ok=NO; fi
  562 + if [ $SRS_LIBRTMP = RESERVED ]; then echo "you must specifies the librtmp, see: ./configure --help"; __check_ok=NO; fi
  563 + if [ $SRS_BWTC = RESERVED ]; then echo "you must specifies the bwtc, see: ./configure --help"; __check_ok=NO; fi
  564 + if [ $SRS_RESEARCH = RESERVED ]; then echo "you must specifies the research, see: ./configure --help"; __check_ok=NO; fi
  565 + if [ $SRS_UTEST = RESERVED ]; then echo "you must specifies the utest, see: ./configure --help"; __check_ok=NO; fi
  566 + if [ $SRS_GPERF = RESERVED ]; then echo "you must specifies the gperf, see: ./configure --help"; __check_ok=NO; fi
  567 + if [ $SRS_GPERF_MC = RESERVED ]; then echo "you must specifies the gperf-mc, see: ./configure --help"; __check_ok=NO; fi
  568 + if [ $SRS_GPERF_MP = RESERVED ]; then echo "you must specifies the gperf-mp, see: ./configure --help"; __check_ok=NO; fi
  569 + if [ $SRS_GPERF_CP = RESERVED ]; then echo "you must specifies the gperf-cp, see: ./configure --help"; __check_ok=NO; fi
  570 + if [ $SRS_GPROF = RESERVED ]; then echo "you must specifies the gprof, see: ./configure --help"; __check_ok=NO; fi
  571 + if [ $SRS_ARM_UBUNTU12 = RESERVED ]; then echo "you must specifies the arm-ubuntu12, see: ./configure --help"; __check_ok=NO; fi
  572 + if [[ -z $SRS_PREFIX ]]; then echo "you must specifies the prefix, see: ./configure --prefix"; __check_ok=NO; fi
  573 + if [ $__check_ok = NO ]; then
455 exit 1; 574 exit 1;
456 -fi  
457 -  
458 -# regenerate the options for default values.  
459 -SRS_AUTO_CONFIGURE="--prefix=${SRS_PREFIX}"  
460 -if [ $SRS_HLS = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-hls"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-hls"; fi  
461 -if [ $SRS_DVR = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-dvr"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-dvr"; fi  
462 -if [ $SRS_NGINX = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-nginx"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-nginx"; fi  
463 -if [ $SRS_SSL = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-ssl"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-ssl"; fi  
464 -if [ $SRS_FFMPEG_TOOL = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-ffmpeg"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-ffmpeg"; fi  
465 -if [ $SRS_TRANSCODE = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-transcode"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-transcode"; fi  
466 -if [ $SRS_INGEST = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-ingest"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-ingest"; fi  
467 -if [ $SRS_HTTP_CALLBACK = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-callback"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-callback"; fi  
468 -if [ $SRS_HTTP_SERVER = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-server"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-server"; fi  
469 -if [ $SRS_HTTP_API = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-http-api"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-http-api"; fi  
470 -if [ $SRS_LIBRTMP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-librtmp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-librtmp"; fi  
471 -if [ $SRS_BWTC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-bwtc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-bwtc"; fi  
472 -if [ $SRS_RESEARCH = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-research"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-research"; fi  
473 -if [ $SRS_UTEST = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-utest"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-utest"; fi  
474 -if [ $SRS_GPERF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gperf"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gperf"; fi  
475 -if [ $SRS_GPERF_MC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gmc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gmc"; fi  
476 -if [ $SRS_GPERF_MP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gmp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gmp"; fi  
477 -if [ $SRS_GPERF_CP = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gcp"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gcp"; fi  
478 -if [ $SRS_GPROF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gprof"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gprof"; fi  
479 -if [ $SRS_ARM_UBUNTU12 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-arm-ubuntu12"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-arm-ubuntu12"; fi  
480 -if [ $SRS_STATIC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --static"; fi  
481 -echo "regenerate config: ${SRS_AUTO_CONFIGURE}" 575 + fi
  576 +}
  577 +check_option_conflicts
@@ -17,4 +17,38 @@ package_dir=${build_objs}/package @@ -17,4 +17,38 @@ package_dir=${build_objs}/package
17 log="${build_objs}/logs/package.`date +%s`.log" && . ${product_dir}/scripts/_log.sh && check_log 17 log="${build_objs}/logs/package.`date +%s`.log" && . ${product_dir}/scripts/_log.sh && check_log
18 ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi 18 ret=$?; if [[ $ret -ne 0 ]]; then exit $ret; fi
19 19
20 -# test default configure. 20 +item="default configure"
  21 +ok_msg "test ${item}"
  22 +(./configure && make) >>$log 2>&1
  23 +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test ${item} failed. ret=$ret"; exit $ret; fi
  24 +ok_msg "test ${item} success"
  25 +
  26 +item="preset --x86-x64"
  27 +ok_msg "test ${item}"
  28 +(./configure --x86-x64 && make) >>$log 2>&1
  29 +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test ${item} failed. ret=$ret"; exit $ret; fi
  30 +ok_msg "test ${item} success"
  31 +
  32 +item="preset --dev"
  33 +ok_msg "test ${item}"
  34 +(./configure --dev && make) >>$log 2>&1
  35 +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test ${item} failed. ret=$ret"; exit $ret; fi
  36 +ok_msg "test ${item} success"
  37 +
  38 +item="preset --fast"
  39 +ok_msg "test ${item}"
  40 +(./configure --fast && make) >>$log 2>&1
  41 +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test ${item} failed. ret=$ret"; exit $ret; fi
  42 +ok_msg "test ${item} success"
  43 +
  44 +item="preset --pure-rtmp"
  45 +ok_msg "test ${item}"
  46 +(./configure --pure-rtmp && make) >>$log 2>&1
  47 +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test ${item} failed. ret=$ret"; exit $ret; fi
  48 +ok_msg "test ${item} success"
  49 +
  50 +item="preset --rtmp-hls"
  51 +ok_msg "test ${item}"
  52 +(./configure --rtmp-hls && make) >>$log 2>&1
  53 +ret=$?; if [[ $ret -ne 0 ]]; then failed_msg "test ${item} failed. ret=$ret"; exit $ret; fi
  54 +ok_msg "test ${item} success"