comparison configure @ 35819:6e1b1ab89cdd

configure: Add toupper() and tolower() utility functions
author diego
date Fri, 15 Feb 2013 02:40:35 +0000
parents 0728f9dcb4ac
children 36db4f950d50
comparison
equal deleted inserted replaced
35818:0728f9dcb4ac 35819:6e1b1ab89cdd
67 export LC_ALL=C 67 export LC_ALL=C
68 68
69 # Store the configure line that was used 69 # Store the configure line that was used
70 configuration="$*" 70 configuration="$*"
71 71
72 # utility functions
73 tolower() {
74 tr '[A-Z]' '[a-z]'
75 }
76
77 toupper() {
78 tr '[a-z]' '[A-Z]'
79 }
80
72 # Prefer these macros to full length text ! 81 # Prefer these macros to full length text !
73 # These macros only return an error code - NO display is done 82 # These macros only return an error code - NO display is done
74 compile_check() { 83 compile_check() {
75 source="$1" 84 source="$1"
76 shift 85 shift
223 exit 1 232 exit 1
224 } 233 }
225 234
226 # OS test booleans functions 235 # OS test booleans functions
227 issystem() { 236 issystem() {
228 test "$(echo $system_name | tr A-Z a-z)" = "$(echo $1 | tr A-Z a-z)" 237 test "$(echo $system_name | tolower)" = "$(echo $1 | tolower)"
229 } 238 }
230 aix() { issystem "AIX"; } 239 aix() { issystem "AIX"; }
231 amigaos() { issystem "AmigaOS"; } 240 amigaos() { issystem "AmigaOS"; }
232 bsdos() { issystem "BSD/OS"; } 241 bsdos() { issystem "BSD/OS"; }
233 cygwin() { issystem "CYGWIN"; } 242 cygwin() { issystem "CYGWIN"; }
677 _vf_lavfi=no 686 _vf_lavfi=no
678 _libavcodec_mpegaudio_hp=yes 687 _libavcodec_mpegaudio_hp=yes
679 _libopencore_amrnb=auto 688 _libopencore_amrnb=auto
680 _libopencore_amrwb=auto 689 _libopencore_amrwb=auto
681 libopenjpeg=auto 690 libopenjpeg=auto
682 libavdecoders_all=$(sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' ffmpeg/libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') 691 libavdecoders_all=$(sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' ffmpeg/libavcodec/allcodecs.c | toupper)
683 libavdecoders=$(echo $libavdecoders_all | sed -e 's/ LIB[A-Z0-9_]*_DECODER//g') 692 libavdecoders=$(echo $libavdecoders_all | sed -e 's/ LIB[A-Z0-9_]*_DECODER//g')
684 libavencoders_all=$(sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' ffmpeg/libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') 693 libavencoders_all=$(sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' ffmpeg/libavcodec/allcodecs.c | toupper)
685 libavencoders=$(echo $libavencoders_all | sed -e 's/ LIB[A-Z0-9_]*_ENCODER//g') 694 libavencoders=$(echo $libavencoders_all | sed -e 's/ LIB[A-Z0-9_]*_ENCODER//g')
686 libavparsers_all=$(sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' ffmpeg/libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') 695 libavparsers_all=$(sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' ffmpeg/libavcodec/allcodecs.c | toupper)
687 libavparsers=$libavparsers_all 696 libavparsers=$libavparsers_all
688 libavbsfs_all=$(sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' ffmpeg/libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') 697 libavbsfs_all=$(sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' ffmpeg/libavcodec/allcodecs.c | toupper)
689 libavbsfs=$libavbsfs_all 698 libavbsfs=$libavbsfs_all
690 libavhwaccels_all=$(sed -n 's/^[^#]*HWACCEL.*(.*, *\(.*\)).*/\1_hwaccel/p' ffmpeg/libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]') 699 libavhwaccels_all=$(sed -n 's/^[^#]*HWACCEL.*(.*, *\(.*\)).*/\1_hwaccel/p' ffmpeg/libavcodec/allcodecs.c | toupper)
691 # Disable all hardware accelerators for now. 700 # Disable all hardware accelerators for now.
692 libavhwaccels= 701 libavhwaccels=
693 libavdemuxers_all=$(sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' ffmpeg/libavformat/allformats.c | tr '[a-z]' '[A-Z]') 702 libavdemuxers_all=$(sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' ffmpeg/libavformat/allformats.c | toupper)
694 libavdemuxers=$(echo $libavdemuxers_all | sed -e 's/ LIB[A-Z0-9_]*_DEMUXER//g' -e s/REDIR_DEMUXER// -e s/AVISYNTH_DEMUXER//) 703 libavdemuxers=$(echo $libavdemuxers_all | sed -e 's/ LIB[A-Z0-9_]*_DEMUXER//g' -e s/REDIR_DEMUXER// -e s/AVISYNTH_DEMUXER//)
695 libavmuxers_all=$(sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' ffmpeg/libavformat/allformats.c | tr '[a-z]' '[A-Z]') 704 libavmuxers_all=$(sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' ffmpeg/libavformat/allformats.c | toupper)
696 libavmuxers=$(echo $libavmuxers_all | sed -e 's/ LIB[A-Z0-9_]*_MUXER//g' -e s/RTP_MUXER// -e s/RTSP_MUXER// -e s/SAP_MUXER//) 705 libavmuxers=$(echo $libavmuxers_all | sed -e 's/ LIB[A-Z0-9_]*_MUXER//g' -e s/RTP_MUXER// -e s/RTSP_MUXER// -e s/SAP_MUXER//)
697 libavprotocols_all=$(sed -n 's/^[^#]*PROTOCOL.*(.*, *\(.*\)).*/\1_protocol/p' ffmpeg/libavformat/allformats.c | tr '[a-z]' '[A-Z]') 706 libavprotocols_all=$(sed -n 's/^[^#]*PROTOCOL.*(.*, *\(.*\)).*/\1_protocol/p' ffmpeg/libavformat/allformats.c | toupper)
698 libavprotocols=$(echo $libavprotocols | sed -e s/HTTPS_PROTOCOL// -e s/TLS_PROTOCOL// -e s/BLURAY_PROTOCOL// -e s/FFRTMPCRYPT_PROTOCOL//) 707 libavprotocols=$(echo $libavprotocols | sed -e s/HTTPS_PROTOCOL// -e s/TLS_PROTOCOL// -e s/BLURAY_PROTOCOL// -e s/FFRTMPCRYPT_PROTOCOL//)
699 libavfilters_all=$(sed -n 's/^[^#]*FILTER.*(.*, *\(.*\),.*).*/\1_filter/p' ffmpeg/libavfilter/allfilters.c | tr '[a-z]' '[A-Z]') 708 libavfilters_all=$(sed -n 's/^[^#]*FILTER.*(.*, *\(.*\),.*).*/\1_filter/p' ffmpeg/libavfilter/allfilters.c | toupper)
700 libavfilters=$(echo $libavfilters_all | sed -e 's/ LIB[A-Z0-9_]*_FILTER//g' -e 's/ FREI0R[A-Z0-9_]*_FILTER//g' -e 's/ OCV_FILTER//g' -e 's/ MP_FILTER//g') 709 libavfilters=$(echo $libavfilters_all | sed -e 's/ LIB[A-Z0-9_]*_FILTER//g' -e 's/ FREI0R[A-Z0-9_]*_FILTER//g' -e 's/ OCV_FILTER//g' -e 's/ MP_FILTER//g')
701 _mencoder=yes 710 _mencoder=yes
702 _mplayer=yes 711 _mplayer=yes
703 _x11=auto 712 _x11=auto
704 _xshape=auto 713 _xshape=auto
1289 --disable-libnut) _libnut=no ;; 1298 --disable-libnut) _libnut=no ;;
1290 --enable-libopencore_amrnb) _libopencore_amrnb=yes ;; 1299 --enable-libopencore_amrnb) _libopencore_amrnb=yes ;;
1291 --disable-libopencore_amrnb) _libopencore_amrnb=no ;; 1300 --disable-libopencore_amrnb) _libopencore_amrnb=no ;;
1292 --enable-libopencore_amrwb) _libopencore_amrwb=yes ;; 1301 --enable-libopencore_amrwb) _libopencore_amrwb=yes ;;
1293 --disable-libopencore_amrwb) _libopencore_amrwb=no ;; 1302 --disable-libopencore_amrwb) _libopencore_amrwb=no ;;
1294 --enable-decoder=*) libavdecoders="$libavdecoders $(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')" ;; 1303 --enable-decoder=*) libavdecoders="$libavdecoders $(echo $ac_option | cut -d '=' -f 2 | toupper)" ;;
1295 --disable-decoder=*) libavdecoders=$(echo $libavdecoders | sed "s/$(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')//g") ;; 1304 --disable-decoder=*) libavdecoders=$(echo $libavdecoders | sed "s/$(echo $ac_option | cut -d '=' -f 2 | toupper)//g") ;;
1296 --enable-encoder=*) libavencoders="$libavencoders $(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')" ;; 1305 --enable-encoder=*) libavencoders="$libavencoders $(echo $ac_option | cut -d '=' -f 2 | toupper)" ;;
1297 --disable-encoder=*) libavencoders=$(echo $libavencoders | sed "s/$(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')//g") ;; 1306 --disable-encoder=*) libavencoders=$(echo $libavencoders | sed "s/$(echo $ac_option | cut -d '=' -f 2 | toupper)//g") ;;
1298 --enable-parser=*) libavparsers="$libavparsers $(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')" ;; 1307 --enable-parser=*) libavparsers="$libavparsers $(echo $ac_option | cut -d '=' -f 2 | toupper)" ;;
1299 --disable-parser=*) libavparsers=$(echo $libavparsers | sed "s/$(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')//g") ;; 1308 --disable-parser=*) libavparsers=$(echo $libavparsers | sed "s/$(echo $ac_option | cut -d '=' -f 2 | toupper)//g") ;;
1300 --enable-protocol=*) libavprotocols="$libavprotocols $(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')" ;; 1309 --enable-protocol=*) libavprotocols="$libavprotocols $(echo $ac_option | cut -d '=' -f 2 | toupper)" ;;
1301 --disable-protocol=*) libavprotocols=$(echo $libavprotocols | sed "s/$(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')//g") ;; 1310 --disable-protocol=*) libavprotocols=$(echo $libavprotocols | sed "s/$(echo $ac_option | cut -d '=' -f 2 | toupper)//g") ;;
1302 --enable-demuxer=*) libavdemuxers="$libavdemuxers $(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')" ;; 1311 --enable-demuxer=*) libavdemuxers="$libavdemuxers $(echo $ac_option | cut -d '=' -f 2 | toupper)" ;;
1303 --disable-demuxer=*) libavdemuxers=$(echo $libavdemuxers | sed "s/$(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')//g") ;; 1312 --disable-demuxer=*) libavdemuxers=$(echo $libavdemuxers | sed "s/$(echo $ac_option | cut -d '=' -f 2 | toupper)//g") ;;
1304 --enable-muxer=*) libavmuxers="$libavmuxers $(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')" ;; 1313 --enable-muxer=*) libavmuxers="$libavmuxers $(echo $ac_option | cut -d '=' -f 2 | toupper)" ;;
1305 --disable-muxer=*) libavmuxers=$(echo $libavmuxers | sed "s/$(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')//g") ;; 1314 --disable-muxer=*) libavmuxers=$(echo $libavmuxers | sed "s/$(echo $ac_option | cut -d '=' -f 2 | toupper)//g") ;;
1306 --enable-filter=*) libavfilters="$libavfilters $(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')" ;; 1315 --enable-filter=*) libavfilters="$libavfilters $(echo $ac_option | cut -d '=' -f 2 | toupper)" ;;
1307 --disable-filter=*) libavfilters=$(echo $libavfilters | sed "s/$(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')//g") ;; 1316 --disable-filter=*) libavfilters=$(echo $libavfilters | sed "s/$(echo $ac_option | cut -d '=' -f 2 | toupper)//g") ;;
1308 --enable-ffmpeg_a) ffmpeg_a=yes ;; 1317 --enable-ffmpeg_a) ffmpeg_a=yes ;;
1309 --disable-ffmpeg_a) ffmpeg_a=no ;; 1318 --disable-ffmpeg_a) ffmpeg_a=no ;;
1310 --enable-ffmpeg_so) ffmpeg_so=yes ;; 1319 --enable-ffmpeg_so) ffmpeg_so=yes ;;
1311 --disable-ffmpeg_so) ffmpeg_so=no ;; 1320 --disable-ffmpeg_so) ffmpeg_so=no ;;
1312 --enable-postproc) postproc=yes ;; 1321 --enable-postproc) postproc=yes ;;
1640 *) host_arch=UNKNOWN ;; 1649 *) host_arch=UNKNOWN ;;
1641 esac 1650 esac
1642 else # if test -z "$_target" 1651 else # if test -z "$_target"
1643 for component in 3 2; do 1652 for component in 3 2; do
1644 system_name=$(echo $_target | cut -d '-' -f $component) 1653 system_name=$(echo $_target | cut -d '-' -f $component)
1645 case "$(echo $system_name | tr A-Z a-z)" in 1654 case "$(echo $system_name | tolower)" in
1646 linux) system_name=Linux ;; 1655 linux) system_name=Linux ;;
1647 freebsd) system_name=FreeBSD ;; 1656 freebsd) system_name=FreeBSD ;;
1648 gnu/kfreebsd) system_name=FreeBSD ;; 1657 gnu/kfreebsd) system_name=FreeBSD ;;
1649 netbsd) system_name=NetBSD ;; 1658 netbsd) system_name=NetBSD ;;
1650 bsd/os) system_name=BSD/OS ;; 1659 bsd/os) system_name=BSD/OS ;;
3225 for func in atanf cbrt cbrtf cosf expf exp2 exp2f isnan isinf llrint llrintf log2 log2f log10f lrint lrintf rint round roundf sinf trunc truncf; do 3234 for func in atanf cbrt cbrtf cosf expf exp2 exp2f isnan isinf llrint llrintf log2 log2f log10f lrint lrintf rint round roundf sinf trunc truncf; do
3226 echocheck $func 3235 echocheck $func
3227 eval _$func=no 3236 eval _$func=no
3228 statement_check math.h "${func}(2.0)" -D_ISOC99_SOURCE && eval _$func=yes 3237 statement_check math.h "${func}(2.0)" -D_ISOC99_SOURCE && eval _$func=yes
3229 if eval test "x\$_$func" = "xyes"; then 3238 if eval test "x\$_$func" = "xyes"; then
3230 eval def_$func="\"#define HAVE_$(echo $func | tr '[a-z]' '[A-Z]') 1\"" 3239 eval def_$func="\"#define HAVE_$(echo $func | toupper) 1\""
3231 echores yes 3240 echores yes
3232 else 3241 else
3233 eval def_$func="\"#define HAVE_$(echo $func | tr '[a-z]' '[A-Z]') 0\"" 3242 eval def_$func="\"#define HAVE_$(echo $func | toupper) 0\""
3234 echores no 3243 echores no
3235 fi 3244 fi
3236 done 3245 done
3237 3246
3238 3247
3239 for func in atan2f ldexpf powf; do 3248 for func in atan2f ldexpf powf; do
3240 echocheck $func 3249 echocheck $func
3241 eval _$func=no 3250 eval _$func=no
3242 statement_check math.h "${func}(1.0,1.0)" -D_ISOC99_SOURCE && eval _$func=yes 3251 statement_check math.h "${func}(1.0,1.0)" -D_ISOC99_SOURCE && eval _$func=yes
3243 if eval test "x\$_$func" = "xyes"; then 3252 if eval test "x\$_$func" = "xyes"; then
3244 eval def_$func="\"#define HAVE_$(echo $func | tr '[a-z]' '[A-Z]') 1\"" 3253 eval def_$func="\"#define HAVE_$(echo $func | toupper) 1\""
3245 echores yes 3254 echores yes
3246 else 3255 else
3247 eval def_$func="\"#define HAVE_$(echo $func | tr '[a-z]' '[A-Z]') 0\"" 3256 eval def_$func="\"#define HAVE_$(echo $func | toupper) 0\""
3248 echores no 3257 echores no
3249 fi 3258 fi
3250 done 3259 done
3251 3260
3252 3261
4741 # some VIDIX drivers are architecture and os-specific, discard them elsewhere 4750 # some VIDIX drivers are architecture and os-specific, discard them elsewhere
4742 x86 || _vidix_drivers=$(echo $_vidix_drivers | sed -e s/cyberblade// -e s/sis// -e s/unichrome// -e s/s3//) 4751 x86 || _vidix_drivers=$(echo $_vidix_drivers | sed -e s/cyberblade// -e s/sis// -e s/unichrome// -e s/s3//)
4743 (test $host_arch = "sh" && linux) || _vidix_drivers=$(echo $_vidix_drivers | sed s/sh_veu//) 4752 (test $host_arch = "sh" && linux) || _vidix_drivers=$(echo $_vidix_drivers | sed s/sh_veu//)
4744 4753
4745 for driver in $_vidix_drivers ; do 4754 for driver in $_vidix_drivers ; do
4746 uc_driver=$(echo $driver | tr '[a-z]' '[A-Z]') 4755 uc_driver=$(echo $driver | toupper)
4747 eval _vidix_drv_${driver}=yes 4756 eval _vidix_drv_${driver}=yes
4748 eval def_vidix_drv_${driver}=\"\#define CONFIG_VIDIX_DRV_${uc_driver} 1\" 4757 eval def_vidix_drv_${driver}=\"\#define CONFIG_VIDIX_DRV_${uc_driver} 1\"
4749 done 4758 done
4750 4759
4751 echocheck "VIDIX PCI device name database" 4760 echocheck "VIDIX PCI device name database"
8153 fi 8162 fi
8154 8163
8155 ############################################################################# 8164 #############################################################################
8156 8165
8157 mak_enable () { 8166 mak_enable () {
8158 list=$(echo $1 | tr '[a-z]' '[A-Z]') 8167 list=$(echo $1 | toupper)
8159 item=$(echo $2 | tr '[a-z]' '[A-Z]') 8168 item=$(echo $2 | toupper)
8160 nprefix=$3; 8169 nprefix=$3;
8161 for part in $list; do 8170 for part in $list; do
8162 if $(echo $item | grep -q -E "(^| )$part($| )"); then 8171 if $(echo $item | grep -q -E "(^| )$part($| )"); then
8163 echo "${nprefix}_$part = yes" 8172 echo "${nprefix}_$part = yes"
8164 else 8173 else
8522 EOF 8531 EOF
8523 8532
8524 ############################################################################# 8533 #############################################################################
8525 8534
8526 ff_config_enable () { 8535 ff_config_enable () {
8527 list=$(echo $1 | tr '[a-z]' '[A-Z]') 8536 list=$(echo $1 | toupper)
8528 item=$(echo $2 | tr '[a-z]' '[A-Z]') 8537 item=$(echo $2 | toupper)
8529 _nprefix=$4; 8538 _nprefix=$4;
8530 _defineprefix=$3; 8539 _defineprefix=$3;
8531 _postfix=$5; 8540 _postfix=$5;
8532 test -z "$_nprefix" && _nprefix='CONFIG' 8541 test -z "$_nprefix" && _nprefix='CONFIG'
8533 for part in $list; do 8542 for part in $list; do