libav: switch from CODEC_ID to AV_CODEC_ID
[mplayer.git] / configure
blob95a5ae8f7b326adda1355a25d00b4cea0f159447
1 #! /bin/sh
3 # Original version (C) 2000 Pontscho/fresh!mindworkz
4 # pontscho@makacs.poliod.hu
6 # History / Contributors: Check the Subversion log.
8 # Cleanups all over the place (c) 2001 pl
11 # This configure script is *not* autoconf-based and has different semantics.
12 # It attempts to autodetect all settings and options where possible. It is
13 # possible to override autodetection with the --enable-option/--disable-option
14 # command line parameters. --enable-option forces the option on skipping
15 # autodetection. Yes, this means that compilation may fail and yes, this is not
16 # how autoconf-based configure scripts behave.
18 # configure generates a series of configuration files:
19 # - config.h contains #defines that are used in the C code.
20 # - config.mak is included from the Makefiles.
22 # If you want to add a new check for $feature, look at the existing checks
23 # and try to use helper functions where you can.
25 # Furthermore you need to add the variable _feature to the list of default
26 # settings and set it to one of yes/no/auto. Also add appropriate
27 # --enable-feature/--disable-feature command line options.
28 # The results of the check should be written to config.h and config.mak
29 # at the end of this script. The variable names used for this should be
30 # uniform, i.e. if the option is named 'feature':
32 # _feature : should have a value of yes/no/auto
33 # def_feature : '#define ... 1' or '#undef ...' for conditional compilation
34 # _ld_feature : '-L/path/dir -lfeature' GCC options
36 #############################################################################
38 # Prevent locale nonsense from breaking basic text processing utils
39 export LC_ALL=C
41 # Store the configure line that was used
42 configuration="$*"
44 # Prefer these macros to full length text !
45 # These macros only return an error code - NO display is done
46 compile_check() {
47 source="$1"
48 shift
49 echo >> "$TMPLOG"
50 cat "$source" >> "$TMPLOG"
51 echo >> "$TMPLOG"
52 echo "$_cc $WARNFLAGS $WARN_CFLAGS $CFLAGS $source $extra_cflags $_ld_static $extra_ldflags $libs_mplayer -o $TMPEXE $@" >> "$TMPLOG"
53 rm -f "$TMPEXE"
54 $_cc $WARNFLAGS $WARN_CFLAGS $CFLAGS "$source" $extra_cflags $_ld_static $extra_ldflags $libs_mplayer -o "$TMPEXE" "$@" >> "$TMPLOG" 2>&1
55 TMPRES="$?"
56 echo >> "$TMPLOG"
57 echo >> "$TMPLOG"
58 return "$TMPRES"
61 cc_check() {
62 compile_check $TMPC $@
65 cflag_check() {
66 cat > $TMPC << EOF
67 int main(void) { return 0; }
68 EOF
69 compile_check $TMPC $@
72 header_check() {
73 cat > $TMPC << EOF
74 #include <$1>
75 int main(void) { return 0; }
76 EOF
77 shift
78 compile_check $TMPC $@
81 return_check() {
82 cat > $TMPC << EOF
83 #include <$1>
84 int main(void) { return $2; }
85 EOF
86 shift 2
87 compile_check $TMPC $@
90 statement_check() {
91 cat > $TMPC << EOF
92 #include <$1>
93 int main(void) { $2; return 0; }
94 EOF
95 shift
96 shift
97 compile_check $TMPC $@
100 define_statement_check() {
101 cat > $TMPC << EOF
102 #define $1
103 #include <$2>
104 int main(void) { $3; return 0; }
106 shift 3
107 compile_check $TMPC $@
110 return_statement_check() {
111 cat > $TMPC << EOF
112 #include <$1>
113 int main(void) { $2; return $3; }
115 shift 3
116 compile_check $TMPC $@
119 inline_asm_check() {
120 cat > $TMPC << EOF
121 int main(void) { __asm__ volatile ($1); return 0; }
123 shift
124 compile_check $TMPC $@
127 # The following checks are special and should only be used with broken and
128 # non-selfsufficient headers that do not include all of their dependencies.
130 header_check_broken() {
131 cat > $TMPC << EOF
132 #include <$1>
133 #include <$2>
134 int main(void) { return 0; }
136 shift
137 shift
138 compile_check $TMPC $@
141 statement_check_broken() {
142 cat > $TMPC << EOF
143 #include <$1>
144 #include <$2>
145 int main(void) { $3; return 0; }
147 shift 3
148 compile_check $TMPC $@
151 pkg_config_add() {
152 unset IFS # shell should not be used for programming
153 echo >> "$TMPLOG"
154 echo "$_pkg_config --cflags $@" >> "$TMPLOG"
155 ctmp=$($_pkg_config --cflags "$@" 2>> "$TMPLOG") || return $?
156 echo >> "$TMPLOG"
157 echo "$_pkg_config --libs $@" >> "$TMPLOG"
158 ltmp=$($_pkg_config --libs "$@" 2>> "$TMPLOG") || return $?
159 echo >> "$TMPLOG"
160 echo "cflags: $ctmp" >> "$TMPLOG"
161 echo "libs: $ltmp" >> "$TMPLOG"
162 echo >> "$TMPLOG"
163 extra_cflags="$extra_cflags $ctmp"
164 extra_ldflags="$extra_ldflags $ltmp"
167 tmp_run() {
168 "$TMPEXE" >> "$TMPLOG" 2>&1
171 # Display error message, flushes tempfile, exit
172 die () {
173 echo
174 echo "Error: $@" >&2
175 echo >&2
176 rm -f "$TMPEXE" "$TMPC" "$TMPS"
177 echo "Check \"$TMPLOG\" if you do not understand why it failed."
178 exit 1
181 # OS test booleans functions
182 issystem() {
183 test "$(echo $system_name | tr A-Z a-z)" = "$(echo $1 | tr A-Z a-z)"
185 aix() { issystem "AIX"; }
186 amigaos() { issystem "AmigaOS"; }
187 beos() { issystem "BEOS"; }
188 bsdos() { issystem "BSD/OS"; }
189 cygwin() { issystem "CYGWIN"; }
190 darwin() { issystem "Darwin"; }
191 dragonfly() { issystem "DragonFly"; }
192 freebsd() { issystem "FreeBSD" || issystem "GNU/kFreeBSD"; }
193 gnu() { issystem "GNU"; }
194 hpux() { issystem "HP-UX"; }
195 linux() { issystem "Linux"; }
196 mingw32() { issystem "MINGW32"; }
197 morphos() { issystem "MorphOS"; }
198 netbsd() { issystem "NetBSD"; }
199 openbsd() { issystem "OpenBSD"; }
200 qnx() { issystem "QNX"; }
201 win32() { cygwin || mingw32; }
203 # arch test boolean functions
204 # x86/x86pc is used by QNX
205 x86_32() {
206 case "$host_arch" in
207 i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) return 0 ;;
208 *) return 1 ;;
209 esac
212 x86_64() {
213 case "$host_arch" in
214 x86_64|amd64) return 0 ;;
215 *) return 1 ;;
216 esac
219 x86() {
220 x86_32 || x86_64
223 ppc() {
224 case "$host_arch" in
225 ppc|ppc64|powerpc|powerpc64) return 0;;
226 *) return 1;;
227 esac
230 alpha() {
231 case "$host_arch" in
232 alpha*) return 0;;
233 *) return 1;;
234 esac
237 arm() {
238 case "$host_arch" in
239 arm*) return 0;;
240 *) return 1;;
241 esac
244 # Use this before starting a check
245 echocheck() {
246 echo "============ Checking for $@ ============" >> "$TMPLOG"
247 echo ${_echo_n} "Checking for $@ ... ${_echo_c}"
250 # Use this to echo the results of a check
251 echores() {
252 if test "$res_comment" ; then
253 res_comment="($res_comment)"
255 echo "Result is: $@ $res_comment" >> "$TMPLOG"
256 echo "##########################################" >> "$TMPLOG"
257 echo "" >> "$TMPLOG"
258 echo "$@ $res_comment"
259 res_comment=""
261 #############################################################################
263 # Check how echo works in this /bin/sh
264 case $(echo -n) in
265 -n) _echo_n= _echo_c='\c' ;; # SysV echo
266 *) _echo_n='-n ' _echo_c= ;; # BSD echo
267 esac
269 msg_lang_all=''
270 ls po/*.po >/dev/null 2>&1 && msg_lang_all=$(echo po/*.po | sed -e 's:po/\([^[:space:]]*\)\.po:\1:g')
271 man_lang_all=$(echo DOCS/man/*/mplayer.rst | sed -e "s:DOCS/man/\(..\)/mplayer.rst:\1:g" -e "s:DOCS/man/\(.._..\)/mplayer.rst:\1:g")
272 doc_lang_all=$(echo DOCS/xml/??/ DOCS/xml/??_??/ | sed -e "s:DOCS/xml/\(..\)/:\1:g" -e "s:DOCS/xml/\(.._..\)/:\1:g")
274 show_help(){
275 cat << EOF
276 Usage: $0 [OPTIONS]...
278 Configuration:
279 -h, --help display this help and exit
281 Installation directories:
282 --prefix=DIR prefix directory for installation [/usr/local]
283 --bindir=DIR directory for installing binaries [PREFIX/bin]
284 --mandir=DIR directory for installing man pages [PREFIX/share/man]
285 --confdir=DIR directory for installing configuration files
286 [PREFIX/etc/mplayer]
287 --localedir=DIR directory for locale tree [PREFIX/share/locale]
288 --libdir=DIR directory for object code libraries [PREFIX/lib]
289 --codecsdir=DIR directory for binary codecs [LIBDIR/codecs]
291 Optional features:
292 --disable-mplayer disable MPlayer compilation [enable]
293 --enable-termcap use termcap database for key codes [autodetect]
294 --enable-termios use termios database for key codes [autodetect]
295 --disable-iconv disable iconv for encoding conversion [autodetect]
296 --disable-langinfo do not use langinfo [autodetect]
297 --enable-lirc enable LIRC (remote control) support [autodetect]
298 --enable-lircc enable LIRCCD (LIRC client daemon) input [autodetect]
299 --enable-joystick enable joystick support [disable]
300 --enable-apple-remote enable Apple Remote input (Mac OS X only) [autodetect]
301 --enable-apple-ir enable Apple IR Remote input (Linux only) [autodetect]
302 --disable-vm disable X video mode extensions [autodetect]
303 --disable-xf86keysym disable support for multimedia keys [autodetect]
304 --enable-radio enable radio interface [disable]
305 --enable-radio-capture enable radio capture (through PCI/line-in) [disable]
306 --disable-radio-v4l2 disable Video4Linux2 radio interface [autodetect]
307 --disable-radio-bsdbt848 disable BSD BT848 radio interface [autodetect]
308 --disable-tv disable TV interface (TV/DVB grabbers) [enable]
309 --disable-tv-v4l2 disable Video4Linux2 TV interface [autodetect]
310 --disable-tv-bsdbt848 disable BSD BT848 interface [autodetect]
311 --disable-pvr disable Video4Linux2 MPEG PVR [autodetect]
312 --disable-rtc disable RTC (/dev/rtc) on Linux [autodetect]
313 --disable-networking disable networking [enable]
314 --enable-winsock2_h enable winsock2_h [autodetect]
315 --enable-smb enable Samba (SMB) input [autodetect]
316 --enable-libquvi enable libquvi [autodetect]
317 --enable-lcms2 enable LCMS2 support [autodetect]
318 --disable-vcd disable VCD support [autodetect]
319 --disable-bluray disable Blu-ray support [autodetect]
320 --disable-dvdnav disable libdvdnav [autodetect]
321 --disable-dvdread disable libdvdread [autodetect]
322 --disable-dvdread-internal disable internal libdvdread [autodetect]
323 --disable-libdvdcss-internal disable internal libdvdcss [autodetect]
324 --disable-cddb disable cddb [autodetect]
325 --disable-unrarexec disable using of UnRAR executable [enabled]
326 --disable-enca disable ENCA charset oracle library [autodetect]
327 --enable-macosx-finder enable Mac OS X Finder invocation parameter
328 parsing [disabled]
329 --enable-macosx-bundle enable Mac OS X bundle file locations [autodetect]
330 --disable-inet6 disable IPv6 support [autodetect]
331 --disable-gethostbyname2 gethostbyname2 part of the C library [autodetect]
332 --disable-ftp disable FTP support [enabled]
333 --disable-vstream disable TiVo vstream client support [autodetect]
334 --disable-pthreads disable Posix threads support [autodetect]
335 --disable-w32threads disable Win32 threads support [autodetect]
336 --disable-libass disable subtitle rendering with libass [autodetect]
337 --enable-rpath enable runtime linker path for extra libs [disabled]
338 --disable-libpostproc disable postprocess filter (vf_pp) [autodetect]
339 --disable-libavresample disable libavresample (sample format conversion) [autodetect]
341 Codecs:
342 --enable-gif enable GIF support [autodetect]
343 --enable-png enable PNG input/output support [autodetect]
344 --enable-mng enable MNG input support [autodetect]
345 --enable-jpeg enable JPEG input/output support [autodetect]
346 --enable-libcdio enable libcdio support [autodetect]
347 --disable-win32dll disable Win32 DLL support [autodetect]
348 --disable-qtx disable QuickTime codecs support [enabled]
349 --disable-xanim disable XAnim codecs support [enabled]
350 --disable-real disable RealPlayer codecs support [enabled]
351 --disable-xvid disable Xvid [autodetect]
352 --disable-libnut disable libnut [autodetect]
353 --enable-libav skip Libav autodetection [autodetect]
354 --disable-libvorbis disable libvorbis support [autodetect]
355 --disable-tremor disable Tremor [autodetect if no libvorbis]
356 --disable-speex disable Speex support [autodetect]
357 --enable-theora enable OggTheora libraries [autodetect]
358 --enable-faad enable FAAD2 (AAC) [autodetect]
359 --disable-ladspa disable LADSPA plugin support [autodetect]
360 --disable-libbs2b disable libbs2b audio filter support [autodetect]
361 --disable-libdv disable libdv 0.9.5 en/decoding support [autodetect]
362 --disable-mpg123 disable libmpg123 MP3 decoding support [autodetect]
363 --disable-mad disable libmad (MPEG audio) support [autodetect]
364 --enable-xmms enable XMMS input plugin support [disabled]
365 --enable-libdca enable libdca support [autodetect]
366 --disable-liba52 disable liba52 [autodetect]
367 --enable-musepack enable libmpcdec support (deprecated, libavcodec
368 Musepack decoder is preferred) [disabled]
370 Video output:
371 --enable-gl enable OpenGL video output [autodetect]
372 --enable-sdl enable SDL video output [autodetect]
373 --enable-caca enable CACA video output [autodetect]
374 --enable-direct3d enable Direct3D video output [autodetect]
375 --enable-directx enable DirectX video output [autodetect]
376 --enable-v4l2 enable V4L2 Decoder audio/video output [autodetect]
377 --enable-dvb enable DVB video input [autodetect]
378 --enable-xv enable Xv video output [autodetect]
379 --enable-vdpau enable VDPAU acceleration [autodetect]
380 --enable-vm enable XF86VidMode support [autodetect]
381 --enable-xinerama enable Xinerama support [autodetect]
382 --enable-x11 enable X11 video output [autodetect]
383 --disable-xss disable screensaver support via xss [autodetect]
384 --enable-directfb enable DirectFB video output [autodetect]
385 --disable-tga disable Targa video output [enable]
386 --disable-pnm disable PNM video output [enable]
387 --disable-md5sum disable md5sum video output [enable]
388 --disable-yuv4mpeg disable yuv4mpeg video output [enable]
389 --disable-corevideo disable CoreVideo video output [autodetect]
390 --disable-cocoa disable Cocoa OpenGL backend [autodetect]
391 --disable-sharedbuffer disable OSX shared buffer video output [autodetect]
393 Audio output:
394 --disable-alsa disable ALSA audio output [autodetect]
395 --disable-ossaudio disable OSS audio output [autodetect]
396 --disable-rsound disable RSound audio output [autodetect]
397 --disable-pulse disable Pulseaudio audio output [autodetect]
398 --disable-portaudio disable PortAudio audio output [autodetect]
399 --disable-jack disable JACK audio output [autodetect]
400 --enable-openal enable OpenAL audio output [disable]
401 --disable-coreaudio disable CoreAudio audio output [autodetect]
402 --disable-select disable using select() on the audio device [enable]
404 Language options:
405 --enable-translation enable support for translated output [disable]
406 --charset=charset convert the console messages to this character set
407 --language-doc=lang language to use for the documentation [en]
408 --language-man=lang language to use for the man pages [en]
409 --language-msg=lang extra languages for program messages [all]
410 --language=lang default language to use [en]
411 Specific options override --language. You can pass a list of languages separated
412 by whitespace or commas instead of a single language. Nonexisting translations
413 will be dropped from each list. All translations available in the list will be
414 installed. The value "all" will activate all translations. The LINGUAS
415 environment variable is honored. In all cases the fallback is English.
416 The program always supports English-language output; additional message
417 languages are only installed if --enable-translation is also specified.
418 Available values for --language-doc are: all $doc_lang_all
419 Available values for --language-man are: all $man_lang_all
420 Available values for --language-msg are: all $msg_lang_all
422 Miscellaneous options:
423 --enable-runtime-cpudetection enable runtime CPU detection [disable]
424 --enable-cross-compile enable cross-compilation [disable]
425 --cc=COMPILER C compiler to build MPlayer [gcc]
426 --pkg-config=PKGCONFIG pkg-config to find some libraries [pkg-config]
427 --windres=WINDRES windres to build MPlayer [windres]
428 --target=PLATFORM target platform (i386-linux, arm-linux, etc)
429 --enable-static build a statically linked binary
430 --with-install=PATH path to a custom install program
432 Advanced options:
433 --enable-mmx enable MMX [autodetect]
434 --enable-mmxext enable MMX2 (Pentium III, Athlon) [autodetect]
435 --enable-3dnow enable 3DNow! [autodetect]
436 --enable-3dnowext enable extended 3DNow! [autodetect]
437 --enable-sse enable SSE [autodetect]
438 --enable-sse2 enable SSE2 [autodetect]
439 --enable-ssse3 enable SSSE3 [autodetect]
440 --enable-shm enable shm [autodetect]
441 --enable-altivec enable AltiVec (PowerPC) [autodetect]
442 --enable-armv5te enable DSP extensions (ARM) [autodetect]
443 --enable-armv6 enable ARMv6 (ARM) [autodetect]
444 --enable-armv6t2 enable ARMv6t2 (ARM) [autodetect]
445 --enable-armvfp enable ARM VFP (ARM) [autodetect]
446 --enable-neon enable NEON (ARM) [autodetect]
447 --enable-iwmmxt enable iWMMXt (ARM) [autodetect]
448 --disable-fastmemcpy disable 3DNow!/SSE/MMX optimized memcpy [enable]
449 --enable-big-endian force byte order to big-endian [autodetect]
450 --enable-debug[=1-3] compile-in debugging information [disable]
451 --enable-profile compile-in profiling information [disable]
452 --disable-sighandler disable sighandler for crashes [enable]
453 --enable-crash-debug enable automatic gdb attach on crash [disable]
455 Use these options if autodetection fails:
456 --extra-cflags=FLAGS extra CFLAGS
457 --extra-ldflags=FLAGS extra LDFLAGS
458 --extra-libs=FLAGS extra linker flags
459 --extra-libs-mplayer=FLAGS extra linker flags for MPlayer
461 --with-sdl-config=PATH path to sdl*-config
462 --with-dvdnav-config=PATH path to dvdnav-config
463 --with-dvdread-config=PATH path to dvdread-config
465 This configure script is NOT autoconf-based, even though its output is similar.
466 It will try to autodetect all configuration options. If you --enable an option
467 it will be forcefully turned on, skipping autodetection. This can break
468 compilation, so you need to know what you are doing.
470 exit 0
471 } #show_help()
473 # GOTCHA: the variables below defines the default behavior for autodetection
474 # and have - unless stated otherwise - at least 2 states : yes no
475 # If autodetection is available then the third state is: auto
476 _mmx=auto
477 _3dnow=auto
478 _3dnowext=auto
479 _mmxext=auto
480 _sse=auto
481 _sse2=auto
482 _ssse3=auto
483 _cmov=auto
484 _fast_cmov=auto
485 _fast_clz=auto
486 _armv5te=auto
487 _armv6=auto
488 _armv6t2=auto
489 _armvfp=auto
490 neon=auto
491 _iwmmxt=auto
492 _altivec=auto
493 _install=install
494 _pkg_config=auto
495 _windres=auto
496 _cc=auto
497 test "$CC" && _cc="$CC"
498 _as=auto
499 _runtime_cpudetection=no
500 _cross_compile=no
501 _prefix="/usr/local"
502 ffmpeg=auto
503 _x11=auto
504 _xss=auto
505 _xv=auto
506 _vdpau=auto
507 _sdl=auto
508 _direct3d=auto
509 _directx=auto
510 _png=auto
511 _mng=auto
512 _jpeg=auto
513 _pnm=yes
514 _md5sum=yes
515 _yuv4mpeg=yes
516 _gif=auto
517 _gl=auto
518 _aa=auto
519 _caca=auto
520 _dvb=auto
521 _v4l2=auto
522 _iconv=auto
523 _langinfo=auto
524 _rtc=auto
525 _ossaudio=auto
526 _rsound=auto
527 _pulse=auto
528 _portaudio=auto
529 _jack=auto
530 _openal=no
531 _libcdio=auto
532 _mad=auto
533 _tremor=auto
534 _libvorbis=auto
535 _speex=auto
536 _theora=auto
537 _mpg123=auto
538 _liba52=auto
539 _libdca=auto
540 _faad=auto
541 _ladspa=auto
542 _libbs2b=auto
543 _xmms=no
544 _vcd=auto
545 _bluray=auto
546 _dvdnav=auto
547 _dvdnavconfig=dvdnav-config
548 _dvdreadconfig=dvdread-config
549 _dvdread=auto
550 _dvdread_internal=auto
551 _libdvdcss_internal=auto
552 _xanim=auto
553 _real=auto
554 _lcms2=auto
555 _xinerama=auto
556 _vm=auto
557 _xf86keysym=auto
558 _alsa=auto
559 _fastmemcpy=yes
560 _unrar_exec=auto
561 _win32dll=auto
562 _select=yes
563 _radio=no
564 _radio_capture=no
565 _radio_v4l2=auto
566 _radio_bsdbt848=auto
567 _tv=yes
568 _tv_v4l2=auto
569 _tv_bsdbt848=auto
570 _tv_dshow=auto
571 _pvr=auto
572 networking=yes
573 _winsock2_h=auto
574 _smb=auto
575 _libquvi=auto
576 _joystick=no
577 _xvid=auto
578 _libnut=auto
579 _lirc=auto
580 _lircc=auto
581 _apple_remote=auto
582 _apple_ir=auto
583 _termcap=auto
584 _termios=auto
585 _tga=yes
586 _directfb=auto
587 #language=en
588 _shm=auto
589 _translation=no
590 _charset="UTF-8"
591 _crash_debug=no
592 _sighandler=yes
593 _libdv=auto
594 _cdda=auto
595 _cddb=auto
596 _big_endian=auto
597 _qtx=auto
598 _coreaudio=auto
599 _corevideo=auto
600 _cocoa=auto
601 _sharedbuffer=auto
602 quicktime=auto
603 _macosx_finder=no
604 _macosx_bundle=auto
605 _enca=auto
606 _inet6=auto
607 _gethostbyname2=auto
608 _ftp=auto
609 _musepack=no
610 _vstream=auto
611 _pthreads=auto
612 _w32threads=auto
613 _ass=auto
614 _rpath=no
615 libpostproc=auto
616 libavresample=auto
617 _asmalign_pot=auto
618 _stream_cache=yes
619 _priority=no
620 def_dos_paths="#define HAVE_DOS_PATHS 0"
621 def_stream_cache="#define CONFIG_STREAM_CACHE 1"
622 def_priority="#undef CONFIG_PRIORITY"
623 def_pthread_cache="#undef PTHREAD_CACHE"
624 need_shmem=yes
625 for ac_option do
626 case "$ac_option" in
627 --help|-help|-h)
628 show_help
630 --prefix=*)
631 _prefix=$(echo $ac_option | cut -d '=' -f 2)
633 --bindir=*)
634 _bindir=$(echo $ac_option | cut -d '=' -f 2)
636 --mandir=*)
637 _mandir=$(echo $ac_option | cut -d '=' -f 2)
639 --confdir=*)
640 _confdir=$(echo $ac_option | cut -d '=' -f 2)
642 --libdir=*)
643 _libdir=$(echo $ac_option | cut -d '=' -f 2)
645 --codecsdir=*)
646 _codecsdir=$(echo $ac_option | cut -d '=' -f 2)
648 --localedir=*)
649 _localedir=$(echo $ac_option | cut -d '=' -f 2)
652 --with-install=*)
653 _install=$(echo $ac_option | cut -d '=' -f 2 )
656 --with-sdl-config=*)
657 _sdlconfig=$(echo $ac_option | cut -d '=' -f 2)
659 --with-dvdnav-config=*)
660 _dvdnavconfig=$(echo $ac_option | cut -d '=' -f 2)
662 --with-dvdread-config=*)
663 _dvdreadconfig=$(echo $ac_option | cut -d '=' -f 2)
666 --extra-cflags=*)
667 extra_cflags="$extra_cflags $(echo $ac_option | cut -d '=' -f 2-)"
669 --extra-ldflags=*)
670 extra_ldflags="$extra_ldflags $(echo $ac_option | cut -d '=' -f 2-)"
672 --extra-libs=*)
673 extra_libs=$(echo $ac_option | cut -d '=' -f 2)
675 --extra-libs-mplayer=*)
676 libs_mplayer=$(echo $ac_option | cut -d '=' -f 2)
679 --target=*)
680 _target=$(echo $ac_option | cut -d '=' -f 2)
682 --cc=*)
683 _cc=$(echo $ac_option | cut -d '=' -f 2)
685 --pkg-config=*)
686 _pkg_config=$(echo $ac_option | cut -d '=' -f 2)
688 --windres=*)
689 _windres=$(echo $ac_option | cut -d '=' -f 2)
691 --charset=*)
692 _charset=$(echo $ac_option | cut -d '=' -f 2)
694 --language-doc=*)
695 language_doc=$(echo $ac_option | cut -d '=' -f 2)
697 --language-man=*)
698 language_man=$(echo $ac_option | cut -d '=' -f 2)
700 --language-msg=*)
701 language_msg=$(echo $ac_option | cut -d '=' -f 2)
703 --language=*)
704 language=$(echo $ac_option | cut -d '=' -f 2)
707 --enable-static)
708 _ld_static='-static'
710 --disable-static)
711 _ld_static=''
713 --enable-profile)
714 _profile='-p'
716 --disable-profile)
717 _profile=
719 --enable-debug)
720 _debug='-g'
722 --enable-debug=*)
723 _debug=$(echo $_echo_n '-g'$_echo_c; echo $ac_option | cut -d '=' -f 2)
725 --disable-debug)
726 _debug=
728 --enable-translation) _translation=yes ;;
729 --disable-translation) _translation=no ;;
730 --enable-runtime-cpudetection) _runtime_cpudetection=yes ;;
731 --disable-runtime-cpudetection) _runtime_cpudetection=no ;;
732 --enable-cross-compile) _cross_compile=yes ;;
733 --disable-cross-compile) _cross_compile=no ;;
734 --enable-x11) _x11=yes ;;
735 --disable-x11) _x11=no ;;
736 --enable-xss) _xss=yes ;;
737 --disable-xss) _xss=no ;;
738 --enable-xv) _xv=yes ;;
739 --disable-xv) _xv=no ;;
740 --enable-vdpau) _vdpau=yes ;;
741 --disable-vdpau) _vdpau=no ;;
742 --enable-sdl) _sdl=yes ;;
743 --disable-sdl) _sdl=no ;;
744 --enable-direct3d) _direct3d=yes ;;
745 --disable-direct3d) _direct3d=no ;;
746 --enable-directx) _directx=yes ;;
747 --disable-directx) _directx=no ;;
748 --enable-png) _png=yes ;;
749 --disable-png) _png=no ;;
750 --enable-mng) _mng=yes ;;
751 --disable-mng) _mng=no ;;
752 --enable-jpeg) _jpeg=yes ;;
753 --disable-jpeg) _jpeg=no ;;
754 --enable-pnm) _pnm=yes ;;
755 --disable-pnm) _pnm=no ;;
756 --enable-md5sum) _md5sum=yes ;;
757 --disable-md5sum) _md5sum=no ;;
758 --enable-yuv4mpeg) _yuv4mpeg=yes ;;
759 --disable-yuv4mpeg) _yuv4mpeg=no ;;
760 --enable-gif) _gif=yes ;;
761 --disable-gif) _gif=no ;;
762 --enable-gl) _gl=yes ;;
763 --disable-gl) _gl=no ;;
764 --enable-caca) _caca=yes ;;
765 --disable-caca) _caca=no ;;
766 --enable-dvb) _dvb=yes ;;
767 --disable-dvb) _dvb=no ;;
768 --enable-v4l2) _v4l2=yes ;;
769 --disable-v4l2) _v4l2=no ;;
770 --enable-iconv) _iconv=yes ;;
771 --disable-iconv) _iconv=no ;;
772 --enable-langinfo) _langinfo=yes ;;
773 --disable-langinfo) _langinfo=no ;;
774 --enable-rtc) _rtc=yes ;;
775 --disable-rtc) _rtc=no ;;
776 --enable-libdv) _libdv=yes ;;
777 --disable-libdv) _libdv=no ;;
778 --enable-ossaudio) _ossaudio=yes ;;
779 --disable-ossaudio) _ossaudio=no ;;
780 --enable-rsound) _rsound=yes ;;
781 --disable-rsound) _rsound=no ;;
782 --enable-pulse) _pulse=yes ;;
783 --disable-pulse) _pulse=no ;;
784 --enable-portaudio) _portaudio=yes ;;
785 --disable-portaudio) _portaudio=no ;;
786 --enable-jack) _jack=yes ;;
787 --disable-jack) _jack=no ;;
788 --enable-openal) _openal=yes ;;
789 --disable-openal) _openal=no ;;
790 --enable-mad) _mad=yes ;;
791 --disable-mad) _mad=no ;;
792 --enable-libcdio) _libcdio=yes ;;
793 --disable-libcdio) _libcdio=no ;;
794 --enable-libvorbis) _libvorbis=yes ;;
795 --disable-libvorbis) _libvorbis=no ;;
796 --enable-speex) _speex=yes ;;
797 --disable-speex) _speex=no ;;
798 --enable-tremor) _tremor=yes ;;
799 --disable-tremor) _tremor=no ;;
800 --enable-theora) _theora=yes ;;
801 --disable-theora) _theora=no ;;
802 --enable-mpg123) _mpg123=yes ;;
803 --disable-mpg123) _mpg123=no ;;
804 --enable-liba52) _liba52=yes ;;
805 --disable-liba52) _liba52=no ;;
806 --enable-libdca) _libdca=yes ;;
807 --disable-libdca) _libdca=no ;;
808 --enable-musepack) _musepack=yes ;;
809 --disable-musepack) _musepack=no ;;
810 --enable-faad) _faad=yes ;;
811 --disable-faad) _faad=no ;;
812 --enable-ladspa) _ladspa=yes ;;
813 --disable-ladspa) _ladspa=no ;;
814 --enable-libbs2b) _libbs2b=yes ;;
815 --disable-libbs2b) _libbs2b=no ;;
816 --enable-xmms) _xmms=yes ;;
817 --disable-xmms) _xmms=no ;;
818 --enable-vcd) _vcd=yes ;;
819 --disable-vcd) _vcd=no ;;
820 --enable-bluray) _bluray=yes ;;
821 --disable-bluray) _bluray=no ;;
822 --enable-dvdread) _dvdread=yes ;;
823 --disable-dvdread) _dvdread=no ;;
824 --enable-dvdread-internal) _dvdread_internal=yes ;;
825 --disable-dvdread-internal) _dvdread_internal=no ;;
826 --enable-libdvdcss-internal) _libdvdcss_internal=yes ;;
827 --disable-libdvdcss-internal) _libdvdcss_internal=no ;;
828 --enable-dvdnav) _dvdnav=yes ;;
829 --disable-dvdnav) _dvdnav=no ;;
830 --enable-xanim) _xanim=yes ;;
831 --disable-xanim) _xanim=no ;;
832 --enable-real) _real=yes ;;
833 --disable-real) _real=no ;;
834 --enable-lcms2) _lcms2=yes ;;
835 --disable-lcms2) _lcms2=no ;;
836 --enable-xinerama) _xinerama=yes ;;
837 --disable-xinerama) _xinerama=no ;;
838 --enable-vm) _vm=yes ;;
839 --disable-vm) _vm=no ;;
840 --enable-xf86keysym) _xf86keysym=yes ;;
841 --disable-xf86keysym) _xf86keysym=no ;;
842 --enable-alsa) _alsa=yes ;;
843 --disable-alsa) _alsa=no ;;
844 --enable-tv) _tv=yes ;;
845 --disable-tv) _tv=no ;;
846 --enable-tv-bsdbt848) _tv_bsdbt848=yes ;;
847 --disable-tv-bsdbt848) _tv_bsdbt848=no ;;
848 --enable-tv-v4l2) _tv_v4l2=yes ;;
849 --disable-tv-v4l2) _tv_v4l2=no ;;
850 --enable-tv-dshow) _tv_dshow=yes ;;
851 --disable-tv-dshow) _tv_dshow=no ;;
852 --enable-radio) _radio=yes ;;
853 --enable-radio-capture) _radio_capture=yes ;;
854 --disable-radio-capture) _radio_capture=no ;;
855 --disable-radio) _radio=no ;;
856 --enable-radio-v4l2) _radio_v4l2=yes ;;
857 --disable-radio-v4l2) _radio_v4l2=no ;;
858 --enable-radio-bsdbt848) _radio_bsdbt848=yes ;;
859 --disable-radio-bsdbt848) _radio_bsdbt848=no ;;
860 --enable-pvr) _pvr=yes ;;
861 --disable-pvr) _pvr=no ;;
862 --enable-fastmemcpy) _fastmemcpy=yes ;;
863 --disable-fastmemcpy) _fastmemcpy=no ;;
864 --enable-networking) networking=yes ;;
865 --disable-networking) networking=no ;;
866 --enable-winsock2_h) _winsock2_h=yes ;;
867 --disable-winsock2_h) _winsock2_h=no ;;
868 --enable-smb) _smb=yes ;;
869 --disable-smb) _smb=no ;;
870 --enable-libquvi) _libquvi=yes ;;
871 --disable-libquvi) _libquvi=no ;;
872 --enable-joystick) _joystick=yes ;;
873 --disable-joystick) _joystick=no ;;
874 --enable-xvid) _xvid=yes ;;
875 --disable-xvid) _xvid=no ;;
876 --enable-libnut) _libnut=yes ;;
877 --disable-libnut) _libnut=no ;;
878 --enable-libav) ffmpeg=yes ;;
880 --enable-lirc) _lirc=yes ;;
881 --disable-lirc) _lirc=no ;;
882 --enable-lircc) _lircc=yes ;;
883 --disable-lircc) _lircc=no ;;
884 --enable-apple-remote) _apple_remote=yes ;;
885 --disable-apple-remote) _apple_remote=no ;;
886 --enable-apple-ir) _apple_ir=yes ;;
887 --disable-apple-ir) _apple_ir=no ;;
888 --enable-termcap) _termcap=yes ;;
889 --disable-termcap) _termcap=no ;;
890 --enable-termios) _termios=yes ;;
891 --disable-termios) _termios=no ;;
892 --disable-tga) _tga=no ;;
893 --enable-tga) _tga=yes ;;
894 --enable-directfb) _directfb=yes ;;
895 --disable-directfb) _directfb=no ;;
896 --enable-shm) _shm=yes ;;
897 --disable-shm) _shm=no ;;
898 --enable-select) _select=yes ;;
899 --disable-select) _select=no ;;
900 --enable-cddb) _cddb=yes ;;
901 --disable-cddb) _cddb=no ;;
902 --enable-big-endian) _big_endian=yes ;;
903 --disable-big-endian) _big_endian=no ;;
904 --enable-unrarexec) _unrar_exec=yes ;;
905 --disable-unrarexec) _unrar_exec=no ;;
906 --enable-ftp) _ftp=yes ;;
907 --disable-ftp) _ftp=no ;;
908 --enable-vstream) _vstream=yes ;;
909 --disable-vstream) _vstream=no ;;
910 --enable-pthreads) _pthreads=yes ;;
911 --disable-pthreads) _pthreads=no ;;
912 --enable-w32threads) _w32threads=yes ;;
913 --disable-w32threads) _w32threads=no ;;
914 --enable-libass) _ass=yes ;;
915 --disable-libass) _ass=no ;;
916 --enable-rpath) _rpath=yes ;;
917 --disable-rpath) _rpath=no ;;
918 --enable-libpostproc) libpostproc=yes ;;
919 --disable-libpostproc) libpostproc=no ;;
920 --enable-libavresample) libavresample=yes ;;
921 --disable-libavresample) libavresample=no ;;
923 --enable-enca) _enca=yes ;;
924 --disable-enca) _enca=no ;;
926 --enable-inet6) _inet6=yes ;;
927 --disable-inet6) _inet6=no ;;
929 --enable-gethostbyname2) _gethostbyname2=yes ;;
930 --disable-gethostbyname2) _gethostbyname2=no ;;
932 --enable-qtx) _qtx=yes ;;
933 --disable-qtx) _qtx=no ;;
935 --enable-coreaudio) _coreaudio=yes ;;
936 --disable-coreaudio) _coreaudio=no ;;
937 --enable-corevideo) _corevideo=yes ;;
938 --disable-corevideo) _corevideo=no ;;
939 --enable-cocoa) _cocoa=yes ;;
940 --disable-cocoa) _cocoa=no ;;
941 --enable-sharedbuffer) _sharedbuffer=yes ;;
942 --disable-sharedbuffer) _sharedbuffer=no ;;
943 --enable-macosx-finder) _macosx_finder=yes ;;
944 --disable-macosx-finder) _macosx_finder=no ;;
945 --enable-macosx-bundle) _macosx_bundle=yes ;;
946 --disable-macosx-bundle) _macosx_bundle=no ;;
948 --enable-crash-debug) _crash_debug=yes ;;
949 --disable-crash-debug) _crash_debug=no ;;
950 --enable-sighandler) _sighandler=yes ;;
951 --disable-sighandler) _sighandler=no ;;
952 --enable-win32dll) _win32dll=yes ;;
953 --disable-win32dll) _win32dll=no ;;
955 --enable-sse) _sse=yes ;;
956 --disable-sse) _sse=no ;;
957 --enable-sse2) _sse2=yes ;;
958 --disable-sse2) _sse2=no ;;
959 --enable-ssse3) _ssse3=yes ;;
960 --disable-ssse3) _ssse3=no ;;
961 --enable-mmxext) _mmxext=yes ;;
962 --disable-mmxext) _mmxext=no ;;
963 --enable-3dnow) _3dnow=yes ;;
964 --disable-3dnow) _3dnow=no _3dnowext=no ;;
965 --enable-3dnowext) _3dnow=yes _3dnowext=yes ;;
966 --disable-3dnowext) _3dnowext=no ;;
967 --enable-cmov) _cmov=yes ;;
968 --disable-cmov) _cmov=no ;;
969 --enable-fast-cmov) _fast_cmov=yes ;;
970 --disable-fast-cmov) _fast_cmov=no ;;
971 --enable-fast-clz) _fast_clz=yes ;;
972 --disable-fast-clz) _fast_clz=no ;;
973 --enable-altivec) _altivec=yes ;;
974 --disable-altivec) _altivec=no ;;
975 --enable-armv5te) _armv5te=yes ;;
976 --disable-armv5te) _armv5te=no ;;
977 --enable-armv6) _armv6=yes ;;
978 --disable-armv6) _armv6=no ;;
979 --enable-armv6t2) _armv6t2=yes ;;
980 --disable-armv6t2) _armv6t2=no ;;
981 --enable-armvfp) _armvfp=yes ;;
982 --disable-armvfp) _armvfp=no ;;
983 --enable-neon) neon=yes ;;
984 --disable-neon) neon=no ;;
985 --enable-iwmmxt) _iwmmxt=yes ;;
986 --disable-iwmmxt) _iwmmxt=no ;;
987 --enable-mmx) _mmx=yes ;;
988 --disable-mmx) # 3Dnow! and MMX2 require MMX
989 _3dnow=no _3dnowext=no _mmx=no _mmxext=no ;;
992 echo "Unknown parameter: $ac_option" >&2
993 exit 1
996 esac
997 done
999 # Atmos: moved this here, to be correct, if --prefix is specified
1000 test -z "$_bindir" && _bindir="$_prefix/bin"
1001 test -z "$_mandir" && _mandir="$_prefix/share/man"
1002 test -z "$_confdir" && _confdir="$_prefix/etc/mplayer"
1003 test -z "$_libdir" && _libdir="$_prefix/lib"
1004 test -z "$_localedir" && _localedir="$_prefix/share/locale"
1006 for tmpdir in "$TMPDIR" "$TEMPDIR" "/tmp" ; do
1007 test "$tmpdir" && break
1008 done
1010 mplayer_tmpdir="$tmpdir/mplayer-configure-$RANDOM-$$"
1011 mkdir $mplayer_tmpdir || die "Unable to create tmpdir."
1013 TMPLOG="config.log"
1015 rm -f "$TMPLOG"
1016 echo Parameters configure was run with: > "$TMPLOG"
1017 if test -n "$CFLAGS" ; then
1018 echo ${_echo_n} CFLAGS="'$CFLAGS' ${_echo_c}" >> "$TMPLOG"
1020 if test -n "$PKG_CONFIG_PATH" ; then
1021 echo ${_echo_n} PKG_CONFIG_PATH="'$PKG_CONFIG_PATH' ${_echo_c}" >> "$TMPLOG"
1023 echo ./configure $configuration >> "$TMPLOG"
1024 echo >> "$TMPLOG"
1027 echocheck "cross compilation"
1028 echores $_cross_compile
1030 if test $_cross_compile = yes; then
1031 tmp_run() {
1032 return 0
1036 tool_prefix=""
1038 if test $_cross_compile = yes ; then
1039 # Usually cross-compiler prefixes match with the target triplet
1040 test -n "$_target" && tool_prefix="$_target"-
1043 test "$_windres" = auto && _windres="$tool_prefix"windres
1044 test "$_pkg_config" = auto && _pkg_config="$tool_prefix"pkg-config
1046 if test "$_cc" = auto ; then
1047 if test -n "$tool_prefix" ; then
1048 _cc="$tool_prefix"gcc
1049 else
1050 _cc=cc
1054 # Determine our OS name and CPU architecture
1055 if test -z "$_target" ; then
1056 # OS name
1057 system_name=$(uname -s 2>&1)
1058 case "$system_name" in
1059 Linux|FreeBSD|NetBSD|OpenBSD|DragonFly|BSD/OS|Darwin|QNX|GNU|BeOS|MorphOS|AIX|AmigaOS)
1061 Haiku)
1062 system_name=BeOS
1064 GNU/kFreeBSD)
1065 system_name=FreeBSD
1067 HP-UX*)
1068 system_name=HP-UX
1070 [cC][yY][gG][wW][iI][nN]*)
1071 system_name=CYGWIN
1073 MINGW32*)
1074 system_name=MINGW32
1076 OS/2*)
1077 system_name=OS/2
1080 system_name="$system_name-UNKNOWN"
1082 esac
1085 # host's CPU/instruction set
1086 host_arch=$(uname -p 2>&1)
1087 case "$host_arch" in
1088 i386|sparc|ppc|alpha|arm|mips|vax)
1090 powerpc) # Darwin returns 'powerpc'
1091 host_arch=ppc
1093 *) # uname -p on Linux returns 'unknown' for the processor type,
1094 # OpenBSD returns 'Intel Pentium/MMX ("Genuine Intel" 586-class)'
1096 # Maybe uname -m (machine hardware name) returns something we
1097 # recognize.
1099 # x86/x86pc is used by QNX
1100 case "$(uname -m 2>&1)" in
1101 x86_64|amd64|i[3-9]86*|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686|BePC) host_arch=i386 ;;
1102 ia64) host_arch=ia64 ;;
1103 macppc|ppc) host_arch=ppc ;;
1104 ppc64) host_arch=ppc64 ;;
1105 alpha) host_arch=alpha ;;
1106 sparc) host_arch=sparc ;;
1107 sparc64) host_arch=sparc64 ;;
1108 parisc*|hppa*|9000*) host_arch=hppa ;;
1109 arm*|zaurus|cats) host_arch=arm ;;
1110 sh3|sh4|sh4a) host_arch=sh ;;
1111 s390) host_arch=s390 ;;
1112 s390x) host_arch=s390x ;;
1113 *mips*) host_arch=mips ;;
1114 vax) host_arch=vax ;;
1115 xtensa*) host_arch=xtensa ;;
1116 *) host_arch=UNKNOWN ;;
1117 esac
1119 esac
1120 else # if test -z "$_target"
1121 for i in 2 3; do
1122 system_name=$(echo $_target | cut -d '-' -f $i)
1123 case "$(echo $system_name | tr A-Z a-z)" in
1124 linux) system_name=Linux ;;
1125 freebsd) system_name=FreeBSD ;;
1126 gnu/kfreebsd) system_name=FreeBSD ;;
1127 netbsd) system_name=NetBSD ;;
1128 bsd/os) system_name=BSD/OS ;;
1129 openbsd) system_name=OpenBSD ;;
1130 dragonfly) system_name=DragonFly ;;
1131 qnx) system_name=QNX ;;
1132 morphos) system_name=MorphOS ;;
1133 amigaos) system_name=AmigaOS ;;
1134 mingw32*) system_name=MINGW32 ;;
1135 *) continue ;;
1136 esac
1137 break
1138 done
1139 # We need to convert underscores so that values like k6-2 and pentium-mmx can be passed
1140 host_arch=$(echo $_target | cut -d '-' -f 1)
1141 if test $(echo $host_arch) != "x86_64" ; then
1142 host_arch=$(echo $host_arch | tr '_' '-')
1146 extra_cflags="-I. $extra_cflags"
1147 _timer=timer-linux.c
1148 _getch=getch2.c
1149 if freebsd ; then
1150 extra_ldflags="$extra_ldflags -L/usr/local/lib"
1151 extra_cflags="$extra_cflags -I/usr/local/include"
1154 if netbsd || dragonfly ; then
1155 extra_ldflags="$extra_ldflags -L/usr/pkg/lib"
1156 extra_cflags="$extra_cflags -I/usr/pkg/include"
1159 if darwin; then
1160 extra_cflags="-mdynamic-no-pic $extra_cflags"
1161 _timer=timer-darwin.c
1164 if aix ; then
1165 extra_ldflags="$extra_ldflags -lC"
1168 if win32 ; then
1169 _exesuf=".exe"
1170 extra_cflags="$extra_cflags -fno-common"
1171 # -lwinmm is always needed for osdep/timer-win2.c
1172 extra_ldflags="$extra_ldflags -lwinmm"
1173 _pe_executable=yes
1174 _timer=timer-win2.c
1175 _priority=yes
1176 def_dos_paths="#define HAVE_DOS_PATHS 1"
1177 def_priority="#define CONFIG_PRIORITY 1"
1180 if mingw32 ; then
1181 _getch=getch2-win.c
1182 need_shmem=no
1183 extra_cflags="$extra_cflags -D__USE_MINGW_ANSI_STDIO=1"
1186 if amigaos ; then
1187 _select=no
1188 _sighandler=no
1189 _stream_cache=no
1190 def_stream_cache="#undef CONFIG_STREAM_CACHE"
1191 extra_cflags="-DNEWLIB -D__USE_INLINE__ $extra_cflags"
1194 if qnx ; then
1195 extra_ldflags="$extra_ldflags -lph"
1198 TMPC="$mplayer_tmpdir/tmp.c"
1199 TMPEXE="$mplayer_tmpdir/tmp$_exesuf"
1200 TMPH="$mplayer_tmpdir/tmp.h"
1201 TMPS="$mplayer_tmpdir/tmp.S"
1203 if test "$_runtime_cpudetection" = yes && ! x86 && ! ppc; then
1204 die "Runtime CPU detection only works for x86, x86-64 and PPC!"
1207 _rst2man=rst2man
1208 if [ -f "$(which rst2man.py)" ] ; then
1209 _rst2man=rst2man.py
1212 # Checking CC version...
1213 # Intel C++ Compilers (no autoselect, use CC=/some/binary ./configure)
1214 if test "$(basename $_cc)" = "icc" || test "$(basename $_cc)" = "ecc"; then
1215 echocheck "$_cc version"
1216 cc_vendor=intel
1217 cc_name=$($_cc -V 2>&1 | head -n 1 | cut -d ',' -f 1)
1218 cc_version=$($_cc -V 2>&1 | head -n 1 | cut -d ',' -f 2 | cut -d ' ' -f 3)
1219 _cc_major=$(echo $cc_version | cut -d '.' -f 1)
1220 _cc_minor=$(echo $cc_version | cut -d '.' -f 2)
1221 # TODO verify older icc/ecc compatibility
1222 case $cc_version in
1224 cc_version="v. ?.??, bad"
1225 cc_fail=yes
1227 10.1|11.0|11.1)
1228 cc_version="$cc_version, ok"
1231 cc_version="$cc_version, bad"
1232 cc_fail=yes
1234 esac
1235 echores "$cc_version"
1236 else
1237 for _cc in "$_cc" gcc cc ; do
1238 cc_name_tmp=$($_cc -v 2>&1 | tail -n 1 | cut -d ' ' -f 1)
1239 if test "$cc_name_tmp" = "gcc"; then
1240 cc_name=$cc_name_tmp
1241 echocheck "$_cc version"
1242 cc_vendor=gnu
1243 cc_version=$($_cc -dumpversion 2>&1)
1244 case $cc_version in
1245 2.96*)
1246 cc_fail=yes
1249 _cc_major=$(echo $cc_version | cut -d '.' -f 1)
1250 _cc_minor=$(echo $cc_version | cut -d '.' -f 2)
1251 _cc_mini=$(echo $cc_version | cut -d '.' -f 3)
1253 esac
1254 echores "$cc_version"
1255 break
1257 if $_cc -v 2>&1 | grep -q "clang"; then
1258 echocheck "$_cc version"
1259 cc_vendor=clang
1260 cc_version=$($_cc -dumpversion 2>&1)
1261 res_comment="experimental support only"
1262 echores "clang $cc_version"
1263 break
1265 cc_name_tmp=$($_cc -V 2>&1 | head -n 1 | cut -d ' ' -f 2,3)
1266 done
1267 fi # icc
1268 test "$cc_fail" = yes && die "unsupported compiler version"
1270 echocheck "working compiler"
1271 cflag_check "" || die "Compiler is not functioning correctly. Check your installation and custom CFLAGS $CFLAGS ."
1272 echo "yes"
1274 if test -z "$_target" && x86 ; then
1275 cat > $TMPC << EOF
1276 int main(void) {
1277 int test[(int)sizeof(char *)-7];
1278 return 0;
1281 cc_check && host_arch=x86_64 || host_arch=i386
1284 echo "Detected operating system: $system_name"
1285 echo "Detected host architecture: $host_arch"
1287 # ---
1289 # XXX: this should be ok..
1290 _cpuinfo="echo"
1292 if test "$_runtime_cpudetection" = no ; then
1294 # Cygwin has /proc/cpuinfo, but only supports Intel CPUs
1295 # FIXME: Remove the cygwin check once AMD CPUs are supported
1296 if test -r /proc/cpuinfo && ! cygwin; then
1297 # Linux with /proc mounted, extract CPU information from it
1298 _cpuinfo="cat /proc/cpuinfo"
1299 elif test -r /compat/linux/proc/cpuinfo && ! x86 ; then
1300 # FreeBSD with Linux emulation /proc mounted,
1301 # extract CPU information from it
1302 # Don't use it on x86 though, it never reports 3Dnow
1303 _cpuinfo="cat /compat/linux/proc/cpuinfo"
1304 elif darwin && ! x86 ; then
1305 # use hostinfo on Darwin
1306 _cpuinfo="hostinfo"
1307 elif aix; then
1308 # use 'lsattr' on AIX
1309 _cpuinfo="lsattr -E -l proc0 -a type"
1310 elif x86; then
1311 # all other OSes try to extract CPU information from a small helper
1312 # program cpuinfo instead
1313 $_cc -o cpuinfo$_exesuf cpuinfo.c
1314 _cpuinfo="./cpuinfo$_exesuf"
1317 if x86 ; then
1318 # gather more CPU information
1319 pname=$($_cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -n 1)
1320 pvendor=$($_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
1321 pfamily=$($_cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
1322 pmodel=$($_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
1323 pstepping=$($_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
1325 exts=$($_cpuinfo | egrep 'features|flags' | cut -d ':' -f 2 | head -n 1)
1327 pparam=$(echo $exts | sed -e s/xmm/sse/ -e s/kni/sse/)
1328 # SSE implies MMX2, but not all SSE processors report the mmxext CPU flag.
1329 pparam=$(echo $pparam | sed -e 's/sse/sse mmxext/')
1331 for ext in $pparam ; do
1332 eval test \"\$_$ext\" = auto 2>/dev/null && eval _$ext=kernel_check
1333 done
1335 echocheck "CPU vendor"
1336 echores "$pvendor ($pfamily:$pmodel:$pstepping)"
1338 echocheck "CPU type"
1339 echores "$pname"
1342 fi # test "$_runtime_cpudetection" = no
1344 if x86 && test "$_runtime_cpudetection" = no ; then
1345 extcheck() {
1346 if test "$1" = kernel_check ; then
1347 echocheck "kernel support of $2"
1348 cat > $TMPC <<EOF
1349 #include <stdlib.h>
1350 #include <signal.h>
1351 static void catch(int sig) { exit(1); }
1352 int main(void) {
1353 signal(SIGILL, catch);
1354 __asm__ volatile ("$3":::"memory"); return 0;
1358 if cc_check && tmp_run ; then
1359 eval _$2=yes
1360 echores "yes"
1361 _optimizing="$_optimizing $2"
1362 return 0
1363 else
1364 eval _$2=no
1365 echores "failed"
1366 echo "It seems that your kernel does not correctly support $2."
1367 echo "To use $2 extensions in MPlayer, you have to upgrade/recompile your kernel!"
1368 return 1
1371 return 0
1374 extcheck $_mmx "mmx" "emms"
1375 extcheck $_mmxext "mmxext" "sfence"
1376 extcheck $_3dnow "3dnow" "femms"
1377 extcheck $_3dnowext "3dnowext" "pswapd %%mm0, %%mm0"
1378 extcheck $_sse "sse" "xorps %%xmm0, %%xmm0" || _gcc3_ext="$_gcc3_ext -mno-sse"
1379 extcheck $_sse2 "sse2" "xorpd %%xmm0, %%xmm0" || _gcc3_ext="$_gcc3_ext -mno-sse2"
1380 extcheck $_ssse3 "ssse3" "pabsd %%xmm0, %%xmm0"
1381 extcheck $_cmov "cmov" "cmovb %%eax, %%ebx"
1383 if test "$_gcc3_ext" != ""; then
1384 # if we had to disable sse/sse2 because the active kernel does not
1385 # support this instruction set extension, we also have to tell
1386 # gcc3 to not generate sse/sse2 instructions for normal C code
1387 cflag_check $_march $_gcc3_ext && _march="$_march $_gcc3_ext"
1393 def_fast_64bit='#define HAVE_FAST_64BIT 0'
1394 def_fast_unaligned='#define HAVE_FAST_UNALIGNED 0'
1395 arch_all='X86 IA64 SPARC ARM AVR32 SH4 PPC ALPHA MIPS PA_RISC S390 S390X VAX BFIN XTENSA TOMI GENERIC'
1396 subarch_all='X86_32 X86_64 PPC64'
1397 case "$host_arch" in
1398 i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686)
1399 arch='x86'
1400 subarch='x86_32'
1401 def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
1402 iproc=486
1403 proc=i486
1406 if test "$_runtime_cpudetection" = no ; then
1407 case "$pvendor" in
1408 AuthenticAMD)
1409 case "$pfamily" in
1410 3) proc=i386 iproc=386 ;;
1411 4) proc=i486 iproc=486 ;;
1412 5) iproc=586 # LGB: models are: K5/SSA5 K5 K5 K5 ? ? K6 K6 K6-2 K6-3
1413 # K6 model 13 are the K6-2+ and K6-III+, only differing in cache size.
1414 if test "$pmodel" -eq 9 -o "$pmodel" -eq 13; then
1415 proc=k6-3
1416 elif test "$pmodel" -eq 5 -o "$pmodel" -eq 10; then
1417 proc=geode
1418 elif test "$pmodel" -ge 8; then
1419 proc=k6-2
1420 elif test "$pmodel" -ge 6; then
1421 proc=k6
1422 else
1423 proc=i586
1426 6) iproc=686
1427 # It's a bit difficult to determine the correct type of Family 6
1428 # AMD CPUs just from their signature. Instead, we check directly
1429 # whether it supports SSE.
1430 if test "$_sse" = yes; then
1431 # gcc treats athlon-xp, athlon-4 and athlon-mp similarly.
1432 proc=athlon-xp
1433 else
1434 # Again, gcc treats athlon and athlon-tbird similarly.
1435 proc=athlon
1438 15) iproc=686
1439 # k8 cpu-type only supported in gcc >= 3.4.0, but that will be
1440 # caught and remedied in the optimization tests below.
1441 proc=k8
1444 *) proc=amdfam10 iproc=686
1445 test $_fast_clz = "auto" && _fast_clz=yes
1447 esac
1449 GenuineIntel)
1450 case "$pfamily" in
1451 3) proc=i386 iproc=386 ;;
1452 4) proc=i486 iproc=486 ;;
1453 5) iproc=586
1454 if test "$pmodel" -eq 4 || test "$pmodel" -eq 8; then
1455 proc=pentium-mmx # 4 is desktop, 8 is mobile
1456 else
1457 proc=i586
1460 6) iproc=686
1461 if test "$pmodel" -ge 15; then
1462 proc=core2
1463 elif test "$pmodel" -eq 9 -o "$pmodel" -ge 13; then
1464 proc=pentium-m
1465 elif test "$pmodel" -ge 7; then
1466 proc=pentium3
1467 elif test "$pmodel" -ge 3; then
1468 proc=pentium2
1469 else
1470 proc=i686
1472 test $_fast_clz = "auto" && _fast_clz=yes
1474 15) iproc=686
1475 # A nocona in 32-bit mode has no more capabilities than a prescott.
1476 if test "$pmodel" -ge 3; then
1477 proc=prescott
1478 else
1479 proc=pentium4
1480 test $_fast_clz = "auto" && _fast_clz=yes
1482 test $_fast_cmov = "auto" && _fast_cmov=no
1484 *) proc=prescott iproc=686 ;;
1485 esac
1487 CentaurHauls)
1488 case "$pfamily" in
1489 5) iproc=586
1490 if test "$pmodel" -ge 8; then
1491 proc=winchip2
1492 elif test "$pmodel" -ge 4; then
1493 proc=winchip-c6
1494 else
1495 proc=i586
1498 6) iproc=686
1499 if test "$pmodel" -ge 9; then
1500 proc=c3-2
1501 else
1502 proc=c3
1503 iproc=586
1506 *) proc=i686 iproc=i686 ;;
1507 esac
1509 unknown)
1510 case "$pfamily" in
1511 3) proc=i386 iproc=386 ;;
1512 4) proc=i486 iproc=486 ;;
1513 *) proc=i586 iproc=586 ;;
1514 esac
1517 proc=i586 iproc=586 ;;
1518 esac
1519 test $_fast_clz = "auto" && _fast_clz=no
1520 fi # test "$_runtime_cpudetection" = no
1523 # check that gcc supports our CPU, if not, fall back to earlier ones
1524 # LGB: check -mcpu and -march swithing step by step with enabling
1525 # to fall back till 386.
1527 # gcc >= 3.4.0 doesn't support -mcpu, we have to use -mtune instead
1529 if [ "$cc_vendor" = "gnu" ] && ([ "$_cc_major" -gt 3 ] || ( [ "$_cc_major" = 3 ] && [ "$_cc_minor" -ge 4 ])) ; then
1530 cpuopt=-mtune
1531 else
1532 cpuopt=-mcpu
1535 echocheck "GCC & CPU optimization abilities"
1536 if test "$_runtime_cpudetection" = no ; then
1537 if test $cc_vendor != "intel" && test $cc_vendor != "clang" ; then
1538 cflag_check -march=native && proc=native
1540 if test "$proc" = "amdfam10"; then
1541 cflag_check -march=$proc $cpuopt=$proc || proc=k8
1543 if test "$proc" = "k8"; then
1544 cflag_check -march=$proc $cpuopt=$proc || proc=athlon-xp
1546 if test "$proc" = "athlon-xp"; then
1547 cflag_check -march=$proc $cpuopt=$proc || proc=athlon
1549 if test "$proc" = "k6-3" || test "$proc" = "k6-2"; then
1550 cflag_check -march=$proc $cpuopt=$proc || proc=k6
1552 if test "$proc" = "k6" || test "$proc" = "c3"; then
1553 if ! cflag_check -march=$proc $cpuopt=$proc; then
1554 if cflag_check -march=i586 $cpuopt=i686; then
1555 proc=i586-i686
1556 else
1557 proc=i586
1561 if test "$proc" = "prescott" ; then
1562 cflag_check -march=$proc $cpuopt=$proc || proc=pentium4
1564 if test "$proc" = "core2" ; then
1565 cflag_check -march=$proc $cpuopt=$proc || proc=pentium-m
1567 if test "$proc" = "pentium4" || test "$proc" = "pentium-m" || test "$proc" = "pentium3" || test "$proc" = "pentium2" || test "$proc" = "athlon" || test "$proc" = "c3-2" || test "$proc" = "geode"; then
1568 cflag_check -march=$proc $cpuopt=$proc || proc=i686
1570 if test "$proc" = "i686" || test "$proc" = "pentium-mmx" || test "$proc" = "winchip-c6" || test "$proc" = "winchip2"; then
1571 cflag_check -march=$proc $cpuopt=$proc || proc=i586
1573 if test "$proc" = "i586"; then
1574 cflag_check -march=$proc $cpuopt=$proc || proc=i486
1576 if test "$proc" = "i486" ; then
1577 cflag_check -march=$proc $cpuopt=$proc || proc=i386
1579 if test "$proc" = "i386" ; then
1580 cflag_check -march=$proc $cpuopt=$proc || proc=error
1582 if test "$proc" = "error" ; then
1583 echores "CPU optimization disabled. CPU not recognized or your compiler is too old."
1584 _mcpu=""
1585 _march=""
1586 _optimizing=""
1587 elif test "$proc" = "i586-i686"; then
1588 _march="-march=i586"
1589 _mcpu="$cpuopt=i686"
1590 _optimizing="$proc"
1591 else
1592 _march="-march=$proc"
1593 _mcpu="$cpuopt=$proc"
1594 _optimizing="$proc"
1596 else # if test "$_runtime_cpudetection" = no
1597 _mcpu="$cpuopt=generic"
1598 # at least i486 required, for bswap instruction
1599 _march="-march=i486"
1600 cflag_check $_mcpu || _mcpu="$cpuopt=i686"
1601 cflag_check $_mcpu || _mcpu=""
1602 cflag_check $_march $_mcpu || _march=""
1605 ## Gabucino : --target takes effect here (hopefully...) by overwriting
1606 ## autodetected mcpu/march parameters
1607 if test "$_target" ; then
1608 # TODO: it may be a good idea to check GCC and fall back in all cases
1609 if test "$host_arch" = "i586-i686"; then
1610 _march="-march=i586"
1611 _mcpu="$cpuopt=i686"
1612 else
1613 _march="-march=$host_arch"
1614 _mcpu="$cpuopt=$host_arch"
1617 proc="$host_arch"
1619 case "$proc" in
1620 i386) iproc=386 ;;
1621 i486) iproc=486 ;;
1622 i586|k5|k6|k6-2|k6-3|pentium|pentium-mmx) iproc=586 ;;
1623 i686|athlon*|pentium*) iproc=686 ;;
1624 *) iproc=586 ;;
1625 esac
1628 if test $_cmov = "yes" && test $_fast_cmov = "auto" ; then
1629 _fast_cmov="yes"
1630 else
1631 _fast_cmov="no"
1633 test $_fast_clz = "auto" && _fast_clz=yes
1635 echores "$proc"
1638 ia64)
1639 arch='ia64'
1640 def_fast_64bit='#define HAVE_FAST_64BIT 1'
1641 iproc='ia64'
1644 x86_64|amd64)
1645 arch='x86'
1646 subarch='x86_64'
1647 def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
1648 def_fast_64bit='#define HAVE_FAST_64BIT 1'
1649 iproc='x86_64'
1651 # gcc >= 3.4.0 doesn't support -mcpu, we have to use -mtune instead
1652 if test "$cc_vendor" = "gnu" && test "$_cc_major" -gt 3 -o "$_cc_major" -eq 3 -a "$_cc_minor" -ge 4 ; then
1653 cpuopt=-mtune
1654 else
1655 cpuopt=-mcpu
1657 if test "$_runtime_cpudetection" = no ; then
1658 case "$pvendor" in
1659 AuthenticAMD)
1660 case "$pfamily" in
1661 15) proc=k8
1662 test $_fast_clz = "auto" && _fast_clz=no
1664 *) proc=amdfam10;;
1665 esac
1667 GenuineIntel)
1668 case "$pfamily" in
1669 6) proc=core2;;
1671 # 64-bit prescotts exist, but as far as GCC is concerned they
1672 # have the same capabilities as a nocona.
1673 proc=nocona
1674 test $_fast_cmov = "auto" && _fast_cmov=no
1675 test $_fast_clz = "auto" && _fast_clz=no
1677 esac
1680 proc=error;;
1681 esac
1682 fi # test "$_runtime_cpudetection" = no
1684 echocheck "GCC & CPU optimization abilities"
1685 # This is a stripped-down version of the i386 fallback.
1686 if test "$_runtime_cpudetection" = no ; then
1687 if test $cc_vendor != "intel" && test $cc_vendor != "clang" ; then
1688 cflag_check -march=native && proc=native
1690 # --- AMD processors ---
1691 if test "$proc" = "amdfam10"; then
1692 cflag_check -march=$proc $cpuopt=$proc || proc=k8
1694 if test "$proc" = "k8"; then
1695 cflag_check -march=$proc $cpuopt=$proc || proc=athlon-xp
1697 # This will fail if gcc version < 3.3, which is ok because earlier
1698 # versions don't really support 64-bit on amd64.
1699 # Is this a valid assumption? -Corey
1700 if test "$proc" = "athlon-xp"; then
1701 cflag_check -march=$proc $cpuopt=$proc || proc=error
1703 # --- Intel processors ---
1704 if test "$proc" = "core2"; then
1705 cflag_check -march=$proc $cpuopt=$proc || proc=x86-64
1707 if test "$proc" = "x86-64"; then
1708 cflag_check -march=$proc $cpuopt=$proc || proc=nocona
1710 if test "$proc" = "nocona"; then
1711 cflag_check -march=$proc $cpuopt=$proc || proc=pentium4
1713 if test "$proc" = "pentium4"; then
1714 cflag_check -march=$proc $cpuopt=$proc || proc=error
1717 _march="-march=$proc"
1718 _mcpu="$cpuopt=$proc"
1719 if test "$proc" = "error" ; then
1720 echores "CPU optimization disabled. CPU not recognized or your compiler is too old."
1721 _mcpu=""
1722 _march=""
1724 else # if test "$_runtime_cpudetection" = no
1725 # x86-64 is an undocumented option, an intersection of k8 and nocona.
1726 _march="-march=x86-64"
1727 _mcpu="$cpuopt=generic"
1728 cflag_check $_mcpu || _mcpu="x86-64"
1729 cflag_check $_mcpu || _mcpu=""
1730 cflag_check $_march $_mcpu || _march=""
1733 _optimizing="$proc"
1734 test $_fast_cmov = "auto" && _fast_cmov=yes
1735 test $_fast_clz = "auto" && _fast_clz=yes
1737 echores "$proc"
1740 sparc|sparc64)
1741 arch='sparc'
1742 iproc='sparc'
1743 if test "$host_arch" = "sparc64" ; then
1744 _vis='yes'
1745 proc='ultrasparc'
1746 def_fast_64bit='#define HAVE_FAST_64BIT 1'
1747 else
1748 proc=v8
1750 _mcpu="-mcpu=$proc"
1751 _optimizing="$proc"
1754 arm*)
1755 arch='arm'
1756 iproc='arm'
1759 avr32)
1760 arch='avr32'
1761 def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
1762 iproc='avr32'
1763 test $_fast_clz = "auto" && _fast_clz=yes
1766 sh|sh4)
1767 arch='sh4'
1768 iproc='sh4'
1771 ppc|ppc64|powerpc|powerpc64)
1772 arch='ppc'
1773 def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
1774 iproc='ppc'
1776 if test "$host_arch" = "ppc64" -o "$host_arch" = "powerpc64" ; then
1777 subarch='ppc64'
1778 def_fast_64bit='#define HAVE_FAST_64BIT 1'
1780 echocheck "CPU type"
1781 case $system_name in
1782 Linux)
1783 proc=$($_cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ',' -f 1 | cut -b 2- | head -n 1)
1784 if test -n "$($_cpuinfo | grep altivec)"; then
1785 test $_altivec = auto && _altivec=yes
1788 Darwin)
1789 proc=$($_cpuinfo | grep "Processor type" | cut -f 3 -d ' ' | sed 's/ppc//')
1790 if [ $(sysctl -n hw.vectorunit) -eq 1 -o \
1791 "$(sysctl -n hw.optional.altivec 2> /dev/null)" = "1" ]; then
1792 test $_altivec = auto && _altivec=yes
1795 NetBSD)
1796 # only gcc 3.4 works reliably with AltiVec code under NetBSD
1797 case $cc_version in
1798 2*|3.0*|3.1*|3.2*|3.3*)
1801 if [ $(sysctl -n machdep.altivec) -eq 1 ]; then
1802 test $_altivec = auto && _altivec=yes
1805 esac
1807 AIX)
1808 proc=$($_cpuinfo | grep 'type' | cut -f 2 -d ' ' | sed 's/PowerPC_//')
1810 esac
1811 if test "$_altivec" = yes; then
1812 echores "$proc altivec"
1813 else
1814 _altivec=no
1815 echores "$proc"
1818 echocheck "GCC & CPU optimization abilities"
1820 if test -n "$proc"; then
1821 case "$proc" in
1822 601) _march='-mcpu=601' _mcpu='-mtune=601' ;;
1823 603) _march='-mcpu=603' _mcpu='-mtune=603' ;;
1824 603e|603ev) _march='-mcpu=603e' _mcpu='-mtune=603e' ;;
1825 604|604e|604r|604ev) _march='-mcpu=604' _mcpu='-mtune=604' ;;
1826 740|740/750|745/755) _march='-mcpu=740' _mcpu='-mtune=740' ;;
1827 750|750CX) _march='-mcpu=750' _mcpu='-mtune=750' ;;
1828 POWER) _march='-mcpu=power' _mcpu='-mtune=power' ;;
1829 POWER2) _march='-mcpu=power2' _mcpu='-mtune=power2' ;;
1830 POWER3) _march='-mcpu=power3' _mcpu='-mtune=power3' ;;
1831 *) ;;
1832 esac
1833 # gcc 3.1(.1) and up supports 7400 and 7450
1834 if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "1" || test "$_cc_major" -ge "4"; then
1835 case "$proc" in
1836 7400*|7410*) _march='-mcpu=7400' _mcpu='-mtune=7400' ;;
1837 7447*|7450*|7455*) _march='-mcpu=7450' _mcpu='-mtune=7450' ;;
1838 *) ;;
1839 esac
1841 # gcc 3.2 and up supports 970
1842 if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "3" || test "$_cc_major" -ge "4"; then
1843 case "$proc" in
1844 970*|PPC970*) _march='-mcpu=970' _mcpu='-mtune=970' ;;
1845 *) ;;
1846 esac
1848 # gcc 3.3 and up supports POWER4
1849 if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "3" || test "$_cc_major" -ge "4"; then
1850 case "$proc" in
1851 POWER4) _march='-mcpu=power4' _mcpu='-mtune=power4' ;;
1852 *) ;;
1853 esac
1855 # gcc 3.4 and up supports 440*
1856 if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "4" || test "$_cc_major" -ge "4"; then
1857 case "$proc" in
1858 440EP*) _march='-mcpu=440fp' _mcpu='-mtune=440fp' ;;
1859 440G* ) _march='-mcpu=440' _mcpu='-mtune=440' ;;
1860 *) ;;
1861 esac
1863 # gcc 4.0 and up supports POWER5
1864 if test "$_cc_major" -ge "4"; then
1865 case "$proc" in
1866 POWER5*) _march='-mcpu=power5' _mcpu='-mtune=power5' ;;
1867 *) ;;
1868 esac
1872 if test -n "$_mcpu"; then
1873 _optimizing=$(echo $_mcpu | cut -c 8-)
1874 echores "$_optimizing"
1875 else
1876 echores "none"
1879 test $_fast_clz = "auto" && _fast_clz=yes
1883 alpha*)
1884 arch='alpha'
1885 iproc='alpha'
1886 def_fast_64bit='#define HAVE_FAST_64BIT 1'
1888 echocheck "CPU type"
1889 cat > $TMPC << EOF
1890 int main(void) {
1891 unsigned long ver, mask;
1892 __asm__ ("implver %0" : "=r" (ver));
1893 __asm__ ("amask %1, %0" : "=r" (mask) : "r" (-1));
1894 printf("%ld-%x\n", ver, ~mask);
1895 return 0;
1898 $_cc -o "$TMPEXE" "$TMPC"
1899 case $("$TMPEXE") in
1901 0-0) proc="ev4"; _mvi="0";;
1902 1-0) proc="ev5"; _mvi="0";;
1903 1-1) proc="ev56"; _mvi="0";;
1904 1-101) proc="pca56"; _mvi="1";;
1905 2-303) proc="ev6"; _mvi="1";;
1906 2-307) proc="ev67"; _mvi="1";;
1907 2-1307) proc="ev68"; _mvi="1";;
1908 esac
1909 echores "$proc"
1911 echocheck "GCC & CPU optimization abilities"
1912 if test "$proc" = "ev68" ; then
1913 cc_check -mcpu=$proc || proc=ev67
1915 if test "$proc" = "ev67" ; then
1916 cc_check -mcpu=$proc || proc=ev6
1918 _mcpu="-mcpu=$proc"
1919 echores "$proc"
1921 test $_fast_clz = "auto" && _fast_clz=yes
1923 _optimizing="$proc"
1926 mips*)
1927 arch='mips'
1928 iproc='mips'
1930 test $_fast_clz = "auto" && _fast_clz=yes
1934 hppa)
1935 arch='pa_risc'
1936 iproc='PA-RISC'
1939 s390)
1940 arch='s390'
1941 iproc='390'
1944 s390x)
1945 arch='s390x'
1946 iproc='390x'
1949 vax)
1950 arch='vax'
1951 iproc='vax'
1954 xtensa)
1955 arch='xtensa'
1956 iproc='xtensa'
1959 generic)
1960 arch='generic'
1964 echo "The architecture of your CPU ($host_arch) is not supported by this configure script"
1965 echo "It seems nobody has ported MPlayer to your OS or CPU type yet."
1966 die "unsupported architecture $host_arch"
1968 esac # case "$host_arch" in
1970 if test "$_runtime_cpudetection" = yes ; then
1971 if x86 ; then
1972 test "$_cmov" != no && _cmov=yes
1973 x86_32 && _cmov=no
1974 test "$_mmx" != no && _mmx=yes
1975 test "$_3dnow" != no && _3dnow=yes
1976 test "$_3dnowext" != no && _3dnowext=yes
1977 test "$_mmxext" != no && _mmxext=yes
1978 test "$_sse" != no && _sse=yes
1979 test "$_sse2" != no && _sse2=yes
1980 test "$_ssse3" != no && _ssse3=yes
1982 if ppc; then
1983 _altivec=yes
1988 # endian testing
1989 echocheck "byte order"
1990 if test "$_big_endian" = auto ; then
1991 cat > $TMPC <<EOF
1992 short ascii_name[] = {
1993 'M' << 8 | 'P', 'l' << 8 | 'a', 'y' << 8 | 'e', 'r' << 8 | 'B',
1994 'i' << 8 | 'g', 'E' << 8 | 'n', 'd' << 8 | 'i', 'a' << 8 | 'n', 0 };
1995 int main(void) { return (long)ascii_name; }
1997 if cc_check ; then
1998 if strings $TMPEXE | grep -q -l MPlayerBigEndian ; then
1999 _big_endian=yes
2000 else
2001 _big_endian=no
2003 else
2004 echo ${_echo_n} "failed to autodetect byte order, defaulting to ${_echo_c}"
2007 if test "$_big_endian" = yes ; then
2008 _byte_order='big-endian'
2009 def_words_endian='#define WORDS_BIGENDIAN 1'
2010 def_bigendian='#define HAVE_BIGENDIAN 1'
2011 else
2012 _byte_order='little-endian'
2013 def_words_endian='#undef WORDS_BIGENDIAN'
2014 def_bigendian='#define HAVE_BIGENDIAN 0'
2016 echores "$_byte_order"
2019 echocheck "assembler support of -pipe option"
2020 # -I. helps to detect compilers that just misunderstand -pipe like Sun C
2021 cflag_check -pipe -I. && _pipe="-pipe" && echores "yes" || echores "no"
2024 if darwin && test "$cc_vendor" = "gnu" ; then
2025 echocheck "GCC support of -mstackrealign"
2026 # GCC 4.2 and some earlier Apple versions support this flag on x86. Since
2027 # Mac OS X/Intel has an ABI different from Windows this is needed to avoid
2028 # crashes when loading Win32 DLLs. Unfortunately some gcc versions create
2029 # wrong code with this flag, but this can be worked around by adding
2030 # -fno-unit-at-a-time as described in the blog post at
2031 # http://www.dribin.org/dave/blog/archives/2006/12/05/missing_third_param/
2032 cat > $TMPC << EOF
2033 __attribute__((noinline)) static int foo3(int i1, int i2, int i3) { return i3; }
2034 int main(void) { return foo3(1, 2, 3) == 3 ? 0 : 1; }
2036 cc_check -O2 -mstackrealign && tmp_run && cflags_stackrealign=-mstackrealign
2037 test -z "$cflags_stackrealign" && cc_check -O2 -mstackrealign -fno-unit-at-a-time &&
2038 tmp_run && cflags_stackrealign="-mstackrealign -fno-unit-at-a-time"
2039 test -n "$cflags_stackrealign" && echores "yes" || echores "no"
2040 fi # if darwin && test "$cc_vendor" = "gnu" ; then
2043 # Checking for CFLAGS
2044 _install_strip="-s"
2045 if test "$_profile" != "" || test "$_debug" != "" ; then
2046 _install_strip=
2048 if test -z "$CFLAGS" ; then
2049 if test "$cc_vendor" = "intel" ; then
2050 CFLAGS="-O2 $_debug $_profile $_march $_mcpu $_pipe -fomit-frame-pointer"
2051 WARNFLAGS="-wd167 -wd556 -wd144"
2052 elif test "$cc_vendor" = "clang"; then
2053 CFLAGS="-O2 $_debug $_profile $_march $_pipe"
2054 WARNFLAGS="-Wall -Wno-switch-enum -Wno-logical-op-parentheses -Wpointer-arith -Wundef -Wno-pointer-sign -Wmissing-prototypes"
2055 ERRORFLAGS="-Werror=implicit-function-declaration"
2056 elif test "$cc_vendor" != "gnu" ; then
2057 CFLAGS="-O2 $_debug $_profile $_march $_mcpu $_pipe"
2058 else
2059 CFLAGS="-O2 $_debug $_profile $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
2060 WARNFLAGS="-Wall -Wno-switch -Wno-parentheses -Wpointer-arith -Wredundant-decls"
2061 ERRORFLAGS="-Werror-implicit-function-declaration"
2062 extra_ldflags="$extra_ldflags -ffast-math"
2064 else
2065 warn_cflags=yes
2068 if darwin && test "$cc_vendor" = "gnu" ; then
2069 extra_cflags="-falign-loops=16 -shared-libgcc $extra_cflags"
2072 if test "$cc_vendor" = "gnu" ; then
2073 cflag_check -Wundef && WARNFLAGS="-Wundef $WARNFLAGS"
2074 # -std=gnu99 is not a warning flag but is placed in WARN_CFLAGS because
2075 # that's the only variable specific to C now, and this option is not valid
2076 # for C++.
2077 cflag_check -std=gnu99 && WARN_CFLAGS="-std=gnu99 $WARN_CFLAGS"
2078 cflag_check -Wno-pointer-sign && WARN_CFLAGS="-Wno-pointer-sign $WARN_CFLAGS"
2079 cflag_check -Wdisabled-optimization && WARN_CFLAGS="-Wdisabled-optimization $WARN_CFLAGS"
2080 cflag_check -Wmissing-prototypes && WARN_CFLAGS="-Wmissing-prototypes $WARN_CFLAGS"
2081 cflag_check -Wstrict-prototypes && WARN_CFLAGS="-Wstrict-prototypes $WARN_CFLAGS"
2082 else
2083 CFLAGS="-D_ISOC99_SOURCE -D_BSD_SOURCE $CFLAGS"
2086 cflag_check -mno-omit-leaf-frame-pointer && cflags_no_omit_leaf_frame_pointer="-mno-omit-leaf-frame-pointer"
2087 cflag_check -MD -MP && DEPFLAGS="-MD -MP"
2090 if test -n "$LDFLAGS" ; then
2091 extra_ldflags="$extra_ldflags $LDFLAGS"
2092 warn_cflags=yes
2093 elif test "$cc_vendor" = "intel" ; then
2094 extra_ldflags="$extra_ldflags -i-static"
2096 if test -n "$CPPFLAGS" ; then
2097 extra_cflags="$extra_cflags $CPPFLAGS"
2098 warn_cflags=yes
2103 echocheck "PIC"
2104 pic=no
2105 cat > $TMPC << EOF
2106 int main(void) {
2107 #if !(defined(__PIC__) || defined(__pic__) || defined(PIC))
2108 #error PIC not enabled
2109 #endif
2110 return 0;
2113 cc_check && pic=yes && extra_cflags="$extra_cflags -DPIC"
2114 echores $pic
2117 if x86 ; then
2119 echocheck ".align is a power of two"
2120 if test "$_asmalign_pot" = auto ; then
2121 _asmalign_pot=no
2122 inline_asm_check '".align 3"' && _asmalign_pot=yes
2124 if test "$_asmalign_pot" = "yes" ; then
2125 def_asmalign_pot='#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t"'
2126 else
2127 def_asmalign_pot='#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\n\t"'
2129 echores $_asmalign_pot
2132 echocheck "ebx availability"
2133 ebx_available=no
2134 def_ebx_available='#define HAVE_EBX_AVAILABLE 0'
2135 cat > $TMPC << EOF
2136 int main(void) {
2137 int x;
2138 __asm__ volatile(
2139 "xor %0, %0"
2140 :"=b"(x)
2141 // just adding ebx to clobber list seems unreliable with some
2142 // compilers, e.g. Haiku's gcc 2.95
2144 // and the above check does not work for OSX 64 bit...
2145 __asm__ volatile("":::"%ebx");
2146 return 0;
2149 cc_check && ebx_available=yes && def_ebx_available='#define HAVE_EBX_AVAILABLE 1'
2150 echores $ebx_available
2152 fi #if x86
2154 #FIXME: This should happen before the check for CFLAGS..
2155 def_altivec_h='#define HAVE_ALTIVEC_H 0'
2156 if ppc && ( test "$_altivec" = yes || test "$_runtime_cpudetection" = yes ) ; then
2158 # check if AltiVec is supported by the compiler, and how to enable it
2159 echocheck "GCC AltiVec flags"
2160 if $(cflag_check -maltivec -mabi=altivec) ; then
2161 _altivec_gcc_flags="-maltivec -mabi=altivec"
2162 # check if <altivec.h> should be included
2163 if $(header_check altivec.h $_altivec_gcc_flags) ; then
2164 def_altivec_h='#define HAVE_ALTIVEC_H 1'
2165 inc_altivec_h='#include <altivec.h>'
2166 else
2167 if $(cflag_check -faltivec) ; then
2168 _altivec_gcc_flags="-faltivec"
2169 else
2170 _altivec=no
2171 _altivec_gcc_flags="none, AltiVec disabled"
2175 echores "$_altivec_gcc_flags"
2177 # check if the compiler supports braces for vector declarations
2178 cat > $TMPC << EOF
2179 $inc_altivec_h
2180 int main(void) { (vector int) {1}; return 0; }
2182 cc_check $_altivec_gcc_flags || die "You need a compiler that supports {} in AltiVec vector declarations."
2184 # Disable runtime cpudetection if we cannot generate AltiVec code or
2185 # AltiVec is disabled by the user.
2186 test "$_runtime_cpudetection" = yes && test "$_altivec" = no \
2187 && _runtime_cpudetection=no
2189 # Show that we are optimizing for AltiVec (if enabled and supported).
2190 test "$_runtime_cpudetection" = no && test "$_altivec" = yes \
2191 && _optimizing="$_optimizing altivec"
2193 # If AltiVec is enabled, make sure the correct flags turn up in CFLAGS.
2194 test "$_altivec" = yes && CFLAGS="$CFLAGS $_altivec_gcc_flags"
2197 if arm ; then
2198 echocheck "ARMv5TE (Enhanced DSP Extensions)"
2199 if test $_armv5te = "auto" ; then
2200 _armv5te=no
2201 inline_asm_check '"qadd r0, r0, r0"' && _armv5te=yes
2203 echores "$_armv5te"
2205 test $_armv5te = "yes" && test $_fast_clz = "auto" && _fast_clz=yes
2207 echocheck "ARMv6 (SIMD instructions)"
2208 if test $_armv6 = "auto" ; then
2209 _armv6=no
2210 inline_asm_check '"sadd16 r0, r0, r0"' && _armv6=yes
2212 echores "$_armv6"
2214 echocheck "ARMv6t2 (SIMD instructions)"
2215 if test $_armv6t2 = "auto" ; then
2216 _armv6t2=no
2217 inline_asm_check '"movt r0, #0"' && _armv6t2=yes
2219 echores "$_armv6t2"
2221 echocheck "ARM VFP"
2222 if test $_armvfp = "auto" ; then
2223 _armvfp=no
2224 inline_asm_check '"fadds s0, s0, s0"' && _armvfp=yes
2226 echores "$_armvfp"
2228 echocheck "ARM NEON"
2229 if test $neon = "auto" ; then
2230 neon=no
2231 inline_asm_check '"vadd.i16 q0, q0, q0"' && neon=yes
2233 echores "$neon"
2235 echocheck "iWMMXt (Intel XScale SIMD instructions)"
2236 if test $_iwmmxt = "auto" ; then
2237 _iwmmxt=no
2238 inline_asm_check '"wunpckelub wr6, wr4"' && _iwmmxt=yes
2240 echores "$_iwmmxt"
2243 cpuexts_all='ALTIVEC MMX MMX2 AMD3DNOW AMD3DNOWEXT SSE SSE2 SSSE3 FAST_CMOV CMOV FAST_CLZ ARMV5TE ARMV6 ARMV6T2 ARMVFP NEON IWMMXT MMI VIS MVI'
2244 test "$_altivec" = yes && cpuexts="ALTIVEC $cpuexts"
2245 test "$_mmx" = yes && cpuexts="MMX $cpuexts"
2246 test "$_mmxext" = yes && cpuexts="MMX2 $cpuexts"
2247 test "$_3dnow" = yes && cpuexts="AMD3DNOW $cpuexts"
2248 test "$_3dnowext" = yes && cpuexts="AMD3DNOWEXT $cpuexts"
2249 test "$_sse" = yes && cpuexts="SSE $cpuexts"
2250 test "$_sse2" = yes && cpuexts="SSE2 $cpuexts"
2251 test "$_ssse3" = yes && cpuexts="SSSE3 $cpuexts"
2252 test "$_cmov" = yes && cpuexts="CMOV $cpuexts"
2253 test "$_fast_cmov" = yes && cpuexts="FAST_CMOV $cpuexts"
2254 test "$_fast_clz" = yes && cpuexts="FAST_CLZ $cpuexts"
2255 test "$_armv5te" = yes && cpuexts="ARMV5TE $cpuexts"
2256 test "$_armv6" = yes && cpuexts="ARMV6 $cpuexts"
2257 test "$_armv6t2" = yes && cpuexts="ARMV6T2 $cpuexts"
2258 test "$_armvfp" = yes && cpuexts="ARMVFP $cpuexts"
2259 test "$neon" = yes && cpuexts="NEON $cpuexts"
2260 test "$_iwmmxt" = yes && cpuexts="IWMMXT $cpuexts"
2261 test "$_vis" = yes && cpuexts="VIS $cpuexts"
2262 test "$_mvi" = yes && cpuexts="MVI $cpuexts"
2264 # Checking kernel version...
2265 if x86_32 && linux ; then
2266 _k_verc_problem=no
2267 kernel_version=$(uname -r 2>&1)
2268 echocheck "$system_name kernel version"
2269 case "$kernel_version" in
2270 '') kernel_version="?.??"; _k_verc_fail=yes;;
2271 [0-1].[0-9].[0-9]*|2.[0-3].[0-9]*)
2272 _k_verc_problem=yes;;
2273 esac
2274 if test "$_k_verc_problem" = yes && test "$_sse" = yes ; then
2275 _k_verc_fail=yes
2277 if test "$_k_verc_fail" ; then
2278 echores "$kernel_version, fail"
2279 echo "WARNING! If you want to run MPlayer on this system, get prepared for problems!"
2280 echo "2.2.x has limited SSE support. Upgrade the kernel or use --disable-sse if you"
2281 echo "experience crashes. MPlayer tries to autodetect if your kernel correctly"
2282 echo "supports SSE, but you have been warned! If you are using a kernel older than"
2283 echo "2.2.x you must upgrade it to get SSE support!"
2284 # die "Your kernel is too old for this CPU." # works fine on some 2.2.x so don't die (later check will test)
2285 else
2286 echores "$kernel_version, ok"
2290 ######################
2291 # MAIN TESTS GO HERE #
2292 ######################
2295 echocheck "-lposix"
2296 if cflag_check -lposix ; then
2297 extra_ldflags="$extra_ldflags -lposix"
2298 echores "yes"
2299 else
2300 echores "no"
2303 echocheck "-lm"
2304 if cflag_check -lm ; then
2305 _ld_lm="-lm"
2306 echores "yes"
2307 else
2308 _ld_lm=""
2309 echores "no"
2313 echocheck "langinfo"
2314 if test "$_langinfo" = auto ; then
2315 _langinfo=no
2316 statement_check langinfo.h 'nl_langinfo(CODESET)' && _langinfo=yes
2318 if test "$_langinfo" = yes ; then
2319 def_langinfo='#define HAVE_LANGINFO 1'
2320 else
2321 def_langinfo='#undef HAVE_LANGINFO'
2323 echores "$_langinfo"
2326 echocheck "translation support"
2327 if test "$_translation" = yes; then
2328 def_translation="#define CONFIG_TRANSLATION 1"
2329 else
2330 def_translation="#undef CONFIG_TRANSLATION"
2332 echores "$_translation"
2334 echocheck "language"
2335 # Set preferred languages, "all" uses English as main language.
2336 test -z "$language" && language=$LINGUAS
2337 test -z "$language_doc" && language_doc=$language
2338 test -z "$language_man" && language_man=$language
2339 test -z "$language_msg" && language_msg=$language
2340 test -z "$language_msg" && language_msg="all"
2341 language_doc=$(echo $language_doc | tr , " ")
2342 language_man=$(echo $language_man | tr , " ")
2343 language_msg=$(echo $language_msg | tr , " ")
2345 test "$language_doc" = "all" && language_doc=$doc_lang_all
2346 test "$language_man" = "all" && language_man=$man_lang_all
2347 test "$language_msg" = "all" && language_msg=$msg_lang_all
2349 if test "$_translation" != yes ; then
2350 language_msg=""
2353 # Prune non-existing translations from language lists.
2354 # Set message translation to the first available language.
2355 # Fall back on English.
2356 for lang in $language_doc ; do
2357 test -d DOCS/xml/$lang && tmp_language_doc="$tmp_language_doc $lang"
2358 done
2359 language_doc=$tmp_language_doc
2360 test -z "$language_doc" && language_doc=en
2362 for lang in $language_man ; do
2363 test -d DOCS/man/$lang && tmp_language_man="$tmp_language_man $lang"
2364 done
2365 language_man=$tmp_language_man
2366 test -z "$language_man" && language_man=en
2368 for lang in $language_msg ; do
2369 test -f po/$lang.po && tmp_language_msg="$tmp_language_msg $lang"
2370 done
2371 language_msg=$tmp_language_msg
2373 echores "messages (en+): $language_msg - man pages: $language_man - documentation: $language_doc"
2376 echocheck "enable sighandler"
2377 if test "$_sighandler" = yes ; then
2378 def_sighandler='#define CONFIG_SIGHANDLER 1'
2379 else
2380 def_sighandler='#undef CONFIG_SIGHANDLER'
2382 echores "$_sighandler"
2384 echocheck "runtime cpudetection"
2385 if test "$_runtime_cpudetection" = yes ; then
2386 _optimizing="Runtime CPU-Detection enabled"
2387 def_runtime_cpudetection='#define CONFIG_RUNTIME_CPUDETECT 1'
2388 else
2389 def_runtime_cpudetection='#define CONFIG_RUNTIME_CPUDETECT 0'
2391 echores "$_runtime_cpudetection"
2394 echocheck "restrict keyword"
2395 for restrict_keyword in restrict __restrict __restrict__ ; do
2396 echo "void foo(char * $restrict_keyword p); int main(void) { return 0; }" > $TMPC
2397 if cc_check; then
2398 def_restrict_keyword=$restrict_keyword
2399 break;
2401 done
2402 if [ -n "$def_restrict_keyword" ]; then
2403 echores "$def_restrict_keyword"
2404 else
2405 echores "none"
2407 # Avoid infinite recursion loop ("#define restrict restrict")
2408 if [ "$def_restrict_keyword" != "restrict" ]; then
2409 def_restrict_keyword="#define restrict $def_restrict_keyword"
2410 else
2411 def_restrict_keyword=""
2415 echocheck "__builtin_expect"
2416 # GCC branch prediction hint
2417 cat > $TMPC << EOF
2418 static int foo(int a) {
2419 a = __builtin_expect(a, 10);
2420 return a == 10 ? 0 : 1;
2422 int main(void) { return foo(10) && foo(0); }
2424 _builtin_expect=no
2425 cc_check && _builtin_expect=yes
2426 if test "$_builtin_expect" = yes ; then
2427 def_builtin_expect='#define HAVE_BUILTIN_EXPECT 1'
2428 else
2429 def_builtin_expect='#undef HAVE_BUILTIN_EXPECT'
2431 echores "$_builtin_expect"
2434 echocheck "kstat"
2435 _kstat=no
2436 statement_check kstat.h 'kstat_open()' -lkstat && _kstat=yes
2437 if test "$_kstat" = yes ; then
2438 def_kstat="#define HAVE_LIBKSTAT 1"
2439 extra_ldflags="$extra_ldflags -lkstat"
2440 else
2441 def_kstat="#undef HAVE_LIBKSTAT"
2443 echores "$_kstat"
2446 echocheck "posix4"
2447 # required for nanosleep on some systems
2448 _posix4=no
2449 statement_check time.h 'nanosleep(0, 0)' -lposix4 && _posix4=yes
2450 if test "$_posix4" = yes ; then
2451 extra_ldflags="$extra_ldflags -lposix4"
2453 echores "$_posix4"
2456 echocheck "nanosleep"
2457 _nanosleep=no
2458 statement_check time.h 'nanosleep(0, 0)' && _nanosleep=yes
2459 if test "$_nanosleep" = yes ; then
2460 def_nanosleep='#define HAVE_NANOSLEEP 1'
2461 else
2462 def_nanosleep='#undef HAVE_NANOSLEEP'
2464 echores "$_nanosleep"
2467 echocheck "socklib"
2468 # for Solaris (socket stuff is in -lsocket, gethostbyname and friends in -lnsl):
2469 # for BeOS (socket stuff is in -lsocket, gethostbyname and friends in -lbind):
2470 cat > $TMPC << EOF
2471 #include <netdb.h>
2472 #include <sys/socket.h>
2473 int main(void) { gethostbyname(0); socket(AF_INET, SOCK_STREAM, 0); return 0; }
2475 _socklib=no
2476 for _ld_tmp in "" "-lsocket -lbind" "-lsocket -ldnet" "-lsocket -lnsl" "-lnsl" "-lsocket" ; do
2477 cc_check $_ld_tmp && _ld_sock="$_ld_tmp" && _socklib=yes && break
2478 done
2479 test $_socklib = yes && test $_winsock2_h = auto && _winsock2_h=no
2480 if test $_winsock2_h = auto ; then
2481 _winsock2_h=no
2482 statement_check winsock2.h 'gethostbyname(0)' -lws2_32 && _ld_sock="-lws2_32" && _winsock2_h=yes
2484 test "$_ld_sock" && res_comment="using $_ld_sock"
2485 echores "$_socklib"
2488 if test $_winsock2_h = yes ; then
2489 _ld_sock="-lws2_32"
2490 def_winsock2_h='#define HAVE_WINSOCK2_H 1'
2491 else
2492 def_winsock2_h='#define HAVE_WINSOCK2_H 0'
2496 echocheck "inet_pton()"
2497 def_inet_pton='#define HAVE_INET_PTON 0'
2498 inet_pton=no
2499 for _ld_tmp in "$_ld_sock" "$_ld_sock -lresolv" ; do
2500 statement_check arpa/inet.h 'inet_pton(0, 0, 0)' $_ld_tmp && inet_pton=yes && break
2501 done
2502 if test $inet_pton = yes ; then
2503 test "$_ld_tmp" && res_comment="using $_ld_tmp"
2504 def_inet_pton='#define HAVE_INET_PTON 1'
2506 echores "$inet_pton"
2509 echocheck "inet_aton()"
2510 def_inet_aton='#define HAVE_INET_ATON 0'
2511 inet_aton=no
2512 for _ld_tmp in "$_ld_sock" "$_ld_sock -lresolv" ; do
2513 statement_check arpa/inet.h 'inet_aton(0, 0)' $_ld_tmp && inet_aton=yes && break
2514 done
2515 if test $inet_aton = yes ; then
2516 test "$_ld_tmp" && res_comment="using $_ld_tmp"
2517 def_inet_aton='#define HAVE_INET_ATON 1'
2519 echores "$inet_aton"
2522 echocheck "socklen_t"
2523 _socklen_t=no
2524 for header in "sys/socket.h" "ws2tcpip.h" "sys/types.h" ; do
2525 statement_check $header 'socklen_t v = 0' && _socklen_t=yes && break
2526 done
2527 if test "$_socklen_t" = yes ; then
2528 def_socklen_t='#define HAVE_SOCKLEN_T 1'
2529 else
2530 def_socklen_t='#define HAVE_SOCKLEN_T 0'
2532 echores "$_socklen_t"
2535 echocheck "closesocket()"
2536 _closesocket=no
2537 statement_check winsock2.h 'closesocket(~0)' $_ld_sock && _closesocket=yes
2538 if test "$_closesocket" = yes ; then
2539 def_closesocket='#define HAVE_CLOSESOCKET 1'
2540 else
2541 def_closesocket='#define HAVE_CLOSESOCKET 0'
2543 echores "$_closesocket"
2546 echocheck "networking"
2547 test $_winsock2_h = no && test $inet_pton = no &&
2548 test $inet_aton = no && networking=no
2549 if test "$networking" = yes ; then
2550 def_network='#define CONFIG_NETWORK 1'
2551 def_networking='#define CONFIG_NETWORKING 1'
2552 extra_ldflags="$extra_ldflags $_ld_sock"
2553 inputmodules="networking $inputmodules"
2554 else
2555 noinputmodules="networking $noinputmodules"
2556 def_network='#define CONFIG_NETWORK 0'
2557 def_networking='#undef CONFIG_NETWORKING'
2559 echores "$networking"
2562 echocheck "inet6"
2563 if test "$_inet6" = auto ; then
2564 cat > $TMPC << EOF
2565 #include <sys/types.h>
2566 #if !defined(_WIN32)
2567 #include <sys/socket.h>
2568 #include <netinet/in.h>
2569 #else
2570 #include <ws2tcpip.h>
2571 #endif
2572 int main(void) { struct sockaddr_in6 six; socket(AF_INET6, SOCK_STREAM, AF_INET6); return 0; }
2574 _inet6=no
2575 if cc_check $_ld_sock ; then
2576 _inet6=yes
2579 if test "$_inet6" = yes ; then
2580 def_inet6='#define HAVE_AF_INET6 1'
2581 else
2582 def_inet6='#undef HAVE_AF_INET6'
2584 echores "$_inet6"
2587 echocheck "gethostbyname2"
2588 if test "$_gethostbyname2" = auto ; then
2589 cat > $TMPC << EOF
2590 #include <sys/types.h>
2591 #include <sys/socket.h>
2592 #include <netdb.h>
2593 int main(void) { gethostbyname2("", AF_INET); return 0; }
2595 _gethostbyname2=no
2596 if cc_check ; then
2597 _gethostbyname2=yes
2600 if test "$_gethostbyname2" = yes ; then
2601 def_gethostbyname2='#define HAVE_GETHOSTBYNAME2 1'
2602 else
2603 def_gethostbyname2='#undef HAVE_GETHOSTBYNAME2'
2605 echores "$_gethostbyname2"
2608 echocheck "inttypes.h (required)"
2609 _inttypes=no
2610 header_check inttypes.h && _inttypes=yes
2611 echores "$_inttypes"
2613 if test "$_inttypes" = no ; then
2614 echocheck "sys/bitypes.h (inttypes.h predecessor)"
2615 header_check sys/bitypes.h && _inttypes=yes
2616 if test "$_inttypes" = yes ; then
2617 die "You don't have inttypes.h, but sys/bitypes.h is present. Please copy etc/inttypes.h into the include path, and re-run configure."
2618 else
2619 die "Cannot find header either inttypes.h or bitypes.h. There is no chance for compilation to succeed."
2624 echocheck "alloca.h"
2625 _alloca=no
2626 statement_check alloca.h 'alloca(0)' && _alloca=yes
2627 if cc_check ; then
2628 def_alloca_h='#define HAVE_ALLOCA_H 1'
2629 else
2630 def_alloca_h='#undef HAVE_ALLOCA_H'
2632 echores "$_alloca"
2635 echocheck "fastmemcpy"
2636 if test "$_fastmemcpy" = yes ; then
2637 def_fastmemcpy='#define CONFIG_FASTMEMCPY 1'
2638 else
2639 def_fastmemcpy='#undef CONFIG_FASTMEMCPY'
2641 echores "$_fastmemcpy"
2644 echocheck "mman.h"
2645 _mman=no
2646 statement_check sys/mman.h 'mmap(0, 0, 0, 0, 0, 0)' && _mman=yes
2647 if test "$_mman" = yes ; then
2648 def_mman_h='#define HAVE_SYS_MMAN_H 1'
2649 else
2650 def_mman_h='#undef HAVE_SYS_MMAN_H'
2652 echores "$_mman"
2654 _mman_has_map_failed=no
2655 statement_check sys/mman.h 'void *p = MAP_FAILED' && _mman_has_map_failed=yes
2656 if test "$_mman_has_map_failed" = yes ; then
2657 def_mman_has_map_failed=''
2658 else
2659 def_mman_has_map_failed='#define MAP_FAILED ((void *) -1)'
2662 echocheck "dynamic loader"
2663 _dl=no
2664 for _ld_tmp in "" "-ldl"; do
2665 statement_check dlfcn.h 'dlopen("", 0)' $_ld_tmp && _ld_dl="$_ld_tmp" && _dl=yes && break
2666 done
2667 if test "$_dl" = yes ; then
2668 def_dl='#define HAVE_LIBDL 1'
2669 else
2670 def_dl='#undef HAVE_LIBDL'
2672 echores "$_dl"
2675 echocheck "pthread"
2676 if linux ; then
2677 THREAD_CFLAGS=-D_REENTRANT
2678 elif freebsd || netbsd || openbsd || bsdos ; then
2679 THREAD_CFLAGS=-D_THREAD_SAFE
2681 if test "$_pthreads" = auto ; then
2682 cat > $TMPC << EOF
2683 #include <pthread.h>
2684 static void *func(void *arg) { return arg; }
2685 int main(void) {
2686 pthread_t tid;
2687 #ifdef PTW32_STATIC_LIB
2688 pthread_win32_process_attach_np();
2689 pthread_win32_thread_attach_np();
2690 #endif
2691 return pthread_create (&tid, 0, func, 0) != 0;
2694 _pthreads=no
2695 if ! hpux ; then
2696 for _ld_tmp in "-lpthreadGC2" "" "-lpthread" "-pthread" ; do
2697 # for crosscompilation, we cannot execute the program, be happy if we can link statically
2698 cc_check $THREAD_CFLAGS $_ld_tmp && (tmp_run || test "$_ld_static") && _ld_pthread="$_ld_tmp" && _pthreads=yes && break
2699 done
2700 if test "$_pthreads" = no && mingw32 ; then
2701 _ld_tmp="-lpthreadGC2 -lws2_32"
2702 cc_check $_ld_tmp -DPTW32_STATIC_LIB && (tmp_run || test "$_ld_static") && _ld_pthread="$_ld_tmp" && _pthreads=yes && CFLAGS="$CFLAGS -DPTW32_STATIC_LIB"
2706 if test "$_pthreads" = yes ; then
2707 test $_ld_pthread && res_comment="using $_ld_pthread"
2708 def_pthreads='#define HAVE_PTHREADS 1'
2709 extra_cflags="$extra_cflags $THREAD_CFLAGS"
2710 else
2711 res_comment="v4l2, win32 loader disabled"
2712 def_pthreads='#undef HAVE_PTHREADS'
2713 _tv_v4l2=no
2714 mingw32 || _win32dll=no
2716 echores "$_pthreads"
2718 if cygwin ; then
2719 if test "$_pthreads" = yes ; then
2720 def_pthread_cache="#define PTHREAD_CACHE 1"
2721 else
2722 _stream_cache=no
2723 def_stream_cache="#undef CONFIG_STREAM_CACHE"
2727 echocheck "w32threads"
2728 if test "$_pthreads" = yes ; then
2729 res_comment="using pthread instead"
2730 _w32threads=no
2732 if test "$_w32threads" = auto ; then
2733 _w32threads=no
2734 mingw32 && _w32threads=yes
2736 echores "$_w32threads"
2738 echocheck "rpath"
2739 if test "$_rpath" = yes ; then
2740 for I in $(echo $extra_ldflags | sed 's/-L//g') ; do
2741 tmp="$tmp $(echo $I | sed 's/.*/ -L& -Wl,-R&/')"
2742 done
2743 extra_ldflags=$tmp
2745 echores "$_rpath"
2747 echocheck "iconv"
2748 if test "$_iconv" = auto ; then
2749 cat > $TMPC << EOF
2750 #include <stdio.h>
2751 #include <unistd.h>
2752 #include <iconv.h>
2753 #define INBUFSIZE 1024
2754 #define OUTBUFSIZE 4096
2756 char inbuffer[INBUFSIZE];
2757 char outbuffer[OUTBUFSIZE];
2759 int main(void) {
2760 size_t numread;
2761 iconv_t icdsc;
2762 char *tocode="UTF-8";
2763 char *fromcode="cp1250";
2764 if ((icdsc = iconv_open(tocode, fromcode)) != (iconv_t)(-1)) {
2765 while ((numread = read(0, inbuffer, INBUFSIZE))) {
2766 char *iptr=inbuffer;
2767 char *optr=outbuffer;
2768 size_t inleft=numread;
2769 size_t outleft=OUTBUFSIZE;
2770 if (iconv(icdsc, &iptr, &inleft, &optr, &outleft)
2771 != (size_t)(-1)) {
2772 write(1, outbuffer, OUTBUFSIZE - outleft);
2775 if (iconv_close(icdsc) == -1)
2778 return 0;
2781 _iconv=no
2782 for _ld_tmp in "" "-liconv" "-liconv $_ld_dl" ; do
2783 cc_check $_ld_lm $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" &&
2784 _iconv=yes && break
2785 done
2786 if test "$_iconv" != yes ; then
2787 die "Unable to find iconv which should be part of standard compilation environment. Aborting. If you really mean to compile without iconv support use --disable-iconv."
2790 if test "$_iconv" = yes ; then
2791 def_iconv='#define CONFIG_ICONV 1'
2792 else
2793 def_iconv='#undef CONFIG_ICONV'
2795 echores "$_iconv"
2798 echocheck "soundcard.h"
2799 _soundcard_h=no
2800 def_soundcard_h='#undef HAVE_SOUNDCARD_H'
2801 def_sys_soundcard_h='#undef HAVE_SYS_SOUNDCARD_H'
2802 for _soundcard_header in "sys/soundcard.h" "soundcard.h"; do
2803 header_check $_soundcard_header && _soundcard_h=yes &&
2804 res_comment="$_soundcard_header" && break
2805 done
2807 if test "$_soundcard_h" = yes ; then
2808 if test $_soundcard_header = "sys/soundcard.h"; then
2809 def_sys_soundcard_h='#define HAVE_SYS_SOUNDCARD_H 1'
2810 else
2811 def_soundcard_h='#define HAVE_SOUNDCARD_H 1'
2814 echores "$_soundcard_h"
2817 echocheck "sys/videoio.h"
2818 sys_videoio_h=no
2819 def_sys_videoio_h='#undef HAVE_SYS_VIDEOIO_H'
2820 header_check sys/videoio.h && sys_videoio_h=yes &&
2821 def_sys_videoio_h='#define HAVE_SYS_VIDEOIO_H 1'
2822 echores "$sys_videoio_h"
2825 echocheck "sys/dvdio.h"
2826 _dvdio=no
2827 # FreeBSD 8.1 has broken dvdio.h
2828 header_check_broken sys/types.h sys/dvdio.h && _dvdio=yes
2829 if test "$_dvdio" = yes ; then
2830 def_dvdio='#define DVD_STRUCT_IN_SYS_DVDIO_H 1'
2831 else
2832 def_dvdio='#undef DVD_STRUCT_IN_SYS_DVDIO_H'
2834 echores "$_dvdio"
2837 echocheck "sys/cdio.h"
2838 _cdio=no
2839 # at least OpenSolaris has a broken cdio.h
2840 header_check_broken sys/types.h sys/cdio.h && _cdio=yes
2841 if test "$_cdio" = yes ; then
2842 def_cdio='#define DVD_STRUCT_IN_SYS_CDIO_H 1'
2843 else
2844 def_cdio='#undef DVD_STRUCT_IN_SYS_CDIO_H'
2846 echores "$_cdio"
2849 echocheck "linux/cdrom.h"
2850 _cdrom=no
2851 header_check linux/cdrom.h && _cdrom=yes
2852 if test "$_cdrom" = yes ; then
2853 def_cdrom='#define DVD_STRUCT_IN_LINUX_CDROM_H 1'
2854 else
2855 def_cdrom='#undef DVD_STRUCT_IN_LINUX_CDROM_H'
2857 echores "$_cdrom"
2860 echocheck "dvd.h"
2861 _dvd=no
2862 header_check dvd.h && _dvd=yes
2863 if test "$_dvd" = yes ; then
2864 def_dvd='#define DVD_STRUCT_IN_DVD_H 1'
2865 else
2866 def_dvd='#undef DVD_STRUCT_IN_DVD_H'
2868 echores "$_dvd"
2871 if bsdos; then
2872 echocheck "BSDI dvd.h"
2873 _bsdi_dvd=no
2874 header_check dvd.h && _bsdi_dvd=yes
2875 if test "$_bsdi_dvd" = yes ; then
2876 def_bsdi_dvd='#define DVD_STRUCT_IN_BSDI_DVDIOCTL_DVD_H 1'
2877 else
2878 def_bsdi_dvd='#undef DVD_STRUCT_IN_BSDI_DVDIOCTL_DVD_H'
2880 echores "$_bsdi_dvd"
2881 fi #if bsdos
2884 if hpux; then
2885 # also used by AIX, but AIX does not support VCD and/or libdvdread
2886 echocheck "HP-UX SCSI header"
2887 _hpux_scsi_h=no
2888 header_check sys/scsi.h && _hpux_scsi_h=yes
2889 if test "$_hpux_scsi_h" = yes ; then
2890 def_hpux_scsi_h='#define HPUX_SCTL_IO 1'
2891 else
2892 def_hpux_scsi_h='#undef HPUX_SCTL_IO'
2894 echores "$_hpux_scsi_h"
2895 fi #if hpux
2898 echocheck "termcap"
2899 if test "$_termcap" = auto ; then
2900 _termcap=no
2901 for _ld_tmp in "-lncurses" "-ltinfo" "-ltermcap"; do
2902 statement_check term.h 'tgetent(0, 0)' $_ld_tmp &&
2903 extra_ldflags="$extra_ldflags $_ld_tmp" && _termcap=yes && break
2904 done
2906 if test "$_termcap" = yes ; then
2907 def_termcap='#define HAVE_TERMCAP 1'
2908 test $_ld_tmp && res_comment="using $_ld_tmp"
2909 else
2910 def_termcap='#undef HAVE_TERMCAP'
2912 echores "$_termcap"
2915 echocheck "termios"
2916 def_termios='#undef HAVE_TERMIOS'
2917 def_termios_h='#undef HAVE_TERMIOS_H'
2918 def_termios_sys_h='#undef HAVE_SYS_TERMIOS_H'
2919 if test "$_termios" = auto ; then
2920 _termios=no
2921 for _termios_header in "termios.h" "sys/termios.h"; do
2922 header_check $_termios_header && _termios=yes &&
2923 res_comment="using $_termios_header" && break
2924 done
2927 if test "$_termios" = yes ; then
2928 def_termios='#define HAVE_TERMIOS 1'
2929 if test "$_termios_header" = "termios.h" ; then
2930 def_termios_h='#define HAVE_TERMIOS_H 1'
2931 else
2932 def_termios_sys_h='#define HAVE_SYS_TERMIOS_H 1'
2935 echores "$_termios"
2938 echocheck "shm"
2939 if test "$_shm" = auto ; then
2940 _shm=no
2941 statement_check sys/shm.h 'shmget(0, 0, 0); shmat(0, 0, 0); shmctl(0, 0, 0)' && _shm=yes
2943 if test "$_shm" = yes ; then
2944 def_shm='#define HAVE_SHM 1'
2945 else
2946 def_shm='#undef HAVE_SHM'
2948 echores "$_shm"
2951 echocheck "strsep()"
2952 _strsep=no
2953 statement_check string.h 'char *s = "Hello, world!"; strsep(&s, ",")' && _strsep=yes
2954 if test "$_strsep" = yes ; then
2955 def_strsep='#define HAVE_STRSEP 1'
2956 need_strsep=no
2957 else
2958 def_strsep='#undef HAVE_STRSEP'
2959 need_strsep=yes
2961 echores "$_strsep"
2964 echocheck "vsscanf()"
2965 cat > $TMPC << EOF
2966 #define _ISOC99_SOURCE
2967 #include <stdarg.h>
2968 #include <stdio.h>
2969 int main(void) { va_list ap; vsscanf("foo", "bar", ap); return 0; }
2971 _vsscanf=no
2972 cc_check && _vsscanf=yes
2973 if test "$_vsscanf" = yes ; then
2974 def_vsscanf='#define HAVE_VSSCANF 1'
2975 need_vsscanf=no
2976 else
2977 def_vsscanf='#undef HAVE_VSSCANF'
2978 need_vsscanf=yes
2980 echores "$_vsscanf"
2983 echocheck "swab()"
2984 _swab=no
2985 define_statement_check "_XOPEN_SOURCE 600" "unistd.h" 'int a, b; swab(&a, &b, 0)' ||
2986 statement_check "string.h" 'int a, b; swab(&a, &b, 0)' && _swab=yes
2987 if test "$_swab" = yes ; then
2988 def_swab='#define HAVE_SWAB 1'
2989 need_swab=no
2990 else
2991 def_swab='#undef HAVE_SWAB'
2992 need_swab=yes
2994 echores "$_swab"
2996 echocheck "POSIX select()"
2997 cat > $TMPC << EOF
2998 #include <stdio.h>
2999 #include <stdlib.h>
3000 #include <sys/types.h>
3001 #include <string.h>
3002 #include <sys/time.h>
3003 #include <unistd.h>
3004 int main(void) {int nfds = 1; fd_set readfds; struct timeval timeout; select(nfds, &readfds, NULL, NULL, &timeout); return 0; }
3006 _posix_select=no
3007 def_posix_select='#undef HAVE_POSIX_SELECT'
3008 cc_check && _posix_select=yes &&
3009 def_posix_select='#define HAVE_POSIX_SELECT 1'
3010 echores "$_posix_select"
3013 echocheck "audio select()"
3014 if test "$_select" = no ; then
3015 def_select='#undef HAVE_AUDIO_SELECT'
3016 elif test "$_select" = yes ; then
3017 def_select='#define HAVE_AUDIO_SELECT 1'
3019 echores "$_select"
3022 echocheck "gettimeofday()"
3023 _gettimeofday=no
3024 statement_check sys/time.h 'struct timeval tv; struct timezone tz; gettimeofday(&tv, &tz)' && _gettimeofday=yes
3025 if test "$_gettimeofday" = yes ; then
3026 def_gettimeofday='#define HAVE_GETTIMEOFDAY 1'
3027 need_gettimeofday=no
3028 else
3029 def_gettimeofday='#undef HAVE_GETTIMEOFDAY'
3030 need_gettimeofday=yes
3032 echores "$_gettimeofday"
3035 echocheck "glob()"
3036 _glob=no
3037 statement_check glob.h 'glob("filename", 0, 0, 0)' && _glob=yes
3038 need_glob=no
3039 if test "$_glob" = yes ; then
3040 def_glob='#define HAVE_GLOB 1'
3041 else
3042 def_glob='#undef HAVE_GLOB'
3043 # HACK! need_glob currently enables compilation of a
3044 # win32-specific glob()-replacement.
3045 # Other OS neither need it nor can they use it (mf:// is disabled for them).
3046 win32 && need_glob=yes
3048 echores "$_glob"
3051 echocheck "setenv()"
3052 _setenv=no
3053 statement_check stdlib.h 'setenv("", "", 0)' && _setenv=yes
3054 if test "$_setenv" = yes ; then
3055 def_setenv='#define HAVE_SETENV 1'
3056 need_setenv=no
3057 else
3058 def_setenv='#undef HAVE_SETENV'
3059 need_setenv=yes
3061 echores "$_setenv"
3064 echocheck "setmode()"
3065 _setmode=no
3066 def_setmode='#define HAVE_SETMODE 0'
3067 statement_check io.h 'setmode(0, 0)' && _setmode=yes && def_setmode='#define HAVE_SETMODE 1'
3068 echores "$_setmode"
3071 echocheck "sys/sysinfo.h"
3072 _sys_sysinfo=no
3073 statement_check sys/sysinfo.h 'struct sysinfo s_info; s_info.mem_unit=0; sysinfo(&s_info)' && _sys_sysinfo=yes
3074 if test "$_sys_sysinfo" = yes ; then
3075 def_sys_sysinfo_h='#define HAVE_SYS_SYSINFO_H 1'
3076 else
3077 def_sys_sysinfo_h='#undef HAVE_SYS_SYSINFO_H'
3079 echores "$_sys_sysinfo"
3082 if darwin; then
3084 echocheck "Mac OS X Finder Support"
3085 def_macosx_finder='#undef CONFIG_MACOSX_FINDER'
3086 if test "$_macosx_finder" = yes ; then
3087 def_macosx_finder='#define CONFIG_MACOSX_FINDER 1'
3088 extra_ldflags="$extra_ldflags -framework Cocoa"
3090 echores "$_macosx_finder"
3092 echocheck "Mac OS X Bundle file locations"
3093 def_macosx_bundle='#undef CONFIG_MACOSX_BUNDLE'
3094 test "$_macosx_bundle" = auto && _macosx_bundle=$_macosx_finder
3095 if test "$_macosx_bundle" = yes ; then
3096 def_macosx_bundle='#define CONFIG_MACOSX_BUNDLE 1'
3098 echores "$_macosx_bundle"
3100 echocheck "Apple Remote"
3101 if test "$_apple_remote" = auto ; then
3102 _apple_remote=no
3103 cat > $TMPC <<EOF
3104 #include <stdio.h>
3105 #include <IOKit/IOCFPlugIn.h>
3106 int main(void) {
3107 io_iterator_t hidObjectIterator = (io_iterator_t)NULL;
3108 CFMutableDictionaryRef hidMatchDictionary;
3109 IOReturn ioReturnValue;
3111 // Set up a matching dictionary to search the I/O Registry by class.
3112 // name for all HID class devices
3113 hidMatchDictionary = IOServiceMatching("AppleIRController");
3115 // Now search I/O Registry for matching devices.
3116 ioReturnValue = IOServiceGetMatchingServices(kIOMasterPortDefault,
3117 hidMatchDictionary, &hidObjectIterator);
3119 // If search is unsuccessful, return nonzero.
3120 if (ioReturnValue != kIOReturnSuccess ||
3121 !IOIteratorIsValid(hidObjectIterator)) {
3122 return 1;
3124 return 0;
3127 cc_check -framework IOKit && _apple_remote=yes
3129 if test "$_apple_remote" = yes ; then
3130 def_apple_remote='#define CONFIG_APPLE_REMOTE 1'
3131 libs_mplayer="$libs_mplayer -framework IOKit -framework Cocoa"
3132 else
3133 def_apple_remote='#undef CONFIG_APPLE_REMOTE'
3135 echores "$_apple_remote"
3137 fi #if darwin
3139 if linux; then
3141 echocheck "Apple IR"
3142 if test "$_apple_ir" = auto ; then
3143 _apple_ir=no
3144 statement_check linux/input.h 'struct input_event ev; struct input_id id' && _apple_ir=yes
3146 if test "$_apple_ir" = yes ; then
3147 def_apple_ir='#define CONFIG_APPLE_IR 1'
3148 else
3149 def_apple_ir='#undef CONFIG_APPLE_IR'
3151 echores "$_apple_ir"
3152 fi #if linux
3154 echocheck "pkg-config"
3155 if $($_pkg_config --version > /dev/null 2>&1); then
3156 if test "$_ld_static"; then
3157 _pkg_config="$_pkg_config --static"
3159 echores "yes"
3160 else
3161 _pkg_config=false
3162 echores "no"
3166 echocheck "Samba support (libsmbclient)"
3167 if test "$_smb" = yes; then
3168 extra_ldflags="$extra_ldflags -lsmbclient"
3170 if test "$_smb" = auto; then
3171 _smb=no
3172 for _ld_tmp in "-lsmbclient" "-lsmbclient $_ld_dl" "-lsmbclient $_ld_dl -lnsl" "-lsmbclient $_ld_dl -lssl -lnsl" ; do
3173 statement_check libsmbclient.h 'smbc_opendir("smb://")' $_ld_tmp &&
3174 extra_ldflags="$extra_ldflags $_ld_tmp" && _smb=yes && break
3175 done
3178 if test "$_smb" = yes; then
3179 def_smb="#define CONFIG_LIBSMBCLIENT 1"
3180 inputmodules="smb $inputmodules"
3181 else
3182 def_smb="#undef CONFIG_LIBSMBCLIENT"
3183 noinputmodules="smb $noinputmodules"
3185 echores "$_smb"
3187 echocheck "libquvi support"
3188 if test "$_libquvi" = auto ; then
3189 _libquvi=no
3190 if pkg_config_add 'libquvi >= 0.4.1' ; then
3191 _libquvi=yes
3194 if test "$_libquvi" = yes; then
3195 def_libquvi="#define CONFIG_LIBQUVI 1"
3196 else
3197 def_libquvi="#undef CONFIG_LIBQUVI"
3199 echores "$_libquvi"
3201 #########
3202 # VIDEO #
3203 #########
3206 echocheck "tga"
3207 if test "$_tga" = yes ; then
3208 def_tga='#define CONFIG_TGA 1'
3209 vomodules="tga $vomodules"
3210 else
3211 def_tga='#undef CONFIG_TGA'
3212 novomodules="tga $novomodules"
3214 echores "$_tga"
3217 echocheck "md5sum support"
3218 if test "$_md5sum" = yes; then
3219 def_md5sum="#define CONFIG_MD5SUM 1"
3220 vomodules="md5sum $vomodules"
3221 else
3222 def_md5sum="#undef CONFIG_MD5SUM"
3223 novomodules="md5sum $novomodules"
3225 echores "$_md5sum"
3228 echocheck "yuv4mpeg support"
3229 if test "$_yuv4mpeg" = yes; then
3230 def_yuv4mpeg="#define CONFIG_YUV4MPEG 1"
3231 vomodules="yuv4mpeg $vomodules"
3232 else
3233 def_yuv4mpeg="#undef CONFIG_YUV4MPEG"
3234 novomodules="yuv4mpeg $novomodules"
3236 echores "$_yuv4mpeg"
3239 echocheck "DirectFB"
3240 if test "$_directfb" = auto ; then
3241 _directfb=no
3242 cat > $TMPC << EOF
3243 #include <directfb.h>
3244 #include <directfb_version.h>
3245 #if (DIRECTFB_MAJOR_VERSION << 16 | DIRECTFB_MINOR_VERSION << 8 | DIRECTFB_MICRO_VERSION) < (0 << 16 | 9 << 8 | 22)
3246 #error "DirectFB version too old."
3247 #endif
3248 int main(void) { DirectFBInit(0, 0); return 0; }
3250 for _inc_tmp in "" -I/usr/local/include/directfb -I/usr/include/directfb -I/usr/local/include; do
3251 cc_check $_inc_tmp -ldirectfb &&
3252 _directfb=yes && extra_cflags="$extra_cflags $_inc_tmp" && break
3253 done
3255 if test "$_directfb" = yes ; then
3256 def_directfb='#define CONFIG_DIRECTFB 1'
3257 vomodules="directfb $vomodules"
3258 libs_mplayer="$libs_mplayer -ldirectfb"
3259 else
3260 def_directfb='#undef CONFIG_DIRECTFB'
3261 novomodules="directfb $novomodules"
3263 echores "$_directfb"
3266 if darwin; then
3268 echocheck "QuickTime"
3269 if test "$quicktime" = auto ; then
3270 quicktime=no
3271 statement_check QuickTime/QuickTime.h 'ImageDescription *desc; EnterMovies(); ExitMovies()' -framework QuickTime && quicktime=yes
3273 if test "$quicktime" = yes ; then
3274 extra_ldflags="$extra_ldflags -framework QuickTime"
3275 def_quicktime='#define CONFIG_QUICKTIME 1'
3276 else
3277 def_quicktime='#undef CONFIG_QUICKTIME'
3279 echores $quicktime
3281 echocheck "Cocoa"
3282 if test "$_cocoa" = auto ; then
3283 cat > $TMPC <<EOF
3284 #include <CoreServices/CoreServices.h>
3285 #include <OpenGL/OpenGL.h>
3286 int main(void) {
3287 NSApplicationLoad();
3290 _cocoa=no
3291 cc_check -framework IOKit -framework Cocoa -framework OpenGL && _cocoa=yes
3293 if test "$_cocoa" = yes ; then
3294 libs_mplayer="$libs_mplayer -framework IOKit -framework Cocoa -framework OpenGL"
3295 def_cocoa='#define CONFIG_COCOA 1'
3296 else
3297 def_cocoa='#undef CONFIG_COCOA'
3299 echores "$_cocoa"
3301 echocheck "CoreVideo"
3302 if test "$_cocoa" = yes && test "$_corevideo" = auto ; then
3303 cat > $TMPC <<EOF
3304 #include <QuartzCore/CoreVideo.h>
3305 int main(void) { return 0; }
3307 _corevideo=no
3308 cc_check -framework Cocoa -framework QuartzCore -framework OpenGL && _corevideo=yes
3310 if test "$_corevideo" = yes ; then
3311 vomodules="corevideo $vomodules"
3312 libs_mplayer="$libs_mplayer -framework QuartzCore"
3313 def_corevideo='#define CONFIG_COREVIDEO 1'
3314 else
3315 novomodules="corevideo $novomodules"
3316 def_corevideo='#undef CONFIG_COREVIDEO'
3318 echores "$_corevideo"
3320 echocheck "SharedBuffer"
3321 if test "$_sharedbuffer" = auto ; then
3322 cat > $TMPC <<EOF
3323 int main(void) {
3324 NSApplicationLoad();
3327 _sharedbuffer=no
3328 cc_check -framework Cocoa && _sharedbuffer=yes
3330 if test "$_sharedbuffer" = yes ; then
3331 vomodules="sharedbuffer $vomodules"
3332 libs_mplayer="$libs_mplayer -framework Cocoa"
3333 def_sharedbuffer='#define CONFIG_SHAREDBUFFER 1'
3334 else
3335 novomodules="sharedbuffer $novomodules"
3336 def_sharedbuffer='#undef CONFIG_SHAREDBUFFER'
3338 echores "$_sharedbuffer"
3340 depends_on_application_services(){
3341 test "$_corevideo" = yes
3344 fi #if darwin
3347 echocheck "X11 headers presence"
3348 _x11_headers="no"
3349 res_comment="check if the dev(el) packages are installed"
3350 for I in $(echo $extra_cflags | sed s/-I//g) /usr/include ; do
3351 if test -f "$I/X11/Xlib.h" ; then
3352 _x11_headers="yes"
3353 res_comment=""
3354 break
3356 done
3357 if test $_cross_compile = no; then
3358 for I in /usr/X11/include /usr/X11R7/include /usr/local/include /usr/X11R6/include \
3359 /usr/include/X11R6 /usr/openwin/include ; do
3360 if test -f "$I/X11/Xlib.h" ; then
3361 extra_cflags="$extra_cflags -I$I"
3362 _x11_headers="yes"
3363 res_comment="using $I"
3364 break
3366 done
3368 echores "$_x11_headers"
3371 echocheck "X11"
3372 if test "$_x11" = auto && test "$_x11_headers" = yes ; then
3373 for I in "" -L/usr/X11R7/lib -L/usr/local/lib -L/usr/X11R6/lib -L/usr/lib/X11R6 \
3374 -L/usr/X11/lib -L/usr/lib32 -L/usr/openwin/lib -L/usr/local/lib64 -L/usr/X11R6/lib64 \
3375 -L/usr/lib ; do
3376 if netbsd; then
3377 _ld_tmp="$I -lXext -lX11 $_ld_pthread -Wl,-R$(echo $I | sed s/^-L//)"
3378 else
3379 _ld_tmp="$I -lXext -lX11 $_ld_pthread"
3381 statement_check X11/Xutil.h 'XCreateWindow(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)' $_ld_tmp &&
3382 _x11=yes
3383 # Check that there aren't conflicting headers between ApplicationServices
3384 # and X11. On versions of Mac OSX prior to 10.7 the deprecated QuickDraw API
3385 # is included by -framework ApplicationServices and clashes with the X11
3386 # definition of the "Cursor" type.
3387 if darwin && depends_on_application_services && test "$_x11" = yes ; then
3388 _x11=no
3389 header_check_broken ApplicationServices/ApplicationServices.h \
3390 X11/Xutil.h $_ld_tmp && _x11=yes
3392 if test "$_x11" = yes ; then
3393 libs_mplayer="$libs_mplayer $_ld_tmp"
3394 break
3396 done
3398 if test "$_x11" = yes ; then
3399 def_x11='#define CONFIG_X11 1'
3400 vomodules="x11 $vomodules"
3401 else
3402 _x11=no
3403 def_x11='#undef CONFIG_X11'
3404 novomodules="x11 $novomodules"
3405 res_comment="check if the dev(el) packages are installed"
3407 echores "$_x11"
3409 echocheck "Xss screensaver extensions"
3410 if test "$_xss" = auto ; then
3411 _xss=no
3412 statement_check "X11/extensions/scrnsaver.h" 'XScreenSaverSuspend(NULL, True)' -lXss && _xss=yes
3414 if test "$_xss" = yes ; then
3415 def_xss='#define CONFIG_XSS 1'
3416 libs_mplayer="$libs_mplayer -lXss"
3417 else
3418 def_xss='#undef CONFIG_XSS'
3420 echores "$_xss"
3422 echocheck "DPMS"
3423 _xdpms3=no
3424 _xdpms4=no
3425 if test "$_x11" = yes ; then
3426 cat > $TMPC <<EOF
3427 #include <X11/Xmd.h>
3428 #include <X11/Xlib.h>
3429 #include <X11/Xutil.h>
3430 #include <X11/Xatom.h>
3431 #include <X11/extensions/dpms.h>
3432 int main(void) { DPMSQueryExtension(0, 0, 0); return 0; }
3434 cc_check -lXdpms && _xdpms3=yes
3435 statement_check_broken X11/Xlib.h X11/extensions/dpms.h 'DPMSQueryExtension(0, 0, 0)' -lXext && _xdpms4=yes
3437 if test "$_xdpms4" = yes ; then
3438 def_xdpms='#define CONFIG_XDPMS 1'
3439 res_comment="using Xdpms 4"
3440 echores "yes"
3441 elif test "$_xdpms3" = yes ; then
3442 def_xdpms='#define CONFIG_XDPMS 1'
3443 libs_mplayer="$libs_mplayer -lXdpms"
3444 res_comment="using Xdpms 3"
3445 echores "yes"
3446 else
3447 def_xdpms='#undef CONFIG_XDPMS'
3448 echores "no"
3452 echocheck "Xv"
3453 if test "$_xv" = auto && test "$_x11" = yes ; then
3454 _xv=no
3455 statement_check_broken X11/Xlib.h X11/extensions/Xvlib.h 'XvGetPortAttribute(0, 0, 0, 0)' -lXv && _xv=yes
3458 if test "$_xv" = yes ; then
3459 def_xv='#define CONFIG_XV 1'
3460 libs_mplayer="$libs_mplayer -lXv"
3461 vomodules="xv $vomodules"
3462 else
3463 def_xv='#undef CONFIG_XV'
3464 novomodules="xv $novomodules"
3466 echores "$_xv"
3469 echocheck "VDPAU"
3470 if test "$_vdpau" = auto && test "$_x11" = yes ; then
3471 _vdpau=no
3472 if test "$_dl" = yes ; then
3473 pkg_config_add 'vdpau >= 0.2' && _vdpau=yes
3476 if test "$_vdpau" = yes ; then
3477 def_vdpau='#define CONFIG_VDPAU 1'
3478 vomodules="vdpau $vomodules"
3479 else
3480 def_vdpau='#define CONFIG_VDPAU 0'
3481 novomodules="vdpau $novomodules"
3483 echores "$_vdpau"
3486 echocheck "Xinerama"
3487 if test "$_xinerama" = auto && test "$_x11" = yes ; then
3488 _xinerama=no
3489 statement_check X11/extensions/Xinerama.h 'XineramaIsActive(0)' -lXinerama && _xinerama=yes
3492 if test "$_xinerama" = yes ; then
3493 def_xinerama='#define CONFIG_XINERAMA 1'
3494 libs_mplayer="$libs_mplayer -lXinerama"
3495 else
3496 def_xinerama='#undef CONFIG_XINERAMA'
3498 echores "$_xinerama"
3501 # Note: the -lXxf86vm library is the VideoMode extension and though it's not
3502 # needed for DGA, AFAIK every distribution packages together with DGA stuffs
3503 # named 'X extensions' or something similar.
3504 # This check may be useful for future mplayer versions (to change resolution)
3505 # If you run into problems, remove '-lXxf86vm'.
3506 echocheck "Xxf86vm"
3507 if test "$_vm" = auto && test "$_x11" = yes ; then
3508 _vm=no
3509 statement_check_broken X11/Xlib.h X11/extensions/xf86vmode.h 'XF86VidModeQueryExtension(0, 0, 0)' -lXxf86vm && _vm=yes
3511 if test "$_vm" = yes ; then
3512 def_vm='#define CONFIG_XF86VM 1'
3513 libs_mplayer="$libs_mplayer -lXxf86vm"
3514 else
3515 def_vm='#undef CONFIG_XF86VM'
3517 echores "$_vm"
3519 # Check for the presence of special keycodes, like audio control buttons
3520 # that XFree86 might have. Used to be bundled with the xf86vm check, but
3521 # has nothing to do with xf86vm and XFree 3.x has xf86vm but does NOT
3522 # have these new keycodes.
3523 echocheck "XF86keysym"
3524 if test "$_xf86keysym" = auto && test "$_x11" = yes ; then
3525 _xf86keysym=no
3526 return_check X11/XF86keysym.h XF86XK_AudioPause && _xf86keysym=yes
3528 if test "$_xf86keysym" = yes ; then
3529 def_xf86keysym='#define CONFIG_XF86XK 1'
3530 else
3531 def_xf86keysym='#undef CONFIG_XF86XK'
3533 echores "$_xf86keysym"
3536 echocheck "CACA"
3537 if test "$_caca" = auto ; then
3538 _caca=no
3539 pkg_config_add 'caca' && _caca=yes
3541 if test "$_caca" = yes ; then
3542 def_caca='#define CONFIG_CACA 1'
3543 vomodules="caca $vomodules"
3544 else
3545 def_caca='#undef CONFIG_CACA'
3546 novomodules="caca $novomodules"
3548 echores "$_caca"
3551 echocheck "DVB"
3552 if test "$_dvb" = auto ; then
3553 _dvb=no
3554 cat >$TMPC << EOF
3555 #include <poll.h>
3556 #include <sys/ioctl.h>
3557 #include <stdio.h>
3558 #include <time.h>
3559 #include <unistd.h>
3560 #include <linux/dvb/dmx.h>
3561 #include <linux/dvb/frontend.h>
3562 #include <linux/dvb/video.h>
3563 #include <linux/dvb/audio.h>
3564 int main(void) {return 0;}
3566 for _inc_tmp in "" "-I/usr/src/DVB/include" ; do
3567 cc_check $_inc_tmp && _dvb=yes &&
3568 extra_cflags="$extra_cflags $_inc_tmp" && break
3569 done
3571 echores "$_dvb"
3572 if test "$_dvb" = yes ; then
3573 _dvbin=yes
3574 inputmodules="dvb $inputmodules"
3575 def_dvbin='#define CONFIG_DVBIN 1'
3576 else
3577 _dvbin=no
3578 noinputmodules="dvb $noinputmodules"
3579 def_dvbin='#undef CONFIG_DVBIN '
3583 echocheck "PNG support"
3584 if test "$_png" = auto ; then
3585 _png=no
3586 cat > $TMPC << EOF
3587 #include <stdio.h>
3588 #include <string.h>
3589 #include <png.h>
3590 int main(void) {
3591 printf("png.h : %s\n", PNG_LIBPNG_VER_STRING);
3592 printf("libpng: %s\n", png_libpng_ver);
3593 return strcmp(PNG_LIBPNG_VER_STRING, png_libpng_ver);
3596 cc_check -lpng -lz $_ld_lm && _png=yes
3598 echores "$_png"
3599 if test "$_png" = yes ; then
3600 def_png='#define CONFIG_PNG 1'
3601 extra_ldflags="$extra_ldflags -lpng -lz"
3602 else
3603 def_png='#undef CONFIG_PNG'
3606 echocheck "MNG support"
3607 if test "$_mng" = auto ; then
3608 _mng=no
3609 return_statement_check libmng.h 'const char * p_ver = mng_version_text()' '!p_ver || p_ver[0] == 0' -lmng -lz $_ld_lm && _mng=yes
3611 echores "$_mng"
3612 if test "$_mng" = yes ; then
3613 def_mng='#define CONFIG_MNG 1'
3614 extra_ldflags="$extra_ldflags -lmng -lz"
3615 else
3616 def_mng='#undef CONFIG_MNG'
3619 echocheck "JPEG support"
3620 if test "$_jpeg" = auto ; then
3621 _jpeg=no
3622 header_check_broken stdio.h jpeglib.h -ljpeg $_ld_lm && _jpeg=yes
3624 echores "$_jpeg"
3626 if test "$_jpeg" = yes ; then
3627 def_jpeg='#define CONFIG_JPEG 1'
3628 vomodules="jpeg $vomodules"
3629 extra_ldflags="$extra_ldflags -ljpeg"
3630 else
3631 def_jpeg='#undef CONFIG_JPEG'
3632 novomodules="jpeg $novomodules"
3637 echocheck "PNM support"
3638 if test "$_pnm" = yes; then
3639 def_pnm="#define CONFIG_PNM 1"
3640 vomodules="pnm $vomodules"
3641 else
3642 def_pnm="#undef CONFIG_PNM"
3643 novomodules="pnm $novomodules"
3645 echores "$_pnm"
3649 echocheck "GIF support"
3650 # This is to appease people who want to force gif support.
3651 # If it is forced to yes, then we still do checks to determine
3652 # which gif library to use.
3653 if test "$_gif" = yes ; then
3654 _force_gif=yes
3655 _gif=auto
3658 if test "$_gif" = auto ; then
3659 _gif=no
3660 for _ld_gif in "-lungif" "-lgif" ; do
3661 statement_check gif_lib.h 'QuantizeBuffer(0, 0, 0, 0, 0, 0, 0, 0)' $_ld_gif && _gif=yes && break
3662 done
3665 # If no library was found, and the user wants support forced,
3666 # then we force it on with libgif, as this is the safest
3667 # assumption IMHO. (libungif & libregif both create symbolic
3668 # links to libgif. We also assume that no x11 support is needed,
3669 # because if you are forcing this, then you _should_ know what
3670 # you are doing. [ Besides, package maintainers should never
3671 # have compiled x11 deps into libungif in the first place. ] )
3672 # </rant>
3673 # --Joey
3674 if test "$_force_gif" = yes && test "$_gif" = no ; then
3675 _gif=yes
3676 _ld_gif="-lgif"
3679 if test "$_gif" = yes ; then
3680 def_gif='#define CONFIG_GIF 1'
3681 codecmodules="gif $codecmodules"
3682 vomodules="gif89a $vomodules"
3683 res_comment="old version, some encoding functions disabled"
3684 def_gif_4='#undef CONFIG_GIF_4'
3685 extra_ldflags="$extra_ldflags $_ld_gif"
3687 cat > $TMPC << EOF
3688 #include <signal.h>
3689 #include <stdio.h>
3690 #include <stdlib.h>
3691 #include <gif_lib.h>
3692 static void catch(int sig) { exit(1); }
3693 int main(void) {
3694 signal(SIGSEGV, catch); // catch segfault
3695 printf("EGifPutExtensionFirst is at address %p\n", EGifPutExtensionFirst);
3696 EGifSetGifVersion("89a"); // this will segfault a buggy gif lib.
3697 return 0;
3700 if cc_check "$_ld_gif" ; then
3701 def_gif_4='#define CONFIG_GIF_4 1'
3702 res_comment=""
3704 else
3705 def_gif='#undef CONFIG_GIF'
3706 def_gif_4='#undef CONFIG_GIF_4'
3707 novomodules="gif89a $novomodules"
3708 nocodecmodules="gif $nocodecmodules"
3710 echores "$_gif"
3713 case "$_gif" in yes*)
3714 echocheck "broken giflib workaround"
3715 def_gif_tvt_hack='#define CONFIG_GIF_TVT_HACK 1'
3717 cat > $TMPC << EOF
3718 #include <stdio.h>
3719 #include <gif_lib.h>
3720 int main(void) {
3721 GifFileType gif = {.UserData = NULL};
3722 printf("UserData is at address %p\n", gif.UserData);
3723 return 0;
3726 if cc_check "$_ld_gif" ; then
3727 def_gif_tvt_hack='#undef CONFIG_GIF_TVT_HACK'
3728 echores "disabled"
3729 else
3730 echores "enabled"
3733 esac
3736 #################
3737 # VIDEO + AUDIO #
3738 #################
3741 echocheck "SDL"
3742 _inc_tmp=""
3743 _ld_tmp=""
3744 def_sdl_sdl_h="#undef CONFIG_SDL_SDL_H"
3745 if test -z "$_sdlconfig" ; then
3746 if ( sdl-config --version ) >>"$TMPLOG" 2>&1 ; then
3747 _sdlconfig="sdl-config"
3748 elif ( sdl11-config --version ) >>"$TMPLOG" 2>&1 ; then
3749 _sdlconfig="sdl11-config"
3750 else
3751 _sdlconfig=false
3754 if test "$_sdl" = auto || test "$_sdl" = yes ; then
3755 cat > $TMPC << EOF
3756 #ifdef CONFIG_SDL_SDL_H
3757 #include <SDL/SDL.h>
3758 #else
3759 #include <SDL.h>
3760 #endif
3761 #ifndef __APPLE__
3762 // we allow SDL hacking our main() only on OSX
3763 #undef main
3764 #endif
3765 int main(int argc, char *argv[]) {
3766 SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE);
3767 return 0;
3770 _sdl=no
3771 for _ld_tmp in "-lSDL" "-lSDL -lpthread" "-lSDL -lwinmm -lgdi32" "-lSDL -lwinmm -lgdi32 -ldxguid" ; do
3772 if cc_check -DCONFIG_SDL_SDL_H $_inc_tmp $_ld_tmp ; then
3773 _sdl=yes
3774 def_sdl_sdl_h="#define CONFIG_SDL_SDL_H 1"
3775 break
3777 done
3778 if test "$_sdl" = no && "$_sdlconfig" --version >>"$TMPLOG" 2>&1 ; then
3779 res_comment="using $_sdlconfig"
3780 if cygwin ; then
3781 _inc_tmp="$($_sdlconfig --cflags | cut -d " " -f 1,5,6 | sed s/no-cygwin/cygwin/)"
3782 _ld_tmp="$($_sdlconfig --libs | cut -d " " -f 1,4,6 | sed s/no-cygwin/cygwin/)"
3783 elif mingw32 ; then
3784 _inc_tmp=$($_sdlconfig --cflags | sed s/-Dmain=SDL_main//)
3785 _ld_tmp=$($_sdlconfig --libs | sed -e s/-mwindows// -e s/-lmingw32//)
3786 else
3787 _inc_tmp="$($_sdlconfig --cflags)"
3788 _ld_tmp="$($_sdlconfig --libs)"
3790 if cc_check $_inc_tmp $_ld_tmp >>"$TMPLOG" 2>&1 ; then
3791 _sdl=yes
3792 elif cc_check $_inc_tmp $_ld_tmp -lstdc++ >>"$TMPLOG" 2>&1 ; then
3793 # HACK for BeOS/Haiku SDL
3794 _ld_tmp="$_ld_tmp -lstdc++"
3795 _sdl=yes
3799 if test "$_sdl" = yes ; then
3800 def_sdl='#define CONFIG_SDL 1'
3801 extra_cflags="$extra_cflags $_inc_tmp"
3802 libs_mplayer="$libs_mplayer $_ld_tmp"
3803 vomodules="sdl $vomodules"
3804 aomodules="sdl $aomodules"
3805 else
3806 def_sdl='#undef CONFIG_SDL'
3807 novomodules="sdl $novomodules"
3808 noaomodules="sdl $noaomodules"
3810 echores "$_sdl"
3813 # make sure this stays below CoreVideo to avoid issues due to namespace
3814 # conflicts between -lGL and -framework OpenGL
3815 echocheck "OpenGL"
3816 #Note: this test is run even with --enable-gl since we autodetect linker flags
3817 if (test "$_x11" = yes || test "$_sdl" = yes || test "$_cocoa" = yes || win32) && test "$_gl" != no ; then
3818 cat > $TMPC << EOF
3819 #ifdef GL_WIN32
3820 #include <windows.h>
3821 #include <GL/gl.h>
3822 #elif defined(GL_SDL)
3823 #include <GL/gl.h>
3824 #ifdef CONFIG_SDL_SDL_H
3825 #include <SDL/SDL.h>
3826 #else
3827 #include <SDL.h>
3828 #endif
3829 #ifndef __APPLE__
3830 // we allow SDL hacking our main() only on OSX
3831 #undef main
3832 #endif
3833 #else
3834 #include <GL/gl.h>
3835 #include <X11/Xlib.h>
3836 #include <GL/glx.h>
3837 #endif
3838 int main(int argc, char *argv[]) {
3839 #ifdef GL_WIN32
3840 HDC dc;
3841 wglCreateContext(dc);
3842 #elif defined(GL_SDL)
3843 SDL_GL_SwapBuffers();
3844 #else
3845 glXCreateContext(NULL, NULL, NULL, True);
3846 #endif
3847 glFinish();
3848 return 0;
3851 _gl=no
3852 if test "$_x11" = yes ; then
3853 for _ld_tmp in "" -lGL "-lGL -lXdamage" "-lGL $_ld_pthread" ; do
3854 if cc_check $_ld_tmp $_ld_lm ; then
3855 _gl=yes
3856 _gl_x11=yes
3857 libs_mplayer="$libs_mplayer $_ld_tmp $_ld_dl"
3858 break
3860 done
3862 if win32 && cc_check -DGL_WIN32 -lopengl32 ; then
3863 _gl=yes
3864 _gl_win32=yes
3865 libs_mplayer="$libs_mplayer -lopengl32 -lgdi32"
3867 if test "$_cocoa" = yes ; then
3868 _gl=yes
3869 _gl_cocoa=yes
3871 # last so it can reuse any linker etc. flags detected before
3872 if test "$_sdl" = yes ; then
3873 if cc_check -DGL_SDL ||
3874 cc_check -DCONFIG_SDL_SDL_H -DGL_SDL ; then
3875 _gl=yes
3876 _gl_sdl=yes
3877 elif cc_check -DGL_SDL -lGL ||
3878 cc_check -DCONFIG_SDL_SDL_H -DGL_SDL -lGL ; then
3879 _gl=yes
3880 _gl_sdl=yes
3881 libs_mplayer="$libs_mplayer -lGL"
3884 else
3885 _gl=no
3887 if test "$_gl" = yes ; then
3888 def_gl='#define CONFIG_GL 1'
3889 res_comment="backends:"
3890 if test "$_gl_cocoa" = yes ; then
3891 def_gl_cocoa='#define CONFIG_GL_COCOA 1'
3892 res_comment="$res_comment cocoa"
3894 if test "$_gl_win32" = yes ; then
3895 def_gl_win32='#define CONFIG_GL_WIN32 1'
3896 res_comment="$res_comment win32"
3898 if test "$_gl_x11" = yes ; then
3899 def_gl_x11='#define CONFIG_GL_X11 1'
3900 res_comment="$res_comment x11"
3902 if test "$_gl_sdl" = yes ; then
3903 def_gl_sdl='#define CONFIG_GL_SDL 1'
3904 res_comment="$res_comment sdl"
3906 vomodules="opengl $vomodules"
3907 else
3908 def_gl='#undef CONFIG_GL'
3909 def_gl_cocoa='#undef CONFIG_GL_COCOA'
3910 def_gl_win32='#undef CONFIG_GL_WIN32'
3911 def_gl_x11='#undef CONFIG_GL_X11'
3912 def_gl_sdl='#undef CONFIG_GL_SDL'
3913 novomodules="opengl $novomodules"
3915 echores "$_gl"
3918 if win32; then
3920 echocheck "Direct3D"
3921 if test "$_direct3d" = auto ; then
3922 _direct3d=no
3923 header_check d3d9.h && _direct3d=yes
3925 if test "$_direct3d" = yes ; then
3926 def_direct3d='#define CONFIG_DIRECT3D 1'
3927 vomodules="direct3d $vomodules"
3928 else
3929 def_direct3d='#undef CONFIG_DIRECT3D'
3930 novomodules="direct3d $novomodules"
3932 echores "$_direct3d"
3934 echocheck "Directx"
3935 if test "$_directx" = auto ; then
3936 cat > $TMPC << EOF
3937 #include <ddraw.h>
3938 #include <dsound.h>
3939 int main(void) { return 0; }
3941 _directx=no
3942 cc_check -lgdi32 && _directx=yes
3944 if test "$_directx" = yes ; then
3945 def_directx='#define CONFIG_DIRECTX 1'
3946 libs_mplayer="$libs_mplayer -lgdi32"
3947 vomodules="directx $vomodules"
3948 aomodules="dsound $aomodules"
3949 else
3950 def_directx='#undef CONFIG_DIRECTX'
3951 novomodules="directx $novomodules"
3952 noaomodules="dsound $noaomodules"
3954 echores "$_directx"
3956 fi #if win32; then
3959 echocheck "V4L2 MPEG Decoder"
3960 if test "$_v4l2" = auto ; then
3961 cat > $TMPC << EOF
3962 #include <sys/time.h>
3963 #include <linux/videodev2.h>
3964 #include <linux/version.h>
3965 int main(void) {
3966 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
3967 #error kernel headers too old, need 2.6.22
3968 #endif
3969 struct v4l2_ext_controls ctrls;
3970 ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;
3971 return 0;
3974 _v4l2=no
3975 cc_check && _v4l2=yes
3977 if test "$_v4l2" = yes ; then
3978 def_v4l2='#define CONFIG_V4L2_DECODER 1'
3979 vomodules="v4l2 $vomodules"
3980 aomodules="v4l2 $aomodules"
3981 else
3982 def_v4l2='#undef CONFIG_V4L2_DECODER'
3983 novomodules="v4l2 $novomodules"
3984 noaomodules="v4l2 $noaomodules"
3986 echores "$_v4l2"
3990 #########
3991 # AUDIO #
3992 #########
3995 echocheck "OSS Audio"
3996 if test "$_ossaudio" = auto ; then
3997 _ossaudio=no
3998 return_check $_soundcard_header SNDCTL_DSP_SETFRAGMENT && _ossaudio=yes
4000 if test "$_ossaudio" = yes ; then
4001 def_ossaudio='#define CONFIG_OSS_AUDIO 1'
4002 aomodules="oss $aomodules"
4003 cat > $TMPC << EOF
4004 #include <$_soundcard_header>
4005 #ifdef OPEN_SOUND_SYSTEM
4006 int main(void) { return 0; }
4007 #else
4008 #error Not the real thing
4009 #endif
4011 _real_ossaudio=no
4012 cc_check && _real_ossaudio=yes
4013 if test "$_real_ossaudio" = yes; then
4014 def_ossaudio_devdsp='#define PATH_DEV_DSP "/dev/dsp"'
4015 # Check for OSS4 headers (override default headers)
4016 # Does not apply to systems where OSS4 is native (e.g. FreeBSD)
4017 if test -f /etc/oss.conf; then
4018 . /etc/oss.conf
4019 _ossinc="$OSSLIBDIR/include"
4020 if test -f "$_ossinc/sys/soundcard.h"; then
4021 extra_cflags="-I$_ossinc $extra_cflags"
4024 elif netbsd || openbsd ; then
4025 def_ossaudio_devdsp='#define PATH_DEV_DSP "/dev/sound"'
4026 extra_ldflags="$extra_ldflags -lossaudio"
4027 else
4028 def_ossaudio_devdsp='#define PATH_DEV_DSP "/dev/dsp"'
4030 def_ossaudio_devmixer='#define PATH_DEV_MIXER "/dev/mixer"'
4031 else
4032 def_ossaudio='#undef CONFIG_OSS_AUDIO'
4033 def_ossaudio_devdsp='#define PATH_DEV_DSP ""'
4034 def_ossaudio_devmixer='#define PATH_DEV_MIXER ""'
4035 noaomodules="oss $noaomodules"
4037 echores "$_ossaudio"
4040 echocheck "RSound"
4041 if test "$_rsound" = auto ; then
4042 _rsound=no
4043 statement_check rsound.h 'rsd_init(NULL);' -lrsound && _rsound=yes
4045 echores "$_rsound"
4047 if test "$_rsound" = yes ; then
4048 def_rsound='#define CONFIG_RSOUND 1'
4049 aomodules="rsound $aomodules"
4050 libs_mplayer="$libs_mplayer -lrsound"
4051 else
4052 def_rsound='#undef CONFIG_RSOUND'
4053 noaomodules="rsound $noaomodules"
4057 echocheck "pulse"
4058 if test "$_pulse" = auto ; then
4059 _pulse=no
4060 if pkg_config_add 'libpulse >= 0.9' ; then
4061 _pulse=yes
4064 echores "$_pulse"
4066 if test "$_pulse" = yes ; then
4067 def_pulse='#define CONFIG_PULSE 1'
4068 aomodules="pulse $aomodules"
4069 else
4070 def_pulse='#undef CONFIG_PULSE'
4071 noaomodules="pulse $noaomodules"
4075 echocheck "PortAudio"
4076 if test "$_portaudio" = auto && test "$_pthreads" != yes ; then
4077 _portaudio=no
4078 res_comment="pthreads not enabled"
4080 if test "$_portaudio" = auto ; then
4081 _portaudio=no
4082 if pkg_config_add 'portaudio-2.0 >= 19' ; then
4083 _portaudio=yes
4086 echores "$_portaudio"
4088 if test "$_portaudio" = yes ; then
4089 def_portaudio='#define CONFIG_PORTAUDIO 1'
4090 aomodules="portaudio $aomodules"
4091 else
4092 def_portaudio='#undef CONFIG_PORTAUDIO'
4093 noaomodules="portaudio $noaomodules"
4097 echocheck "JACK"
4098 if test "$_jack" = auto ; then
4099 _jack=no
4100 if pkg_config_add jack ; then
4101 _jack=yes
4105 if test "$_jack" = yes ; then
4106 def_jack='#define CONFIG_JACK 1'
4107 aomodules="jack $aomodules"
4108 else
4109 noaomodules="jack $noaomodules"
4111 echores "$_jack"
4113 echocheck "OpenAL"
4114 if test "$_openal" = auto ; then
4115 _openal=no
4116 cat > $TMPC << EOF
4117 #ifdef OPENAL_AL_H
4118 #include <OpenAL/al.h>
4119 #else
4120 #include <AL/al.h>
4121 #endif
4122 int main(void) {
4123 alSourceQueueBuffers(0, 0, 0);
4124 // alGetSourcei(0, AL_SAMPLE_OFFSET, 0);
4125 return 0;
4128 for I in "-lopenal" "-lopenal32" "-framework OpenAL" ; do
4129 cc_check $I && _openal=yes && break
4130 cc_check -DOPENAL_AL_H=1 $I && def_openal_h='#define OPENAL_AL_H 1' && _openal=yes && break
4131 done
4132 test "$_openal" = yes && libs_mplayer="$libs_mplayer $I"
4134 if test "$_openal" = yes ; then
4135 def_openal='#define CONFIG_OPENAL 1'
4136 aomodules="openal $aomodules"
4137 else
4138 noaomodules="openal $noaomodules"
4140 echores "$_openal"
4142 echocheck "ALSA audio"
4143 if test "$_alloca" != yes ; then
4144 _alsa=no
4145 res_comment="alloca missing"
4147 if test "$_alsa" = auto ; then
4148 _alsa=no
4149 if pkg_config_add "alsa >= 1.0.9" ; then
4150 _alsa=yes
4153 def_alsa='#undef CONFIG_ALSA'
4154 if test "$_alsa" = yes ; then
4155 aomodules="alsa $aomodules"
4156 def_alsa='#define CONFIG_ALSA 1'
4157 else
4158 noaomodules="alsa $noaomodules"
4160 echores "$_alsa"
4163 if darwin; then
4164 echocheck "CoreAudio"
4165 if test "$_coreaudio" = auto ; then
4166 cat > $TMPC <<EOF
4167 #include <CoreAudio/CoreAudio.h>
4168 #include <AudioToolbox/AudioToolbox.h>
4169 #include <AudioUnit/AudioUnit.h>
4170 int main(void) { return 0; }
4172 _coreaudio=no
4173 cc_check -framework CoreAudio -framework AudioUnit -framework AudioToolbox && _coreaudio=yes
4175 if test "$_coreaudio" = yes ; then
4176 libs_mplayer="$libs_mplayer -framework CoreAudio -framework AudioUnit -framework AudioToolbox"
4177 def_coreaudio='#define CONFIG_COREAUDIO 1'
4178 aomodules="coreaudio $aomodules"
4179 else
4180 def_coreaudio='#undef CONFIG_COREAUDIO'
4181 noaomodules="coreaudio $noaomodules"
4183 echores $_coreaudio
4184 fi #if darwin
4187 # set default CD/DVD devices
4188 if win32 ; then
4189 default_cdrom_device="D:"
4190 elif darwin ; then
4191 default_cdrom_device="/dev/disk1"
4192 elif dragonfly ; then
4193 default_cdrom_device="/dev/cd0"
4194 elif freebsd ; then
4195 default_cdrom_device="/dev/acd0"
4196 elif openbsd ; then
4197 default_cdrom_device="/dev/rcd0c"
4198 elif amigaos ; then
4199 default_cdrom_device="a1ide.device:2"
4200 else
4201 default_cdrom_device="/dev/cdrom"
4204 if win32 || dragonfly || freebsd || openbsd || amigaos ; then
4205 default_dvd_device=$default_cdrom_device
4206 elif darwin ; then
4207 default_dvd_device="/dev/rdiskN"
4208 else
4209 default_dvd_device="/dev/dvd"
4213 echocheck "VCD support"
4214 if test "$_vcd" = auto; then
4215 _vcd=no
4216 if linux || freebsd || netbsd || openbsd || dragonfly || bsdos || darwin ; then
4217 _vcd=yes
4218 elif mingw32; then
4219 header_check ddk/ntddcdrm.h && _vcd=yes
4222 if test "$_vcd" = yes; then
4223 inputmodules="vcd $inputmodules"
4224 def_vcd='#define CONFIG_VCD 1'
4225 else
4226 def_vcd='#undef CONFIG_VCD'
4227 noinputmodules="vcd $noinputmodules"
4228 res_comment="not supported on this OS"
4230 echores "$_vcd"
4234 echocheck "Blu-ray support"
4235 if test "$_bluray" = auto ; then
4236 _bluray=no
4237 pkg_config_add 'libbluray >= 0.2.1' && _bluray=yes
4239 if test "$_bluray" = yes ; then
4240 def_bluray='#define CONFIG_LIBBLURAY 1'
4241 inputmodules="bluray $inputmodules"
4242 else
4243 def_bluray='#undef CONFIG_LIBBLURAY'
4244 noinputmodules="bluray $noinputmodules"
4246 echores "$_bluray"
4248 echocheck "dvdread"
4249 if test "$_dvdread_internal" = auto && test ! -f "libdvdread4/dvd_reader.c" ; then
4250 _dvdread_internal=no
4252 if test "$_dvdread_internal" = auto ; then
4253 _dvdread_internal=no
4254 _dvdread=no
4255 if (linux || freebsd || netbsd || openbsd || dragonfly || hpux) &&
4256 (test "$_dvd" = yes || test "$_cdrom" = yes || test "$_cdio" = yes ||
4257 test "$_dvdio" = yes || test "$_bsdi_dvd" = yes) ||
4258 darwin || win32; then
4259 _dvdread_internal=yes
4260 _dvdread=yes
4261 extra_cflags="-Ilibdvdread4 $extra_cflags"
4263 elif test "$_dvdread" = auto ; then
4264 _dvdread=no
4265 if test "$_dl" = yes; then
4266 _dvdreadcflags=$($_dvdreadconfig --cflags 2> /dev/null)
4267 _dvdreadlibs=$($_dvdreadconfig --libs 2> /dev/null)
4268 if header_check dvdread/dvd_reader.h $_dvdreadcflags $_dvdreadlibs $_ld_dl ; then
4269 _dvdread=yes
4270 extra_cflags="$extra_cflags $_dvdreadcflags"
4271 extra_ldflags="$extra_ldflags $_dvdreadlibs"
4272 res_comment="external"
4277 if test "$_dvdread_internal" = yes; then
4278 def_dvdread='#define CONFIG_DVDREAD 1'
4279 inputmodules="dvdread(internal) $inputmodules"
4280 res_comment="internal"
4281 elif test "$_dvdread" = yes; then
4282 def_dvdread='#define CONFIG_DVDREAD 1'
4283 extra_ldflags="$extra_ldflags -ldvdread"
4284 inputmodules="dvdread(external) $inputmodules"
4285 res_comment="external"
4286 else
4287 def_dvdread='#undef CONFIG_DVDREAD'
4288 noinputmodules="dvdread $noinputmodules"
4290 echores "$_dvdread"
4293 echocheck "internal libdvdcss"
4294 if test "$_libdvdcss_internal" = auto ; then
4295 _libdvdcss_internal=no
4296 test "$_dvdread_internal" = yes && test -d libdvdcss && _libdvdcss_internal=yes
4297 hpux && test "$_hpux_scsi_h" = no && _libdvdcss_internal=no
4299 if test "$_libdvdcss_internal" = yes ; then
4300 if linux || netbsd || openbsd || bsdos ; then
4301 def_dvd_linux='#define HAVE_LINUX_DVD_STRUCT 1'
4302 openbsd && def_dvd_openbsd='#define HAVE_OPENBSD_DVD_STRUCT 1'
4303 elif freebsd || dragonfly ; then
4304 def_dvd_bsd='#define HAVE_BSD_DVD_STRUCT 1'
4305 elif darwin ; then
4306 def_dvd_darwin='#define DARWIN_DVD_IOCTL'
4307 extra_ldflags="$extra_ldflags -framework IOKit -framework Carbon"
4308 elif cygwin ; then
4309 cflags_libdvdcss="-DSYS_CYGWIN -DWIN32"
4310 elif beos ; then
4311 cflags_libdvdcss="-DSYS_BEOS"
4313 cflags_libdvdcss_dvdread="-Ilibdvdcss"
4314 def_dvdcss="#define HAVE_DVDCSS_DVDCSS_H 1"
4315 inputmodules="libdvdcss(internal) $inputmodules"
4316 else
4317 noinputmodules="libdvdcss(internal) $noinputmodules"
4319 echores "$_libdvdcss_internal"
4322 echocheck "libcdio"
4323 if test "$_libcdio" = auto ; then
4324 _libcdio=no
4325 if pkg_config_add libcdio_paranoia ; then
4326 _libcdio=yes
4329 if test "$_libcdio" = yes ; then
4330 _cdda='yes'
4331 def_cdda='#define CONFIG_CDDA 1'
4332 test $_cddb = auto && test $networking = yes && _cddb=yes
4333 inputmodules="cdda $inputmodules"
4334 else
4335 _libcdio=no
4336 _cdda='no'
4337 def_cdda='#undef CONFIG_CDDA'
4338 noinputmodules="cdda $noinputmodules"
4340 echores "$_libcdio"
4342 if test "$_cddb" = yes ; then
4343 def_cddb='#define CONFIG_CDDB 1'
4344 inputmodules="cddb $inputmodules"
4345 else
4346 _cddb=no
4347 def_cddb='#undef CONFIG_CDDB'
4348 noinputmodules="cddb $noinputmodules"
4352 echocheck "SSA/ASS support"
4353 if test "$_ass" = auto ; then
4354 if pkg_config_add libass ; then
4355 _ass=yes
4356 def_ass='#define CONFIG_ASS 1'
4357 else
4358 die "Unable to find development files for libass. Aborting. If you really mean to compile without libass support use --disable-libass."
4360 else
4361 def_ass='#undef CONFIG_ASS'
4363 echores "$_ass"
4366 echocheck "ENCA"
4367 if test "$_enca" = auto ; then
4368 _enca=no
4369 statement_check enca.h 'enca_get_languages(NULL)' -lenca $_ld_lm && _enca=yes
4371 if test "$_enca" = yes ; then
4372 def_enca='#define CONFIG_ENCA 1'
4373 extra_ldflags="$extra_ldflags -lenca"
4374 else
4375 def_enca='#undef CONFIG_ENCA'
4377 echores "$_enca"
4380 echocheck "zlib"
4381 _zlib=no
4382 statement_check zlib.h 'inflate(0, Z_NO_FLUSH)' -lz && _zlib=yes
4383 if test "$_zlib" = yes ; then
4384 def_zlib='#define CONFIG_ZLIB 1'
4385 extra_ldflags="$extra_ldflags -lz"
4386 else
4387 def_zlib='#define CONFIG_ZLIB 0'
4389 echores "$_zlib"
4392 echocheck "RTC"
4393 if test "$_rtc" = auto ; then
4394 cat > $TMPC << EOF
4395 #include <sys/ioctl.h>
4396 #ifdef __linux__
4397 #include <linux/rtc.h>
4398 #else
4399 #include <rtc.h>
4400 #define RTC_PIE_ON RTCIO_PIE_ON
4401 #endif
4402 int main(void) { return RTC_PIE_ON; }
4404 _rtc=no
4405 cc_check && _rtc=yes
4406 ppc && _rtc=no
4408 if test "$_rtc" = yes ; then
4409 def_rtc='#define HAVE_RTC 1'
4410 else
4411 def_rtc='#undef HAVE_RTC'
4413 echores "$_rtc"
4416 echocheck "mad support"
4417 if test "$_mad" = auto ; then
4418 _mad=no
4419 header_check mad.h -lmad && _mad=yes
4421 if test "$_mad" = yes ; then
4422 def_mad='#define CONFIG_LIBMAD 1'
4423 extra_ldflags="$extra_ldflags -lmad"
4424 codecmodules="libmad $codecmodules"
4425 else
4426 def_mad='#undef CONFIG_LIBMAD'
4427 nocodecmodules="libmad $nocodecmodules"
4429 echores "$_mad"
4431 echocheck "OggVorbis support"
4432 if test "$_libvorbis" = auto; then
4433 _libvorbis=no
4434 statement_check vorbis/codec.h 'vorbis_packet_blocksize(0, 0)' -lvorbis -logg $_ld_lm && _libvorbis=yes && _tremor=no
4435 elif test "$_libvorbis" = yes ; then
4436 _tremor=no
4438 if test "$_tremor" = auto; then
4439 _tremor=no
4440 statement_check tremor/ivorbiscodec.h 'vorbis_packet_blocksize(0, 0)' -logg -lvorbisidec $_ld_lm && _tremor=yes
4442 if test "$_tremor" = yes ; then
4443 _vorbis=yes
4444 def_vorbis='#define CONFIG_OGGVORBIS 1'
4445 def_tremor='#define CONFIG_TREMOR 1'
4446 codecmodules="tremor(external) $codecmodules"
4447 res_comment="external Tremor"
4448 extra_ldflags="$extra_ldflags -logg -lvorbisidec"
4449 elif test "$_libvorbis" = yes ; then
4450 _vorbis=yes
4451 def_vorbis='#define CONFIG_OGGVORBIS 1'
4452 codecmodules="libvorbis $codecmodules"
4453 res_comment="libvorbis"
4454 extra_ldflags="$extra_ldflags -lvorbis -logg"
4455 else
4456 _vorbis=no
4457 nocodecmodules="libvorbis $nocodecmodules"
4459 echores "$_vorbis"
4461 echocheck "libspeex (version >= 1.1 required)"
4462 if test "$_speex" = auto ; then
4463 _speex=no
4464 cat > $TMPC << EOF
4465 #include <stddef.h>
4466 #include <speex/speex.h>
4467 int main(void) { SpeexBits bits; void *dec = NULL; speex_decode_int(dec, &bits, dec); return 0; }
4469 cc_check -lspeex $_ld_lm && _speex=yes
4471 if test "$_speex" = yes ; then
4472 def_speex='#define CONFIG_SPEEX 1'
4473 extra_ldflags="$extra_ldflags -lspeex"
4474 codecmodules="speex $codecmodules"
4475 else
4476 def_speex='#undef CONFIG_SPEEX'
4477 nocodecmodules="speex $nocodecmodules"
4479 echores "$_speex"
4481 echocheck "OggTheora support"
4482 if test "$_theora" = auto ; then
4483 _theora=no
4484 if pkg_config_add theora ; then
4485 _theora=yes
4488 if test "$_theora" = yes ; then
4489 def_theora='#define CONFIG_OGGTHEORA 1'
4490 codecmodules="libtheora $codecmodules"
4491 else
4492 def_theora='#undef CONFIG_OGGTHEORA'
4493 nocodecmodules="libtheora $nocodecmodules"
4495 echores "$_theora"
4497 # Any version of libmpg123 that knows MPG123_RESYNC_LIMIT shall be fine.
4498 # That is, 1.2.0 onwards. Recommened is 1.14 onwards, though.
4499 echocheck "mpg123 support"
4500 def_mpg123='#undef CONFIG_MPG123'
4501 if test "$_mpg123" = auto; then
4502 _mpg123=no
4503 pkg_config_add 'libmpg123 >= 1.2.0' && _mpg123=yes
4505 if test "$_mpg123" = yes ; then
4506 def_mpg123='#define CONFIG_MPG123 1'
4507 codecmodules="mpg123 $codecmodules"
4508 else
4509 nocodecmodules="mpg123 $nocodecmodules"
4511 echores "$_mpg123"
4513 echocheck "liba52 support"
4514 def_liba52='#undef CONFIG_LIBA52'
4515 if test "$_liba52" = auto ; then
4516 _liba52=no
4517 cat > $TMPC << EOF
4518 #include <inttypes.h>
4519 #include <a52dec/a52.h>
4520 int main(void) { a52_state_t *testHand; testHand=a52_init(0); return 0; }
4522 cc_check -la52 && _liba52=yes && extra_ldflags="$extra_ldflags -la52"
4524 if test "$_liba52" = yes ; then
4525 def_liba52='#define CONFIG_LIBA52 1'
4526 codecmodules="liba52 $codecmodules"
4527 else
4528 nocodecmodules="liba52 $nocodecmodules"
4530 echores "$_liba52"
4532 echocheck "libdca support"
4533 if test "$_libdca" = auto ; then
4534 _libdca=no
4535 for _ld_dca in -ldca -ldts ; do
4536 statement_check_broken stdint.h dts.h 'dts_init(0)' $_ld_dca $_ld_lm &&
4537 extra_ldflags="$extra_ldflags $_ld_dca" && _libdca=yes && break
4538 done
4540 if test "$_libdca" = yes ; then
4541 def_libdca='#define CONFIG_LIBDCA 1'
4542 codecmodules="libdca $codecmodules"
4543 else
4544 def_libdca='#undef CONFIG_LIBDCA'
4545 nocodecmodules="libdca $nocodecmodules"
4547 echores "$_libdca"
4549 echocheck "libmpcdec (musepack, version >= 1.2.1 required)"
4550 if test "$_musepack" = yes ; then
4551 _musepack=no
4552 cat > $TMPC << EOF
4553 #include <stddef.h>
4554 #include <mpcdec/mpcdec.h>
4555 int main(void) {
4556 mpc_streaminfo info;
4557 mpc_decoder decoder;
4558 mpc_decoder_set_streaminfo(&decoder, &info);
4559 mpc_decoder_decode_frame(&decoder, NULL, 0, NULL);
4560 return 0;
4563 cc_check -lmpcdec $_ld_lm && _musepack=yes
4565 if test "$_musepack" = yes ; then
4566 def_musepack='#define CONFIG_MUSEPACK 1'
4567 extra_ldflags="$extra_ldflags -lmpcdec"
4568 codecmodules="musepack $codecmodules"
4569 else
4570 def_musepack='#undef CONFIG_MUSEPACK'
4571 nocodecmodules="musepack $nocodecmodules"
4573 echores "$_musepack"
4576 echocheck "FAAD2 support"
4577 if test "$_faad" = auto ; then
4578 _faad=no
4579 cat > $TMPC << EOF
4580 #include <faad.h>
4581 #ifndef FAAD_MIN_STREAMSIZE
4582 #error Too old version
4583 #endif
4584 int main(void) { faacDecHandle testhand; faacDecFrameInfo testinfo;
4585 testhand = faacDecOpen(); faacDecInit(0, 0, 0, 0, 0); return 0; }
4587 cc_check -lfaad $_ld_lm && _faad=yes
4590 def_faad='#undef CONFIG_FAAD'
4591 if test "$_faad" = yes ; then
4592 def_faad='#define CONFIG_FAAD 1'
4593 extra_ldflags="$extra_ldflags -lfaad"
4594 codecmodules="faad2 $codecmodules"
4595 else
4596 nocodecmodules="faad2 $nocodecmodules"
4598 echores "$_faad"
4601 echocheck "LADSPA plugin support"
4602 if test "$_ladspa" = auto ; then
4603 _ladspa=no
4604 statement_check ladspa.h 'LADSPA_Descriptor ld = {0}' && _ladspa=yes
4606 if test "$_ladspa" = yes; then
4607 def_ladspa="#define CONFIG_LADSPA 1"
4608 else
4609 def_ladspa="#undef CONFIG_LADSPA"
4611 echores "$_ladspa"
4614 echocheck "libbs2b audio filter support"
4615 if test "$_libbs2b" = auto ; then
4616 _libbs2b=no
4617 if pkg_config_add libbs2b ; then
4618 _libbs2b=yes
4621 def_libbs2b="#undef CONFIG_LIBBS2B"
4622 test "$_libbs2b" = yes && def_libbs2b="#define CONFIG_LIBBS2B 1"
4623 echores "$_libbs2b"
4626 if test -z "$_codecsdir" ; then
4627 for dir in "$_libdir/codecs" "$_libdir/win32" /usr/local/lib/codecs \
4628 /usr/lib/codecs /usr/local/lib/win32 /usr/lib/win32 ; do
4629 if test -d "$dir" ; then
4630 _codecsdir="$dir"
4631 break;
4633 done
4635 # Fall back on default directory.
4636 if test -z "$_codecsdir" ; then
4637 _codecsdir="$_libdir/codecs"
4638 mingw32 && _codecsdir="codecs"
4642 echocheck "Win32 codecs"
4643 if test "$_win32dll" = auto ; then
4644 _win32dll=no
4645 if x86_32 && ! qnx; then
4646 _win32dll=yes
4649 if test "$_win32dll" = yes ; then
4650 def_win32dll='#define CONFIG_WIN32DLL 1'
4651 if ! win32 ; then
4652 def_win32_loader='#define WIN32_LOADER 1'
4653 _win32_emulation=yes
4654 else
4655 extra_ldflags="$extra_ldflags -ladvapi32 -lole32"
4656 res_comment="using native windows"
4658 codecmodules="win32 $codecmodules"
4659 else
4660 def_win32dll='#undef CONFIG_WIN32DLL'
4661 def_win32_loader='#undef WIN32_LOADER'
4662 nocodecmodules="win32 $nocodecmodules"
4664 echores "$_win32dll"
4667 echocheck "XAnim codecs"
4668 if test "$_xanim" = auto ; then
4669 _xanim=no
4670 res_comment="dynamic loader support needed"
4671 if test "$_dl" = yes ; then
4672 _xanim=yes
4675 if test "$_xanim" = yes ; then
4676 def_xanim='#define CONFIG_XANIM 1'
4677 codecmodules="xanim $codecmodules"
4678 else
4679 def_xanim='#undef CONFIG_XANIM'
4680 nocodecmodules="xanim $nocodecmodules"
4682 echores "$_xanim"
4685 echocheck "RealPlayer codecs"
4686 if test "$_real" = auto ; then
4687 _real=no
4688 res_comment="dynamic loader support needed"
4689 if test "$_dl" = yes || test "$_win32dll" = yes &&
4690 (linux || freebsd || netbsd || openbsd || dragonfly || darwin || win32) ; then
4691 _real=yes
4694 if test "$_real" = yes ; then
4695 def_real='#define CONFIG_REALCODECS 1'
4696 codecmodules="real $codecmodules"
4697 else
4698 def_real='#undef CONFIG_REALCODECS'
4699 nocodecmodules="real $nocodecmodules"
4701 echores "$_real"
4704 echocheck "QuickTime codecs"
4705 _qtx_emulation=no
4706 def_qtx_win32='#undef CONFIG_QTX_CODECS_WIN32'
4707 if test "$_qtx" = auto ; then
4708 test "$_win32dll" = yes || test "$quicktime" = yes && _qtx=yes
4710 if test "$_qtx" = yes ; then
4711 def_qtx='#define CONFIG_QTX_CODECS 1'
4712 win32 && _qtx_codecs_win32=yes && def_qtx_win32='#define CONFIG_QTX_CODECS_WIN32 1'
4713 codecmodules="qtx $codecmodules"
4714 darwin || win32 || _qtx_emulation=yes
4715 else
4716 def_qtx='#undef CONFIG_QTX_CODECS'
4717 nocodecmodules="qtx $nocodecmodules"
4719 echores "$_qtx"
4721 echocheck "LCMS2 support"
4722 if test "$_lcms2" = auto ; then
4723 _lcms2=no
4724 if pkg_config_add lcms2 ; then
4725 _lcms2=yes
4728 if test "$_lcms2" = yes; then
4729 def_lcms2="#define CONFIG_LCMS2 1"
4730 else
4731 def_lcms2="#undef CONFIG_LCMS2"
4733 echores "$_lcms2"
4736 all_libav_libs="libavutil > 51.21.0:libavcodec >= 54.25.0:libavformat > 53.20.0:libswscale >= 2.0.0"
4737 echocheck "Libav ($all_libav_libs)"
4738 if test "$ffmpeg" = auto ; then
4739 IFS=":" # shell should not be used for programming
4740 if ! pkg_config_add $all_libav_libs ; then
4741 die "Unable to find development files for some of the required Libav libraries above. Aborting."
4744 echores "yes"
4746 echocheck "libpostproc >= 52.0.0"
4747 if test "$libpostproc" = auto ; then
4748 libpostproc=no
4749 if pkg_config_add "libpostproc >= 52.0.0" ; then
4750 libpostproc=yes
4753 if test "$libpostproc" = yes ; then
4754 def_libpostproc='#define CONFIG_LIBPOSTPROC 1'
4755 else
4756 def_libpostproc='#undef CONFIG_LIBPOSTPROC'
4758 echores "$libpostproc"
4760 echocheck "libavresample >= 1.0.0"
4761 if test "$libavresample" = auto ; then
4762 libavresample=no
4763 if pkg_config_add "libavresample >= 1.0.0" ; then
4764 libavresample=yes
4767 if test "$libavresample" = yes ; then
4768 def_libavresample='#define CONFIG_LIBAVRESAMPLE 1'
4769 else
4770 def_libavresample='#undef CONFIG_LIBAVRESAMPLE'
4772 echores "$libavresample"
4774 echocheck "libdv-0.9.5+"
4775 if test "$_libdv" = auto ; then
4776 _libdv=no
4777 statement_check libdv/dv.h 'dv_encoder_new(1, 1, 1)' -ldv $_ld_pthread $_ld_lm && _libdv=yes
4779 if test "$_libdv" = yes ; then
4780 def_libdv='#define CONFIG_LIBDV095 1'
4781 extra_ldflags="$extra_ldflags -ldv"
4782 codecmodules="libdv $codecmodules"
4783 else
4784 def_libdv='#undef CONFIG_LIBDV095'
4785 nocodecmodules="libdv $nocodecmodules"
4787 echores "$_libdv"
4790 echocheck "Xvid"
4791 if test "$_xvid" = auto ; then
4792 _xvid=no
4793 for _ld_tmp in "-lxvidcore $_ld_lm" "-lxvidcore $_ld_lm $_ld_pthread" ; do
4794 statement_check xvid.h 'xvid_global(0, 0, 0, 0)' $_ld_tmp &&
4795 extra_ldflags="$extra_ldflags $_ld_tmp" && _xvid=yes && break
4796 done
4799 if test "$_xvid" = yes ; then
4800 def_xvid='#define CONFIG_XVID4 1'
4801 codecmodules="xvid $codecmodules"
4802 else
4803 def_xvid='#undef CONFIG_XVID4'
4804 nocodecmodules="xvid $nocodecmodules"
4806 echores "$_xvid"
4809 echocheck "libnut"
4810 if test "$_libnut" = auto ; then
4811 _libnut=no
4812 statement_check libnut.h 'nut_context_tt * nut; nut_error(0)' -lnut && _libnut=yes
4815 if test "$_libnut" = yes ; then
4816 def_libnut='#define CONFIG_LIBNUT 1'
4817 extra_ldflags="$extra_ldflags -lnut"
4818 else
4819 def_libnut='#undef CONFIG_LIBNUT'
4821 echores "$_libnut"
4824 echocheck "UnRAR executable"
4825 if test "$_unrar_exec" = auto ; then
4826 _unrar_exec="yes"
4827 mingw32 && _unrar_exec="no"
4829 if test "$_unrar_exec" = yes ; then
4830 def_unrar_exec='#define CONFIG_UNRAR_EXEC 1'
4831 else
4832 def_unrar_exec='#undef CONFIG_UNRAR_EXEC'
4834 echores "$_unrar_exec"
4836 echocheck "TV interface"
4837 if test "$_tv" = yes ; then
4838 def_tv='#define CONFIG_TV 1'
4839 inputmodules="tv $inputmodules"
4840 else
4841 noinputmodules="tv $noinputmodules"
4842 def_tv='#undef CONFIG_TV'
4844 echores "$_tv"
4847 if freebsd || netbsd || openbsd || dragonfly || bsdos ; then
4848 echocheck "*BSD BT848 bt8xx header"
4849 _ioctl_bt848_h=no
4850 for file in "machine/ioctl_bt848.h" \
4851 "dev/bktr/ioctl_bt848.h" \
4852 "dev/video/bktr/ioctl_bt848.h" \
4853 "dev/ic/bt8xx.h" ; do
4854 cat > $TMPC <<EOF
4855 #include <sys/types.h>
4856 #include <sys/ioctl.h>
4857 #include <$file>
4858 int main(void) { ioctl(0, TVTUNER_GETFREQ, 0); return 0; }
4860 if cc_check ; then
4861 _ioctl_bt848_h=yes
4862 _ioctl_bt848_h_name="$file"
4863 break;
4865 done
4866 if test "$_ioctl_bt848_h" = yes ; then
4867 def_ioctl_bt848_h_name="#define IOCTL_BT848_H_NAME <$_ioctl_bt848_h_name>"
4868 res_comment="using $_ioctl_bt848_h_name"
4869 else
4870 def_ioctl_bt848_h_name="#undef IOCTL_BT848_H_NAME"
4872 echores "$_ioctl_bt848_h"
4874 echocheck "*BSD ioctl_meteor.h"
4875 _ioctl_meteor_h=no
4876 for ioctl_meteor_h_path in "machine/ioctl_meteor.h" "dev/bktr/ioctl_meteor.h" "dev/video/bktr/ioctl_meteor.h" ; do
4877 statement_check_broken "sys/types.h" "$ioctl_meteor_h_path" 'ioctl(0, METEORSINPUT, 0)' &&
4878 _ioctl_meteor_h=yes && break
4879 done
4880 if test "$_ioctl_meteor_h" = yes ; then
4881 def_ioctl_meteor_h_name="#define IOCTL_METEOR_H_NAME <$ioctl_meteor_h_path>"
4882 res_comment="using $ioctl_meteor_h_path"
4883 else
4884 def_ioctl_meteor_h_name="#undef IOCTL_METEOR_H_NAME"
4886 echores "$_ioctl_meteor_h"
4888 echocheck "*BSD BrookTree 848 TV interface"
4889 if test "$_tv_bsdbt848" = auto ; then
4890 _tv_bsdbt848=no
4891 if test "$_tv" = yes ; then
4892 cat > $TMPC <<EOF
4893 #include <sys/types.h>
4894 $def_ioctl_meteor_h_name
4895 $def_ioctl_bt848_h_name
4896 #ifdef IOCTL_METEOR_H_NAME
4897 #include IOCTL_METEOR_H_NAME
4898 #endif
4899 #ifdef IOCTL_BT848_H_NAME
4900 #include IOCTL_BT848_H_NAME
4901 #endif
4902 int main(void) {
4903 ioctl(0, METEORSINPUT, 0);
4904 ioctl(0, TVTUNER_GETFREQ, 0);
4905 return 0;
4908 cc_check && _tv_bsdbt848=yes
4911 if test "$_tv_bsdbt848" = yes ; then
4912 def_tv_bsdbt848='#define CONFIG_TV_BSDBT848 1'
4913 inputmodules="tv-bsdbt848 $inputmodules"
4914 else
4915 def_tv_bsdbt848='#undef CONFIG_TV_BSDBT848'
4916 noinputmodules="tv-bsdbt848 $noinputmodules"
4918 echores "$_tv_bsdbt848"
4919 fi #if freebsd || netbsd || openbsd || dragonfly || bsdos
4922 echocheck "DirectShow TV interface"
4923 if test "$_tv_dshow" = auto ; then
4924 _tv_dshow=no
4925 if test "$_tv" = yes && win32 ; then
4926 statement_check ole2.h 'void* p; CoCreateInstance((GUID*)&GUID_NULL, NULL, CLSCTX_INPROC_SERVER, &GUID_NULL, &p)' -lole32 -luuid && _tv_dshow=yes
4929 if test "$_tv_dshow" = yes ; then
4930 inputmodules="tv-dshow $inputmodules"
4931 def_tv_dshow='#define CONFIG_TV_DSHOW 1'
4932 extra_ldflags="$extra_ldflags -lole32 -luuid"
4933 else
4934 noinputmodules="tv-dshow $noinputmodules"
4935 def_tv_dshow='#undef CONFIG_TV_DSHOW'
4937 echores "$_tv_dshow"
4940 echocheck "Video 4 Linux 2 TV interface"
4941 if test "$_tv_v4l2" = auto ; then
4942 _tv_v4l2=no
4943 if test "$_tv" = yes && linux ; then
4944 header_check_broken sys/time.h linux/videodev2.h && _tv_v4l2=yes
4945 elif test "$_tv" = yes && test "$sys_videoio_h" = "yes" ; then
4946 _tv_v4l2=yes
4949 if test "$_tv_v4l2" = yes ; then
4950 _audio_input=yes
4951 def_tv_v4l2='#define CONFIG_TV_V4L2 1'
4952 inputmodules="tv-v4l2 $inputmodules"
4953 else
4954 noinputmodules="tv-v4l2 $noinputmodules"
4955 def_tv_v4l2='#undef CONFIG_TV_V4L2'
4957 echores "$_tv_v4l2"
4960 echocheck "Radio interface"
4961 if test "$_radio" = yes ; then
4962 def_radio='#define CONFIG_RADIO 1'
4963 inputmodules="radio $inputmodules"
4964 if test "$_alsa" != yes -a "$_ossaudio" != yes ; then
4965 _radio_capture=no
4967 if test "$_radio_capture" = yes ; then
4968 _audio_input=yes
4969 def_radio_capture="#define CONFIG_RADIO_CAPTURE 1"
4970 else
4971 def_radio_capture="#undef CONFIG_RADIO_CAPTURE"
4973 else
4974 noinputmodules="radio $noinputmodules"
4975 def_radio='#undef CONFIG_RADIO'
4976 def_radio_capture="#undef CONFIG_RADIO_CAPTURE"
4977 _radio_capture=no
4979 echores "$_radio"
4980 echocheck "Capture for Radio interface"
4981 echores "$_radio_capture"
4983 echocheck "Video 4 Linux 2 Radio interface"
4984 if test "$_radio_v4l2" = auto ; then
4985 _radio_v4l2=no
4986 if test "$_radio" = yes && linux ; then
4987 header_check linux/videodev2.h && _radio_v4l2=yes
4990 if test "$_radio_v4l2" = yes ; then
4991 def_radio_v4l2='#define CONFIG_RADIO_V4L2 1'
4992 else
4993 def_radio_v4l2='#undef CONFIG_RADIO_V4L2'
4995 echores "$_radio_v4l2"
4997 if freebsd || netbsd || openbsd || dragonfly || bsdos &&
4998 test "$_radio" = yes && test "$_radio_bsdbt848" = auto ; then
4999 echocheck "*BSD BrookTree 848 Radio interface"
5000 _radio_bsdbt848=no
5001 cat > $TMPC <<EOF
5002 #include <sys/types.h>
5003 $def_ioctl_bt848_h_name
5004 #ifdef IOCTL_BT848_H_NAME
5005 #include IOCTL_BT848_H_NAME
5006 #endif
5007 int main(void) { ioctl(0, RADIO_GETFREQ, 0); return 0; }
5009 cc_check && _radio_bsdbt848=yes
5010 echores "$_radio_bsdbt848"
5011 fi #if freebsd || netbsd || openbsd || dragonfly || bsdos && _radio && _radio_bsdbt848
5013 if test "$_radio_bsdbt848" = yes ; then
5014 def_radio_bsdbt848='#define CONFIG_RADIO_BSDBT848 1'
5015 else
5016 def_radio_bsdbt848='#undef CONFIG_RADIO_BSDBT848'
5019 if test "$_radio_v4l2" = no &&
5020 test "$_radio_bsdbt848" = no && test "$_radio" = yes ; then
5021 die "Radio driver requires BSD BT848 or V4L2!"
5024 echocheck "Video 4 Linux 2 MPEG PVR interface"
5025 if test "$_pvr" = auto ; then
5026 _pvr=no
5027 if test "$_tv_v4l2" = yes && linux ; then
5028 cat > $TMPC <<EOF
5029 #include <sys/time.h>
5030 #include <linux/videodev2.h>
5031 int main(void) { struct v4l2_ext_controls ext; return ext.controls->value; }
5033 cc_check && _pvr=yes
5036 if test "$_pvr" = yes ; then
5037 def_pvr='#define CONFIG_PVR 1'
5038 inputmodules="pvr $inputmodules"
5039 else
5040 noinputmodules="pvr $noinputmodules"
5041 def_pvr='#undef CONFIG_PVR'
5043 echores "$_pvr"
5046 echocheck "ftp"
5047 if test "$_ftp" = "auto" ; then
5048 test "$networking" = "yes" && ! beos && _ftp=yes
5050 if test "$_ftp" = yes ; then
5051 def_ftp='#define CONFIG_FTP 1'
5052 inputmodules="ftp $inputmodules"
5053 else
5054 noinputmodules="ftp $noinputmodules"
5055 def_ftp='#undef CONFIG_FTP'
5057 echores "$_ftp"
5059 echocheck "vstream client"
5060 if test "$_vstream" = auto ; then
5061 _vstream=no
5062 cat > $TMPC <<EOF
5063 #include <vstream-client.h>
5064 void vstream_error(const char *format, ... ) {}
5065 int main(void) { vstream_start(); return 0; }
5067 cc_check -lvstream-client && _vstream=yes
5069 if test "$_vstream" = yes ; then
5070 def_vstream='#define CONFIG_VSTREAM 1'
5071 inputmodules="vstream $inputmodules"
5072 extra_ldflags="$extra_ldflags -lvstream-client"
5073 else
5074 noinputmodules="vstream $noinputmodules"
5075 def_vstream='#undef CONFIG_VSTREAM'
5077 echores "$_vstream"
5080 echocheck "XMMS inputplugin support"
5081 if test "$_xmms" = yes ; then
5082 if ( xmms-config --version ) >/dev/null 2>&1 ; then
5083 _xmmsplugindir=$(xmms-config --input-plugin-dir)
5084 _xmmslibdir=$(xmms-config --exec-prefix)/lib
5085 else
5086 _xmmsplugindir=/usr/lib/xmms/Input
5087 _xmmslibdir=/usr/lib
5090 def_xmms='#define CONFIG_XMMS 1'
5091 if darwin ; then
5092 extra_ldflags="$extra_ldflags ${_xmmslibdir}/libxmms.dylib"
5093 else
5094 extra_ldflags="$extra_ldflags ${_xmmslibdir}/libxmms.so.1 -export-dynamic"
5096 else
5097 def_xmms='#undef CONFIG_XMMS'
5099 echores "$_xmms"
5101 if test "$_charset" != "noconv" ; then
5102 def_charset="#define MSG_CHARSET \"$_charset\""
5103 else
5104 def_charset="#undef MSG_CHARSET"
5105 _charset="UTF-8"
5108 #############################################################################
5110 echocheck "automatic gdb attach"
5111 if test "$_crash_debug" = yes ; then
5112 def_crash_debug='#define CONFIG_CRASH_DEBUG 1'
5113 else
5114 def_crash_debug='#undef CONFIG_CRASH_DEBUG'
5115 _crash_debug=no
5117 echores "$_crash_debug"
5119 echocheck "compiler support for noexecstack"
5120 if cflag_check -Wl,-z,noexecstack ; then
5121 extra_ldflags="-Wl,-z,noexecstack $extra_ldflags"
5122 echores "yes"
5123 else
5124 echores "no"
5127 echocheck "linker support for --nxcompat --no-seh --dynamicbase"
5128 if cflag_check "-Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase" ; then
5129 extra_ldflags="-Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase $extra_ldflags"
5130 echores "yes"
5131 else
5132 echores "no"
5136 # Dynamic linking flags
5137 # (FIXME: 'echocheck "dynamic linking"' above and modify here accordingly)
5138 _ld_dl_dynamic=''
5139 freebsd || netbsd || openbsd || dragonfly || bsdos && _ld_dl_dynamic='-rdynamic'
5140 if test "$_real" = yes || test "$_xanim" = yes && ! win32 && ! qnx && ! darwin ; then
5141 _ld_dl_dynamic='-rdynamic'
5144 extra_ldflags="$extra_ldflags $_ld_pthread $_ld_dl $_ld_dl_dynamic"
5145 bsdos && extra_ldflags="$extra_ldflags -ldvd"
5146 (netbsd || openbsd) && x86_32 && extra_ldflags="$extra_ldflags -li386"
5148 def_debug='#undef MP_DEBUG'
5149 test "$_debug" != "" && def_debug='#define MP_DEBUG 1'
5152 echocheck "joystick"
5153 def_joystick='#undef CONFIG_JOYSTICK'
5154 if test "$_joystick" = yes ; then
5155 if linux || freebsd ; then
5156 # TODO add some check
5157 def_joystick='#define CONFIG_JOYSTICK 1'
5158 else
5159 _joystick="no"
5160 res_comment="unsupported under $system_name"
5163 echores "$_joystick"
5165 echocheck "lirc"
5166 if test "$_lirc" = auto ; then
5167 _lirc=no
5168 header_check lirc/lirc_client.h -llirc_client && _lirc=yes
5170 if test "$_lirc" = yes ; then
5171 def_lirc='#define CONFIG_LIRC 1'
5172 libs_mplayer="$libs_mplayer -llirc_client"
5173 else
5174 def_lirc='#undef CONFIG_LIRC'
5176 echores "$_lirc"
5178 echocheck "lircc"
5179 if test "$_lircc" = auto ; then
5180 _lircc=no
5181 header_check lirc/lircc.h -llircc && _lircc=yes
5183 if test "$_lircc" = yes ; then
5184 def_lircc='#define CONFIG_LIRCC 1'
5185 libs_mplayer="$libs_mplayer -llircc"
5186 else
5187 def_lircc='#undef CONFIG_LIRCC'
5189 echores "$_lircc"
5191 #############################################################################
5193 CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"
5195 # This must be the last test to be performed. Any other tests following it
5196 # could fail due to linker errors. libdvdnavmini is intentionally not linked
5197 # against libdvdread (to permit MPlayer to use its own copy of the library).
5198 # So any compilation using the flags added here but not linking against
5199 # libdvdread can fail.
5200 echocheck "DVD support (libdvdnav)"
5201 if test "$_dvdread_internal" = yes && test ! -f "libdvdnav/dvdnav.c" ; then
5202 _dvdnav=no
5204 dvdnav_internal=no
5205 if test "$_dvdnav" = auto ; then
5206 if test "$_dvdread_internal" = yes ; then
5207 _dvdnav=yes
5208 dvdnav_internal=yes
5209 res_comment="internal"
5210 else
5211 $_dvdnavconfig --version --minilibs >> $TMPLOG 2>&1 || _dvdnav=no
5214 if test "$_dvdnav" = auto ; then
5215 _dvdnav=no
5216 _dvdnavdir=$($_dvdnavconfig --cflags)
5217 _dvdnavlibs=$($_dvdnavconfig --libs)
5218 statement_check_broken stdint.h dvdnav/dvdnav.h 'dvdnav_t *dvd = 0' $_dvdnavdir $_dvdnavlibs $_ld_dl $_ld_pthread && _dvdnav=yes
5220 if test "$_dvdnav" = yes ; then
5221 def_dvdnav='#define CONFIG_DVDNAV 1'
5222 if test "$dvdnav_internal" = yes ; then
5223 cflags_libdvdnav="-Ilibdvdnav"
5224 inputmodules="dvdnav(internal) $inputmodules"
5225 else
5226 extra_cflags="$extra_cflags $($_dvdnavconfig --cflags)"
5227 extra_ldflags="$extra_ldflags $($_dvdnavconfig --minilibs)"
5228 inputmodules="dvdnav $inputmodules"
5230 else
5231 def_dvdnav='#undef CONFIG_DVDNAV'
5232 noinputmodules="dvdnav $noinputmodules"
5234 echores "$_dvdnav"
5236 # DO NOT ADD ANY TESTS THAT USE LINKER FLAGS HERE (like cc_check).
5237 # Read dvdnav comment above.
5239 mak_enable () {
5240 list=$(echo $1 | tr '[a-z]' '[A-Z]')
5241 item=$(echo $2 | tr '[a-z]' '[A-Z]')
5242 nprefix=$3;
5243 for part in $list; do
5244 if $(echo $item | grep -q -E "(^| )$part($| )"); then
5245 echo "${nprefix}_$part = yes"
5247 done
5250 #############################################################################
5251 echo "Creating config.mak"
5252 cat > config.mak << EOF
5253 # -------- Generated by configure -----------
5255 # Ensure that locale settings do not interfere with shell commands.
5256 export LC_ALL = C
5258 CONFIGURATION = $configuration
5260 CHARSET = $_charset
5261 DOC_LANGS = $language_doc
5262 DOC_LANG_ALL = $doc_lang_all
5263 MAN_LANGS = $language_man
5264 MAN_LANG_ALL = $man_lang_all
5265 MSG_LANGS = $language_msg
5266 MSG_LANG_ALL = $msg_lang_all
5268 prefix = \$(DESTDIR)$_prefix
5269 BINDIR = \$(DESTDIR)$_bindir
5270 LIBDIR = \$(DESTDIR)$_libdir
5271 MANDIR = \$(DESTDIR)$_mandir
5272 CONFDIR = \$(DESTDIR)$_confdir
5273 LOCALEDIR = \$(DESTDIR)$_localedir
5275 CC = $_cc
5276 INSTALL = $_install
5277 INSTALLSTRIP = $_install_strip
5278 WINDRES = $_windres
5280 CFLAGS = $WARNFLAGS $ERRORFLAGS $WARN_CFLAGS $CFLAGS $extra_cflags
5281 DEPFLAGS = $DEPFLAGS
5283 CFLAGS_LIBDVDCSS = $cflags_libdvdcss
5284 CFLAGS_LIBDVDCSS_DVDREAD = $cflags_libdvdcss_dvdread
5285 CFLAGS_LIBDVDNAV = $cflags_libdvdnav
5286 CFLAGS_NO_OMIT_LEAF_FRAME_POINTER = $cflags_no_omit_leaf_frame_pointer
5287 CFLAGS_STACKREALIGN = $cflags_stackrealign
5289 EXTRALIBS = $extra_ldflags $_ld_static $_ld_lm $extra_libs
5290 EXTRALIBS_MPLAYER = $libs_mplayer
5292 GETCH = $_getch
5293 TIMER = $_timer
5294 RST2MAN = $_rst2man
5296 EXESUF = $_exesuf
5297 EXESUFS_ALL = .exe
5299 ARCH = $arch
5300 $(mak_enable "$arch_all" "$arch" ARCH)
5301 $(mak_enable "$subarch_all" "$subarch" ARCH)
5302 $(mak_enable "$cpuexts_all" "$cpuexts" HAVE)
5304 NEED_GETTIMEOFDAY = $need_gettimeofday
5305 NEED_GLOB = $need_glob
5306 NEED_SETENV = $need_setenv
5307 NEED_SHMEM = $need_shmem
5308 NEED_STRSEP = $need_strsep
5309 NEED_SWAB = $need_swab
5310 NEED_VSSCANF = $need_vsscanf
5312 # features
5313 ALSA = $_alsa
5314 APPLE_IR = $_apple_ir
5315 APPLE_REMOTE = $_apple_remote
5316 AUDIO_INPUT = $_audio_input
5317 CACA = $_caca
5318 CDDA = $_cdda
5319 CDDB = $_cddb
5320 COCOA = $_cocoa
5321 COREAUDIO = $_coreaudio
5322 COREVIDEO = $_corevideo
5323 SHAREDBUFFER = $_sharedbuffer
5324 DIRECT3D = $_direct3d
5325 DIRECTFB = $_directfb
5326 DIRECTX = $_directx
5327 DVBIN = $_dvbin
5328 DVDNAV = $_dvdnav
5329 DVDNAV_INTERNAL = $dvdnav_internal
5330 DVDREAD = $_dvdread
5331 DVDREAD_INTERNAL = $_dvdread_internal
5332 DXR3 = $_dxr3
5333 FAAD = $_faad
5334 FASTMEMCPY = $_fastmemcpy
5335 FTP = $_ftp
5336 GIF = $_gif
5337 GL = $_gl
5338 GL_COCOA = $_gl_cocoa
5339 GL_WIN32 = $_gl_win32
5340 GL_X11 = $_gl_x11
5341 GL_SDL = $_gl_sdl
5342 HAVE_POSIX_SELECT = $_posix_select
5343 HAVE_SYS_MMAN_H = $_mman
5344 JACK = $_jack
5345 JOYSTICK = $_joystick
5346 JPEG = $_jpeg
5347 LADSPA = $_ladspa
5348 LIBA52 = $_liba52
5349 LIBASS = $_ass
5350 LIBBLURAY = $_bluray
5351 LIBBS2B = $_libbs2b
5352 LIBDCA = $_libdca
5353 LIBDV = $_libdv
5354 LIBDVDCSS_INTERNAL = $_libdvdcss_internal
5355 LIBMAD = $_mad
5356 LCMS2 = $_lcms2
5357 LIBNUT = $_libnut
5358 LIBPOSTPROC = $libpostproc
5359 LIBAVRESAMPLE = $libavresample
5360 LIBSMBCLIENT = $_smb
5361 LIBQUVI = $_libquvi
5362 LIBTHEORA = $_theora
5363 LIRC = $_lirc
5364 MACOSX_FINDER = $_macosx_finder
5365 MD5SUM = $_md5sum
5366 MNG = $_mng
5367 MPG123 = $_mpg123
5368 MUSEPACK = $_musepack
5369 NETWORKING = $networking
5370 OPENAL = $_openal
5371 OSS = $_ossaudio
5372 PE_EXECUTABLE = $_pe_executable
5373 PNG = $_png
5374 PNM = $_pnm
5375 PRIORITY = $_priority
5376 PULSE = $_pulse
5377 PORTAUDIO = $_portaudio
5378 PVR = $_pvr
5379 QTX_CODECS = $_qtx
5380 QTX_CODECS_WIN32 = $_qtx_codecs_win32
5381 QTX_EMULATION = $_qtx_emulation
5382 RADIO=$_radio
5383 RADIO_CAPTURE=$_radio_capture
5384 REAL_CODECS = $_real
5385 RSOUND = $_rsound
5386 SDL = $_sdl
5387 SPEEX = $_speex
5388 STREAM_CACHE = $_stream_cache
5389 TGA = $_tga
5390 TV = $_tv
5391 TV_BSDBT848 = $_tv_bsdbt848
5392 TV_DSHOW = $_tv_dshow
5393 TV_V4L2 = $_tv_v4l2
5394 UNRAR_EXEC = $_unrar_exec
5395 V4L2 = $_v4l2
5396 VCD = $_vcd
5397 VDPAU = $_vdpau
5398 VORBIS = $_vorbis
5399 VSTREAM = $_vstream
5400 WIN32DLL = $_win32dll
5401 WIN32_EMULATION = $_win32_emulation
5402 X11 = $_x11
5403 XANIM_CODECS = $_xanim
5404 XMMS_PLUGINS = $_xmms
5405 XV = $_xv
5406 XVID4 = $_xvid
5407 YUV4MPEG = $_yuv4mpeg
5409 CONFIG_VDPAU = $_vdpau
5410 CONFIG_ZLIB = $_zlib
5412 HAVE_PTHREADS = $_pthreads
5413 HAVE_SHM = $_shm
5414 HAVE_W32THREADS = $_w32threads
5418 #############################################################################
5420 ff_config_enable () {
5421 list=$(echo $1 | tr '[a-z]' '[A-Z]')
5422 item=$(echo $2 | tr '[a-z]' '[A-Z]')
5423 _nprefix=$3;
5424 test -z "$_nprefix" && _nprefix='CONFIG'
5425 for part in $list; do
5426 if $(echo $item | grep -q -E "(^| )$part($| )"); then
5427 echo "#define ${_nprefix}_$part 1"
5428 else
5429 echo "#define ${_nprefix}_$part 0"
5431 done
5434 echo "Creating config.h"
5435 cat > $TMPH << EOF
5436 /*----------------------------------------------------------------------------
5437 ** This file has been automatically generated by configure any changes in it
5438 ** will be lost when you run configure again.
5439 ** Instead of modifying definitions here, use the --enable/--disable options
5440 ** of the configure script! See ./configure --help for details.
5441 *---------------------------------------------------------------------------*/
5443 #ifndef MPLAYER_CONFIG_H
5444 #define MPLAYER_CONFIG_H
5446 #define CONFIGURATION "$configuration"
5448 #define MPLAYER_CONFDIR "$_confdir"
5449 #define MPLAYER_LOCALEDIR "$_localedir"
5451 $def_translation
5453 /* definitions needed by included libraries */
5454 #define HAVE_INTTYPES_H 1
5455 /* libdvdcss */
5456 #define HAVE_ERRNO_H 1
5457 /* libdvdcss + libdvdread */
5458 #define HAVE_LIMITS_H 1
5459 /* libdvdcss */
5460 #define HAVE_UNISTD_H 1
5461 /* libdvdread */
5462 #define STDC_HEADERS 1
5463 #define HAVE_MEMCPY 1
5464 /* libdvdnav */
5465 #define READ_CACHE_TRACE 0
5466 /* libdvdread */
5467 #define HAVE_DLFCN_H 1
5468 $def_dvdcss
5471 /* system headers */
5472 $def_alloca_h
5473 $def_altivec_h
5474 $def_mman_h
5475 $def_mman_has_map_failed
5476 $def_soundcard_h
5477 $def_sys_soundcard_h
5478 $def_sys_sysinfo_h
5479 $def_sys_videoio_h
5480 $def_termios_h
5481 $def_termios_sys_h
5482 $def_winsock2_h
5485 /* system functions */
5486 $def_gethostbyname2
5487 $def_gettimeofday
5488 $def_glob
5489 $def_langinfo
5490 $def_nanosleep
5491 $def_posix_select
5492 $def_select
5493 $def_setenv
5494 $def_setmode
5495 $def_shm
5496 $def_strsep
5497 $def_swab
5498 $def_sysi86
5499 $def_sysi86_iv
5500 $def_termcap
5501 $def_termios
5502 $def_vsscanf
5505 /* system-specific features */
5506 $def_asmalign_pot
5507 $def_builtin_expect
5508 $def_dl
5509 $def_dos_paths
5510 $def_extern_asm
5511 $def_extern_prefix
5512 $def_iconv
5513 $def_kstat
5514 $def_macosx_bundle
5515 $def_macosx_finder
5516 $def_priority
5517 $def_quicktime
5518 $def_restrict_keyword
5519 $def_rtc
5520 $def_unrar_exec
5523 /* configurable options */
5524 $def_charset
5525 $def_crash_debug
5526 $def_debug
5527 $def_fastmemcpy
5528 $def_runtime_cpudetection
5529 $def_sighandler
5530 $def_stream_cache
5531 $def_pthread_cache
5534 /* CPU stuff */
5535 #define __CPU__ $iproc
5536 $def_ebx_available
5537 $def_words_endian
5538 $def_bigendian
5539 $(ff_config_enable "$arch_all" "$arch" "ARCH")
5540 $(ff_config_enable "$subarch_all" "$subarch" "ARCH")
5541 $(ff_config_enable "$cpuexts_all" "$cpuexts" "HAVE")
5544 /* Blu-ray/DVD/VCD/CD */
5545 #define DEFAULT_CDROM_DEVICE "$default_cdrom_device"
5546 #define DEFAULT_DVD_DEVICE "$default_dvd_device"
5547 $def_bluray
5548 $def_bsdi_dvd
5549 $def_cdda
5550 $def_cddb
5551 $def_cdio
5552 $def_cdrom
5553 $def_dvd
5554 $def_dvd_bsd
5555 $def_dvd_darwin
5556 $def_dvd_linux
5557 $def_dvd_openbsd
5558 $def_dvdio
5559 $def_dvdnav
5560 $def_dvdread
5561 $def_hpux_scsi_h
5562 $def_sol_scsi_h
5563 $def_vcd
5566 /* codec libraries */
5567 $def_faad
5568 $def_liba52
5569 $def_libdca
5570 $def_libdv
5571 $def_mad
5572 $def_mpg123
5573 $def_musepack
5574 $def_speex
5575 $def_theora
5576 $def_tremor
5577 $def_vorbis
5578 $def_xvid
5579 $def_zlib
5581 $def_libpostproc
5582 $def_libavresample
5583 $def_libnut
5586 /* binary codecs */
5587 $def_qtx
5588 $def_qtx_win32
5589 $def_real
5590 $def_win32_loader
5591 $def_win32dll
5592 $def_xanim
5593 $def_xmms
5594 #define BINARY_CODECS_PATH "$_codecsdir"
5595 #define XMMS_INPUT_PLUGIN_DIR "$_xmmsplugindir"
5598 /* Audio output drivers */
5599 $def_alsa
5600 $def_coreaudio
5601 $def_jack
5602 $def_openal
5603 $def_openal_h
5604 $def_ossaudio
5605 $def_ossaudio_devdsp
5606 $def_ossaudio_devmixer
5607 $def_pulse
5608 $def_portaudio
5609 $def_rsound
5611 $def_ladspa
5612 $def_libbs2b
5615 /* input */
5616 $def_apple_ir
5617 $def_apple_remote
5618 $def_ioctl_bt848_h_name
5619 $def_ioctl_meteor_h_name
5620 $def_joystick
5621 $def_lirc
5622 $def_lircc
5623 $def_pvr
5624 $def_radio
5625 $def_radio_bsdbt848
5626 $def_radio_capture
5627 $def_radio_v4l2
5628 $def_tv
5629 $def_tv_bsdbt848
5630 $def_tv_dshow
5631 $def_tv_v4l2
5634 /* font stuff */
5635 $def_ass
5636 $def_enca
5638 /* networking */
5639 $def_closesocket
5640 $def_ftp
5641 $def_inet6
5642 $def_inet_aton
5643 $def_inet_pton
5644 $def_networking
5645 $def_smb
5646 $def_libquvi
5647 $def_socklen_t
5648 $def_vstream
5650 $def_lcms2
5653 /* libvo options */
5654 $def_caca
5655 $def_corevideo
5656 $def_cocoa
5657 $def_sharedbuffer
5658 $def_direct3d
5659 $def_directfb
5660 $def_directx
5661 $def_dvbin
5662 $def_gif
5663 $def_gif_4
5664 $def_gif_tvt_hack
5665 $def_gl
5666 $def_gl_cocoa
5667 $def_gl_win32
5668 $def_gl_x11
5669 $def_gl_sdl
5670 $def_jpeg
5671 $def_md5sum
5672 $def_mng
5673 $def_png
5674 $def_pnm
5675 $def_sdl
5676 $def_sdl_sdl_h
5677 $def_tga
5678 $def_v4l2
5679 $def_vdpau
5680 $def_vm
5681 $def_x11
5682 $def_xdpms
5683 $def_xf86keysym
5684 $def_xinerama
5685 $def_xss
5686 $def_xv
5687 $def_yuv4mpeg
5690 $def_fast_64bit
5691 $def_fast_unaligned
5692 $def_pthreads
5694 /* Use these registers in x86 inline asm. No proper detection yet. */
5695 #define HAVE_EBP_AVAILABLE 1
5697 #endif /* MPLAYER_CONFIG_H */
5700 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
5701 cmp -s "$TMPH" config.h || mv -f "$TMPH" config.h
5703 #############################################################################
5705 cat << EOF
5707 Config files successfully generated by ./configure $configuration !
5709 Install prefix: $_prefix
5710 Config direct.: $_confdir
5712 Byte order: $_byte_order
5713 Optimizing for: $_optimizing
5715 Languages:
5716 Messages (in addition to English): $language_msg
5717 Manual pages: $language_man
5718 Documentation: $language_doc
5720 Enabled optional drivers:
5721 Input: $inputmodules
5722 Codecs: $codecmodules
5723 Audio output: $aomodules
5724 Video output: $vomodules
5726 Disabled optional drivers:
5727 Input: $noinputmodules
5728 Codecs: $nocodecmodules
5729 Audio output: $noaomodules
5730 Video output: $novomodules
5732 'config.h' and 'config.mak' contain your configuration options.
5733 Note: If you alter theses files (for instance CFLAGS) MPlayer may no longer
5734 compile *** DO NOT REPORT BUGS if you tweak these files ***
5736 'make' will now compile MPlayer and 'make install' will install it.
5737 Note: On non-Linux systems you might need to use 'gmake' instead of 'make'.
5742 cat <<EOF
5743 Check $TMPLOG if you wonder why an autodetection failed (make sure
5744 development headers/packages are installed).
5746 NOTE: The --enable-* parameters unconditionally force options on, completely
5747 skipping autodetection. This behavior is unlike what you may be used to from
5748 autoconf-based configure scripts that can decide to override you. This greater
5749 level of control comes at a price. You may have to provide the correct compiler
5750 and linker flags yourself.
5751 If you used one of these options (except --enable-runtime-cpudetection and
5752 similar ones that turn on internal features) and experience a compilation or
5753 linking failure, make sure you have passed the necessary compiler/linker flags
5754 to configure.
5756 If you suspect a bug, please read DOCS/HTML/$language_doc/bugreports.html.
5760 if test "$warn_cflags" = yes; then
5761 cat <<EOF
5763 MPlayer compilation will use the CPPFLAGS/CFLAGS/LDFLAGS set by you,
5764 but:
5766 *** *** DO NOT REPORT BUGS IF IT DOES NOT COMPILE/WORK! *** ***
5768 It is strongly recommended to let MPlayer choose the correct CFLAGS!
5769 To do so, execute 'CFLAGS= ./configure <options>'
5774 # Last move:
5775 rm -rf "$mplayer_tmpdir"