audio: add af_lavrresample, remove old resampling filters
[mplayer.git] / configure
blob60fd3088d4e897c5f8291d45ecc7731ec205743c
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]
340 Codecs:
341 --enable-gif enable GIF support [autodetect]
342 --enable-png enable PNG input/output support [autodetect]
343 --enable-mng enable MNG input support [autodetect]
344 --enable-jpeg enable JPEG input/output support [autodetect]
345 --enable-libcdio enable libcdio support [autodetect]
346 --disable-win32dll disable Win32 DLL support [autodetect]
347 --disable-qtx disable QuickTime codecs support [enabled]
348 --disable-xanim disable XAnim codecs support [enabled]
349 --disable-real disable RealPlayer codecs support [enabled]
350 --disable-xvid disable Xvid [autodetect]
351 --disable-libnut disable libnut [autodetect]
352 --enable-libav skip Libav autodetection [autodetect]
353 --disable-libvorbis disable libvorbis support [autodetect]
354 --disable-tremor disable Tremor [autodetect if no libvorbis]
355 --disable-speex disable Speex support [autodetect]
356 --enable-theora enable OggTheora libraries [autodetect]
357 --enable-faad enable FAAD2 (AAC) [autodetect]
358 --disable-ladspa disable LADSPA plugin support [autodetect]
359 --disable-libbs2b disable libbs2b audio filter support [autodetect]
360 --disable-libdv disable libdv 0.9.5 en/decoding support [autodetect]
361 --disable-mpg123 disable libmpg123 MP3 decoding support [autodetect]
362 --disable-mad disable libmad (MPEG audio) support [autodetect]
363 --enable-xmms enable XMMS input plugin support [disabled]
364 --enable-libdca enable libdca support [autodetect]
365 --disable-liba52 disable liba52 [autodetect]
366 --enable-musepack enable libmpcdec support (deprecated, libavcodec
367 Musepack decoder is preferred) [disabled]
369 Video output:
370 --enable-gl enable OpenGL video output [autodetect]
371 --enable-sdl enable SDL video output [autodetect]
372 --enable-caca enable CACA video output [autodetect]
373 --enable-direct3d enable Direct3D video output [autodetect]
374 --enable-directx enable DirectX video output [autodetect]
375 --enable-v4l2 enable V4L2 Decoder audio/video output [autodetect]
376 --enable-dvb enable DVB video input [autodetect]
377 --enable-xv enable Xv video output [autodetect]
378 --enable-vdpau enable VDPAU acceleration [autodetect]
379 --enable-vm enable XF86VidMode support [autodetect]
380 --enable-xinerama enable Xinerama support [autodetect]
381 --enable-x11 enable X11 video output [autodetect]
382 --disable-xss disable screensaver support via xss [autodetect]
383 --enable-directfb enable DirectFB video output [autodetect]
384 --disable-tga disable Targa video output [enable]
385 --disable-pnm disable PNM video output [enable]
386 --disable-md5sum disable md5sum video output [enable]
387 --disable-yuv4mpeg disable yuv4mpeg video output [enable]
388 --disable-corevideo disable CoreVideo video output [autodetect]
389 --disable-cocoa disable Cocoa OpenGL backend [autodetect]
390 --disable-sharedbuffer disable OSX shared buffer video output [autodetect]
392 Audio output:
393 --disable-alsa disable ALSA audio output [autodetect]
394 --disable-ossaudio disable OSS audio output [autodetect]
395 --disable-rsound disable RSound audio output [autodetect]
396 --disable-pulse disable Pulseaudio audio output [autodetect]
397 --disable-portaudio disable PortAudio audio output [autodetect]
398 --disable-jack disable JACK audio output [autodetect]
399 --enable-openal enable OpenAL audio output [disable]
400 --disable-coreaudio disable CoreAudio audio output [autodetect]
401 --disable-select disable using select() on the audio device [enable]
403 Language options:
404 --enable-translation enable support for translated output [disable]
405 --charset=charset convert the console messages to this character set
406 --language-doc=lang language to use for the documentation [en]
407 --language-man=lang language to use for the man pages [en]
408 --language-msg=lang extra languages for program messages [all]
409 --language=lang default language to use [en]
410 Specific options override --language. You can pass a list of languages separated
411 by whitespace or commas instead of a single language. Nonexisting translations
412 will be dropped from each list. All translations available in the list will be
413 installed. The value "all" will activate all translations. The LINGUAS
414 environment variable is honored. In all cases the fallback is English.
415 The program always supports English-language output; additional message
416 languages are only installed if --enable-translation is also specified.
417 Available values for --language-doc are: all $doc_lang_all
418 Available values for --language-man are: all $man_lang_all
419 Available values for --language-msg are: all $msg_lang_all
421 Miscellaneous options:
422 --enable-runtime-cpudetection enable runtime CPU detection [disable]
423 --enable-cross-compile enable cross-compilation [disable]
424 --cc=COMPILER C compiler to build MPlayer [gcc]
425 --pkg-config=PKGCONFIG pkg-config to find some libraries [pkg-config]
426 --windres=WINDRES windres to build MPlayer [windres]
427 --target=PLATFORM target platform (i386-linux, arm-linux, etc)
428 --enable-static build a statically linked binary
429 --with-install=PATH path to a custom install program
431 Advanced options:
432 --enable-mmx enable MMX [autodetect]
433 --enable-mmxext enable MMX2 (Pentium III, Athlon) [autodetect]
434 --enable-3dnow enable 3DNow! [autodetect]
435 --enable-3dnowext enable extended 3DNow! [autodetect]
436 --enable-sse enable SSE [autodetect]
437 --enable-sse2 enable SSE2 [autodetect]
438 --enable-ssse3 enable SSSE3 [autodetect]
439 --enable-shm enable shm [autodetect]
440 --enable-altivec enable AltiVec (PowerPC) [autodetect]
441 --enable-armv5te enable DSP extensions (ARM) [autodetect]
442 --enable-armv6 enable ARMv6 (ARM) [autodetect]
443 --enable-armv6t2 enable ARMv6t2 (ARM) [autodetect]
444 --enable-armvfp enable ARM VFP (ARM) [autodetect]
445 --enable-neon enable NEON (ARM) [autodetect]
446 --enable-iwmmxt enable iWMMXt (ARM) [autodetect]
447 --disable-fastmemcpy disable 3DNow!/SSE/MMX optimized memcpy [enable]
448 --enable-big-endian force byte order to big-endian [autodetect]
449 --enable-debug[=1-3] compile-in debugging information [disable]
450 --enable-profile compile-in profiling information [disable]
451 --disable-sighandler disable sighandler for crashes [enable]
452 --enable-crash-debug enable automatic gdb attach on crash [disable]
454 Use these options if autodetection fails:
455 --extra-cflags=FLAGS extra CFLAGS
456 --extra-ldflags=FLAGS extra LDFLAGS
457 --extra-libs=FLAGS extra linker flags
458 --extra-libs-mplayer=FLAGS extra linker flags for MPlayer
460 --with-sdl-config=PATH path to sdl*-config
461 --with-dvdnav-config=PATH path to dvdnav-config
462 --with-dvdread-config=PATH path to dvdread-config
464 This configure script is NOT autoconf-based, even though its output is similar.
465 It will try to autodetect all configuration options. If you --enable an option
466 it will be forcefully turned on, skipping autodetection. This can break
467 compilation, so you need to know what you are doing.
469 exit 0
470 } #show_help()
472 # GOTCHA: the variables below defines the default behavior for autodetection
473 # and have - unless stated otherwise - at least 2 states : yes no
474 # If autodetection is available then the third state is: auto
475 _mmx=auto
476 _3dnow=auto
477 _3dnowext=auto
478 _mmxext=auto
479 _sse=auto
480 _sse2=auto
481 _ssse3=auto
482 _cmov=auto
483 _fast_cmov=auto
484 _fast_clz=auto
485 _armv5te=auto
486 _armv6=auto
487 _armv6t2=auto
488 _armvfp=auto
489 neon=auto
490 _iwmmxt=auto
491 _altivec=auto
492 _install=install
493 _pkg_config=auto
494 _windres=auto
495 _cc=auto
496 test "$CC" && _cc="$CC"
497 _as=auto
498 _runtime_cpudetection=no
499 _cross_compile=no
500 _prefix="/usr/local"
501 ffmpeg=auto
502 _x11=auto
503 _xss=auto
504 _xv=auto
505 _vdpau=auto
506 _sdl=auto
507 _direct3d=auto
508 _directx=auto
509 _png=auto
510 _mng=auto
511 _jpeg=auto
512 _pnm=yes
513 _md5sum=yes
514 _yuv4mpeg=yes
515 _gif=auto
516 _gl=auto
517 _aa=auto
518 _caca=auto
519 _dvb=auto
520 _v4l2=auto
521 _iconv=auto
522 _langinfo=auto
523 _rtc=auto
524 _ossaudio=auto
525 _rsound=auto
526 _pulse=auto
527 _portaudio=auto
528 _jack=auto
529 _openal=no
530 _libcdio=auto
531 _mad=auto
532 _tremor=auto
533 _libvorbis=auto
534 _speex=auto
535 _theora=auto
536 _mpg123=auto
537 _liba52=auto
538 _libdca=auto
539 _faad=auto
540 _ladspa=auto
541 _libbs2b=auto
542 _xmms=no
543 _vcd=auto
544 _bluray=auto
545 _dvdnav=auto
546 _dvdnavconfig=dvdnav-config
547 _dvdreadconfig=dvdread-config
548 _dvdread=auto
549 _dvdread_internal=auto
550 _libdvdcss_internal=auto
551 _xanim=auto
552 _real=auto
553 _lcms2=auto
554 _xinerama=auto
555 _vm=auto
556 _xf86keysym=auto
557 _alsa=auto
558 _fastmemcpy=yes
559 _unrar_exec=auto
560 _win32dll=auto
561 _select=yes
562 _radio=no
563 _radio_capture=no
564 _radio_v4l2=auto
565 _radio_bsdbt848=auto
566 _tv=yes
567 _tv_v4l2=auto
568 _tv_bsdbt848=auto
569 _tv_dshow=auto
570 _pvr=auto
571 networking=yes
572 _winsock2_h=auto
573 _smb=auto
574 _libquvi=auto
575 _joystick=no
576 _xvid=auto
577 _libnut=auto
578 _lirc=auto
579 _lircc=auto
580 _apple_remote=auto
581 _apple_ir=auto
582 _termcap=auto
583 _termios=auto
584 _tga=yes
585 _directfb=auto
586 #language=en
587 _shm=auto
588 _translation=no
589 _charset="UTF-8"
590 _crash_debug=no
591 _sighandler=yes
592 _libdv=auto
593 _cdda=auto
594 _cddb=auto
595 _big_endian=auto
596 _qtx=auto
597 _coreaudio=auto
598 _corevideo=auto
599 _cocoa=auto
600 _sharedbuffer=auto
601 quicktime=auto
602 _macosx_finder=no
603 _macosx_bundle=auto
604 _enca=auto
605 _inet6=auto
606 _gethostbyname2=auto
607 _ftp=auto
608 _musepack=no
609 _vstream=auto
610 _pthreads=auto
611 _w32threads=auto
612 _ass=auto
613 _rpath=no
614 libpostproc=auto
615 _asmalign_pot=auto
616 _stream_cache=yes
617 _priority=no
618 def_dos_paths="#define HAVE_DOS_PATHS 0"
619 def_stream_cache="#define CONFIG_STREAM_CACHE 1"
620 def_priority="#undef CONFIG_PRIORITY"
621 def_pthread_cache="#undef PTHREAD_CACHE"
622 need_shmem=yes
623 for ac_option do
624 case "$ac_option" in
625 --help|-help|-h)
626 show_help
628 --prefix=*)
629 _prefix=$(echo $ac_option | cut -d '=' -f 2)
631 --bindir=*)
632 _bindir=$(echo $ac_option | cut -d '=' -f 2)
634 --mandir=*)
635 _mandir=$(echo $ac_option | cut -d '=' -f 2)
637 --confdir=*)
638 _confdir=$(echo $ac_option | cut -d '=' -f 2)
640 --libdir=*)
641 _libdir=$(echo $ac_option | cut -d '=' -f 2)
643 --codecsdir=*)
644 _codecsdir=$(echo $ac_option | cut -d '=' -f 2)
646 --localedir=*)
647 _localedir=$(echo $ac_option | cut -d '=' -f 2)
650 --with-install=*)
651 _install=$(echo $ac_option | cut -d '=' -f 2 )
654 --with-sdl-config=*)
655 _sdlconfig=$(echo $ac_option | cut -d '=' -f 2)
657 --with-dvdnav-config=*)
658 _dvdnavconfig=$(echo $ac_option | cut -d '=' -f 2)
660 --with-dvdread-config=*)
661 _dvdreadconfig=$(echo $ac_option | cut -d '=' -f 2)
664 --extra-cflags=*)
665 extra_cflags="$extra_cflags $(echo $ac_option | cut -d '=' -f 2-)"
667 --extra-ldflags=*)
668 extra_ldflags="$extra_ldflags $(echo $ac_option | cut -d '=' -f 2-)"
670 --extra-libs=*)
671 extra_libs=$(echo $ac_option | cut -d '=' -f 2)
673 --extra-libs-mplayer=*)
674 libs_mplayer=$(echo $ac_option | cut -d '=' -f 2)
677 --target=*)
678 _target=$(echo $ac_option | cut -d '=' -f 2)
680 --cc=*)
681 _cc=$(echo $ac_option | cut -d '=' -f 2)
683 --pkg-config=*)
684 _pkg_config=$(echo $ac_option | cut -d '=' -f 2)
686 --windres=*)
687 _windres=$(echo $ac_option | cut -d '=' -f 2)
689 --charset=*)
690 _charset=$(echo $ac_option | cut -d '=' -f 2)
692 --language-doc=*)
693 language_doc=$(echo $ac_option | cut -d '=' -f 2)
695 --language-man=*)
696 language_man=$(echo $ac_option | cut -d '=' -f 2)
698 --language-msg=*)
699 language_msg=$(echo $ac_option | cut -d '=' -f 2)
701 --language=*)
702 language=$(echo $ac_option | cut -d '=' -f 2)
705 --enable-static)
706 _ld_static='-static'
708 --disable-static)
709 _ld_static=''
711 --enable-profile)
712 _profile='-p'
714 --disable-profile)
715 _profile=
717 --enable-debug)
718 _debug='-g'
720 --enable-debug=*)
721 _debug=$(echo $_echo_n '-g'$_echo_c; echo $ac_option | cut -d '=' -f 2)
723 --disable-debug)
724 _debug=
726 --enable-translation) _translation=yes ;;
727 --disable-translation) _translation=no ;;
728 --enable-runtime-cpudetection) _runtime_cpudetection=yes ;;
729 --disable-runtime-cpudetection) _runtime_cpudetection=no ;;
730 --enable-cross-compile) _cross_compile=yes ;;
731 --disable-cross-compile) _cross_compile=no ;;
732 --enable-x11) _x11=yes ;;
733 --disable-x11) _x11=no ;;
734 --enable-xss) _xss=yes ;;
735 --disable-xss) _xss=no ;;
736 --enable-xv) _xv=yes ;;
737 --disable-xv) _xv=no ;;
738 --enable-vdpau) _vdpau=yes ;;
739 --disable-vdpau) _vdpau=no ;;
740 --enable-sdl) _sdl=yes ;;
741 --disable-sdl) _sdl=no ;;
742 --enable-direct3d) _direct3d=yes ;;
743 --disable-direct3d) _direct3d=no ;;
744 --enable-directx) _directx=yes ;;
745 --disable-directx) _directx=no ;;
746 --enable-png) _png=yes ;;
747 --disable-png) _png=no ;;
748 --enable-mng) _mng=yes ;;
749 --disable-mng) _mng=no ;;
750 --enable-jpeg) _jpeg=yes ;;
751 --disable-jpeg) _jpeg=no ;;
752 --enable-pnm) _pnm=yes ;;
753 --disable-pnm) _pnm=no ;;
754 --enable-md5sum) _md5sum=yes ;;
755 --disable-md5sum) _md5sum=no ;;
756 --enable-yuv4mpeg) _yuv4mpeg=yes ;;
757 --disable-yuv4mpeg) _yuv4mpeg=no ;;
758 --enable-gif) _gif=yes ;;
759 --disable-gif) _gif=no ;;
760 --enable-gl) _gl=yes ;;
761 --disable-gl) _gl=no ;;
762 --enable-caca) _caca=yes ;;
763 --disable-caca) _caca=no ;;
764 --enable-dvb) _dvb=yes ;;
765 --disable-dvb) _dvb=no ;;
766 --enable-v4l2) _v4l2=yes ;;
767 --disable-v4l2) _v4l2=no ;;
768 --enable-iconv) _iconv=yes ;;
769 --disable-iconv) _iconv=no ;;
770 --enable-langinfo) _langinfo=yes ;;
771 --disable-langinfo) _langinfo=no ;;
772 --enable-rtc) _rtc=yes ;;
773 --disable-rtc) _rtc=no ;;
774 --enable-libdv) _libdv=yes ;;
775 --disable-libdv) _libdv=no ;;
776 --enable-ossaudio) _ossaudio=yes ;;
777 --disable-ossaudio) _ossaudio=no ;;
778 --enable-rsound) _rsound=yes ;;
779 --disable-rsound) _rsound=no ;;
780 --enable-pulse) _pulse=yes ;;
781 --disable-pulse) _pulse=no ;;
782 --enable-portaudio) _portaudio=yes ;;
783 --disable-portaudio) _portaudio=no ;;
784 --enable-jack) _jack=yes ;;
785 --disable-jack) _jack=no ;;
786 --enable-openal) _openal=yes ;;
787 --disable-openal) _openal=no ;;
788 --enable-mad) _mad=yes ;;
789 --disable-mad) _mad=no ;;
790 --enable-libcdio) _libcdio=yes ;;
791 --disable-libcdio) _libcdio=no ;;
792 --enable-libvorbis) _libvorbis=yes ;;
793 --disable-libvorbis) _libvorbis=no ;;
794 --enable-speex) _speex=yes ;;
795 --disable-speex) _speex=no ;;
796 --enable-tremor) _tremor=yes ;;
797 --disable-tremor) _tremor=no ;;
798 --enable-theora) _theora=yes ;;
799 --disable-theora) _theora=no ;;
800 --enable-mpg123) _mpg123=yes ;;
801 --disable-mpg123) _mpg123=no ;;
802 --enable-liba52) _liba52=yes ;;
803 --disable-liba52) _liba52=no ;;
804 --enable-libdca) _libdca=yes ;;
805 --disable-libdca) _libdca=no ;;
806 --enable-musepack) _musepack=yes ;;
807 --disable-musepack) _musepack=no ;;
808 --enable-faad) _faad=yes ;;
809 --disable-faad) _faad=no ;;
810 --enable-ladspa) _ladspa=yes ;;
811 --disable-ladspa) _ladspa=no ;;
812 --enable-libbs2b) _libbs2b=yes ;;
813 --disable-libbs2b) _libbs2b=no ;;
814 --enable-xmms) _xmms=yes ;;
815 --disable-xmms) _xmms=no ;;
816 --enable-vcd) _vcd=yes ;;
817 --disable-vcd) _vcd=no ;;
818 --enable-bluray) _bluray=yes ;;
819 --disable-bluray) _bluray=no ;;
820 --enable-dvdread) _dvdread=yes ;;
821 --disable-dvdread) _dvdread=no ;;
822 --enable-dvdread-internal) _dvdread_internal=yes ;;
823 --disable-dvdread-internal) _dvdread_internal=no ;;
824 --enable-libdvdcss-internal) _libdvdcss_internal=yes ;;
825 --disable-libdvdcss-internal) _libdvdcss_internal=no ;;
826 --enable-dvdnav) _dvdnav=yes ;;
827 --disable-dvdnav) _dvdnav=no ;;
828 --enable-xanim) _xanim=yes ;;
829 --disable-xanim) _xanim=no ;;
830 --enable-real) _real=yes ;;
831 --disable-real) _real=no ;;
832 --enable-lcms2) _lcms2=yes ;;
833 --disable-lcms2) _lcms2=no ;;
834 --enable-xinerama) _xinerama=yes ;;
835 --disable-xinerama) _xinerama=no ;;
836 --enable-vm) _vm=yes ;;
837 --disable-vm) _vm=no ;;
838 --enable-xf86keysym) _xf86keysym=yes ;;
839 --disable-xf86keysym) _xf86keysym=no ;;
840 --enable-alsa) _alsa=yes ;;
841 --disable-alsa) _alsa=no ;;
842 --enable-tv) _tv=yes ;;
843 --disable-tv) _tv=no ;;
844 --enable-tv-bsdbt848) _tv_bsdbt848=yes ;;
845 --disable-tv-bsdbt848) _tv_bsdbt848=no ;;
846 --enable-tv-v4l2) _tv_v4l2=yes ;;
847 --disable-tv-v4l2) _tv_v4l2=no ;;
848 --enable-tv-dshow) _tv_dshow=yes ;;
849 --disable-tv-dshow) _tv_dshow=no ;;
850 --enable-radio) _radio=yes ;;
851 --enable-radio-capture) _radio_capture=yes ;;
852 --disable-radio-capture) _radio_capture=no ;;
853 --disable-radio) _radio=no ;;
854 --enable-radio-v4l2) _radio_v4l2=yes ;;
855 --disable-radio-v4l2) _radio_v4l2=no ;;
856 --enable-radio-bsdbt848) _radio_bsdbt848=yes ;;
857 --disable-radio-bsdbt848) _radio_bsdbt848=no ;;
858 --enable-pvr) _pvr=yes ;;
859 --disable-pvr) _pvr=no ;;
860 --enable-fastmemcpy) _fastmemcpy=yes ;;
861 --disable-fastmemcpy) _fastmemcpy=no ;;
862 --enable-networking) networking=yes ;;
863 --disable-networking) networking=no ;;
864 --enable-winsock2_h) _winsock2_h=yes ;;
865 --disable-winsock2_h) _winsock2_h=no ;;
866 --enable-smb) _smb=yes ;;
867 --disable-smb) _smb=no ;;
868 --enable-libquvi) _libquvi=yes ;;
869 --disable-libquvi) _libquvi=no ;;
870 --enable-joystick) _joystick=yes ;;
871 --disable-joystick) _joystick=no ;;
872 --enable-xvid) _xvid=yes ;;
873 --disable-xvid) _xvid=no ;;
874 --enable-libnut) _libnut=yes ;;
875 --disable-libnut) _libnut=no ;;
876 --enable-libav) ffmpeg=yes ;;
878 --enable-lirc) _lirc=yes ;;
879 --disable-lirc) _lirc=no ;;
880 --enable-lircc) _lircc=yes ;;
881 --disable-lircc) _lircc=no ;;
882 --enable-apple-remote) _apple_remote=yes ;;
883 --disable-apple-remote) _apple_remote=no ;;
884 --enable-apple-ir) _apple_ir=yes ;;
885 --disable-apple-ir) _apple_ir=no ;;
886 --enable-termcap) _termcap=yes ;;
887 --disable-termcap) _termcap=no ;;
888 --enable-termios) _termios=yes ;;
889 --disable-termios) _termios=no ;;
890 --disable-tga) _tga=no ;;
891 --enable-tga) _tga=yes ;;
892 --enable-directfb) _directfb=yes ;;
893 --disable-directfb) _directfb=no ;;
894 --enable-shm) _shm=yes ;;
895 --disable-shm) _shm=no ;;
896 --enable-select) _select=yes ;;
897 --disable-select) _select=no ;;
898 --enable-cddb) _cddb=yes ;;
899 --disable-cddb) _cddb=no ;;
900 --enable-big-endian) _big_endian=yes ;;
901 --disable-big-endian) _big_endian=no ;;
902 --enable-unrarexec) _unrar_exec=yes ;;
903 --disable-unrarexec) _unrar_exec=no ;;
904 --enable-ftp) _ftp=yes ;;
905 --disable-ftp) _ftp=no ;;
906 --enable-vstream) _vstream=yes ;;
907 --disable-vstream) _vstream=no ;;
908 --enable-pthreads) _pthreads=yes ;;
909 --disable-pthreads) _pthreads=no ;;
910 --enable-w32threads) _w32threads=yes ;;
911 --disable-w32threads) _w32threads=no ;;
912 --enable-libass) _ass=yes ;;
913 --disable-libass) _ass=no ;;
914 --enable-rpath) _rpath=yes ;;
915 --disable-rpath) _rpath=no ;;
916 --enable-libpostproc) libpostproc=yes ;;
917 --disable-libpostproc) libpostproc=no ;;
919 --enable-enca) _enca=yes ;;
920 --disable-enca) _enca=no ;;
922 --enable-inet6) _inet6=yes ;;
923 --disable-inet6) _inet6=no ;;
925 --enable-gethostbyname2) _gethostbyname2=yes ;;
926 --disable-gethostbyname2) _gethostbyname2=no ;;
928 --enable-qtx) _qtx=yes ;;
929 --disable-qtx) _qtx=no ;;
931 --enable-coreaudio) _coreaudio=yes ;;
932 --disable-coreaudio) _coreaudio=no ;;
933 --enable-corevideo) _corevideo=yes ;;
934 --disable-corevideo) _corevideo=no ;;
935 --enable-cocoa) _cocoa=yes ;;
936 --disable-cocoa) _cocoa=no ;;
937 --enable-sharedbuffer) _sharedbuffer=yes ;;
938 --disable-sharedbuffer) _sharedbuffer=no ;;
939 --enable-macosx-finder) _macosx_finder=yes ;;
940 --disable-macosx-finder) _macosx_finder=no ;;
941 --enable-macosx-bundle) _macosx_bundle=yes ;;
942 --disable-macosx-bundle) _macosx_bundle=no ;;
944 --enable-crash-debug) _crash_debug=yes ;;
945 --disable-crash-debug) _crash_debug=no ;;
946 --enable-sighandler) _sighandler=yes ;;
947 --disable-sighandler) _sighandler=no ;;
948 --enable-win32dll) _win32dll=yes ;;
949 --disable-win32dll) _win32dll=no ;;
951 --enable-sse) _sse=yes ;;
952 --disable-sse) _sse=no ;;
953 --enable-sse2) _sse2=yes ;;
954 --disable-sse2) _sse2=no ;;
955 --enable-ssse3) _ssse3=yes ;;
956 --disable-ssse3) _ssse3=no ;;
957 --enable-mmxext) _mmxext=yes ;;
958 --disable-mmxext) _mmxext=no ;;
959 --enable-3dnow) _3dnow=yes ;;
960 --disable-3dnow) _3dnow=no _3dnowext=no ;;
961 --enable-3dnowext) _3dnow=yes _3dnowext=yes ;;
962 --disable-3dnowext) _3dnowext=no ;;
963 --enable-cmov) _cmov=yes ;;
964 --disable-cmov) _cmov=no ;;
965 --enable-fast-cmov) _fast_cmov=yes ;;
966 --disable-fast-cmov) _fast_cmov=no ;;
967 --enable-fast-clz) _fast_clz=yes ;;
968 --disable-fast-clz) _fast_clz=no ;;
969 --enable-altivec) _altivec=yes ;;
970 --disable-altivec) _altivec=no ;;
971 --enable-armv5te) _armv5te=yes ;;
972 --disable-armv5te) _armv5te=no ;;
973 --enable-armv6) _armv6=yes ;;
974 --disable-armv6) _armv6=no ;;
975 --enable-armv6t2) _armv6t2=yes ;;
976 --disable-armv6t2) _armv6t2=no ;;
977 --enable-armvfp) _armvfp=yes ;;
978 --disable-armvfp) _armvfp=no ;;
979 --enable-neon) neon=yes ;;
980 --disable-neon) neon=no ;;
981 --enable-iwmmxt) _iwmmxt=yes ;;
982 --disable-iwmmxt) _iwmmxt=no ;;
983 --enable-mmx) _mmx=yes ;;
984 --disable-mmx) # 3Dnow! and MMX2 require MMX
985 _3dnow=no _3dnowext=no _mmx=no _mmxext=no ;;
988 echo "Unknown parameter: $ac_option" >&2
989 exit 1
992 esac
993 done
995 # Atmos: moved this here, to be correct, if --prefix is specified
996 test -z "$_bindir" && _bindir="$_prefix/bin"
997 test -z "$_mandir" && _mandir="$_prefix/share/man"
998 test -z "$_confdir" && _confdir="$_prefix/etc/mplayer"
999 test -z "$_libdir" && _libdir="$_prefix/lib"
1000 test -z "$_localedir" && _localedir="$_prefix/share/locale"
1002 for tmpdir in "$TMPDIR" "$TEMPDIR" "/tmp" ; do
1003 test "$tmpdir" && break
1004 done
1006 mplayer_tmpdir="$tmpdir/mplayer-configure-$RANDOM-$$"
1007 mkdir $mplayer_tmpdir || die "Unable to create tmpdir."
1009 TMPLOG="config.log"
1011 rm -f "$TMPLOG"
1012 echo Parameters configure was run with: > "$TMPLOG"
1013 if test -n "$CFLAGS" ; then
1014 echo ${_echo_n} CFLAGS="'$CFLAGS' ${_echo_c}" >> "$TMPLOG"
1016 if test -n "$PKG_CONFIG_PATH" ; then
1017 echo ${_echo_n} PKG_CONFIG_PATH="'$PKG_CONFIG_PATH' ${_echo_c}" >> "$TMPLOG"
1019 echo ./configure $configuration >> "$TMPLOG"
1020 echo >> "$TMPLOG"
1023 echocheck "cross compilation"
1024 echores $_cross_compile
1026 if test $_cross_compile = yes; then
1027 tmp_run() {
1028 return 0
1032 tool_prefix=""
1034 if test $_cross_compile = yes ; then
1035 # Usually cross-compiler prefixes match with the target triplet
1036 test -n "$_target" && tool_prefix="$_target"-
1039 test "$_windres" = auto && _windres="$tool_prefix"windres
1040 test "$_pkg_config" = auto && _pkg_config="$tool_prefix"pkg-config
1042 if test "$_cc" = auto ; then
1043 if test -n "$tool_prefix" ; then
1044 _cc="$tool_prefix"gcc
1045 else
1046 _cc=cc
1050 # Determine our OS name and CPU architecture
1051 if test -z "$_target" ; then
1052 # OS name
1053 system_name=$(uname -s 2>&1)
1054 case "$system_name" in
1055 Linux|FreeBSD|NetBSD|OpenBSD|DragonFly|BSD/OS|Darwin|QNX|GNU|BeOS|MorphOS|AIX|AmigaOS)
1057 Haiku)
1058 system_name=BeOS
1060 GNU/kFreeBSD)
1061 system_name=FreeBSD
1063 HP-UX*)
1064 system_name=HP-UX
1066 [cC][yY][gG][wW][iI][nN]*)
1067 system_name=CYGWIN
1069 MINGW32*)
1070 system_name=MINGW32
1072 OS/2*)
1073 system_name=OS/2
1076 system_name="$system_name-UNKNOWN"
1078 esac
1081 # host's CPU/instruction set
1082 host_arch=$(uname -p 2>&1)
1083 case "$host_arch" in
1084 i386|sparc|ppc|alpha|arm|mips|vax)
1086 powerpc) # Darwin returns 'powerpc'
1087 host_arch=ppc
1089 *) # uname -p on Linux returns 'unknown' for the processor type,
1090 # OpenBSD returns 'Intel Pentium/MMX ("Genuine Intel" 586-class)'
1092 # Maybe uname -m (machine hardware name) returns something we
1093 # recognize.
1095 # x86/x86pc is used by QNX
1096 case "$(uname -m 2>&1)" in
1097 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 ;;
1098 ia64) host_arch=ia64 ;;
1099 macppc|ppc) host_arch=ppc ;;
1100 ppc64) host_arch=ppc64 ;;
1101 alpha) host_arch=alpha ;;
1102 sparc) host_arch=sparc ;;
1103 sparc64) host_arch=sparc64 ;;
1104 parisc*|hppa*|9000*) host_arch=hppa ;;
1105 arm*|zaurus|cats) host_arch=arm ;;
1106 sh3|sh4|sh4a) host_arch=sh ;;
1107 s390) host_arch=s390 ;;
1108 s390x) host_arch=s390x ;;
1109 *mips*) host_arch=mips ;;
1110 vax) host_arch=vax ;;
1111 xtensa*) host_arch=xtensa ;;
1112 *) host_arch=UNKNOWN ;;
1113 esac
1115 esac
1116 else # if test -z "$_target"
1117 for i in 2 3; do
1118 system_name=$(echo $_target | cut -d '-' -f $i)
1119 case "$(echo $system_name | tr A-Z a-z)" in
1120 linux) system_name=Linux ;;
1121 freebsd) system_name=FreeBSD ;;
1122 gnu/kfreebsd) system_name=FreeBSD ;;
1123 netbsd) system_name=NetBSD ;;
1124 bsd/os) system_name=BSD/OS ;;
1125 openbsd) system_name=OpenBSD ;;
1126 dragonfly) system_name=DragonFly ;;
1127 qnx) system_name=QNX ;;
1128 morphos) system_name=MorphOS ;;
1129 amigaos) system_name=AmigaOS ;;
1130 mingw32*) system_name=MINGW32 ;;
1131 *) continue ;;
1132 esac
1133 break
1134 done
1135 # We need to convert underscores so that values like k6-2 and pentium-mmx can be passed
1136 host_arch=$(echo $_target | cut -d '-' -f 1)
1137 if test $(echo $host_arch) != "x86_64" ; then
1138 host_arch=$(echo $host_arch | tr '_' '-')
1142 extra_cflags="-I. $extra_cflags"
1143 _timer=timer-linux.c
1144 _getch=getch2.c
1145 if freebsd ; then
1146 extra_ldflags="$extra_ldflags -L/usr/local/lib"
1147 extra_cflags="$extra_cflags -I/usr/local/include"
1150 if netbsd || dragonfly ; then
1151 extra_ldflags="$extra_ldflags -L/usr/pkg/lib"
1152 extra_cflags="$extra_cflags -I/usr/pkg/include"
1155 if darwin; then
1156 extra_cflags="-mdynamic-no-pic $extra_cflags"
1157 _timer=timer-darwin.c
1160 if aix ; then
1161 extra_ldflags="$extra_ldflags -lC"
1164 if win32 ; then
1165 _exesuf=".exe"
1166 extra_cflags="$extra_cflags -fno-common"
1167 # -lwinmm is always needed for osdep/timer-win2.c
1168 extra_ldflags="$extra_ldflags -lwinmm"
1169 _pe_executable=yes
1170 _timer=timer-win2.c
1171 _priority=yes
1172 def_dos_paths="#define HAVE_DOS_PATHS 1"
1173 def_priority="#define CONFIG_PRIORITY 1"
1176 if mingw32 ; then
1177 _getch=getch2-win.c
1178 need_shmem=no
1179 extra_cflags="$extra_cflags -D__USE_MINGW_ANSI_STDIO=1"
1182 if amigaos ; then
1183 _select=no
1184 _sighandler=no
1185 _stream_cache=no
1186 def_stream_cache="#undef CONFIG_STREAM_CACHE"
1187 extra_cflags="-DNEWLIB -D__USE_INLINE__ $extra_cflags"
1190 if qnx ; then
1191 extra_ldflags="$extra_ldflags -lph"
1194 TMPC="$mplayer_tmpdir/tmp.c"
1195 TMPEXE="$mplayer_tmpdir/tmp$_exesuf"
1196 TMPH="$mplayer_tmpdir/tmp.h"
1197 TMPS="$mplayer_tmpdir/tmp.S"
1199 if test "$_runtime_cpudetection" = yes && ! x86 && ! ppc; then
1200 die "Runtime CPU detection only works for x86, x86-64 and PPC!"
1203 _rst2man=rst2man
1204 if [ -f "$(which rst2man.py)" ] ; then
1205 _rst2man=rst2man.py
1208 # Checking CC version...
1209 # Intel C++ Compilers (no autoselect, use CC=/some/binary ./configure)
1210 if test "$(basename $_cc)" = "icc" || test "$(basename $_cc)" = "ecc"; then
1211 echocheck "$_cc version"
1212 cc_vendor=intel
1213 cc_name=$($_cc -V 2>&1 | head -n 1 | cut -d ',' -f 1)
1214 cc_version=$($_cc -V 2>&1 | head -n 1 | cut -d ',' -f 2 | cut -d ' ' -f 3)
1215 _cc_major=$(echo $cc_version | cut -d '.' -f 1)
1216 _cc_minor=$(echo $cc_version | cut -d '.' -f 2)
1217 # TODO verify older icc/ecc compatibility
1218 case $cc_version in
1220 cc_version="v. ?.??, bad"
1221 cc_fail=yes
1223 10.1|11.0|11.1)
1224 cc_version="$cc_version, ok"
1227 cc_version="$cc_version, bad"
1228 cc_fail=yes
1230 esac
1231 echores "$cc_version"
1232 else
1233 for _cc in "$_cc" gcc cc ; do
1234 cc_name_tmp=$($_cc -v 2>&1 | tail -n 1 | cut -d ' ' -f 1)
1235 if test "$cc_name_tmp" = "gcc"; then
1236 cc_name=$cc_name_tmp
1237 echocheck "$_cc version"
1238 cc_vendor=gnu
1239 cc_version=$($_cc -dumpversion 2>&1)
1240 case $cc_version in
1241 2.96*)
1242 cc_fail=yes
1245 _cc_major=$(echo $cc_version | cut -d '.' -f 1)
1246 _cc_minor=$(echo $cc_version | cut -d '.' -f 2)
1247 _cc_mini=$(echo $cc_version | cut -d '.' -f 3)
1249 esac
1250 echores "$cc_version"
1251 break
1253 if $_cc -v 2>&1 | grep -q "clang"; then
1254 echocheck "$_cc version"
1255 cc_vendor=clang
1256 cc_version=$($_cc -dumpversion 2>&1)
1257 res_comment="experimental support only"
1258 echores "clang $cc_version"
1259 break
1261 cc_name_tmp=$($_cc -V 2>&1 | head -n 1 | cut -d ' ' -f 2,3)
1262 done
1263 fi # icc
1264 test "$cc_fail" = yes && die "unsupported compiler version"
1266 echocheck "working compiler"
1267 cflag_check "" || die "Compiler is not functioning correctly. Check your installation and custom CFLAGS $CFLAGS ."
1268 echo "yes"
1270 if test -z "$_target" && x86 ; then
1271 cat > $TMPC << EOF
1272 int main(void) {
1273 int test[(int)sizeof(char *)-7];
1274 return 0;
1277 cc_check && host_arch=x86_64 || host_arch=i386
1280 echo "Detected operating system: $system_name"
1281 echo "Detected host architecture: $host_arch"
1283 # ---
1285 # XXX: this should be ok..
1286 _cpuinfo="echo"
1288 if test "$_runtime_cpudetection" = no ; then
1290 # Cygwin has /proc/cpuinfo, but only supports Intel CPUs
1291 # FIXME: Remove the cygwin check once AMD CPUs are supported
1292 if test -r /proc/cpuinfo && ! cygwin; then
1293 # Linux with /proc mounted, extract CPU information from it
1294 _cpuinfo="cat /proc/cpuinfo"
1295 elif test -r /compat/linux/proc/cpuinfo && ! x86 ; then
1296 # FreeBSD with Linux emulation /proc mounted,
1297 # extract CPU information from it
1298 # Don't use it on x86 though, it never reports 3Dnow
1299 _cpuinfo="cat /compat/linux/proc/cpuinfo"
1300 elif darwin && ! x86 ; then
1301 # use hostinfo on Darwin
1302 _cpuinfo="hostinfo"
1303 elif aix; then
1304 # use 'lsattr' on AIX
1305 _cpuinfo="lsattr -E -l proc0 -a type"
1306 elif x86; then
1307 # all other OSes try to extract CPU information from a small helper
1308 # program cpuinfo instead
1309 $_cc -o cpuinfo$_exesuf cpuinfo.c
1310 _cpuinfo="./cpuinfo$_exesuf"
1313 if x86 ; then
1314 # gather more CPU information
1315 pname=$($_cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -n 1)
1316 pvendor=$($_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
1317 pfamily=$($_cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
1318 pmodel=$($_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
1319 pstepping=$($_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
1321 exts=$($_cpuinfo | egrep 'features|flags' | cut -d ':' -f 2 | head -n 1)
1323 pparam=$(echo $exts | sed -e s/xmm/sse/ -e s/kni/sse/)
1324 # SSE implies MMX2, but not all SSE processors report the mmxext CPU flag.
1325 pparam=$(echo $pparam | sed -e 's/sse/sse mmxext/')
1327 for ext in $pparam ; do
1328 eval test \"\$_$ext\" = auto 2>/dev/null && eval _$ext=kernel_check
1329 done
1331 echocheck "CPU vendor"
1332 echores "$pvendor ($pfamily:$pmodel:$pstepping)"
1334 echocheck "CPU type"
1335 echores "$pname"
1338 fi # test "$_runtime_cpudetection" = no
1340 if x86 && test "$_runtime_cpudetection" = no ; then
1341 extcheck() {
1342 if test "$1" = kernel_check ; then
1343 echocheck "kernel support of $2"
1344 cat > $TMPC <<EOF
1345 #include <stdlib.h>
1346 #include <signal.h>
1347 static void catch(int sig) { exit(1); }
1348 int main(void) {
1349 signal(SIGILL, catch);
1350 __asm__ volatile ("$3":::"memory"); return 0;
1354 if cc_check && tmp_run ; then
1355 eval _$2=yes
1356 echores "yes"
1357 _optimizing="$_optimizing $2"
1358 return 0
1359 else
1360 eval _$2=no
1361 echores "failed"
1362 echo "It seems that your kernel does not correctly support $2."
1363 echo "To use $2 extensions in MPlayer, you have to upgrade/recompile your kernel!"
1364 return 1
1367 return 0
1370 extcheck $_mmx "mmx" "emms"
1371 extcheck $_mmxext "mmxext" "sfence"
1372 extcheck $_3dnow "3dnow" "femms"
1373 extcheck $_3dnowext "3dnowext" "pswapd %%mm0, %%mm0"
1374 extcheck $_sse "sse" "xorps %%xmm0, %%xmm0" || _gcc3_ext="$_gcc3_ext -mno-sse"
1375 extcheck $_sse2 "sse2" "xorpd %%xmm0, %%xmm0" || _gcc3_ext="$_gcc3_ext -mno-sse2"
1376 extcheck $_ssse3 "ssse3" "pabsd %%xmm0, %%xmm0"
1377 extcheck $_cmov "cmov" "cmovb %%eax, %%ebx"
1379 if test "$_gcc3_ext" != ""; then
1380 # if we had to disable sse/sse2 because the active kernel does not
1381 # support this instruction set extension, we also have to tell
1382 # gcc3 to not generate sse/sse2 instructions for normal C code
1383 cflag_check $_march $_gcc3_ext && _march="$_march $_gcc3_ext"
1389 def_fast_64bit='#define HAVE_FAST_64BIT 0'
1390 def_fast_unaligned='#define HAVE_FAST_UNALIGNED 0'
1391 arch_all='X86 IA64 SPARC ARM AVR32 SH4 PPC ALPHA MIPS PA_RISC S390 S390X VAX BFIN XTENSA TOMI GENERIC'
1392 subarch_all='X86_32 X86_64 PPC64'
1393 case "$host_arch" in
1394 i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686)
1395 arch='x86'
1396 subarch='x86_32'
1397 def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
1398 iproc=486
1399 proc=i486
1402 if test "$_runtime_cpudetection" = no ; then
1403 case "$pvendor" in
1404 AuthenticAMD)
1405 case "$pfamily" in
1406 3) proc=i386 iproc=386 ;;
1407 4) proc=i486 iproc=486 ;;
1408 5) iproc=586 # LGB: models are: K5/SSA5 K5 K5 K5 ? ? K6 K6 K6-2 K6-3
1409 # K6 model 13 are the K6-2+ and K6-III+, only differing in cache size.
1410 if test "$pmodel" -eq 9 -o "$pmodel" -eq 13; then
1411 proc=k6-3
1412 elif test "$pmodel" -eq 5 -o "$pmodel" -eq 10; then
1413 proc=geode
1414 elif test "$pmodel" -ge 8; then
1415 proc=k6-2
1416 elif test "$pmodel" -ge 6; then
1417 proc=k6
1418 else
1419 proc=i586
1422 6) iproc=686
1423 # It's a bit difficult to determine the correct type of Family 6
1424 # AMD CPUs just from their signature. Instead, we check directly
1425 # whether it supports SSE.
1426 if test "$_sse" = yes; then
1427 # gcc treats athlon-xp, athlon-4 and athlon-mp similarly.
1428 proc=athlon-xp
1429 else
1430 # Again, gcc treats athlon and athlon-tbird similarly.
1431 proc=athlon
1434 15) iproc=686
1435 # k8 cpu-type only supported in gcc >= 3.4.0, but that will be
1436 # caught and remedied in the optimization tests below.
1437 proc=k8
1440 *) proc=amdfam10 iproc=686
1441 test $_fast_clz = "auto" && _fast_clz=yes
1443 esac
1445 GenuineIntel)
1446 case "$pfamily" in
1447 3) proc=i386 iproc=386 ;;
1448 4) proc=i486 iproc=486 ;;
1449 5) iproc=586
1450 if test "$pmodel" -eq 4 || test "$pmodel" -eq 8; then
1451 proc=pentium-mmx # 4 is desktop, 8 is mobile
1452 else
1453 proc=i586
1456 6) iproc=686
1457 if test "$pmodel" -ge 15; then
1458 proc=core2
1459 elif test "$pmodel" -eq 9 -o "$pmodel" -ge 13; then
1460 proc=pentium-m
1461 elif test "$pmodel" -ge 7; then
1462 proc=pentium3
1463 elif test "$pmodel" -ge 3; then
1464 proc=pentium2
1465 else
1466 proc=i686
1468 test $_fast_clz = "auto" && _fast_clz=yes
1470 15) iproc=686
1471 # A nocona in 32-bit mode has no more capabilities than a prescott.
1472 if test "$pmodel" -ge 3; then
1473 proc=prescott
1474 else
1475 proc=pentium4
1476 test $_fast_clz = "auto" && _fast_clz=yes
1478 test $_fast_cmov = "auto" && _fast_cmov=no
1480 *) proc=prescott iproc=686 ;;
1481 esac
1483 CentaurHauls)
1484 case "$pfamily" in
1485 5) iproc=586
1486 if test "$pmodel" -ge 8; then
1487 proc=winchip2
1488 elif test "$pmodel" -ge 4; then
1489 proc=winchip-c6
1490 else
1491 proc=i586
1494 6) iproc=686
1495 if test "$pmodel" -ge 9; then
1496 proc=c3-2
1497 else
1498 proc=c3
1499 iproc=586
1502 *) proc=i686 iproc=i686 ;;
1503 esac
1505 unknown)
1506 case "$pfamily" in
1507 3) proc=i386 iproc=386 ;;
1508 4) proc=i486 iproc=486 ;;
1509 *) proc=i586 iproc=586 ;;
1510 esac
1513 proc=i586 iproc=586 ;;
1514 esac
1515 test $_fast_clz = "auto" && _fast_clz=no
1516 fi # test "$_runtime_cpudetection" = no
1519 # check that gcc supports our CPU, if not, fall back to earlier ones
1520 # LGB: check -mcpu and -march swithing step by step with enabling
1521 # to fall back till 386.
1523 # gcc >= 3.4.0 doesn't support -mcpu, we have to use -mtune instead
1525 if [ "$cc_vendor" = "gnu" ] && ([ "$_cc_major" -gt 3 ] || ( [ "$_cc_major" = 3 ] && [ "$_cc_minor" -ge 4 ])) ; then
1526 cpuopt=-mtune
1527 else
1528 cpuopt=-mcpu
1531 echocheck "GCC & CPU optimization abilities"
1532 if test "$_runtime_cpudetection" = no ; then
1533 if test $cc_vendor != "intel" && test $cc_vendor != "clang" ; then
1534 cflag_check -march=native && proc=native
1536 if test "$proc" = "amdfam10"; then
1537 cflag_check -march=$proc $cpuopt=$proc || proc=k8
1539 if test "$proc" = "k8"; then
1540 cflag_check -march=$proc $cpuopt=$proc || proc=athlon-xp
1542 if test "$proc" = "athlon-xp"; then
1543 cflag_check -march=$proc $cpuopt=$proc || proc=athlon
1545 if test "$proc" = "k6-3" || test "$proc" = "k6-2"; then
1546 cflag_check -march=$proc $cpuopt=$proc || proc=k6
1548 if test "$proc" = "k6" || test "$proc" = "c3"; then
1549 if ! cflag_check -march=$proc $cpuopt=$proc; then
1550 if cflag_check -march=i586 $cpuopt=i686; then
1551 proc=i586-i686
1552 else
1553 proc=i586
1557 if test "$proc" = "prescott" ; then
1558 cflag_check -march=$proc $cpuopt=$proc || proc=pentium4
1560 if test "$proc" = "core2" ; then
1561 cflag_check -march=$proc $cpuopt=$proc || proc=pentium-m
1563 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
1564 cflag_check -march=$proc $cpuopt=$proc || proc=i686
1566 if test "$proc" = "i686" || test "$proc" = "pentium-mmx" || test "$proc" = "winchip-c6" || test "$proc" = "winchip2"; then
1567 cflag_check -march=$proc $cpuopt=$proc || proc=i586
1569 if test "$proc" = "i586"; then
1570 cflag_check -march=$proc $cpuopt=$proc || proc=i486
1572 if test "$proc" = "i486" ; then
1573 cflag_check -march=$proc $cpuopt=$proc || proc=i386
1575 if test "$proc" = "i386" ; then
1576 cflag_check -march=$proc $cpuopt=$proc || proc=error
1578 if test "$proc" = "error" ; then
1579 echores "CPU optimization disabled. CPU not recognized or your compiler is too old."
1580 _mcpu=""
1581 _march=""
1582 _optimizing=""
1583 elif test "$proc" = "i586-i686"; then
1584 _march="-march=i586"
1585 _mcpu="$cpuopt=i686"
1586 _optimizing="$proc"
1587 else
1588 _march="-march=$proc"
1589 _mcpu="$cpuopt=$proc"
1590 _optimizing="$proc"
1592 else # if test "$_runtime_cpudetection" = no
1593 _mcpu="$cpuopt=generic"
1594 # at least i486 required, for bswap instruction
1595 _march="-march=i486"
1596 cflag_check $_mcpu || _mcpu="$cpuopt=i686"
1597 cflag_check $_mcpu || _mcpu=""
1598 cflag_check $_march $_mcpu || _march=""
1601 ## Gabucino : --target takes effect here (hopefully...) by overwriting
1602 ## autodetected mcpu/march parameters
1603 if test "$_target" ; then
1604 # TODO: it may be a good idea to check GCC and fall back in all cases
1605 if test "$host_arch" = "i586-i686"; then
1606 _march="-march=i586"
1607 _mcpu="$cpuopt=i686"
1608 else
1609 _march="-march=$host_arch"
1610 _mcpu="$cpuopt=$host_arch"
1613 proc="$host_arch"
1615 case "$proc" in
1616 i386) iproc=386 ;;
1617 i486) iproc=486 ;;
1618 i586|k5|k6|k6-2|k6-3|pentium|pentium-mmx) iproc=586 ;;
1619 i686|athlon*|pentium*) iproc=686 ;;
1620 *) iproc=586 ;;
1621 esac
1624 if test $_cmov = "yes" && test $_fast_cmov = "auto" ; then
1625 _fast_cmov="yes"
1626 else
1627 _fast_cmov="no"
1629 test $_fast_clz = "auto" && _fast_clz=yes
1631 echores "$proc"
1634 ia64)
1635 arch='ia64'
1636 def_fast_64bit='#define HAVE_FAST_64BIT 1'
1637 iproc='ia64'
1640 x86_64|amd64)
1641 arch='x86'
1642 subarch='x86_64'
1643 def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
1644 def_fast_64bit='#define HAVE_FAST_64BIT 1'
1645 iproc='x86_64'
1647 # gcc >= 3.4.0 doesn't support -mcpu, we have to use -mtune instead
1648 if test "$cc_vendor" = "gnu" && test "$_cc_major" -gt 3 -o "$_cc_major" -eq 3 -a "$_cc_minor" -ge 4 ; then
1649 cpuopt=-mtune
1650 else
1651 cpuopt=-mcpu
1653 if test "$_runtime_cpudetection" = no ; then
1654 case "$pvendor" in
1655 AuthenticAMD)
1656 case "$pfamily" in
1657 15) proc=k8
1658 test $_fast_clz = "auto" && _fast_clz=no
1660 *) proc=amdfam10;;
1661 esac
1663 GenuineIntel)
1664 case "$pfamily" in
1665 6) proc=core2;;
1667 # 64-bit prescotts exist, but as far as GCC is concerned they
1668 # have the same capabilities as a nocona.
1669 proc=nocona
1670 test $_fast_cmov = "auto" && _fast_cmov=no
1671 test $_fast_clz = "auto" && _fast_clz=no
1673 esac
1676 proc=error;;
1677 esac
1678 fi # test "$_runtime_cpudetection" = no
1680 echocheck "GCC & CPU optimization abilities"
1681 # This is a stripped-down version of the i386 fallback.
1682 if test "$_runtime_cpudetection" = no ; then
1683 if test $cc_vendor != "intel" && test $cc_vendor != "clang" ; then
1684 cflag_check -march=native && proc=native
1686 # --- AMD processors ---
1687 if test "$proc" = "amdfam10"; then
1688 cflag_check -march=$proc $cpuopt=$proc || proc=k8
1690 if test "$proc" = "k8"; then
1691 cflag_check -march=$proc $cpuopt=$proc || proc=athlon-xp
1693 # This will fail if gcc version < 3.3, which is ok because earlier
1694 # versions don't really support 64-bit on amd64.
1695 # Is this a valid assumption? -Corey
1696 if test "$proc" = "athlon-xp"; then
1697 cflag_check -march=$proc $cpuopt=$proc || proc=error
1699 # --- Intel processors ---
1700 if test "$proc" = "core2"; then
1701 cflag_check -march=$proc $cpuopt=$proc || proc=x86-64
1703 if test "$proc" = "x86-64"; then
1704 cflag_check -march=$proc $cpuopt=$proc || proc=nocona
1706 if test "$proc" = "nocona"; then
1707 cflag_check -march=$proc $cpuopt=$proc || proc=pentium4
1709 if test "$proc" = "pentium4"; then
1710 cflag_check -march=$proc $cpuopt=$proc || proc=error
1713 _march="-march=$proc"
1714 _mcpu="$cpuopt=$proc"
1715 if test "$proc" = "error" ; then
1716 echores "CPU optimization disabled. CPU not recognized or your compiler is too old."
1717 _mcpu=""
1718 _march=""
1720 else # if test "$_runtime_cpudetection" = no
1721 # x86-64 is an undocumented option, an intersection of k8 and nocona.
1722 _march="-march=x86-64"
1723 _mcpu="$cpuopt=generic"
1724 cflag_check $_mcpu || _mcpu="x86-64"
1725 cflag_check $_mcpu || _mcpu=""
1726 cflag_check $_march $_mcpu || _march=""
1729 _optimizing="$proc"
1730 test $_fast_cmov = "auto" && _fast_cmov=yes
1731 test $_fast_clz = "auto" && _fast_clz=yes
1733 echores "$proc"
1736 sparc|sparc64)
1737 arch='sparc'
1738 iproc='sparc'
1739 if test "$host_arch" = "sparc64" ; then
1740 _vis='yes'
1741 proc='ultrasparc'
1742 def_fast_64bit='#define HAVE_FAST_64BIT 1'
1743 else
1744 proc=v8
1746 _mcpu="-mcpu=$proc"
1747 _optimizing="$proc"
1750 arm*)
1751 arch='arm'
1752 iproc='arm'
1755 avr32)
1756 arch='avr32'
1757 def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
1758 iproc='avr32'
1759 test $_fast_clz = "auto" && _fast_clz=yes
1762 sh|sh4)
1763 arch='sh4'
1764 iproc='sh4'
1767 ppc|ppc64|powerpc|powerpc64)
1768 arch='ppc'
1769 def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
1770 iproc='ppc'
1772 if test "$host_arch" = "ppc64" -o "$host_arch" = "powerpc64" ; then
1773 subarch='ppc64'
1774 def_fast_64bit='#define HAVE_FAST_64BIT 1'
1776 echocheck "CPU type"
1777 case $system_name in
1778 Linux)
1779 proc=$($_cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ',' -f 1 | cut -b 2- | head -n 1)
1780 if test -n "$($_cpuinfo | grep altivec)"; then
1781 test $_altivec = auto && _altivec=yes
1784 Darwin)
1785 proc=$($_cpuinfo | grep "Processor type" | cut -f 3 -d ' ' | sed 's/ppc//')
1786 if [ $(sysctl -n hw.vectorunit) -eq 1 -o \
1787 "$(sysctl -n hw.optional.altivec 2> /dev/null)" = "1" ]; then
1788 test $_altivec = auto && _altivec=yes
1791 NetBSD)
1792 # only gcc 3.4 works reliably with AltiVec code under NetBSD
1793 case $cc_version in
1794 2*|3.0*|3.1*|3.2*|3.3*)
1797 if [ $(sysctl -n machdep.altivec) -eq 1 ]; then
1798 test $_altivec = auto && _altivec=yes
1801 esac
1803 AIX)
1804 proc=$($_cpuinfo | grep 'type' | cut -f 2 -d ' ' | sed 's/PowerPC_//')
1806 esac
1807 if test "$_altivec" = yes; then
1808 echores "$proc altivec"
1809 else
1810 _altivec=no
1811 echores "$proc"
1814 echocheck "GCC & CPU optimization abilities"
1816 if test -n "$proc"; then
1817 case "$proc" in
1818 601) _march='-mcpu=601' _mcpu='-mtune=601' ;;
1819 603) _march='-mcpu=603' _mcpu='-mtune=603' ;;
1820 603e|603ev) _march='-mcpu=603e' _mcpu='-mtune=603e' ;;
1821 604|604e|604r|604ev) _march='-mcpu=604' _mcpu='-mtune=604' ;;
1822 740|740/750|745/755) _march='-mcpu=740' _mcpu='-mtune=740' ;;
1823 750|750CX) _march='-mcpu=750' _mcpu='-mtune=750' ;;
1824 POWER) _march='-mcpu=power' _mcpu='-mtune=power' ;;
1825 POWER2) _march='-mcpu=power2' _mcpu='-mtune=power2' ;;
1826 POWER3) _march='-mcpu=power3' _mcpu='-mtune=power3' ;;
1827 *) ;;
1828 esac
1829 # gcc 3.1(.1) and up supports 7400 and 7450
1830 if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "1" || test "$_cc_major" -ge "4"; then
1831 case "$proc" in
1832 7400*|7410*) _march='-mcpu=7400' _mcpu='-mtune=7400' ;;
1833 7447*|7450*|7455*) _march='-mcpu=7450' _mcpu='-mtune=7450' ;;
1834 *) ;;
1835 esac
1837 # gcc 3.2 and up supports 970
1838 if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "3" || test "$_cc_major" -ge "4"; then
1839 case "$proc" in
1840 970*|PPC970*) _march='-mcpu=970' _mcpu='-mtune=970' ;;
1841 *) ;;
1842 esac
1844 # gcc 3.3 and up supports POWER4
1845 if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "3" || test "$_cc_major" -ge "4"; then
1846 case "$proc" in
1847 POWER4) _march='-mcpu=power4' _mcpu='-mtune=power4' ;;
1848 *) ;;
1849 esac
1851 # gcc 3.4 and up supports 440*
1852 if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "4" || test "$_cc_major" -ge "4"; then
1853 case "$proc" in
1854 440EP*) _march='-mcpu=440fp' _mcpu='-mtune=440fp' ;;
1855 440G* ) _march='-mcpu=440' _mcpu='-mtune=440' ;;
1856 *) ;;
1857 esac
1859 # gcc 4.0 and up supports POWER5
1860 if test "$_cc_major" -ge "4"; then
1861 case "$proc" in
1862 POWER5*) _march='-mcpu=power5' _mcpu='-mtune=power5' ;;
1863 *) ;;
1864 esac
1868 if test -n "$_mcpu"; then
1869 _optimizing=$(echo $_mcpu | cut -c 8-)
1870 echores "$_optimizing"
1871 else
1872 echores "none"
1875 test $_fast_clz = "auto" && _fast_clz=yes
1879 alpha*)
1880 arch='alpha'
1881 iproc='alpha'
1882 def_fast_64bit='#define HAVE_FAST_64BIT 1'
1884 echocheck "CPU type"
1885 cat > $TMPC << EOF
1886 int main(void) {
1887 unsigned long ver, mask;
1888 __asm__ ("implver %0" : "=r" (ver));
1889 __asm__ ("amask %1, %0" : "=r" (mask) : "r" (-1));
1890 printf("%ld-%x\n", ver, ~mask);
1891 return 0;
1894 $_cc -o "$TMPEXE" "$TMPC"
1895 case $("$TMPEXE") in
1897 0-0) proc="ev4"; _mvi="0";;
1898 1-0) proc="ev5"; _mvi="0";;
1899 1-1) proc="ev56"; _mvi="0";;
1900 1-101) proc="pca56"; _mvi="1";;
1901 2-303) proc="ev6"; _mvi="1";;
1902 2-307) proc="ev67"; _mvi="1";;
1903 2-1307) proc="ev68"; _mvi="1";;
1904 esac
1905 echores "$proc"
1907 echocheck "GCC & CPU optimization abilities"
1908 if test "$proc" = "ev68" ; then
1909 cc_check -mcpu=$proc || proc=ev67
1911 if test "$proc" = "ev67" ; then
1912 cc_check -mcpu=$proc || proc=ev6
1914 _mcpu="-mcpu=$proc"
1915 echores "$proc"
1917 test $_fast_clz = "auto" && _fast_clz=yes
1919 _optimizing="$proc"
1922 mips*)
1923 arch='mips'
1924 iproc='mips'
1926 test $_fast_clz = "auto" && _fast_clz=yes
1930 hppa)
1931 arch='pa_risc'
1932 iproc='PA-RISC'
1935 s390)
1936 arch='s390'
1937 iproc='390'
1940 s390x)
1941 arch='s390x'
1942 iproc='390x'
1945 vax)
1946 arch='vax'
1947 iproc='vax'
1950 xtensa)
1951 arch='xtensa'
1952 iproc='xtensa'
1955 generic)
1956 arch='generic'
1960 echo "The architecture of your CPU ($host_arch) is not supported by this configure script"
1961 echo "It seems nobody has ported MPlayer to your OS or CPU type yet."
1962 die "unsupported architecture $host_arch"
1964 esac # case "$host_arch" in
1966 if test "$_runtime_cpudetection" = yes ; then
1967 if x86 ; then
1968 test "$_cmov" != no && _cmov=yes
1969 x86_32 && _cmov=no
1970 test "$_mmx" != no && _mmx=yes
1971 test "$_3dnow" != no && _3dnow=yes
1972 test "$_3dnowext" != no && _3dnowext=yes
1973 test "$_mmxext" != no && _mmxext=yes
1974 test "$_sse" != no && _sse=yes
1975 test "$_sse2" != no && _sse2=yes
1976 test "$_ssse3" != no && _ssse3=yes
1978 if ppc; then
1979 _altivec=yes
1984 # endian testing
1985 echocheck "byte order"
1986 if test "$_big_endian" = auto ; then
1987 cat > $TMPC <<EOF
1988 short ascii_name[] = {
1989 'M' << 8 | 'P', 'l' << 8 | 'a', 'y' << 8 | 'e', 'r' << 8 | 'B',
1990 'i' << 8 | 'g', 'E' << 8 | 'n', 'd' << 8 | 'i', 'a' << 8 | 'n', 0 };
1991 int main(void) { return (long)ascii_name; }
1993 if cc_check ; then
1994 if strings $TMPEXE | grep -q -l MPlayerBigEndian ; then
1995 _big_endian=yes
1996 else
1997 _big_endian=no
1999 else
2000 echo ${_echo_n} "failed to autodetect byte order, defaulting to ${_echo_c}"
2003 if test "$_big_endian" = yes ; then
2004 _byte_order='big-endian'
2005 def_words_endian='#define WORDS_BIGENDIAN 1'
2006 def_bigendian='#define HAVE_BIGENDIAN 1'
2007 else
2008 _byte_order='little-endian'
2009 def_words_endian='#undef WORDS_BIGENDIAN'
2010 def_bigendian='#define HAVE_BIGENDIAN 0'
2012 echores "$_byte_order"
2015 echocheck "assembler support of -pipe option"
2016 # -I. helps to detect compilers that just misunderstand -pipe like Sun C
2017 cflag_check -pipe -I. && _pipe="-pipe" && echores "yes" || echores "no"
2020 if darwin && test "$cc_vendor" = "gnu" ; then
2021 echocheck "GCC support of -mstackrealign"
2022 # GCC 4.2 and some earlier Apple versions support this flag on x86. Since
2023 # Mac OS X/Intel has an ABI different from Windows this is needed to avoid
2024 # crashes when loading Win32 DLLs. Unfortunately some gcc versions create
2025 # wrong code with this flag, but this can be worked around by adding
2026 # -fno-unit-at-a-time as described in the blog post at
2027 # http://www.dribin.org/dave/blog/archives/2006/12/05/missing_third_param/
2028 cat > $TMPC << EOF
2029 __attribute__((noinline)) static int foo3(int i1, int i2, int i3) { return i3; }
2030 int main(void) { return foo3(1, 2, 3) == 3 ? 0 : 1; }
2032 cc_check -O2 -mstackrealign && tmp_run && cflags_stackrealign=-mstackrealign
2033 test -z "$cflags_stackrealign" && cc_check -O2 -mstackrealign -fno-unit-at-a-time &&
2034 tmp_run && cflags_stackrealign="-mstackrealign -fno-unit-at-a-time"
2035 test -n "$cflags_stackrealign" && echores "yes" || echores "no"
2036 fi # if darwin && test "$cc_vendor" = "gnu" ; then
2039 # Checking for CFLAGS
2040 _install_strip="-s"
2041 if test "$_profile" != "" || test "$_debug" != "" ; then
2042 _install_strip=
2044 if test -z "$CFLAGS" ; then
2045 if test "$cc_vendor" = "intel" ; then
2046 CFLAGS="-O2 $_debug $_profile $_march $_mcpu $_pipe -fomit-frame-pointer"
2047 WARNFLAGS="-wd167 -wd556 -wd144"
2048 elif test "$cc_vendor" = "clang"; then
2049 CFLAGS="-O2 $_debug $_profile $_march $_pipe"
2050 WARNFLAGS="-Wall -Wno-switch-enum -Wno-logical-op-parentheses -Wpointer-arith -Wundef -Wno-pointer-sign -Wmissing-prototypes"
2051 ERRORFLAGS="-Werror=implicit-function-declaration"
2052 elif test "$cc_vendor" != "gnu" ; then
2053 CFLAGS="-O2 $_debug $_profile $_march $_mcpu $_pipe"
2054 else
2055 CFLAGS="-O2 $_debug $_profile $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
2056 WARNFLAGS="-Wall -Wno-switch -Wno-parentheses -Wpointer-arith -Wredundant-decls"
2057 ERRORFLAGS="-Werror-implicit-function-declaration"
2058 extra_ldflags="$extra_ldflags -ffast-math"
2060 else
2061 warn_cflags=yes
2064 if darwin && test "$cc_vendor" = "gnu" ; then
2065 extra_cflags="-falign-loops=16 -shared-libgcc $extra_cflags"
2068 if test "$cc_vendor" = "gnu" ; then
2069 cflag_check -Wundef && WARNFLAGS="-Wundef $WARNFLAGS"
2070 # -std=gnu99 is not a warning flag but is placed in WARN_CFLAGS because
2071 # that's the only variable specific to C now, and this option is not valid
2072 # for C++.
2073 cflag_check -std=gnu99 && WARN_CFLAGS="-std=gnu99 $WARN_CFLAGS"
2074 cflag_check -Wno-pointer-sign && WARN_CFLAGS="-Wno-pointer-sign $WARN_CFLAGS"
2075 cflag_check -Wdisabled-optimization && WARN_CFLAGS="-Wdisabled-optimization $WARN_CFLAGS"
2076 cflag_check -Wmissing-prototypes && WARN_CFLAGS="-Wmissing-prototypes $WARN_CFLAGS"
2077 cflag_check -Wstrict-prototypes && WARN_CFLAGS="-Wstrict-prototypes $WARN_CFLAGS"
2078 else
2079 CFLAGS="-D_ISOC99_SOURCE -D_BSD_SOURCE $CFLAGS"
2082 cflag_check -mno-omit-leaf-frame-pointer && cflags_no_omit_leaf_frame_pointer="-mno-omit-leaf-frame-pointer"
2083 cflag_check -MD -MP && DEPFLAGS="-MD -MP"
2086 if test -n "$LDFLAGS" ; then
2087 extra_ldflags="$extra_ldflags $LDFLAGS"
2088 warn_cflags=yes
2089 elif test "$cc_vendor" = "intel" ; then
2090 extra_ldflags="$extra_ldflags -i-static"
2092 if test -n "$CPPFLAGS" ; then
2093 extra_cflags="$extra_cflags $CPPFLAGS"
2094 warn_cflags=yes
2099 echocheck "PIC"
2100 pic=no
2101 cat > $TMPC << EOF
2102 int main(void) {
2103 #if !(defined(__PIC__) || defined(__pic__) || defined(PIC))
2104 #error PIC not enabled
2105 #endif
2106 return 0;
2109 cc_check && pic=yes && extra_cflags="$extra_cflags -DPIC"
2110 echores $pic
2113 if x86 ; then
2115 echocheck ".align is a power of two"
2116 if test "$_asmalign_pot" = auto ; then
2117 _asmalign_pot=no
2118 inline_asm_check '".align 3"' && _asmalign_pot=yes
2120 if test "$_asmalign_pot" = "yes" ; then
2121 def_asmalign_pot='#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t"'
2122 else
2123 def_asmalign_pot='#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\n\t"'
2125 echores $_asmalign_pot
2128 echocheck "ebx availability"
2129 ebx_available=no
2130 def_ebx_available='#define HAVE_EBX_AVAILABLE 0'
2131 cat > $TMPC << EOF
2132 int main(void) {
2133 int x;
2134 __asm__ volatile(
2135 "xor %0, %0"
2136 :"=b"(x)
2137 // just adding ebx to clobber list seems unreliable with some
2138 // compilers, e.g. Haiku's gcc 2.95
2140 // and the above check does not work for OSX 64 bit...
2141 __asm__ volatile("":::"%ebx");
2142 return 0;
2145 cc_check && ebx_available=yes && def_ebx_available='#define HAVE_EBX_AVAILABLE 1'
2146 echores $ebx_available
2148 fi #if x86
2150 #FIXME: This should happen before the check for CFLAGS..
2151 def_altivec_h='#define HAVE_ALTIVEC_H 0'
2152 if ppc && ( test "$_altivec" = yes || test "$_runtime_cpudetection" = yes ) ; then
2154 # check if AltiVec is supported by the compiler, and how to enable it
2155 echocheck "GCC AltiVec flags"
2156 if $(cflag_check -maltivec -mabi=altivec) ; then
2157 _altivec_gcc_flags="-maltivec -mabi=altivec"
2158 # check if <altivec.h> should be included
2159 if $(header_check altivec.h $_altivec_gcc_flags) ; then
2160 def_altivec_h='#define HAVE_ALTIVEC_H 1'
2161 inc_altivec_h='#include <altivec.h>'
2162 else
2163 if $(cflag_check -faltivec) ; then
2164 _altivec_gcc_flags="-faltivec"
2165 else
2166 _altivec=no
2167 _altivec_gcc_flags="none, AltiVec disabled"
2171 echores "$_altivec_gcc_flags"
2173 # check if the compiler supports braces for vector declarations
2174 cat > $TMPC << EOF
2175 $inc_altivec_h
2176 int main(void) { (vector int) {1}; return 0; }
2178 cc_check $_altivec_gcc_flags || die "You need a compiler that supports {} in AltiVec vector declarations."
2180 # Disable runtime cpudetection if we cannot generate AltiVec code or
2181 # AltiVec is disabled by the user.
2182 test "$_runtime_cpudetection" = yes && test "$_altivec" = no \
2183 && _runtime_cpudetection=no
2185 # Show that we are optimizing for AltiVec (if enabled and supported).
2186 test "$_runtime_cpudetection" = no && test "$_altivec" = yes \
2187 && _optimizing="$_optimizing altivec"
2189 # If AltiVec is enabled, make sure the correct flags turn up in CFLAGS.
2190 test "$_altivec" = yes && CFLAGS="$CFLAGS $_altivec_gcc_flags"
2193 if arm ; then
2194 echocheck "ARMv5TE (Enhanced DSP Extensions)"
2195 if test $_armv5te = "auto" ; then
2196 _armv5te=no
2197 inline_asm_check '"qadd r0, r0, r0"' && _armv5te=yes
2199 echores "$_armv5te"
2201 test $_armv5te = "yes" && test $_fast_clz = "auto" && _fast_clz=yes
2203 echocheck "ARMv6 (SIMD instructions)"
2204 if test $_armv6 = "auto" ; then
2205 _armv6=no
2206 inline_asm_check '"sadd16 r0, r0, r0"' && _armv6=yes
2208 echores "$_armv6"
2210 echocheck "ARMv6t2 (SIMD instructions)"
2211 if test $_armv6t2 = "auto" ; then
2212 _armv6t2=no
2213 inline_asm_check '"movt r0, #0"' && _armv6t2=yes
2215 echores "$_armv6t2"
2217 echocheck "ARM VFP"
2218 if test $_armvfp = "auto" ; then
2219 _armvfp=no
2220 inline_asm_check '"fadds s0, s0, s0"' && _armvfp=yes
2222 echores "$_armvfp"
2224 echocheck "ARM NEON"
2225 if test $neon = "auto" ; then
2226 neon=no
2227 inline_asm_check '"vadd.i16 q0, q0, q0"' && neon=yes
2229 echores "$neon"
2231 echocheck "iWMMXt (Intel XScale SIMD instructions)"
2232 if test $_iwmmxt = "auto" ; then
2233 _iwmmxt=no
2234 inline_asm_check '"wunpckelub wr6, wr4"' && _iwmmxt=yes
2236 echores "$_iwmmxt"
2239 cpuexts_all='ALTIVEC MMX MMX2 AMD3DNOW AMD3DNOWEXT SSE SSE2 SSSE3 FAST_CMOV CMOV FAST_CLZ ARMV5TE ARMV6 ARMV6T2 ARMVFP NEON IWMMXT MMI VIS MVI'
2240 test "$_altivec" = yes && cpuexts="ALTIVEC $cpuexts"
2241 test "$_mmx" = yes && cpuexts="MMX $cpuexts"
2242 test "$_mmxext" = yes && cpuexts="MMX2 $cpuexts"
2243 test "$_3dnow" = yes && cpuexts="AMD3DNOW $cpuexts"
2244 test "$_3dnowext" = yes && cpuexts="AMD3DNOWEXT $cpuexts"
2245 test "$_sse" = yes && cpuexts="SSE $cpuexts"
2246 test "$_sse2" = yes && cpuexts="SSE2 $cpuexts"
2247 test "$_ssse3" = yes && cpuexts="SSSE3 $cpuexts"
2248 test "$_cmov" = yes && cpuexts="CMOV $cpuexts"
2249 test "$_fast_cmov" = yes && cpuexts="FAST_CMOV $cpuexts"
2250 test "$_fast_clz" = yes && cpuexts="FAST_CLZ $cpuexts"
2251 test "$_armv5te" = yes && cpuexts="ARMV5TE $cpuexts"
2252 test "$_armv6" = yes && cpuexts="ARMV6 $cpuexts"
2253 test "$_armv6t2" = yes && cpuexts="ARMV6T2 $cpuexts"
2254 test "$_armvfp" = yes && cpuexts="ARMVFP $cpuexts"
2255 test "$neon" = yes && cpuexts="NEON $cpuexts"
2256 test "$_iwmmxt" = yes && cpuexts="IWMMXT $cpuexts"
2257 test "$_vis" = yes && cpuexts="VIS $cpuexts"
2258 test "$_mvi" = yes && cpuexts="MVI $cpuexts"
2260 # Checking kernel version...
2261 if x86_32 && linux ; then
2262 _k_verc_problem=no
2263 kernel_version=$(uname -r 2>&1)
2264 echocheck "$system_name kernel version"
2265 case "$kernel_version" in
2266 '') kernel_version="?.??"; _k_verc_fail=yes;;
2267 [0-1].[0-9].[0-9]*|2.[0-3].[0-9]*)
2268 _k_verc_problem=yes;;
2269 esac
2270 if test "$_k_verc_problem" = yes && test "$_sse" = yes ; then
2271 _k_verc_fail=yes
2273 if test "$_k_verc_fail" ; then
2274 echores "$kernel_version, fail"
2275 echo "WARNING! If you want to run MPlayer on this system, get prepared for problems!"
2276 echo "2.2.x has limited SSE support. Upgrade the kernel or use --disable-sse if you"
2277 echo "experience crashes. MPlayer tries to autodetect if your kernel correctly"
2278 echo "supports SSE, but you have been warned! If you are using a kernel older than"
2279 echo "2.2.x you must upgrade it to get SSE support!"
2280 # die "Your kernel is too old for this CPU." # works fine on some 2.2.x so don't die (later check will test)
2281 else
2282 echores "$kernel_version, ok"
2286 ######################
2287 # MAIN TESTS GO HERE #
2288 ######################
2291 echocheck "-lposix"
2292 if cflag_check -lposix ; then
2293 extra_ldflags="$extra_ldflags -lposix"
2294 echores "yes"
2295 else
2296 echores "no"
2299 echocheck "-lm"
2300 if cflag_check -lm ; then
2301 _ld_lm="-lm"
2302 echores "yes"
2303 else
2304 _ld_lm=""
2305 echores "no"
2309 echocheck "langinfo"
2310 if test "$_langinfo" = auto ; then
2311 _langinfo=no
2312 statement_check langinfo.h 'nl_langinfo(CODESET)' && _langinfo=yes
2314 if test "$_langinfo" = yes ; then
2315 def_langinfo='#define HAVE_LANGINFO 1'
2316 else
2317 def_langinfo='#undef HAVE_LANGINFO'
2319 echores "$_langinfo"
2322 echocheck "translation support"
2323 if test "$_translation" = yes; then
2324 def_translation="#define CONFIG_TRANSLATION 1"
2325 else
2326 def_translation="#undef CONFIG_TRANSLATION"
2328 echores "$_translation"
2330 echocheck "language"
2331 # Set preferred languages, "all" uses English as main language.
2332 test -z "$language" && language=$LINGUAS
2333 test -z "$language_doc" && language_doc=$language
2334 test -z "$language_man" && language_man=$language
2335 test -z "$language_msg" && language_msg=$language
2336 test -z "$language_msg" && language_msg="all"
2337 language_doc=$(echo $language_doc | tr , " ")
2338 language_man=$(echo $language_man | tr , " ")
2339 language_msg=$(echo $language_msg | tr , " ")
2341 test "$language_doc" = "all" && language_doc=$doc_lang_all
2342 test "$language_man" = "all" && language_man=$man_lang_all
2343 test "$language_msg" = "all" && language_msg=$msg_lang_all
2345 if test "$_translation" != yes ; then
2346 language_msg=""
2349 # Prune non-existing translations from language lists.
2350 # Set message translation to the first available language.
2351 # Fall back on English.
2352 for lang in $language_doc ; do
2353 test -d DOCS/xml/$lang && tmp_language_doc="$tmp_language_doc $lang"
2354 done
2355 language_doc=$tmp_language_doc
2356 test -z "$language_doc" && language_doc=en
2358 for lang in $language_man ; do
2359 test -d DOCS/man/$lang && tmp_language_man="$tmp_language_man $lang"
2360 done
2361 language_man=$tmp_language_man
2362 test -z "$language_man" && language_man=en
2364 for lang in $language_msg ; do
2365 test -f po/$lang.po && tmp_language_msg="$tmp_language_msg $lang"
2366 done
2367 language_msg=$tmp_language_msg
2369 echores "messages (en+): $language_msg - man pages: $language_man - documentation: $language_doc"
2372 echocheck "enable sighandler"
2373 if test "$_sighandler" = yes ; then
2374 def_sighandler='#define CONFIG_SIGHANDLER 1'
2375 else
2376 def_sighandler='#undef CONFIG_SIGHANDLER'
2378 echores "$_sighandler"
2380 echocheck "runtime cpudetection"
2381 if test "$_runtime_cpudetection" = yes ; then
2382 _optimizing="Runtime CPU-Detection enabled"
2383 def_runtime_cpudetection='#define CONFIG_RUNTIME_CPUDETECT 1'
2384 else
2385 def_runtime_cpudetection='#define CONFIG_RUNTIME_CPUDETECT 0'
2387 echores "$_runtime_cpudetection"
2390 echocheck "restrict keyword"
2391 for restrict_keyword in restrict __restrict __restrict__ ; do
2392 echo "void foo(char * $restrict_keyword p); int main(void) { return 0; }" > $TMPC
2393 if cc_check; then
2394 def_restrict_keyword=$restrict_keyword
2395 break;
2397 done
2398 if [ -n "$def_restrict_keyword" ]; then
2399 echores "$def_restrict_keyword"
2400 else
2401 echores "none"
2403 # Avoid infinite recursion loop ("#define restrict restrict")
2404 if [ "$def_restrict_keyword" != "restrict" ]; then
2405 def_restrict_keyword="#define restrict $def_restrict_keyword"
2406 else
2407 def_restrict_keyword=""
2411 echocheck "__builtin_expect"
2412 # GCC branch prediction hint
2413 cat > $TMPC << EOF
2414 static int foo(int a) {
2415 a = __builtin_expect(a, 10);
2416 return a == 10 ? 0 : 1;
2418 int main(void) { return foo(10) && foo(0); }
2420 _builtin_expect=no
2421 cc_check && _builtin_expect=yes
2422 if test "$_builtin_expect" = yes ; then
2423 def_builtin_expect='#define HAVE_BUILTIN_EXPECT 1'
2424 else
2425 def_builtin_expect='#undef HAVE_BUILTIN_EXPECT'
2427 echores "$_builtin_expect"
2430 echocheck "kstat"
2431 _kstat=no
2432 statement_check kstat.h 'kstat_open()' -lkstat && _kstat=yes
2433 if test "$_kstat" = yes ; then
2434 def_kstat="#define HAVE_LIBKSTAT 1"
2435 extra_ldflags="$extra_ldflags -lkstat"
2436 else
2437 def_kstat="#undef HAVE_LIBKSTAT"
2439 echores "$_kstat"
2442 echocheck "posix4"
2443 # required for nanosleep on some systems
2444 _posix4=no
2445 statement_check time.h 'nanosleep(0, 0)' -lposix4 && _posix4=yes
2446 if test "$_posix4" = yes ; then
2447 extra_ldflags="$extra_ldflags -lposix4"
2449 echores "$_posix4"
2452 echocheck "nanosleep"
2453 _nanosleep=no
2454 statement_check time.h 'nanosleep(0, 0)' && _nanosleep=yes
2455 if test "$_nanosleep" = yes ; then
2456 def_nanosleep='#define HAVE_NANOSLEEP 1'
2457 else
2458 def_nanosleep='#undef HAVE_NANOSLEEP'
2460 echores "$_nanosleep"
2463 echocheck "socklib"
2464 # for Solaris (socket stuff is in -lsocket, gethostbyname and friends in -lnsl):
2465 # for BeOS (socket stuff is in -lsocket, gethostbyname and friends in -lbind):
2466 cat > $TMPC << EOF
2467 #include <netdb.h>
2468 #include <sys/socket.h>
2469 int main(void) { gethostbyname(0); socket(AF_INET, SOCK_STREAM, 0); return 0; }
2471 _socklib=no
2472 for _ld_tmp in "" "-lsocket -lbind" "-lsocket -ldnet" "-lsocket -lnsl" "-lnsl" "-lsocket" ; do
2473 cc_check $_ld_tmp && _ld_sock="$_ld_tmp" && _socklib=yes && break
2474 done
2475 test $_socklib = yes && test $_winsock2_h = auto && _winsock2_h=no
2476 if test $_winsock2_h = auto ; then
2477 _winsock2_h=no
2478 statement_check winsock2.h 'gethostbyname(0)' -lws2_32 && _ld_sock="-lws2_32" && _winsock2_h=yes
2480 test "$_ld_sock" && res_comment="using $_ld_sock"
2481 echores "$_socklib"
2484 if test $_winsock2_h = yes ; then
2485 _ld_sock="-lws2_32"
2486 def_winsock2_h='#define HAVE_WINSOCK2_H 1'
2487 else
2488 def_winsock2_h='#define HAVE_WINSOCK2_H 0'
2492 echocheck "inet_pton()"
2493 def_inet_pton='#define HAVE_INET_PTON 0'
2494 inet_pton=no
2495 for _ld_tmp in "$_ld_sock" "$_ld_sock -lresolv" ; do
2496 statement_check arpa/inet.h 'inet_pton(0, 0, 0)' $_ld_tmp && inet_pton=yes && break
2497 done
2498 if test $inet_pton = yes ; then
2499 test "$_ld_tmp" && res_comment="using $_ld_tmp"
2500 def_inet_pton='#define HAVE_INET_PTON 1'
2502 echores "$inet_pton"
2505 echocheck "inet_aton()"
2506 def_inet_aton='#define HAVE_INET_ATON 0'
2507 inet_aton=no
2508 for _ld_tmp in "$_ld_sock" "$_ld_sock -lresolv" ; do
2509 statement_check arpa/inet.h 'inet_aton(0, 0)' $_ld_tmp && inet_aton=yes && break
2510 done
2511 if test $inet_aton = yes ; then
2512 test "$_ld_tmp" && res_comment="using $_ld_tmp"
2513 def_inet_aton='#define HAVE_INET_ATON 1'
2515 echores "$inet_aton"
2518 echocheck "socklen_t"
2519 _socklen_t=no
2520 for header in "sys/socket.h" "ws2tcpip.h" "sys/types.h" ; do
2521 statement_check $header 'socklen_t v = 0' && _socklen_t=yes && break
2522 done
2523 if test "$_socklen_t" = yes ; then
2524 def_socklen_t='#define HAVE_SOCKLEN_T 1'
2525 else
2526 def_socklen_t='#define HAVE_SOCKLEN_T 0'
2528 echores "$_socklen_t"
2531 echocheck "closesocket()"
2532 _closesocket=no
2533 statement_check winsock2.h 'closesocket(~0)' $_ld_sock && _closesocket=yes
2534 if test "$_closesocket" = yes ; then
2535 def_closesocket='#define HAVE_CLOSESOCKET 1'
2536 else
2537 def_closesocket='#define HAVE_CLOSESOCKET 0'
2539 echores "$_closesocket"
2542 echocheck "networking"
2543 test $_winsock2_h = no && test $inet_pton = no &&
2544 test $inet_aton = no && networking=no
2545 if test "$networking" = yes ; then
2546 def_network='#define CONFIG_NETWORK 1'
2547 def_networking='#define CONFIG_NETWORKING 1'
2548 extra_ldflags="$extra_ldflags $_ld_sock"
2549 inputmodules="networking $inputmodules"
2550 else
2551 noinputmodules="networking $noinputmodules"
2552 def_network='#define CONFIG_NETWORK 0'
2553 def_networking='#undef CONFIG_NETWORKING'
2555 echores "$networking"
2558 echocheck "inet6"
2559 if test "$_inet6" = auto ; then
2560 cat > $TMPC << EOF
2561 #include <sys/types.h>
2562 #if !defined(_WIN32)
2563 #include <sys/socket.h>
2564 #include <netinet/in.h>
2565 #else
2566 #include <ws2tcpip.h>
2567 #endif
2568 int main(void) { struct sockaddr_in6 six; socket(AF_INET6, SOCK_STREAM, AF_INET6); return 0; }
2570 _inet6=no
2571 if cc_check $_ld_sock ; then
2572 _inet6=yes
2575 if test "$_inet6" = yes ; then
2576 def_inet6='#define HAVE_AF_INET6 1'
2577 else
2578 def_inet6='#undef HAVE_AF_INET6'
2580 echores "$_inet6"
2583 echocheck "gethostbyname2"
2584 if test "$_gethostbyname2" = auto ; then
2585 cat > $TMPC << EOF
2586 #include <sys/types.h>
2587 #include <sys/socket.h>
2588 #include <netdb.h>
2589 int main(void) { gethostbyname2("", AF_INET); return 0; }
2591 _gethostbyname2=no
2592 if cc_check ; then
2593 _gethostbyname2=yes
2596 if test "$_gethostbyname2" = yes ; then
2597 def_gethostbyname2='#define HAVE_GETHOSTBYNAME2 1'
2598 else
2599 def_gethostbyname2='#undef HAVE_GETHOSTBYNAME2'
2601 echores "$_gethostbyname2"
2604 echocheck "inttypes.h (required)"
2605 _inttypes=no
2606 header_check inttypes.h && _inttypes=yes
2607 echores "$_inttypes"
2609 if test "$_inttypes" = no ; then
2610 echocheck "sys/bitypes.h (inttypes.h predecessor)"
2611 header_check sys/bitypes.h && _inttypes=yes
2612 if test "$_inttypes" = yes ; then
2613 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."
2614 else
2615 die "Cannot find header either inttypes.h or bitypes.h. There is no chance for compilation to succeed."
2620 echocheck "alloca.h"
2621 _alloca=no
2622 statement_check alloca.h 'alloca(0)' && _alloca=yes
2623 if cc_check ; then
2624 def_alloca_h='#define HAVE_ALLOCA_H 1'
2625 else
2626 def_alloca_h='#undef HAVE_ALLOCA_H'
2628 echores "$_alloca"
2631 echocheck "fastmemcpy"
2632 if test "$_fastmemcpy" = yes ; then
2633 def_fastmemcpy='#define CONFIG_FASTMEMCPY 1'
2634 else
2635 def_fastmemcpy='#undef CONFIG_FASTMEMCPY'
2637 echores "$_fastmemcpy"
2640 echocheck "mman.h"
2641 _mman=no
2642 statement_check sys/mman.h 'mmap(0, 0, 0, 0, 0, 0)' && _mman=yes
2643 if test "$_mman" = yes ; then
2644 def_mman_h='#define HAVE_SYS_MMAN_H 1'
2645 else
2646 def_mman_h='#undef HAVE_SYS_MMAN_H'
2648 echores "$_mman"
2650 _mman_has_map_failed=no
2651 statement_check sys/mman.h 'void *p = MAP_FAILED' && _mman_has_map_failed=yes
2652 if test "$_mman_has_map_failed" = yes ; then
2653 def_mman_has_map_failed=''
2654 else
2655 def_mman_has_map_failed='#define MAP_FAILED ((void *) -1)'
2658 echocheck "dynamic loader"
2659 _dl=no
2660 for _ld_tmp in "" "-ldl"; do
2661 statement_check dlfcn.h 'dlopen("", 0)' $_ld_tmp && _ld_dl="$_ld_tmp" && _dl=yes && break
2662 done
2663 if test "$_dl" = yes ; then
2664 def_dl='#define HAVE_LIBDL 1'
2665 else
2666 def_dl='#undef HAVE_LIBDL'
2668 echores "$_dl"
2671 echocheck "pthread"
2672 if linux ; then
2673 THREAD_CFLAGS=-D_REENTRANT
2674 elif freebsd || netbsd || openbsd || bsdos ; then
2675 THREAD_CFLAGS=-D_THREAD_SAFE
2677 if test "$_pthreads" = auto ; then
2678 cat > $TMPC << EOF
2679 #include <pthread.h>
2680 static void *func(void *arg) { return arg; }
2681 int main(void) {
2682 pthread_t tid;
2683 #ifdef PTW32_STATIC_LIB
2684 pthread_win32_process_attach_np();
2685 pthread_win32_thread_attach_np();
2686 #endif
2687 return pthread_create (&tid, 0, func, 0) != 0;
2690 _pthreads=no
2691 if ! hpux ; then
2692 for _ld_tmp in "-lpthreadGC2" "" "-lpthread" "-pthread" ; do
2693 # for crosscompilation, we cannot execute the program, be happy if we can link statically
2694 cc_check $THREAD_CFLAGS $_ld_tmp && (tmp_run || test "$_ld_static") && _ld_pthread="$_ld_tmp" && _pthreads=yes && break
2695 done
2696 if test "$_pthreads" = no && mingw32 ; then
2697 _ld_tmp="-lpthreadGC2 -lws2_32"
2698 cc_check $_ld_tmp -DPTW32_STATIC_LIB && (tmp_run || test "$_ld_static") && _ld_pthread="$_ld_tmp" && _pthreads=yes && CFLAGS="$CFLAGS -DPTW32_STATIC_LIB"
2702 if test "$_pthreads" = yes ; then
2703 test $_ld_pthread && res_comment="using $_ld_pthread"
2704 def_pthreads='#define HAVE_PTHREADS 1'
2705 extra_cflags="$extra_cflags $THREAD_CFLAGS"
2706 else
2707 res_comment="v4l2, win32 loader disabled"
2708 def_pthreads='#undef HAVE_PTHREADS'
2709 _tv_v4l2=no
2710 mingw32 || _win32dll=no
2712 echores "$_pthreads"
2714 if cygwin ; then
2715 if test "$_pthreads" = yes ; then
2716 def_pthread_cache="#define PTHREAD_CACHE 1"
2717 else
2718 _stream_cache=no
2719 def_stream_cache="#undef CONFIG_STREAM_CACHE"
2723 echocheck "w32threads"
2724 if test "$_pthreads" = yes ; then
2725 res_comment="using pthread instead"
2726 _w32threads=no
2728 if test "$_w32threads" = auto ; then
2729 _w32threads=no
2730 mingw32 && _w32threads=yes
2732 echores "$_w32threads"
2734 echocheck "rpath"
2735 if test "$_rpath" = yes ; then
2736 for I in $(echo $extra_ldflags | sed 's/-L//g') ; do
2737 tmp="$tmp $(echo $I | sed 's/.*/ -L& -Wl,-R&/')"
2738 done
2739 extra_ldflags=$tmp
2741 echores "$_rpath"
2743 echocheck "iconv"
2744 if test "$_iconv" = auto ; then
2745 cat > $TMPC << EOF
2746 #include <stdio.h>
2747 #include <unistd.h>
2748 #include <iconv.h>
2749 #define INBUFSIZE 1024
2750 #define OUTBUFSIZE 4096
2752 char inbuffer[INBUFSIZE];
2753 char outbuffer[OUTBUFSIZE];
2755 int main(void) {
2756 size_t numread;
2757 iconv_t icdsc;
2758 char *tocode="UTF-8";
2759 char *fromcode="cp1250";
2760 if ((icdsc = iconv_open(tocode, fromcode)) != (iconv_t)(-1)) {
2761 while ((numread = read(0, inbuffer, INBUFSIZE))) {
2762 char *iptr=inbuffer;
2763 char *optr=outbuffer;
2764 size_t inleft=numread;
2765 size_t outleft=OUTBUFSIZE;
2766 if (iconv(icdsc, &iptr, &inleft, &optr, &outleft)
2767 != (size_t)(-1)) {
2768 write(1, outbuffer, OUTBUFSIZE - outleft);
2771 if (iconv_close(icdsc) == -1)
2774 return 0;
2777 _iconv=no
2778 for _ld_tmp in "" "-liconv" "-liconv $_ld_dl" ; do
2779 cc_check $_ld_lm $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" &&
2780 _iconv=yes && break
2781 done
2782 if test "$_iconv" != yes ; then
2783 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."
2786 if test "$_iconv" = yes ; then
2787 def_iconv='#define CONFIG_ICONV 1'
2788 else
2789 def_iconv='#undef CONFIG_ICONV'
2791 echores "$_iconv"
2794 echocheck "soundcard.h"
2795 _soundcard_h=no
2796 def_soundcard_h='#undef HAVE_SOUNDCARD_H'
2797 def_sys_soundcard_h='#undef HAVE_SYS_SOUNDCARD_H'
2798 for _soundcard_header in "sys/soundcard.h" "soundcard.h"; do
2799 header_check $_soundcard_header && _soundcard_h=yes &&
2800 res_comment="$_soundcard_header" && break
2801 done
2803 if test "$_soundcard_h" = yes ; then
2804 if test $_soundcard_header = "sys/soundcard.h"; then
2805 def_sys_soundcard_h='#define HAVE_SYS_SOUNDCARD_H 1'
2806 else
2807 def_soundcard_h='#define HAVE_SOUNDCARD_H 1'
2810 echores "$_soundcard_h"
2813 echocheck "sys/videoio.h"
2814 sys_videoio_h=no
2815 def_sys_videoio_h='#undef HAVE_SYS_VIDEOIO_H'
2816 header_check sys/videoio.h && sys_videoio_h=yes &&
2817 def_sys_videoio_h='#define HAVE_SYS_VIDEOIO_H 1'
2818 echores "$sys_videoio_h"
2821 echocheck "sys/dvdio.h"
2822 _dvdio=no
2823 # FreeBSD 8.1 has broken dvdio.h
2824 header_check_broken sys/types.h sys/dvdio.h && _dvdio=yes
2825 if test "$_dvdio" = yes ; then
2826 def_dvdio='#define DVD_STRUCT_IN_SYS_DVDIO_H 1'
2827 else
2828 def_dvdio='#undef DVD_STRUCT_IN_SYS_DVDIO_H'
2830 echores "$_dvdio"
2833 echocheck "sys/cdio.h"
2834 _cdio=no
2835 # at least OpenSolaris has a broken cdio.h
2836 header_check_broken sys/types.h sys/cdio.h && _cdio=yes
2837 if test "$_cdio" = yes ; then
2838 def_cdio='#define DVD_STRUCT_IN_SYS_CDIO_H 1'
2839 else
2840 def_cdio='#undef DVD_STRUCT_IN_SYS_CDIO_H'
2842 echores "$_cdio"
2845 echocheck "linux/cdrom.h"
2846 _cdrom=no
2847 header_check linux/cdrom.h && _cdrom=yes
2848 if test "$_cdrom" = yes ; then
2849 def_cdrom='#define DVD_STRUCT_IN_LINUX_CDROM_H 1'
2850 else
2851 def_cdrom='#undef DVD_STRUCT_IN_LINUX_CDROM_H'
2853 echores "$_cdrom"
2856 echocheck "dvd.h"
2857 _dvd=no
2858 header_check dvd.h && _dvd=yes
2859 if test "$_dvd" = yes ; then
2860 def_dvd='#define DVD_STRUCT_IN_DVD_H 1'
2861 else
2862 def_dvd='#undef DVD_STRUCT_IN_DVD_H'
2864 echores "$_dvd"
2867 if bsdos; then
2868 echocheck "BSDI dvd.h"
2869 _bsdi_dvd=no
2870 header_check dvd.h && _bsdi_dvd=yes
2871 if test "$_bsdi_dvd" = yes ; then
2872 def_bsdi_dvd='#define DVD_STRUCT_IN_BSDI_DVDIOCTL_DVD_H 1'
2873 else
2874 def_bsdi_dvd='#undef DVD_STRUCT_IN_BSDI_DVDIOCTL_DVD_H'
2876 echores "$_bsdi_dvd"
2877 fi #if bsdos
2880 if hpux; then
2881 # also used by AIX, but AIX does not support VCD and/or libdvdread
2882 echocheck "HP-UX SCSI header"
2883 _hpux_scsi_h=no
2884 header_check sys/scsi.h && _hpux_scsi_h=yes
2885 if test "$_hpux_scsi_h" = yes ; then
2886 def_hpux_scsi_h='#define HPUX_SCTL_IO 1'
2887 else
2888 def_hpux_scsi_h='#undef HPUX_SCTL_IO'
2890 echores "$_hpux_scsi_h"
2891 fi #if hpux
2894 echocheck "termcap"
2895 if test "$_termcap" = auto ; then
2896 _termcap=no
2897 for _ld_tmp in "-lncurses" "-ltinfo" "-ltermcap"; do
2898 statement_check term.h 'tgetent(0, 0)' $_ld_tmp &&
2899 extra_ldflags="$extra_ldflags $_ld_tmp" && _termcap=yes && break
2900 done
2902 if test "$_termcap" = yes ; then
2903 def_termcap='#define HAVE_TERMCAP 1'
2904 test $_ld_tmp && res_comment="using $_ld_tmp"
2905 else
2906 def_termcap='#undef HAVE_TERMCAP'
2908 echores "$_termcap"
2911 echocheck "termios"
2912 def_termios='#undef HAVE_TERMIOS'
2913 def_termios_h='#undef HAVE_TERMIOS_H'
2914 def_termios_sys_h='#undef HAVE_SYS_TERMIOS_H'
2915 if test "$_termios" = auto ; then
2916 _termios=no
2917 for _termios_header in "termios.h" "sys/termios.h"; do
2918 header_check $_termios_header && _termios=yes &&
2919 res_comment="using $_termios_header" && break
2920 done
2923 if test "$_termios" = yes ; then
2924 def_termios='#define HAVE_TERMIOS 1'
2925 if test "$_termios_header" = "termios.h" ; then
2926 def_termios_h='#define HAVE_TERMIOS_H 1'
2927 else
2928 def_termios_sys_h='#define HAVE_SYS_TERMIOS_H 1'
2931 echores "$_termios"
2934 echocheck "shm"
2935 if test "$_shm" = auto ; then
2936 _shm=no
2937 statement_check sys/shm.h 'shmget(0, 0, 0); shmat(0, 0, 0); shmctl(0, 0, 0)' && _shm=yes
2939 if test "$_shm" = yes ; then
2940 def_shm='#define HAVE_SHM 1'
2941 else
2942 def_shm='#undef HAVE_SHM'
2944 echores "$_shm"
2947 echocheck "strsep()"
2948 _strsep=no
2949 statement_check string.h 'char *s = "Hello, world!"; strsep(&s, ",")' && _strsep=yes
2950 if test "$_strsep" = yes ; then
2951 def_strsep='#define HAVE_STRSEP 1'
2952 need_strsep=no
2953 else
2954 def_strsep='#undef HAVE_STRSEP'
2955 need_strsep=yes
2957 echores "$_strsep"
2960 echocheck "vsscanf()"
2961 cat > $TMPC << EOF
2962 #define _ISOC99_SOURCE
2963 #include <stdarg.h>
2964 #include <stdio.h>
2965 int main(void) { va_list ap; vsscanf("foo", "bar", ap); return 0; }
2967 _vsscanf=no
2968 cc_check && _vsscanf=yes
2969 if test "$_vsscanf" = yes ; then
2970 def_vsscanf='#define HAVE_VSSCANF 1'
2971 need_vsscanf=no
2972 else
2973 def_vsscanf='#undef HAVE_VSSCANF'
2974 need_vsscanf=yes
2976 echores "$_vsscanf"
2979 echocheck "swab()"
2980 _swab=no
2981 define_statement_check "_XOPEN_SOURCE 600" "unistd.h" 'int a, b; swab(&a, &b, 0)' ||
2982 statement_check "string.h" 'int a, b; swab(&a, &b, 0)' && _swab=yes
2983 if test "$_swab" = yes ; then
2984 def_swab='#define HAVE_SWAB 1'
2985 need_swab=no
2986 else
2987 def_swab='#undef HAVE_SWAB'
2988 need_swab=yes
2990 echores "$_swab"
2992 echocheck "POSIX select()"
2993 cat > $TMPC << EOF
2994 #include <stdio.h>
2995 #include <stdlib.h>
2996 #include <sys/types.h>
2997 #include <string.h>
2998 #include <sys/time.h>
2999 #include <unistd.h>
3000 int main(void) {int nfds = 1; fd_set readfds; struct timeval timeout; select(nfds, &readfds, NULL, NULL, &timeout); return 0; }
3002 _posix_select=no
3003 def_posix_select='#undef HAVE_POSIX_SELECT'
3004 cc_check && _posix_select=yes &&
3005 def_posix_select='#define HAVE_POSIX_SELECT 1'
3006 echores "$_posix_select"
3009 echocheck "audio select()"
3010 if test "$_select" = no ; then
3011 def_select='#undef HAVE_AUDIO_SELECT'
3012 elif test "$_select" = yes ; then
3013 def_select='#define HAVE_AUDIO_SELECT 1'
3015 echores "$_select"
3018 echocheck "gettimeofday()"
3019 _gettimeofday=no
3020 statement_check sys/time.h 'struct timeval tv; struct timezone tz; gettimeofday(&tv, &tz)' && _gettimeofday=yes
3021 if test "$_gettimeofday" = yes ; then
3022 def_gettimeofday='#define HAVE_GETTIMEOFDAY 1'
3023 need_gettimeofday=no
3024 else
3025 def_gettimeofday='#undef HAVE_GETTIMEOFDAY'
3026 need_gettimeofday=yes
3028 echores "$_gettimeofday"
3031 echocheck "glob()"
3032 _glob=no
3033 statement_check glob.h 'glob("filename", 0, 0, 0)' && _glob=yes
3034 need_glob=no
3035 if test "$_glob" = yes ; then
3036 def_glob='#define HAVE_GLOB 1'
3037 else
3038 def_glob='#undef HAVE_GLOB'
3039 # HACK! need_glob currently enables compilation of a
3040 # win32-specific glob()-replacement.
3041 # Other OS neither need it nor can they use it (mf:// is disabled for them).
3042 win32 && need_glob=yes
3044 echores "$_glob"
3047 echocheck "setenv()"
3048 _setenv=no
3049 statement_check stdlib.h 'setenv("", "", 0)' && _setenv=yes
3050 if test "$_setenv" = yes ; then
3051 def_setenv='#define HAVE_SETENV 1'
3052 need_setenv=no
3053 else
3054 def_setenv='#undef HAVE_SETENV'
3055 need_setenv=yes
3057 echores "$_setenv"
3060 echocheck "setmode()"
3061 _setmode=no
3062 def_setmode='#define HAVE_SETMODE 0'
3063 statement_check io.h 'setmode(0, 0)' && _setmode=yes && def_setmode='#define HAVE_SETMODE 1'
3064 echores "$_setmode"
3067 echocheck "sys/sysinfo.h"
3068 _sys_sysinfo=no
3069 statement_check sys/sysinfo.h 'struct sysinfo s_info; s_info.mem_unit=0; sysinfo(&s_info)' && _sys_sysinfo=yes
3070 if test "$_sys_sysinfo" = yes ; then
3071 def_sys_sysinfo_h='#define HAVE_SYS_SYSINFO_H 1'
3072 else
3073 def_sys_sysinfo_h='#undef HAVE_SYS_SYSINFO_H'
3075 echores "$_sys_sysinfo"
3078 if darwin; then
3080 echocheck "Mac OS X Finder Support"
3081 def_macosx_finder='#undef CONFIG_MACOSX_FINDER'
3082 if test "$_macosx_finder" = yes ; then
3083 def_macosx_finder='#define CONFIG_MACOSX_FINDER 1'
3084 extra_ldflags="$extra_ldflags -framework Cocoa"
3086 echores "$_macosx_finder"
3088 echocheck "Mac OS X Bundle file locations"
3089 def_macosx_bundle='#undef CONFIG_MACOSX_BUNDLE'
3090 test "$_macosx_bundle" = auto && _macosx_bundle=$_macosx_finder
3091 if test "$_macosx_bundle" = yes ; then
3092 def_macosx_bundle='#define CONFIG_MACOSX_BUNDLE 1'
3094 echores "$_macosx_bundle"
3096 echocheck "Apple Remote"
3097 if test "$_apple_remote" = auto ; then
3098 _apple_remote=no
3099 cat > $TMPC <<EOF
3100 #include <stdio.h>
3101 #include <IOKit/IOCFPlugIn.h>
3102 int main(void) {
3103 io_iterator_t hidObjectIterator = (io_iterator_t)NULL;
3104 CFMutableDictionaryRef hidMatchDictionary;
3105 IOReturn ioReturnValue;
3107 // Set up a matching dictionary to search the I/O Registry by class.
3108 // name for all HID class devices
3109 hidMatchDictionary = IOServiceMatching("AppleIRController");
3111 // Now search I/O Registry for matching devices.
3112 ioReturnValue = IOServiceGetMatchingServices(kIOMasterPortDefault,
3113 hidMatchDictionary, &hidObjectIterator);
3115 // If search is unsuccessful, return nonzero.
3116 if (ioReturnValue != kIOReturnSuccess ||
3117 !IOIteratorIsValid(hidObjectIterator)) {
3118 return 1;
3120 return 0;
3123 cc_check -framework IOKit && _apple_remote=yes
3125 if test "$_apple_remote" = yes ; then
3126 def_apple_remote='#define CONFIG_APPLE_REMOTE 1'
3127 libs_mplayer="$libs_mplayer -framework IOKit -framework Cocoa"
3128 else
3129 def_apple_remote='#undef CONFIG_APPLE_REMOTE'
3131 echores "$_apple_remote"
3133 fi #if darwin
3135 if linux; then
3137 echocheck "Apple IR"
3138 if test "$_apple_ir" = auto ; then
3139 _apple_ir=no
3140 statement_check linux/input.h 'struct input_event ev; struct input_id id' && _apple_ir=yes
3142 if test "$_apple_ir" = yes ; then
3143 def_apple_ir='#define CONFIG_APPLE_IR 1'
3144 else
3145 def_apple_ir='#undef CONFIG_APPLE_IR'
3147 echores "$_apple_ir"
3148 fi #if linux
3150 echocheck "pkg-config"
3151 if $($_pkg_config --version > /dev/null 2>&1); then
3152 if test "$_ld_static"; then
3153 _pkg_config="$_pkg_config --static"
3155 echores "yes"
3156 else
3157 _pkg_config=false
3158 echores "no"
3162 echocheck "Samba support (libsmbclient)"
3163 if test "$_smb" = yes; then
3164 extra_ldflags="$extra_ldflags -lsmbclient"
3166 if test "$_smb" = auto; then
3167 _smb=no
3168 for _ld_tmp in "-lsmbclient" "-lsmbclient $_ld_dl" "-lsmbclient $_ld_dl -lnsl" "-lsmbclient $_ld_dl -lssl -lnsl" ; do
3169 statement_check libsmbclient.h 'smbc_opendir("smb://")' $_ld_tmp &&
3170 extra_ldflags="$extra_ldflags $_ld_tmp" && _smb=yes && break
3171 done
3174 if test "$_smb" = yes; then
3175 def_smb="#define CONFIG_LIBSMBCLIENT 1"
3176 inputmodules="smb $inputmodules"
3177 else
3178 def_smb="#undef CONFIG_LIBSMBCLIENT"
3179 noinputmodules="smb $noinputmodules"
3181 echores "$_smb"
3183 echocheck "libquvi support"
3184 if test "$_libquvi" = auto ; then
3185 _libquvi=no
3186 if pkg_config_add 'libquvi >= 0.4.1' ; then
3187 _libquvi=yes
3190 if test "$_libquvi" = yes; then
3191 def_libquvi="#define CONFIG_LIBQUVI 1"
3192 else
3193 def_libquvi="#undef CONFIG_LIBQUVI"
3195 echores "$_libquvi"
3197 #########
3198 # VIDEO #
3199 #########
3202 echocheck "tga"
3203 if test "$_tga" = yes ; then
3204 def_tga='#define CONFIG_TGA 1'
3205 vomodules="tga $vomodules"
3206 else
3207 def_tga='#undef CONFIG_TGA'
3208 novomodules="tga $novomodules"
3210 echores "$_tga"
3213 echocheck "md5sum support"
3214 if test "$_md5sum" = yes; then
3215 def_md5sum="#define CONFIG_MD5SUM 1"
3216 vomodules="md5sum $vomodules"
3217 else
3218 def_md5sum="#undef CONFIG_MD5SUM"
3219 novomodules="md5sum $novomodules"
3221 echores "$_md5sum"
3224 echocheck "yuv4mpeg support"
3225 if test "$_yuv4mpeg" = yes; then
3226 def_yuv4mpeg="#define CONFIG_YUV4MPEG 1"
3227 vomodules="yuv4mpeg $vomodules"
3228 else
3229 def_yuv4mpeg="#undef CONFIG_YUV4MPEG"
3230 novomodules="yuv4mpeg $novomodules"
3232 echores "$_yuv4mpeg"
3235 echocheck "DirectFB"
3236 if test "$_directfb" = auto ; then
3237 _directfb=no
3238 cat > $TMPC << EOF
3239 #include <directfb.h>
3240 #include <directfb_version.h>
3241 #if (DIRECTFB_MAJOR_VERSION << 16 | DIRECTFB_MINOR_VERSION << 8 | DIRECTFB_MICRO_VERSION) < (0 << 16 | 9 << 8 | 22)
3242 #error "DirectFB version too old."
3243 #endif
3244 int main(void) { DirectFBInit(0, 0); return 0; }
3246 for _inc_tmp in "" -I/usr/local/include/directfb -I/usr/include/directfb -I/usr/local/include; do
3247 cc_check $_inc_tmp -ldirectfb &&
3248 _directfb=yes && extra_cflags="$extra_cflags $_inc_tmp" && break
3249 done
3251 if test "$_directfb" = yes ; then
3252 def_directfb='#define CONFIG_DIRECTFB 1'
3253 vomodules="directfb $vomodules"
3254 libs_mplayer="$libs_mplayer -ldirectfb"
3255 else
3256 def_directfb='#undef CONFIG_DIRECTFB'
3257 novomodules="directfb $novomodules"
3259 echores "$_directfb"
3262 if darwin; then
3264 echocheck "QuickTime"
3265 if test "$quicktime" = auto ; then
3266 quicktime=no
3267 statement_check QuickTime/QuickTime.h 'ImageDescription *desc; EnterMovies(); ExitMovies()' -framework QuickTime && quicktime=yes
3269 if test "$quicktime" = yes ; then
3270 extra_ldflags="$extra_ldflags -framework QuickTime"
3271 def_quicktime='#define CONFIG_QUICKTIME 1'
3272 else
3273 def_quicktime='#undef CONFIG_QUICKTIME'
3275 echores $quicktime
3277 echocheck "Cocoa"
3278 if test "$_cocoa" = auto ; then
3279 cat > $TMPC <<EOF
3280 #include <CoreServices/CoreServices.h>
3281 #include <OpenGL/OpenGL.h>
3282 int main(void) {
3283 NSApplicationLoad();
3286 _cocoa=no
3287 cc_check -framework IOKit -framework Cocoa -framework OpenGL && _cocoa=yes
3289 if test "$_cocoa" = yes ; then
3290 libs_mplayer="$libs_mplayer -framework IOKit -framework Cocoa -framework OpenGL"
3291 def_cocoa='#define CONFIG_COCOA 1'
3292 else
3293 def_cocoa='#undef CONFIG_COCOA'
3295 echores "$_cocoa"
3297 echocheck "CoreVideo"
3298 if test "$_cocoa" = yes && test "$_corevideo" = auto ; then
3299 cat > $TMPC <<EOF
3300 #include <QuartzCore/CoreVideo.h>
3301 int main(void) { return 0; }
3303 _corevideo=no
3304 cc_check -framework Cocoa -framework QuartzCore -framework OpenGL && _corevideo=yes
3306 if test "$_corevideo" = yes ; then
3307 vomodules="corevideo $vomodules"
3308 libs_mplayer="$libs_mplayer -framework QuartzCore"
3309 def_corevideo='#define CONFIG_COREVIDEO 1'
3310 else
3311 novomodules="corevideo $novomodules"
3312 def_corevideo='#undef CONFIG_COREVIDEO'
3314 echores "$_corevideo"
3316 echocheck "SharedBuffer"
3317 if test "$_sharedbuffer" = auto ; then
3318 cat > $TMPC <<EOF
3319 int main(void) {
3320 NSApplicationLoad();
3323 _sharedbuffer=no
3324 cc_check -framework Cocoa && _sharedbuffer=yes
3326 if test "$_sharedbuffer" = yes ; then
3327 vomodules="sharedbuffer $vomodules"
3328 libs_mplayer="$libs_mplayer -framework Cocoa"
3329 def_sharedbuffer='#define CONFIG_SHAREDBUFFER 1'
3330 else
3331 novomodules="sharedbuffer $novomodules"
3332 def_sharedbuffer='#undef CONFIG_SHAREDBUFFER'
3334 echores "$_sharedbuffer"
3336 depends_on_application_services(){
3337 test "$_corevideo" = yes
3340 fi #if darwin
3343 echocheck "X11 headers presence"
3344 _x11_headers="no"
3345 res_comment="check if the dev(el) packages are installed"
3346 for I in $(echo $extra_cflags | sed s/-I//g) /usr/include ; do
3347 if test -f "$I/X11/Xlib.h" ; then
3348 _x11_headers="yes"
3349 res_comment=""
3350 break
3352 done
3353 if test $_cross_compile = no; then
3354 for I in /usr/X11/include /usr/X11R7/include /usr/local/include /usr/X11R6/include \
3355 /usr/include/X11R6 /usr/openwin/include ; do
3356 if test -f "$I/X11/Xlib.h" ; then
3357 extra_cflags="$extra_cflags -I$I"
3358 _x11_headers="yes"
3359 res_comment="using $I"
3360 break
3362 done
3364 echores "$_x11_headers"
3367 echocheck "X11"
3368 if test "$_x11" = auto && test "$_x11_headers" = yes ; then
3369 for I in "" -L/usr/X11R7/lib -L/usr/local/lib -L/usr/X11R6/lib -L/usr/lib/X11R6 \
3370 -L/usr/X11/lib -L/usr/lib32 -L/usr/openwin/lib -L/usr/local/lib64 -L/usr/X11R6/lib64 \
3371 -L/usr/lib ; do
3372 if netbsd; then
3373 _ld_tmp="$I -lXext -lX11 $_ld_pthread -Wl,-R$(echo $I | sed s/^-L//)"
3374 else
3375 _ld_tmp="$I -lXext -lX11 $_ld_pthread"
3377 statement_check X11/Xutil.h 'XCreateWindow(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)' $_ld_tmp &&
3378 _x11=yes
3379 # Check that there aren't conflicting headers between ApplicationServices
3380 # and X11. On versions of Mac OSX prior to 10.7 the deprecated QuickDraw API
3381 # is included by -framework ApplicationServices and clashes with the X11
3382 # definition of the "Cursor" type.
3383 if darwin && depends_on_application_services && test "$_x11" = yes ; then
3384 _x11=no
3385 header_check_broken ApplicationServices/ApplicationServices.h \
3386 X11/Xutil.h $_ld_tmp && _x11=yes
3388 if test "$_x11" = yes ; then
3389 libs_mplayer="$libs_mplayer $_ld_tmp"
3390 break
3392 done
3394 if test "$_x11" = yes ; then
3395 def_x11='#define CONFIG_X11 1'
3396 vomodules="x11 $vomodules"
3397 else
3398 _x11=no
3399 def_x11='#undef CONFIG_X11'
3400 novomodules="x11 $novomodules"
3401 res_comment="check if the dev(el) packages are installed"
3403 echores "$_x11"
3405 echocheck "Xss screensaver extensions"
3406 if test "$_xss" = auto ; then
3407 _xss=no
3408 statement_check "X11/extensions/scrnsaver.h" 'XScreenSaverSuspend(NULL, True)' -lXss && _xss=yes
3410 if test "$_xss" = yes ; then
3411 def_xss='#define CONFIG_XSS 1'
3412 libs_mplayer="$libs_mplayer -lXss"
3413 else
3414 def_xss='#undef CONFIG_XSS'
3416 echores "$_xss"
3418 echocheck "DPMS"
3419 _xdpms3=no
3420 _xdpms4=no
3421 if test "$_x11" = yes ; then
3422 cat > $TMPC <<EOF
3423 #include <X11/Xmd.h>
3424 #include <X11/Xlib.h>
3425 #include <X11/Xutil.h>
3426 #include <X11/Xatom.h>
3427 #include <X11/extensions/dpms.h>
3428 int main(void) { DPMSQueryExtension(0, 0, 0); return 0; }
3430 cc_check -lXdpms && _xdpms3=yes
3431 statement_check_broken X11/Xlib.h X11/extensions/dpms.h 'DPMSQueryExtension(0, 0, 0)' -lXext && _xdpms4=yes
3433 if test "$_xdpms4" = yes ; then
3434 def_xdpms='#define CONFIG_XDPMS 1'
3435 res_comment="using Xdpms 4"
3436 echores "yes"
3437 elif test "$_xdpms3" = yes ; then
3438 def_xdpms='#define CONFIG_XDPMS 1'
3439 libs_mplayer="$libs_mplayer -lXdpms"
3440 res_comment="using Xdpms 3"
3441 echores "yes"
3442 else
3443 def_xdpms='#undef CONFIG_XDPMS'
3444 echores "no"
3448 echocheck "Xv"
3449 if test "$_xv" = auto && test "$_x11" = yes ; then
3450 _xv=no
3451 statement_check_broken X11/Xlib.h X11/extensions/Xvlib.h 'XvGetPortAttribute(0, 0, 0, 0)' -lXv && _xv=yes
3454 if test "$_xv" = yes ; then
3455 def_xv='#define CONFIG_XV 1'
3456 libs_mplayer="$libs_mplayer -lXv"
3457 vomodules="xv $vomodules"
3458 else
3459 def_xv='#undef CONFIG_XV'
3460 novomodules="xv $novomodules"
3462 echores "$_xv"
3465 echocheck "VDPAU"
3466 if test "$_vdpau" = auto && test "$_x11" = yes ; then
3467 _vdpau=no
3468 if test "$_dl" = yes ; then
3469 pkg_config_add 'vdpau >= 0.2' && _vdpau=yes
3472 if test "$_vdpau" = yes ; then
3473 def_vdpau='#define CONFIG_VDPAU 1'
3474 vomodules="vdpau $vomodules"
3475 else
3476 def_vdpau='#define CONFIG_VDPAU 0'
3477 novomodules="vdpau $novomodules"
3479 echores "$_vdpau"
3482 echocheck "Xinerama"
3483 if test "$_xinerama" = auto && test "$_x11" = yes ; then
3484 _xinerama=no
3485 statement_check X11/extensions/Xinerama.h 'XineramaIsActive(0)' -lXinerama && _xinerama=yes
3488 if test "$_xinerama" = yes ; then
3489 def_xinerama='#define CONFIG_XINERAMA 1'
3490 libs_mplayer="$libs_mplayer -lXinerama"
3491 else
3492 def_xinerama='#undef CONFIG_XINERAMA'
3494 echores "$_xinerama"
3497 # Note: the -lXxf86vm library is the VideoMode extension and though it's not
3498 # needed for DGA, AFAIK every distribution packages together with DGA stuffs
3499 # named 'X extensions' or something similar.
3500 # This check may be useful for future mplayer versions (to change resolution)
3501 # If you run into problems, remove '-lXxf86vm'.
3502 echocheck "Xxf86vm"
3503 if test "$_vm" = auto && test "$_x11" = yes ; then
3504 _vm=no
3505 statement_check_broken X11/Xlib.h X11/extensions/xf86vmode.h 'XF86VidModeQueryExtension(0, 0, 0)' -lXxf86vm && _vm=yes
3507 if test "$_vm" = yes ; then
3508 def_vm='#define CONFIG_XF86VM 1'
3509 libs_mplayer="$libs_mplayer -lXxf86vm"
3510 else
3511 def_vm='#undef CONFIG_XF86VM'
3513 echores "$_vm"
3515 # Check for the presence of special keycodes, like audio control buttons
3516 # that XFree86 might have. Used to be bundled with the xf86vm check, but
3517 # has nothing to do with xf86vm and XFree 3.x has xf86vm but does NOT
3518 # have these new keycodes.
3519 echocheck "XF86keysym"
3520 if test "$_xf86keysym" = auto && test "$_x11" = yes ; then
3521 _xf86keysym=no
3522 return_check X11/XF86keysym.h XF86XK_AudioPause && _xf86keysym=yes
3524 if test "$_xf86keysym" = yes ; then
3525 def_xf86keysym='#define CONFIG_XF86XK 1'
3526 else
3527 def_xf86keysym='#undef CONFIG_XF86XK'
3529 echores "$_xf86keysym"
3532 echocheck "CACA"
3533 if test "$_caca" = auto ; then
3534 _caca=no
3535 pkg_config_add 'caca' && _caca=yes
3537 if test "$_caca" = yes ; then
3538 def_caca='#define CONFIG_CACA 1'
3539 vomodules="caca $vomodules"
3540 else
3541 def_caca='#undef CONFIG_CACA'
3542 novomodules="caca $novomodules"
3544 echores "$_caca"
3547 echocheck "DVB"
3548 if test "$_dvb" = auto ; then
3549 _dvb=no
3550 cat >$TMPC << EOF
3551 #include <poll.h>
3552 #include <sys/ioctl.h>
3553 #include <stdio.h>
3554 #include <time.h>
3555 #include <unistd.h>
3556 #include <linux/dvb/dmx.h>
3557 #include <linux/dvb/frontend.h>
3558 #include <linux/dvb/video.h>
3559 #include <linux/dvb/audio.h>
3560 int main(void) {return 0;}
3562 for _inc_tmp in "" "-I/usr/src/DVB/include" ; do
3563 cc_check $_inc_tmp && _dvb=yes &&
3564 extra_cflags="$extra_cflags $_inc_tmp" && break
3565 done
3567 echores "$_dvb"
3568 if test "$_dvb" = yes ; then
3569 _dvbin=yes
3570 inputmodules="dvb $inputmodules"
3571 def_dvbin='#define CONFIG_DVBIN 1'
3572 else
3573 _dvbin=no
3574 noinputmodules="dvb $noinputmodules"
3575 def_dvbin='#undef CONFIG_DVBIN '
3579 echocheck "PNG support"
3580 if test "$_png" = auto ; then
3581 _png=no
3582 cat > $TMPC << EOF
3583 #include <stdio.h>
3584 #include <string.h>
3585 #include <png.h>
3586 int main(void) {
3587 printf("png.h : %s\n", PNG_LIBPNG_VER_STRING);
3588 printf("libpng: %s\n", png_libpng_ver);
3589 return strcmp(PNG_LIBPNG_VER_STRING, png_libpng_ver);
3592 cc_check -lpng -lz $_ld_lm && _png=yes
3594 echores "$_png"
3595 if test "$_png" = yes ; then
3596 def_png='#define CONFIG_PNG 1'
3597 extra_ldflags="$extra_ldflags -lpng -lz"
3598 else
3599 def_png='#undef CONFIG_PNG'
3602 echocheck "MNG support"
3603 if test "$_mng" = auto ; then
3604 _mng=no
3605 return_statement_check libmng.h 'const char * p_ver = mng_version_text()' '!p_ver || p_ver[0] == 0' -lmng -lz $_ld_lm && _mng=yes
3607 echores "$_mng"
3608 if test "$_mng" = yes ; then
3609 def_mng='#define CONFIG_MNG 1'
3610 extra_ldflags="$extra_ldflags -lmng -lz"
3611 else
3612 def_mng='#undef CONFIG_MNG'
3615 echocheck "JPEG support"
3616 if test "$_jpeg" = auto ; then
3617 _jpeg=no
3618 header_check_broken stdio.h jpeglib.h -ljpeg $_ld_lm && _jpeg=yes
3620 echores "$_jpeg"
3622 if test "$_jpeg" = yes ; then
3623 def_jpeg='#define CONFIG_JPEG 1'
3624 vomodules="jpeg $vomodules"
3625 extra_ldflags="$extra_ldflags -ljpeg"
3626 else
3627 def_jpeg='#undef CONFIG_JPEG'
3628 novomodules="jpeg $novomodules"
3633 echocheck "PNM support"
3634 if test "$_pnm" = yes; then
3635 def_pnm="#define CONFIG_PNM 1"
3636 vomodules="pnm $vomodules"
3637 else
3638 def_pnm="#undef CONFIG_PNM"
3639 novomodules="pnm $novomodules"
3641 echores "$_pnm"
3645 echocheck "GIF support"
3646 # This is to appease people who want to force gif support.
3647 # If it is forced to yes, then we still do checks to determine
3648 # which gif library to use.
3649 if test "$_gif" = yes ; then
3650 _force_gif=yes
3651 _gif=auto
3654 if test "$_gif" = auto ; then
3655 _gif=no
3656 for _ld_gif in "-lungif" "-lgif" ; do
3657 statement_check gif_lib.h 'QuantizeBuffer(0, 0, 0, 0, 0, 0, 0, 0)' $_ld_gif && _gif=yes && break
3658 done
3661 # If no library was found, and the user wants support forced,
3662 # then we force it on with libgif, as this is the safest
3663 # assumption IMHO. (libungif & libregif both create symbolic
3664 # links to libgif. We also assume that no x11 support is needed,
3665 # because if you are forcing this, then you _should_ know what
3666 # you are doing. [ Besides, package maintainers should never
3667 # have compiled x11 deps into libungif in the first place. ] )
3668 # </rant>
3669 # --Joey
3670 if test "$_force_gif" = yes && test "$_gif" = no ; then
3671 _gif=yes
3672 _ld_gif="-lgif"
3675 if test "$_gif" = yes ; then
3676 def_gif='#define CONFIG_GIF 1'
3677 codecmodules="gif $codecmodules"
3678 vomodules="gif89a $vomodules"
3679 res_comment="old version, some encoding functions disabled"
3680 def_gif_4='#undef CONFIG_GIF_4'
3681 extra_ldflags="$extra_ldflags $_ld_gif"
3683 cat > $TMPC << EOF
3684 #include <signal.h>
3685 #include <stdio.h>
3686 #include <stdlib.h>
3687 #include <gif_lib.h>
3688 static void catch(int sig) { exit(1); }
3689 int main(void) {
3690 signal(SIGSEGV, catch); // catch segfault
3691 printf("EGifPutExtensionFirst is at address %p\n", EGifPutExtensionFirst);
3692 EGifSetGifVersion("89a"); // this will segfault a buggy gif lib.
3693 return 0;
3696 if cc_check "$_ld_gif" ; then
3697 def_gif_4='#define CONFIG_GIF_4 1'
3698 res_comment=""
3700 else
3701 def_gif='#undef CONFIG_GIF'
3702 def_gif_4='#undef CONFIG_GIF_4'
3703 novomodules="gif89a $novomodules"
3704 nocodecmodules="gif $nocodecmodules"
3706 echores "$_gif"
3709 case "$_gif" in yes*)
3710 echocheck "broken giflib workaround"
3711 def_gif_tvt_hack='#define CONFIG_GIF_TVT_HACK 1'
3713 cat > $TMPC << EOF
3714 #include <stdio.h>
3715 #include <gif_lib.h>
3716 int main(void) {
3717 GifFileType gif = {.UserData = NULL};
3718 printf("UserData is at address %p\n", gif.UserData);
3719 return 0;
3722 if cc_check "$_ld_gif" ; then
3723 def_gif_tvt_hack='#undef CONFIG_GIF_TVT_HACK'
3724 echores "disabled"
3725 else
3726 echores "enabled"
3729 esac
3732 #################
3733 # VIDEO + AUDIO #
3734 #################
3737 echocheck "SDL"
3738 _inc_tmp=""
3739 _ld_tmp=""
3740 def_sdl_sdl_h="#undef CONFIG_SDL_SDL_H"
3741 if test -z "$_sdlconfig" ; then
3742 if ( sdl-config --version ) >>"$TMPLOG" 2>&1 ; then
3743 _sdlconfig="sdl-config"
3744 elif ( sdl11-config --version ) >>"$TMPLOG" 2>&1 ; then
3745 _sdlconfig="sdl11-config"
3746 else
3747 _sdlconfig=false
3750 if test "$_sdl" = auto || test "$_sdl" = yes ; then
3751 cat > $TMPC << EOF
3752 #ifdef CONFIG_SDL_SDL_H
3753 #include <SDL/SDL.h>
3754 #else
3755 #include <SDL.h>
3756 #endif
3757 #ifndef __APPLE__
3758 // we allow SDL hacking our main() only on OSX
3759 #undef main
3760 #endif
3761 int main(int argc, char *argv[]) {
3762 SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE);
3763 return 0;
3766 _sdl=no
3767 for _ld_tmp in "-lSDL" "-lSDL -lpthread" "-lSDL -lwinmm -lgdi32" "-lSDL -lwinmm -lgdi32 -ldxguid" ; do
3768 if cc_check -DCONFIG_SDL_SDL_H $_inc_tmp $_ld_tmp ; then
3769 _sdl=yes
3770 def_sdl_sdl_h="#define CONFIG_SDL_SDL_H 1"
3771 break
3773 done
3774 if test "$_sdl" = no && "$_sdlconfig" --version >>"$TMPLOG" 2>&1 ; then
3775 res_comment="using $_sdlconfig"
3776 if cygwin ; then
3777 _inc_tmp="$($_sdlconfig --cflags | cut -d " " -f 1,5,6 | sed s/no-cygwin/cygwin/)"
3778 _ld_tmp="$($_sdlconfig --libs | cut -d " " -f 1,4,6 | sed s/no-cygwin/cygwin/)"
3779 elif mingw32 ; then
3780 _inc_tmp=$($_sdlconfig --cflags | sed s/-Dmain=SDL_main//)
3781 _ld_tmp=$($_sdlconfig --libs | sed -e s/-mwindows// -e s/-lmingw32//)
3782 else
3783 _inc_tmp="$($_sdlconfig --cflags)"
3784 _ld_tmp="$($_sdlconfig --libs)"
3786 if cc_check $_inc_tmp $_ld_tmp >>"$TMPLOG" 2>&1 ; then
3787 _sdl=yes
3788 elif cc_check $_inc_tmp $_ld_tmp -lstdc++ >>"$TMPLOG" 2>&1 ; then
3789 # HACK for BeOS/Haiku SDL
3790 _ld_tmp="$_ld_tmp -lstdc++"
3791 _sdl=yes
3795 if test "$_sdl" = yes ; then
3796 def_sdl='#define CONFIG_SDL 1'
3797 extra_cflags="$extra_cflags $_inc_tmp"
3798 libs_mplayer="$libs_mplayer $_ld_tmp"
3799 vomodules="sdl $vomodules"
3800 aomodules="sdl $aomodules"
3801 else
3802 def_sdl='#undef CONFIG_SDL'
3803 novomodules="sdl $novomodules"
3804 noaomodules="sdl $noaomodules"
3806 echores "$_sdl"
3809 # make sure this stays below CoreVideo to avoid issues due to namespace
3810 # conflicts between -lGL and -framework OpenGL
3811 echocheck "OpenGL"
3812 #Note: this test is run even with --enable-gl since we autodetect linker flags
3813 if (test "$_x11" = yes || test "$_sdl" = yes || test "$_cocoa" = yes || win32) && test "$_gl" != no ; then
3814 cat > $TMPC << EOF
3815 #ifdef GL_WIN32
3816 #include <windows.h>
3817 #include <GL/gl.h>
3818 #elif defined(GL_SDL)
3819 #include <GL/gl.h>
3820 #ifdef CONFIG_SDL_SDL_H
3821 #include <SDL/SDL.h>
3822 #else
3823 #include <SDL.h>
3824 #endif
3825 #ifndef __APPLE__
3826 // we allow SDL hacking our main() only on OSX
3827 #undef main
3828 #endif
3829 #else
3830 #include <GL/gl.h>
3831 #include <X11/Xlib.h>
3832 #include <GL/glx.h>
3833 #endif
3834 int main(int argc, char *argv[]) {
3835 #ifdef GL_WIN32
3836 HDC dc;
3837 wglCreateContext(dc);
3838 #elif defined(GL_SDL)
3839 SDL_GL_SwapBuffers();
3840 #else
3841 glXCreateContext(NULL, NULL, NULL, True);
3842 #endif
3843 glFinish();
3844 return 0;
3847 _gl=no
3848 if test "$_x11" = yes ; then
3849 for _ld_tmp in "" -lGL "-lGL -lXdamage" "-lGL $_ld_pthread" ; do
3850 if cc_check $_ld_tmp $_ld_lm ; then
3851 _gl=yes
3852 _gl_x11=yes
3853 libs_mplayer="$libs_mplayer $_ld_tmp $_ld_dl"
3854 break
3856 done
3858 if win32 && cc_check -DGL_WIN32 -lopengl32 ; then
3859 _gl=yes
3860 _gl_win32=yes
3861 libs_mplayer="$libs_mplayer -lopengl32 -lgdi32"
3863 if test "$_cocoa" = yes ; then
3864 _gl=yes
3865 _gl_cocoa=yes
3867 # last so it can reuse any linker etc. flags detected before
3868 if test "$_sdl" = yes ; then
3869 if cc_check -DGL_SDL ||
3870 cc_check -DCONFIG_SDL_SDL_H -DGL_SDL ; then
3871 _gl=yes
3872 _gl_sdl=yes
3873 elif cc_check -DGL_SDL -lGL ||
3874 cc_check -DCONFIG_SDL_SDL_H -DGL_SDL -lGL ; then
3875 _gl=yes
3876 _gl_sdl=yes
3877 libs_mplayer="$libs_mplayer -lGL"
3880 else
3881 _gl=no
3883 if test "$_gl" = yes ; then
3884 def_gl='#define CONFIG_GL 1'
3885 res_comment="backends:"
3886 if test "$_gl_cocoa" = yes ; then
3887 def_gl_cocoa='#define CONFIG_GL_COCOA 1'
3888 res_comment="$res_comment cocoa"
3890 if test "$_gl_win32" = yes ; then
3891 def_gl_win32='#define CONFIG_GL_WIN32 1'
3892 res_comment="$res_comment win32"
3894 if test "$_gl_x11" = yes ; then
3895 def_gl_x11='#define CONFIG_GL_X11 1'
3896 res_comment="$res_comment x11"
3898 if test "$_gl_sdl" = yes ; then
3899 def_gl_sdl='#define CONFIG_GL_SDL 1'
3900 res_comment="$res_comment sdl"
3902 vomodules="opengl $vomodules"
3903 else
3904 def_gl='#undef CONFIG_GL'
3905 def_gl_cocoa='#undef CONFIG_GL_COCOA'
3906 def_gl_win32='#undef CONFIG_GL_WIN32'
3907 def_gl_x11='#undef CONFIG_GL_X11'
3908 def_gl_sdl='#undef CONFIG_GL_SDL'
3909 novomodules="opengl $novomodules"
3911 echores "$_gl"
3914 if win32; then
3916 echocheck "Direct3D"
3917 if test "$_direct3d" = auto ; then
3918 _direct3d=no
3919 header_check d3d9.h && _direct3d=yes
3921 if test "$_direct3d" = yes ; then
3922 def_direct3d='#define CONFIG_DIRECT3D 1'
3923 vomodules="direct3d $vomodules"
3924 else
3925 def_direct3d='#undef CONFIG_DIRECT3D'
3926 novomodules="direct3d $novomodules"
3928 echores "$_direct3d"
3930 echocheck "Directx"
3931 if test "$_directx" = auto ; then
3932 cat > $TMPC << EOF
3933 #include <ddraw.h>
3934 #include <dsound.h>
3935 int main(void) { return 0; }
3937 _directx=no
3938 cc_check -lgdi32 && _directx=yes
3940 if test "$_directx" = yes ; then
3941 def_directx='#define CONFIG_DIRECTX 1'
3942 libs_mplayer="$libs_mplayer -lgdi32"
3943 vomodules="directx $vomodules"
3944 aomodules="dsound $aomodules"
3945 else
3946 def_directx='#undef CONFIG_DIRECTX'
3947 novomodules="directx $novomodules"
3948 noaomodules="dsound $noaomodules"
3950 echores "$_directx"
3952 fi #if win32; then
3955 echocheck "V4L2 MPEG Decoder"
3956 if test "$_v4l2" = auto ; then
3957 cat > $TMPC << EOF
3958 #include <sys/time.h>
3959 #include <linux/videodev2.h>
3960 #include <linux/version.h>
3961 int main(void) {
3962 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
3963 #error kernel headers too old, need 2.6.22
3964 #endif
3965 struct v4l2_ext_controls ctrls;
3966 ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;
3967 return 0;
3970 _v4l2=no
3971 cc_check && _v4l2=yes
3973 if test "$_v4l2" = yes ; then
3974 def_v4l2='#define CONFIG_V4L2_DECODER 1'
3975 vomodules="v4l2 $vomodules"
3976 aomodules="v4l2 $aomodules"
3977 else
3978 def_v4l2='#undef CONFIG_V4L2_DECODER'
3979 novomodules="v4l2 $novomodules"
3980 noaomodules="v4l2 $noaomodules"
3982 echores "$_v4l2"
3986 #########
3987 # AUDIO #
3988 #########
3991 echocheck "OSS Audio"
3992 if test "$_ossaudio" = auto ; then
3993 _ossaudio=no
3994 return_check $_soundcard_header SNDCTL_DSP_SETFRAGMENT && _ossaudio=yes
3996 if test "$_ossaudio" = yes ; then
3997 def_ossaudio='#define CONFIG_OSS_AUDIO 1'
3998 aomodules="oss $aomodules"
3999 cat > $TMPC << EOF
4000 #include <$_soundcard_header>
4001 #ifdef OPEN_SOUND_SYSTEM
4002 int main(void) { return 0; }
4003 #else
4004 #error Not the real thing
4005 #endif
4007 _real_ossaudio=no
4008 cc_check && _real_ossaudio=yes
4009 if test "$_real_ossaudio" = yes; then
4010 def_ossaudio_devdsp='#define PATH_DEV_DSP "/dev/dsp"'
4011 # Check for OSS4 headers (override default headers)
4012 # Does not apply to systems where OSS4 is native (e.g. FreeBSD)
4013 if test -f /etc/oss.conf; then
4014 . /etc/oss.conf
4015 _ossinc="$OSSLIBDIR/include"
4016 if test -f "$_ossinc/sys/soundcard.h"; then
4017 extra_cflags="-I$_ossinc $extra_cflags"
4020 elif netbsd || openbsd ; then
4021 def_ossaudio_devdsp='#define PATH_DEV_DSP "/dev/sound"'
4022 extra_ldflags="$extra_ldflags -lossaudio"
4023 else
4024 def_ossaudio_devdsp='#define PATH_DEV_DSP "/dev/dsp"'
4026 def_ossaudio_devmixer='#define PATH_DEV_MIXER "/dev/mixer"'
4027 else
4028 def_ossaudio='#undef CONFIG_OSS_AUDIO'
4029 def_ossaudio_devdsp='#define PATH_DEV_DSP ""'
4030 def_ossaudio_devmixer='#define PATH_DEV_MIXER ""'
4031 noaomodules="oss $noaomodules"
4033 echores "$_ossaudio"
4036 echocheck "RSound"
4037 if test "$_rsound" = auto ; then
4038 _rsound=no
4039 statement_check rsound.h 'rsd_init(NULL);' -lrsound && _rsound=yes
4041 echores "$_rsound"
4043 if test "$_rsound" = yes ; then
4044 def_rsound='#define CONFIG_RSOUND 1'
4045 aomodules="rsound $aomodules"
4046 libs_mplayer="$libs_mplayer -lrsound"
4047 else
4048 def_rsound='#undef CONFIG_RSOUND'
4049 noaomodules="rsound $noaomodules"
4053 echocheck "pulse"
4054 if test "$_pulse" = auto ; then
4055 _pulse=no
4056 if pkg_config_add 'libpulse >= 0.9' ; then
4057 _pulse=yes
4060 echores "$_pulse"
4062 if test "$_pulse" = yes ; then
4063 def_pulse='#define CONFIG_PULSE 1'
4064 aomodules="pulse $aomodules"
4065 else
4066 def_pulse='#undef CONFIG_PULSE'
4067 noaomodules="pulse $noaomodules"
4071 echocheck "PortAudio"
4072 if test "$_portaudio" = auto && test "$_pthreads" != yes ; then
4073 _portaudio=no
4074 res_comment="pthreads not enabled"
4076 if test "$_portaudio" = auto ; then
4077 _portaudio=no
4078 if pkg_config_add 'portaudio-2.0 >= 19' ; then
4079 _portaudio=yes
4082 echores "$_portaudio"
4084 if test "$_portaudio" = yes ; then
4085 def_portaudio='#define CONFIG_PORTAUDIO 1'
4086 aomodules="portaudio $aomodules"
4087 else
4088 def_portaudio='#undef CONFIG_PORTAUDIO'
4089 noaomodules="portaudio $noaomodules"
4093 echocheck "JACK"
4094 if test "$_jack" = auto ; then
4095 _jack=no
4096 if pkg_config_add jack ; then
4097 _jack=yes
4101 if test "$_jack" = yes ; then
4102 def_jack='#define CONFIG_JACK 1'
4103 aomodules="jack $aomodules"
4104 else
4105 noaomodules="jack $noaomodules"
4107 echores "$_jack"
4109 echocheck "OpenAL"
4110 if test "$_openal" = auto ; then
4111 _openal=no
4112 cat > $TMPC << EOF
4113 #ifdef OPENAL_AL_H
4114 #include <OpenAL/al.h>
4115 #else
4116 #include <AL/al.h>
4117 #endif
4118 int main(void) {
4119 alSourceQueueBuffers(0, 0, 0);
4120 // alGetSourcei(0, AL_SAMPLE_OFFSET, 0);
4121 return 0;
4124 for I in "-lopenal" "-lopenal32" "-framework OpenAL" ; do
4125 cc_check $I && _openal=yes && break
4126 cc_check -DOPENAL_AL_H=1 $I && def_openal_h='#define OPENAL_AL_H 1' && _openal=yes && break
4127 done
4128 test "$_openal" = yes && libs_mplayer="$libs_mplayer $I"
4130 if test "$_openal" = yes ; then
4131 def_openal='#define CONFIG_OPENAL 1'
4132 aomodules="openal $aomodules"
4133 else
4134 noaomodules="openal $noaomodules"
4136 echores "$_openal"
4138 echocheck "ALSA audio"
4139 if test "$_alloca" != yes ; then
4140 _alsa=no
4141 res_comment="alloca missing"
4143 if test "$_alsa" = auto ; then
4144 _alsa=no
4145 if pkg_config_add "alsa >= 1.0.9" ; then
4146 _alsa=yes
4149 def_alsa='#undef CONFIG_ALSA'
4150 if test "$_alsa" = yes ; then
4151 aomodules="alsa $aomodules"
4152 def_alsa='#define CONFIG_ALSA 1'
4153 else
4154 noaomodules="alsa $noaomodules"
4156 echores "$_alsa"
4159 if darwin; then
4160 echocheck "CoreAudio"
4161 if test "$_coreaudio" = auto ; then
4162 cat > $TMPC <<EOF
4163 #include <CoreAudio/CoreAudio.h>
4164 #include <AudioToolbox/AudioToolbox.h>
4165 #include <AudioUnit/AudioUnit.h>
4166 int main(void) { return 0; }
4168 _coreaudio=no
4169 cc_check -framework CoreAudio -framework AudioUnit -framework AudioToolbox && _coreaudio=yes
4171 if test "$_coreaudio" = yes ; then
4172 libs_mplayer="$libs_mplayer -framework CoreAudio -framework AudioUnit -framework AudioToolbox"
4173 def_coreaudio='#define CONFIG_COREAUDIO 1'
4174 aomodules="coreaudio $aomodules"
4175 else
4176 def_coreaudio='#undef CONFIG_COREAUDIO'
4177 noaomodules="coreaudio $noaomodules"
4179 echores $_coreaudio
4180 fi #if darwin
4183 # set default CD/DVD devices
4184 if win32 ; then
4185 default_cdrom_device="D:"
4186 elif darwin ; then
4187 default_cdrom_device="/dev/disk1"
4188 elif dragonfly ; then
4189 default_cdrom_device="/dev/cd0"
4190 elif freebsd ; then
4191 default_cdrom_device="/dev/acd0"
4192 elif openbsd ; then
4193 default_cdrom_device="/dev/rcd0c"
4194 elif amigaos ; then
4195 default_cdrom_device="a1ide.device:2"
4196 else
4197 default_cdrom_device="/dev/cdrom"
4200 if win32 || dragonfly || freebsd || openbsd || amigaos ; then
4201 default_dvd_device=$default_cdrom_device
4202 elif darwin ; then
4203 default_dvd_device="/dev/rdiskN"
4204 else
4205 default_dvd_device="/dev/dvd"
4209 echocheck "VCD support"
4210 if test "$_vcd" = auto; then
4211 _vcd=no
4212 if linux || freebsd || netbsd || openbsd || dragonfly || bsdos || darwin ; then
4213 _vcd=yes
4214 elif mingw32; then
4215 header_check ddk/ntddcdrm.h && _vcd=yes
4218 if test "$_vcd" = yes; then
4219 inputmodules="vcd $inputmodules"
4220 def_vcd='#define CONFIG_VCD 1'
4221 else
4222 def_vcd='#undef CONFIG_VCD'
4223 noinputmodules="vcd $noinputmodules"
4224 res_comment="not supported on this OS"
4226 echores "$_vcd"
4230 echocheck "Blu-ray support"
4231 if test "$_bluray" = auto ; then
4232 _bluray=no
4233 pkg_config_add 'libbluray >= 0.2.1' && _bluray=yes
4235 if test "$_bluray" = yes ; then
4236 def_bluray='#define CONFIG_LIBBLURAY 1'
4237 inputmodules="bluray $inputmodules"
4238 else
4239 def_bluray='#undef CONFIG_LIBBLURAY'
4240 noinputmodules="bluray $noinputmodules"
4242 echores "$_bluray"
4244 echocheck "dvdread"
4245 if test "$_dvdread_internal" = auto && test ! -f "libdvdread4/dvd_reader.c" ; then
4246 _dvdread_internal=no
4248 if test "$_dvdread_internal" = auto ; then
4249 _dvdread_internal=no
4250 _dvdread=no
4251 if (linux || freebsd || netbsd || openbsd || dragonfly || hpux) &&
4252 (test "$_dvd" = yes || test "$_cdrom" = yes || test "$_cdio" = yes ||
4253 test "$_dvdio" = yes || test "$_bsdi_dvd" = yes) ||
4254 darwin || win32; then
4255 _dvdread_internal=yes
4256 _dvdread=yes
4257 extra_cflags="-Ilibdvdread4 $extra_cflags"
4259 elif test "$_dvdread" = auto ; then
4260 _dvdread=no
4261 if test "$_dl" = yes; then
4262 _dvdreadcflags=$($_dvdreadconfig --cflags 2> /dev/null)
4263 _dvdreadlibs=$($_dvdreadconfig --libs 2> /dev/null)
4264 if header_check dvdread/dvd_reader.h $_dvdreadcflags $_dvdreadlibs $_ld_dl ; then
4265 _dvdread=yes
4266 extra_cflags="$extra_cflags $_dvdreadcflags"
4267 extra_ldflags="$extra_ldflags $_dvdreadlibs"
4268 res_comment="external"
4273 if test "$_dvdread_internal" = yes; then
4274 def_dvdread='#define CONFIG_DVDREAD 1'
4275 inputmodules="dvdread(internal) $inputmodules"
4276 res_comment="internal"
4277 elif test "$_dvdread" = yes; then
4278 def_dvdread='#define CONFIG_DVDREAD 1'
4279 extra_ldflags="$extra_ldflags -ldvdread"
4280 inputmodules="dvdread(external) $inputmodules"
4281 res_comment="external"
4282 else
4283 def_dvdread='#undef CONFIG_DVDREAD'
4284 noinputmodules="dvdread $noinputmodules"
4286 echores "$_dvdread"
4289 echocheck "internal libdvdcss"
4290 if test "$_libdvdcss_internal" = auto ; then
4291 _libdvdcss_internal=no
4292 test "$_dvdread_internal" = yes && test -d libdvdcss && _libdvdcss_internal=yes
4293 hpux && test "$_hpux_scsi_h" = no && _libdvdcss_internal=no
4295 if test "$_libdvdcss_internal" = yes ; then
4296 if linux || netbsd || openbsd || bsdos ; then
4297 def_dvd_linux='#define HAVE_LINUX_DVD_STRUCT 1'
4298 openbsd && def_dvd_openbsd='#define HAVE_OPENBSD_DVD_STRUCT 1'
4299 elif freebsd || dragonfly ; then
4300 def_dvd_bsd='#define HAVE_BSD_DVD_STRUCT 1'
4301 elif darwin ; then
4302 def_dvd_darwin='#define DARWIN_DVD_IOCTL'
4303 extra_ldflags="$extra_ldflags -framework IOKit -framework Carbon"
4304 elif cygwin ; then
4305 cflags_libdvdcss="-DSYS_CYGWIN -DWIN32"
4306 elif beos ; then
4307 cflags_libdvdcss="-DSYS_BEOS"
4309 cflags_libdvdcss_dvdread="-Ilibdvdcss"
4310 def_dvdcss="#define HAVE_DVDCSS_DVDCSS_H 1"
4311 inputmodules="libdvdcss(internal) $inputmodules"
4312 else
4313 noinputmodules="libdvdcss(internal) $noinputmodules"
4315 echores "$_libdvdcss_internal"
4318 echocheck "libcdio"
4319 if test "$_libcdio" = auto ; then
4320 _libcdio=no
4321 if pkg_config_add libcdio_paranoia ; then
4322 _libcdio=yes
4325 if test "$_libcdio" = yes ; then
4326 _cdda='yes'
4327 def_cdda='#define CONFIG_CDDA 1'
4328 test $_cddb = auto && test $networking = yes && _cddb=yes
4329 inputmodules="cdda $inputmodules"
4330 else
4331 _libcdio=no
4332 _cdda='no'
4333 def_cdda='#undef CONFIG_CDDA'
4334 noinputmodules="cdda $noinputmodules"
4336 echores "$_libcdio"
4338 if test "$_cddb" = yes ; then
4339 def_cddb='#define CONFIG_CDDB 1'
4340 inputmodules="cddb $inputmodules"
4341 else
4342 _cddb=no
4343 def_cddb='#undef CONFIG_CDDB'
4344 noinputmodules="cddb $noinputmodules"
4348 echocheck "SSA/ASS support"
4349 if test "$_ass" = auto ; then
4350 if pkg_config_add libass ; then
4351 _ass=yes
4352 def_ass='#define CONFIG_ASS 1'
4353 else
4354 die "Unable to find development files for libass. Aborting. If you really mean to compile without libass support use --disable-libass."
4356 else
4357 def_ass='#undef CONFIG_ASS'
4359 echores "$_ass"
4362 echocheck "ENCA"
4363 if test "$_enca" = auto ; then
4364 _enca=no
4365 statement_check enca.h 'enca_get_languages(NULL)' -lenca $_ld_lm && _enca=yes
4367 if test "$_enca" = yes ; then
4368 def_enca='#define CONFIG_ENCA 1'
4369 extra_ldflags="$extra_ldflags -lenca"
4370 else
4371 def_enca='#undef CONFIG_ENCA'
4373 echores "$_enca"
4376 echocheck "zlib"
4377 _zlib=no
4378 statement_check zlib.h 'inflate(0, Z_NO_FLUSH)' -lz && _zlib=yes
4379 if test "$_zlib" = yes ; then
4380 def_zlib='#define CONFIG_ZLIB 1'
4381 extra_ldflags="$extra_ldflags -lz"
4382 else
4383 def_zlib='#define CONFIG_ZLIB 0'
4385 echores "$_zlib"
4388 echocheck "RTC"
4389 if test "$_rtc" = auto ; then
4390 cat > $TMPC << EOF
4391 #include <sys/ioctl.h>
4392 #ifdef __linux__
4393 #include <linux/rtc.h>
4394 #else
4395 #include <rtc.h>
4396 #define RTC_PIE_ON RTCIO_PIE_ON
4397 #endif
4398 int main(void) { return RTC_PIE_ON; }
4400 _rtc=no
4401 cc_check && _rtc=yes
4402 ppc && _rtc=no
4404 if test "$_rtc" = yes ; then
4405 def_rtc='#define HAVE_RTC 1'
4406 else
4407 def_rtc='#undef HAVE_RTC'
4409 echores "$_rtc"
4412 echocheck "mad support"
4413 if test "$_mad" = auto ; then
4414 _mad=no
4415 header_check mad.h -lmad && _mad=yes
4417 if test "$_mad" = yes ; then
4418 def_mad='#define CONFIG_LIBMAD 1'
4419 extra_ldflags="$extra_ldflags -lmad"
4420 codecmodules="libmad $codecmodules"
4421 else
4422 def_mad='#undef CONFIG_LIBMAD'
4423 nocodecmodules="libmad $nocodecmodules"
4425 echores "$_mad"
4427 echocheck "OggVorbis support"
4428 if test "$_libvorbis" = auto; then
4429 _libvorbis=no
4430 statement_check vorbis/codec.h 'vorbis_packet_blocksize(0, 0)' -lvorbis -logg $_ld_lm && _libvorbis=yes && _tremor=no
4431 elif test "$_libvorbis" = yes ; then
4432 _tremor=no
4434 if test "$_tremor" = auto; then
4435 _tremor=no
4436 statement_check tremor/ivorbiscodec.h 'vorbis_packet_blocksize(0, 0)' -logg -lvorbisidec $_ld_lm && _tremor=yes
4438 if test "$_tremor" = yes ; then
4439 _vorbis=yes
4440 def_vorbis='#define CONFIG_OGGVORBIS 1'
4441 def_tremor='#define CONFIG_TREMOR 1'
4442 codecmodules="tremor(external) $codecmodules"
4443 res_comment="external Tremor"
4444 extra_ldflags="$extra_ldflags -logg -lvorbisidec"
4445 elif test "$_libvorbis" = yes ; then
4446 _vorbis=yes
4447 def_vorbis='#define CONFIG_OGGVORBIS 1'
4448 codecmodules="libvorbis $codecmodules"
4449 res_comment="libvorbis"
4450 extra_ldflags="$extra_ldflags -lvorbis -logg"
4451 else
4452 _vorbis=no
4453 nocodecmodules="libvorbis $nocodecmodules"
4455 echores "$_vorbis"
4457 echocheck "libspeex (version >= 1.1 required)"
4458 if test "$_speex" = auto ; then
4459 _speex=no
4460 cat > $TMPC << EOF
4461 #include <stddef.h>
4462 #include <speex/speex.h>
4463 int main(void) { SpeexBits bits; void *dec = NULL; speex_decode_int(dec, &bits, dec); return 0; }
4465 cc_check -lspeex $_ld_lm && _speex=yes
4467 if test "$_speex" = yes ; then
4468 def_speex='#define CONFIG_SPEEX 1'
4469 extra_ldflags="$extra_ldflags -lspeex"
4470 codecmodules="speex $codecmodules"
4471 else
4472 def_speex='#undef CONFIG_SPEEX'
4473 nocodecmodules="speex $nocodecmodules"
4475 echores "$_speex"
4477 echocheck "OggTheora support"
4478 if test "$_theora" = auto ; then
4479 _theora=no
4480 if pkg_config_add theora ; then
4481 _theora=yes
4484 if test "$_theora" = yes ; then
4485 def_theora='#define CONFIG_OGGTHEORA 1'
4486 codecmodules="libtheora $codecmodules"
4487 else
4488 def_theora='#undef CONFIG_OGGTHEORA'
4489 nocodecmodules="libtheora $nocodecmodules"
4491 echores "$_theora"
4493 # Any version of libmpg123 that knows MPG123_RESYNC_LIMIT shall be fine.
4494 # That is, 1.2.0 onwards. Recommened is 1.14 onwards, though.
4495 echocheck "mpg123 support"
4496 def_mpg123='#undef CONFIG_MPG123'
4497 if test "$_mpg123" = auto; then
4498 _mpg123=no
4499 pkg_config_add 'libmpg123 >= 1.2.0' && _mpg123=yes
4501 if test "$_mpg123" = yes ; then
4502 def_mpg123='#define CONFIG_MPG123 1'
4503 codecmodules="mpg123 $codecmodules"
4504 else
4505 nocodecmodules="mpg123 $nocodecmodules"
4507 echores "$_mpg123"
4509 echocheck "liba52 support"
4510 def_liba52='#undef CONFIG_LIBA52'
4511 if test "$_liba52" = auto ; then
4512 _liba52=no
4513 cat > $TMPC << EOF
4514 #include <inttypes.h>
4515 #include <a52dec/a52.h>
4516 int main(void) { a52_state_t *testHand; testHand=a52_init(0); return 0; }
4518 cc_check -la52 && _liba52=yes && extra_ldflags="$extra_ldflags -la52"
4520 if test "$_liba52" = yes ; then
4521 def_liba52='#define CONFIG_LIBA52 1'
4522 codecmodules="liba52 $codecmodules"
4523 else
4524 nocodecmodules="liba52 $nocodecmodules"
4526 echores "$_liba52"
4528 echocheck "libdca support"
4529 if test "$_libdca" = auto ; then
4530 _libdca=no
4531 for _ld_dca in -ldca -ldts ; do
4532 statement_check_broken stdint.h dts.h 'dts_init(0)' $_ld_dca $_ld_lm &&
4533 extra_ldflags="$extra_ldflags $_ld_dca" && _libdca=yes && break
4534 done
4536 if test "$_libdca" = yes ; then
4537 def_libdca='#define CONFIG_LIBDCA 1'
4538 codecmodules="libdca $codecmodules"
4539 else
4540 def_libdca='#undef CONFIG_LIBDCA'
4541 nocodecmodules="libdca $nocodecmodules"
4543 echores "$_libdca"
4545 echocheck "libmpcdec (musepack, version >= 1.2.1 required)"
4546 if test "$_musepack" = yes ; then
4547 _musepack=no
4548 cat > $TMPC << EOF
4549 #include <stddef.h>
4550 #include <mpcdec/mpcdec.h>
4551 int main(void) {
4552 mpc_streaminfo info;
4553 mpc_decoder decoder;
4554 mpc_decoder_set_streaminfo(&decoder, &info);
4555 mpc_decoder_decode_frame(&decoder, NULL, 0, NULL);
4556 return 0;
4559 cc_check -lmpcdec $_ld_lm && _musepack=yes
4561 if test "$_musepack" = yes ; then
4562 def_musepack='#define CONFIG_MUSEPACK 1'
4563 extra_ldflags="$extra_ldflags -lmpcdec"
4564 codecmodules="musepack $codecmodules"
4565 else
4566 def_musepack='#undef CONFIG_MUSEPACK'
4567 nocodecmodules="musepack $nocodecmodules"
4569 echores "$_musepack"
4572 echocheck "FAAD2 support"
4573 if test "$_faad" = auto ; then
4574 _faad=no
4575 cat > $TMPC << EOF
4576 #include <faad.h>
4577 #ifndef FAAD_MIN_STREAMSIZE
4578 #error Too old version
4579 #endif
4580 int main(void) { faacDecHandle testhand; faacDecFrameInfo testinfo;
4581 testhand = faacDecOpen(); faacDecInit(0, 0, 0, 0, 0); return 0; }
4583 cc_check -lfaad $_ld_lm && _faad=yes
4586 def_faad='#undef CONFIG_FAAD'
4587 if test "$_faad" = yes ; then
4588 def_faad='#define CONFIG_FAAD 1'
4589 extra_ldflags="$extra_ldflags -lfaad"
4590 codecmodules="faad2 $codecmodules"
4591 else
4592 nocodecmodules="faad2 $nocodecmodules"
4594 echores "$_faad"
4597 echocheck "LADSPA plugin support"
4598 if test "$_ladspa" = auto ; then
4599 _ladspa=no
4600 statement_check ladspa.h 'LADSPA_Descriptor ld = {0}' && _ladspa=yes
4602 if test "$_ladspa" = yes; then
4603 def_ladspa="#define CONFIG_LADSPA 1"
4604 else
4605 def_ladspa="#undef CONFIG_LADSPA"
4607 echores "$_ladspa"
4610 echocheck "libbs2b audio filter support"
4611 if test "$_libbs2b" = auto ; then
4612 _libbs2b=no
4613 if pkg_config_add libbs2b ; then
4614 _libbs2b=yes
4617 def_libbs2b="#undef CONFIG_LIBBS2B"
4618 test "$_libbs2b" = yes && def_libbs2b="#define CONFIG_LIBBS2B 1"
4619 echores "$_libbs2b"
4622 if test -z "$_codecsdir" ; then
4623 for dir in "$_libdir/codecs" "$_libdir/win32" /usr/local/lib/codecs \
4624 /usr/lib/codecs /usr/local/lib/win32 /usr/lib/win32 ; do
4625 if test -d "$dir" ; then
4626 _codecsdir="$dir"
4627 break;
4629 done
4631 # Fall back on default directory.
4632 if test -z "$_codecsdir" ; then
4633 _codecsdir="$_libdir/codecs"
4634 mingw32 && _codecsdir="codecs"
4638 echocheck "Win32 codecs"
4639 if test "$_win32dll" = auto ; then
4640 _win32dll=no
4641 if x86_32 && ! qnx; then
4642 _win32dll=yes
4645 if test "$_win32dll" = yes ; then
4646 def_win32dll='#define CONFIG_WIN32DLL 1'
4647 if ! win32 ; then
4648 def_win32_loader='#define WIN32_LOADER 1'
4649 _win32_emulation=yes
4650 else
4651 extra_ldflags="$extra_ldflags -ladvapi32 -lole32"
4652 res_comment="using native windows"
4654 codecmodules="win32 $codecmodules"
4655 else
4656 def_win32dll='#undef CONFIG_WIN32DLL'
4657 def_win32_loader='#undef WIN32_LOADER'
4658 nocodecmodules="win32 $nocodecmodules"
4660 echores "$_win32dll"
4663 echocheck "XAnim codecs"
4664 if test "$_xanim" = auto ; then
4665 _xanim=no
4666 res_comment="dynamic loader support needed"
4667 if test "$_dl" = yes ; then
4668 _xanim=yes
4671 if test "$_xanim" = yes ; then
4672 def_xanim='#define CONFIG_XANIM 1'
4673 codecmodules="xanim $codecmodules"
4674 else
4675 def_xanim='#undef CONFIG_XANIM'
4676 nocodecmodules="xanim $nocodecmodules"
4678 echores "$_xanim"
4681 echocheck "RealPlayer codecs"
4682 if test "$_real" = auto ; then
4683 _real=no
4684 res_comment="dynamic loader support needed"
4685 if test "$_dl" = yes || test "$_win32dll" = yes &&
4686 (linux || freebsd || netbsd || openbsd || dragonfly || darwin || win32) ; then
4687 _real=yes
4690 if test "$_real" = yes ; then
4691 def_real='#define CONFIG_REALCODECS 1'
4692 codecmodules="real $codecmodules"
4693 else
4694 def_real='#undef CONFIG_REALCODECS'
4695 nocodecmodules="real $nocodecmodules"
4697 echores "$_real"
4700 echocheck "QuickTime codecs"
4701 _qtx_emulation=no
4702 def_qtx_win32='#undef CONFIG_QTX_CODECS_WIN32'
4703 if test "$_qtx" = auto ; then
4704 test "$_win32dll" = yes || test "$quicktime" = yes && _qtx=yes
4706 if test "$_qtx" = yes ; then
4707 def_qtx='#define CONFIG_QTX_CODECS 1'
4708 win32 && _qtx_codecs_win32=yes && def_qtx_win32='#define CONFIG_QTX_CODECS_WIN32 1'
4709 codecmodules="qtx $codecmodules"
4710 darwin || win32 || _qtx_emulation=yes
4711 else
4712 def_qtx='#undef CONFIG_QTX_CODECS'
4713 nocodecmodules="qtx $nocodecmodules"
4715 echores "$_qtx"
4717 echocheck "LCMS2 support"
4718 if test "$_lcms2" = auto ; then
4719 _lcms2=no
4720 if pkg_config_add lcms2 ; then
4721 _lcms2=yes
4724 if test "$_lcms2" = yes; then
4725 def_lcms2="#define CONFIG_LCMS2 1"
4726 else
4727 def_lcms2="#undef CONFIG_LCMS2"
4729 echores "$_lcms2"
4732 all_libav_libs="libavutil > 51.21.0:libavcodec >= 54.25.0:libavformat > 53.20.0:libswscale >= 2.0.0:libavresample >= 1.0.0"
4733 echocheck "Libav ($all_libav_libs)"
4734 if test "$ffmpeg" = auto ; then
4735 IFS=":" # shell should not be used for programming
4736 if ! pkg_config_add $all_libav_libs ; then
4737 die "Unable to find development files for some of the required Libav libraries above. Aborting."
4740 echores "yes"
4742 echocheck "libpostproc >= 52.0.0"
4743 if test "$libpostproc" = auto ; then
4744 libpostproc=no
4745 if pkg_config_add "libpostproc >= 52.0.0" ; then
4746 libpostproc=yes
4749 if test "$libpostproc" = yes ; then
4750 def_libpostproc='#define CONFIG_LIBPOSTPROC 1'
4751 else
4752 def_libpostproc='#undef CONFIG_LIBPOSTPROC'
4754 echores "$libpostproc"
4756 echocheck "libdv-0.9.5+"
4757 if test "$_libdv" = auto ; then
4758 _libdv=no
4759 statement_check libdv/dv.h 'dv_encoder_new(1, 1, 1)' -ldv $_ld_pthread $_ld_lm && _libdv=yes
4761 if test "$_libdv" = yes ; then
4762 def_libdv='#define CONFIG_LIBDV095 1'
4763 extra_ldflags="$extra_ldflags -ldv"
4764 codecmodules="libdv $codecmodules"
4765 else
4766 def_libdv='#undef CONFIG_LIBDV095'
4767 nocodecmodules="libdv $nocodecmodules"
4769 echores "$_libdv"
4772 echocheck "Xvid"
4773 if test "$_xvid" = auto ; then
4774 _xvid=no
4775 for _ld_tmp in "-lxvidcore $_ld_lm" "-lxvidcore $_ld_lm $_ld_pthread" ; do
4776 statement_check xvid.h 'xvid_global(0, 0, 0, 0)' $_ld_tmp &&
4777 extra_ldflags="$extra_ldflags $_ld_tmp" && _xvid=yes && break
4778 done
4781 if test "$_xvid" = yes ; then
4782 def_xvid='#define CONFIG_XVID4 1'
4783 codecmodules="xvid $codecmodules"
4784 else
4785 def_xvid='#undef CONFIG_XVID4'
4786 nocodecmodules="xvid $nocodecmodules"
4788 echores "$_xvid"
4791 echocheck "libnut"
4792 if test "$_libnut" = auto ; then
4793 _libnut=no
4794 statement_check libnut.h 'nut_context_tt * nut; nut_error(0)' -lnut && _libnut=yes
4797 if test "$_libnut" = yes ; then
4798 def_libnut='#define CONFIG_LIBNUT 1'
4799 extra_ldflags="$extra_ldflags -lnut"
4800 else
4801 def_libnut='#undef CONFIG_LIBNUT'
4803 echores "$_libnut"
4806 echocheck "UnRAR executable"
4807 if test "$_unrar_exec" = auto ; then
4808 _unrar_exec="yes"
4809 mingw32 && _unrar_exec="no"
4811 if test "$_unrar_exec" = yes ; then
4812 def_unrar_exec='#define CONFIG_UNRAR_EXEC 1'
4813 else
4814 def_unrar_exec='#undef CONFIG_UNRAR_EXEC'
4816 echores "$_unrar_exec"
4818 echocheck "TV interface"
4819 if test "$_tv" = yes ; then
4820 def_tv='#define CONFIG_TV 1'
4821 inputmodules="tv $inputmodules"
4822 else
4823 noinputmodules="tv $noinputmodules"
4824 def_tv='#undef CONFIG_TV'
4826 echores "$_tv"
4829 if freebsd || netbsd || openbsd || dragonfly || bsdos ; then
4830 echocheck "*BSD BT848 bt8xx header"
4831 _ioctl_bt848_h=no
4832 for file in "machine/ioctl_bt848.h" \
4833 "dev/bktr/ioctl_bt848.h" \
4834 "dev/video/bktr/ioctl_bt848.h" \
4835 "dev/ic/bt8xx.h" ; do
4836 cat > $TMPC <<EOF
4837 #include <sys/types.h>
4838 #include <sys/ioctl.h>
4839 #include <$file>
4840 int main(void) { ioctl(0, TVTUNER_GETFREQ, 0); return 0; }
4842 if cc_check ; then
4843 _ioctl_bt848_h=yes
4844 _ioctl_bt848_h_name="$file"
4845 break;
4847 done
4848 if test "$_ioctl_bt848_h" = yes ; then
4849 def_ioctl_bt848_h_name="#define IOCTL_BT848_H_NAME <$_ioctl_bt848_h_name>"
4850 res_comment="using $_ioctl_bt848_h_name"
4851 else
4852 def_ioctl_bt848_h_name="#undef IOCTL_BT848_H_NAME"
4854 echores "$_ioctl_bt848_h"
4856 echocheck "*BSD ioctl_meteor.h"
4857 _ioctl_meteor_h=no
4858 for ioctl_meteor_h_path in "machine/ioctl_meteor.h" "dev/bktr/ioctl_meteor.h" "dev/video/bktr/ioctl_meteor.h" ; do
4859 statement_check_broken "sys/types.h" "$ioctl_meteor_h_path" 'ioctl(0, METEORSINPUT, 0)' &&
4860 _ioctl_meteor_h=yes && break
4861 done
4862 if test "$_ioctl_meteor_h" = yes ; then
4863 def_ioctl_meteor_h_name="#define IOCTL_METEOR_H_NAME <$ioctl_meteor_h_path>"
4864 res_comment="using $ioctl_meteor_h_path"
4865 else
4866 def_ioctl_meteor_h_name="#undef IOCTL_METEOR_H_NAME"
4868 echores "$_ioctl_meteor_h"
4870 echocheck "*BSD BrookTree 848 TV interface"
4871 if test "$_tv_bsdbt848" = auto ; then
4872 _tv_bsdbt848=no
4873 if test "$_tv" = yes ; then
4874 cat > $TMPC <<EOF
4875 #include <sys/types.h>
4876 $def_ioctl_meteor_h_name
4877 $def_ioctl_bt848_h_name
4878 #ifdef IOCTL_METEOR_H_NAME
4879 #include IOCTL_METEOR_H_NAME
4880 #endif
4881 #ifdef IOCTL_BT848_H_NAME
4882 #include IOCTL_BT848_H_NAME
4883 #endif
4884 int main(void) {
4885 ioctl(0, METEORSINPUT, 0);
4886 ioctl(0, TVTUNER_GETFREQ, 0);
4887 return 0;
4890 cc_check && _tv_bsdbt848=yes
4893 if test "$_tv_bsdbt848" = yes ; then
4894 def_tv_bsdbt848='#define CONFIG_TV_BSDBT848 1'
4895 inputmodules="tv-bsdbt848 $inputmodules"
4896 else
4897 def_tv_bsdbt848='#undef CONFIG_TV_BSDBT848'
4898 noinputmodules="tv-bsdbt848 $noinputmodules"
4900 echores "$_tv_bsdbt848"
4901 fi #if freebsd || netbsd || openbsd || dragonfly || bsdos
4904 echocheck "DirectShow TV interface"
4905 if test "$_tv_dshow" = auto ; then
4906 _tv_dshow=no
4907 if test "$_tv" = yes && win32 ; then
4908 statement_check ole2.h 'void* p; CoCreateInstance((GUID*)&GUID_NULL, NULL, CLSCTX_INPROC_SERVER, &GUID_NULL, &p)' -lole32 -luuid && _tv_dshow=yes
4911 if test "$_tv_dshow" = yes ; then
4912 inputmodules="tv-dshow $inputmodules"
4913 def_tv_dshow='#define CONFIG_TV_DSHOW 1'
4914 extra_ldflags="$extra_ldflags -lole32 -luuid"
4915 else
4916 noinputmodules="tv-dshow $noinputmodules"
4917 def_tv_dshow='#undef CONFIG_TV_DSHOW'
4919 echores "$_tv_dshow"
4922 echocheck "Video 4 Linux 2 TV interface"
4923 if test "$_tv_v4l2" = auto ; then
4924 _tv_v4l2=no
4925 if test "$_tv" = yes && linux ; then
4926 header_check_broken sys/time.h linux/videodev2.h && _tv_v4l2=yes
4927 elif test "$_tv" = yes && test "$sys_videoio_h" = "yes" ; then
4928 _tv_v4l2=yes
4931 if test "$_tv_v4l2" = yes ; then
4932 _audio_input=yes
4933 def_tv_v4l2='#define CONFIG_TV_V4L2 1'
4934 inputmodules="tv-v4l2 $inputmodules"
4935 else
4936 noinputmodules="tv-v4l2 $noinputmodules"
4937 def_tv_v4l2='#undef CONFIG_TV_V4L2'
4939 echores "$_tv_v4l2"
4942 echocheck "Radio interface"
4943 if test "$_radio" = yes ; then
4944 def_radio='#define CONFIG_RADIO 1'
4945 inputmodules="radio $inputmodules"
4946 if test "$_alsa" != yes -a "$_ossaudio" != yes ; then
4947 _radio_capture=no
4949 if test "$_radio_capture" = yes ; then
4950 _audio_input=yes
4951 def_radio_capture="#define CONFIG_RADIO_CAPTURE 1"
4952 else
4953 def_radio_capture="#undef CONFIG_RADIO_CAPTURE"
4955 else
4956 noinputmodules="radio $noinputmodules"
4957 def_radio='#undef CONFIG_RADIO'
4958 def_radio_capture="#undef CONFIG_RADIO_CAPTURE"
4959 _radio_capture=no
4961 echores "$_radio"
4962 echocheck "Capture for Radio interface"
4963 echores "$_radio_capture"
4965 echocheck "Video 4 Linux 2 Radio interface"
4966 if test "$_radio_v4l2" = auto ; then
4967 _radio_v4l2=no
4968 if test "$_radio" = yes && linux ; then
4969 header_check linux/videodev2.h && _radio_v4l2=yes
4972 if test "$_radio_v4l2" = yes ; then
4973 def_radio_v4l2='#define CONFIG_RADIO_V4L2 1'
4974 else
4975 def_radio_v4l2='#undef CONFIG_RADIO_V4L2'
4977 echores "$_radio_v4l2"
4979 if freebsd || netbsd || openbsd || dragonfly || bsdos &&
4980 test "$_radio" = yes && test "$_radio_bsdbt848" = auto ; then
4981 echocheck "*BSD BrookTree 848 Radio interface"
4982 _radio_bsdbt848=no
4983 cat > $TMPC <<EOF
4984 #include <sys/types.h>
4985 $def_ioctl_bt848_h_name
4986 #ifdef IOCTL_BT848_H_NAME
4987 #include IOCTL_BT848_H_NAME
4988 #endif
4989 int main(void) { ioctl(0, RADIO_GETFREQ, 0); return 0; }
4991 cc_check && _radio_bsdbt848=yes
4992 echores "$_radio_bsdbt848"
4993 fi #if freebsd || netbsd || openbsd || dragonfly || bsdos && _radio && _radio_bsdbt848
4995 if test "$_radio_bsdbt848" = yes ; then
4996 def_radio_bsdbt848='#define CONFIG_RADIO_BSDBT848 1'
4997 else
4998 def_radio_bsdbt848='#undef CONFIG_RADIO_BSDBT848'
5001 if test "$_radio_v4l2" = no &&
5002 test "$_radio_bsdbt848" = no && test "$_radio" = yes ; then
5003 die "Radio driver requires BSD BT848 or V4L2!"
5006 echocheck "Video 4 Linux 2 MPEG PVR interface"
5007 if test "$_pvr" = auto ; then
5008 _pvr=no
5009 if test "$_tv_v4l2" = yes && linux ; then
5010 cat > $TMPC <<EOF
5011 #include <sys/time.h>
5012 #include <linux/videodev2.h>
5013 int main(void) { struct v4l2_ext_controls ext; return ext.controls->value; }
5015 cc_check && _pvr=yes
5018 if test "$_pvr" = yes ; then
5019 def_pvr='#define CONFIG_PVR 1'
5020 inputmodules="pvr $inputmodules"
5021 else
5022 noinputmodules="pvr $noinputmodules"
5023 def_pvr='#undef CONFIG_PVR'
5025 echores "$_pvr"
5028 echocheck "ftp"
5029 if test "$_ftp" = "auto" ; then
5030 test "$networking" = "yes" && ! beos && _ftp=yes
5032 if test "$_ftp" = yes ; then
5033 def_ftp='#define CONFIG_FTP 1'
5034 inputmodules="ftp $inputmodules"
5035 else
5036 noinputmodules="ftp $noinputmodules"
5037 def_ftp='#undef CONFIG_FTP'
5039 echores "$_ftp"
5041 echocheck "vstream client"
5042 if test "$_vstream" = auto ; then
5043 _vstream=no
5044 cat > $TMPC <<EOF
5045 #include <vstream-client.h>
5046 void vstream_error(const char *format, ... ) {}
5047 int main(void) { vstream_start(); return 0; }
5049 cc_check -lvstream-client && _vstream=yes
5051 if test "$_vstream" = yes ; then
5052 def_vstream='#define CONFIG_VSTREAM 1'
5053 inputmodules="vstream $inputmodules"
5054 extra_ldflags="$extra_ldflags -lvstream-client"
5055 else
5056 noinputmodules="vstream $noinputmodules"
5057 def_vstream='#undef CONFIG_VSTREAM'
5059 echores "$_vstream"
5062 echocheck "XMMS inputplugin support"
5063 if test "$_xmms" = yes ; then
5064 if ( xmms-config --version ) >/dev/null 2>&1 ; then
5065 _xmmsplugindir=$(xmms-config --input-plugin-dir)
5066 _xmmslibdir=$(xmms-config --exec-prefix)/lib
5067 else
5068 _xmmsplugindir=/usr/lib/xmms/Input
5069 _xmmslibdir=/usr/lib
5072 def_xmms='#define CONFIG_XMMS 1'
5073 if darwin ; then
5074 extra_ldflags="$extra_ldflags ${_xmmslibdir}/libxmms.dylib"
5075 else
5076 extra_ldflags="$extra_ldflags ${_xmmslibdir}/libxmms.so.1 -export-dynamic"
5078 else
5079 def_xmms='#undef CONFIG_XMMS'
5081 echores "$_xmms"
5083 if test "$_charset" != "noconv" ; then
5084 def_charset="#define MSG_CHARSET \"$_charset\""
5085 else
5086 def_charset="#undef MSG_CHARSET"
5087 _charset="UTF-8"
5090 #############################################################################
5092 echocheck "automatic gdb attach"
5093 if test "$_crash_debug" = yes ; then
5094 def_crash_debug='#define CONFIG_CRASH_DEBUG 1'
5095 else
5096 def_crash_debug='#undef CONFIG_CRASH_DEBUG'
5097 _crash_debug=no
5099 echores "$_crash_debug"
5101 echocheck "compiler support for noexecstack"
5102 if cflag_check -Wl,-z,noexecstack ; then
5103 extra_ldflags="-Wl,-z,noexecstack $extra_ldflags"
5104 echores "yes"
5105 else
5106 echores "no"
5109 echocheck "linker support for --nxcompat --no-seh --dynamicbase"
5110 if cflag_check "-Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase" ; then
5111 extra_ldflags="-Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase $extra_ldflags"
5112 echores "yes"
5113 else
5114 echores "no"
5118 # Dynamic linking flags
5119 # (FIXME: 'echocheck "dynamic linking"' above and modify here accordingly)
5120 _ld_dl_dynamic=''
5121 freebsd || netbsd || openbsd || dragonfly || bsdos && _ld_dl_dynamic='-rdynamic'
5122 if test "$_real" = yes || test "$_xanim" = yes && ! win32 && ! qnx && ! darwin ; then
5123 _ld_dl_dynamic='-rdynamic'
5126 extra_ldflags="$extra_ldflags $_ld_pthread $_ld_dl $_ld_dl_dynamic"
5127 bsdos && extra_ldflags="$extra_ldflags -ldvd"
5128 (netbsd || openbsd) && x86_32 && extra_ldflags="$extra_ldflags -li386"
5130 def_debug='#undef MP_DEBUG'
5131 test "$_debug" != "" && def_debug='#define MP_DEBUG 1'
5134 echocheck "joystick"
5135 def_joystick='#undef CONFIG_JOYSTICK'
5136 if test "$_joystick" = yes ; then
5137 if linux || freebsd ; then
5138 # TODO add some check
5139 def_joystick='#define CONFIG_JOYSTICK 1'
5140 else
5141 _joystick="no"
5142 res_comment="unsupported under $system_name"
5145 echores "$_joystick"
5147 echocheck "lirc"
5148 if test "$_lirc" = auto ; then
5149 _lirc=no
5150 header_check lirc/lirc_client.h -llirc_client && _lirc=yes
5152 if test "$_lirc" = yes ; then
5153 def_lirc='#define CONFIG_LIRC 1'
5154 libs_mplayer="$libs_mplayer -llirc_client"
5155 else
5156 def_lirc='#undef CONFIG_LIRC'
5158 echores "$_lirc"
5160 echocheck "lircc"
5161 if test "$_lircc" = auto ; then
5162 _lircc=no
5163 header_check lirc/lircc.h -llircc && _lircc=yes
5165 if test "$_lircc" = yes ; then
5166 def_lircc='#define CONFIG_LIRCC 1'
5167 libs_mplayer="$libs_mplayer -llircc"
5168 else
5169 def_lircc='#undef CONFIG_LIRCC'
5171 echores "$_lircc"
5173 #############################################################################
5175 CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"
5177 # This must be the last test to be performed. Any other tests following it
5178 # could fail due to linker errors. libdvdnavmini is intentionally not linked
5179 # against libdvdread (to permit MPlayer to use its own copy of the library).
5180 # So any compilation using the flags added here but not linking against
5181 # libdvdread can fail.
5182 echocheck "DVD support (libdvdnav)"
5183 if test "$_dvdread_internal" = yes && test ! -f "libdvdnav/dvdnav.c" ; then
5184 _dvdnav=no
5186 dvdnav_internal=no
5187 if test "$_dvdnav" = auto ; then
5188 if test "$_dvdread_internal" = yes ; then
5189 _dvdnav=yes
5190 dvdnav_internal=yes
5191 res_comment="internal"
5192 else
5193 $_dvdnavconfig --version --minilibs >> $TMPLOG 2>&1 || _dvdnav=no
5196 if test "$_dvdnav" = auto ; then
5197 _dvdnav=no
5198 _dvdnavdir=$($_dvdnavconfig --cflags)
5199 _dvdnavlibs=$($_dvdnavconfig --libs)
5200 statement_check_broken stdint.h dvdnav/dvdnav.h 'dvdnav_t *dvd = 0' $_dvdnavdir $_dvdnavlibs $_ld_dl $_ld_pthread && _dvdnav=yes
5202 if test "$_dvdnav" = yes ; then
5203 def_dvdnav='#define CONFIG_DVDNAV 1'
5204 if test "$dvdnav_internal" = yes ; then
5205 cflags_libdvdnav="-Ilibdvdnav"
5206 inputmodules="dvdnav(internal) $inputmodules"
5207 else
5208 extra_cflags="$extra_cflags $($_dvdnavconfig --cflags)"
5209 extra_ldflags="$extra_ldflags $($_dvdnavconfig --minilibs)"
5210 inputmodules="dvdnav $inputmodules"
5212 else
5213 def_dvdnav='#undef CONFIG_DVDNAV'
5214 noinputmodules="dvdnav $noinputmodules"
5216 echores "$_dvdnav"
5218 # DO NOT ADD ANY TESTS THAT USE LINKER FLAGS HERE (like cc_check).
5219 # Read dvdnav comment above.
5221 mak_enable () {
5222 list=$(echo $1 | tr '[a-z]' '[A-Z]')
5223 item=$(echo $2 | tr '[a-z]' '[A-Z]')
5224 nprefix=$3;
5225 for part in $list; do
5226 if $(echo $item | grep -q -E "(^| )$part($| )"); then
5227 echo "${nprefix}_$part = yes"
5229 done
5232 #############################################################################
5233 echo "Creating config.mak"
5234 cat > config.mak << EOF
5235 # -------- Generated by configure -----------
5237 # Ensure that locale settings do not interfere with shell commands.
5238 export LC_ALL = C
5240 CONFIGURATION = $configuration
5242 CHARSET = $_charset
5243 DOC_LANGS = $language_doc
5244 DOC_LANG_ALL = $doc_lang_all
5245 MAN_LANGS = $language_man
5246 MAN_LANG_ALL = $man_lang_all
5247 MSG_LANGS = $language_msg
5248 MSG_LANG_ALL = $msg_lang_all
5250 prefix = \$(DESTDIR)$_prefix
5251 BINDIR = \$(DESTDIR)$_bindir
5252 LIBDIR = \$(DESTDIR)$_libdir
5253 MANDIR = \$(DESTDIR)$_mandir
5254 CONFDIR = \$(DESTDIR)$_confdir
5255 LOCALEDIR = \$(DESTDIR)$_localedir
5257 CC = $_cc
5258 INSTALL = $_install
5259 INSTALLSTRIP = $_install_strip
5260 WINDRES = $_windres
5262 CFLAGS = $WARNFLAGS $ERRORFLAGS $WARN_CFLAGS $CFLAGS $extra_cflags
5263 DEPFLAGS = $DEPFLAGS
5265 CFLAGS_LIBDVDCSS = $cflags_libdvdcss
5266 CFLAGS_LIBDVDCSS_DVDREAD = $cflags_libdvdcss_dvdread
5267 CFLAGS_LIBDVDNAV = $cflags_libdvdnav
5268 CFLAGS_NO_OMIT_LEAF_FRAME_POINTER = $cflags_no_omit_leaf_frame_pointer
5269 CFLAGS_STACKREALIGN = $cflags_stackrealign
5271 EXTRALIBS = $extra_ldflags $_ld_static $_ld_lm $extra_libs
5272 EXTRALIBS_MPLAYER = $libs_mplayer
5274 GETCH = $_getch
5275 TIMER = $_timer
5276 RST2MAN = $_rst2man
5278 EXESUF = $_exesuf
5279 EXESUFS_ALL = .exe
5281 ARCH = $arch
5282 $(mak_enable "$arch_all" "$arch" ARCH)
5283 $(mak_enable "$subarch_all" "$subarch" ARCH)
5284 $(mak_enable "$cpuexts_all" "$cpuexts" HAVE)
5286 NEED_GETTIMEOFDAY = $need_gettimeofday
5287 NEED_GLOB = $need_glob
5288 NEED_SETENV = $need_setenv
5289 NEED_SHMEM = $need_shmem
5290 NEED_STRSEP = $need_strsep
5291 NEED_SWAB = $need_swab
5292 NEED_VSSCANF = $need_vsscanf
5294 # features
5295 ALSA = $_alsa
5296 APPLE_IR = $_apple_ir
5297 APPLE_REMOTE = $_apple_remote
5298 AUDIO_INPUT = $_audio_input
5299 CACA = $_caca
5300 CDDA = $_cdda
5301 CDDB = $_cddb
5302 COCOA = $_cocoa
5303 COREAUDIO = $_coreaudio
5304 COREVIDEO = $_corevideo
5305 SHAREDBUFFER = $_sharedbuffer
5306 DIRECT3D = $_direct3d
5307 DIRECTFB = $_directfb
5308 DIRECTX = $_directx
5309 DVBIN = $_dvbin
5310 DVDNAV = $_dvdnav
5311 DVDNAV_INTERNAL = $dvdnav_internal
5312 DVDREAD = $_dvdread
5313 DVDREAD_INTERNAL = $_dvdread_internal
5314 DXR3 = $_dxr3
5315 FAAD = $_faad
5316 FASTMEMCPY = $_fastmemcpy
5317 FTP = $_ftp
5318 GIF = $_gif
5319 GL = $_gl
5320 GL_COCOA = $_gl_cocoa
5321 GL_WIN32 = $_gl_win32
5322 GL_X11 = $_gl_x11
5323 GL_SDL = $_gl_sdl
5324 HAVE_POSIX_SELECT = $_posix_select
5325 HAVE_SYS_MMAN_H = $_mman
5326 JACK = $_jack
5327 JOYSTICK = $_joystick
5328 JPEG = $_jpeg
5329 LADSPA = $_ladspa
5330 LIBA52 = $_liba52
5331 LIBASS = $_ass
5332 LIBBLURAY = $_bluray
5333 LIBBS2B = $_libbs2b
5334 LIBDCA = $_libdca
5335 LIBDV = $_libdv
5336 LIBDVDCSS_INTERNAL = $_libdvdcss_internal
5337 LIBMAD = $_mad
5338 LCMS2 = $_lcms2
5339 LIBNUT = $_libnut
5340 LIBPOSTPROC = $libpostproc
5341 LIBSMBCLIENT = $_smb
5342 LIBQUVI = $_libquvi
5343 LIBTHEORA = $_theora
5344 LIRC = $_lirc
5345 MACOSX_FINDER = $_macosx_finder
5346 MD5SUM = $_md5sum
5347 MNG = $_mng
5348 MPG123 = $_mpg123
5349 MUSEPACK = $_musepack
5350 NETWORKING = $networking
5351 OPENAL = $_openal
5352 OSS = $_ossaudio
5353 PE_EXECUTABLE = $_pe_executable
5354 PNG = $_png
5355 PNM = $_pnm
5356 PRIORITY = $_priority
5357 PULSE = $_pulse
5358 PORTAUDIO = $_portaudio
5359 PVR = $_pvr
5360 QTX_CODECS = $_qtx
5361 QTX_CODECS_WIN32 = $_qtx_codecs_win32
5362 QTX_EMULATION = $_qtx_emulation
5363 RADIO=$_radio
5364 RADIO_CAPTURE=$_radio_capture
5365 REAL_CODECS = $_real
5366 RSOUND = $_rsound
5367 SDL = $_sdl
5368 SPEEX = $_speex
5369 STREAM_CACHE = $_stream_cache
5370 TGA = $_tga
5371 TV = $_tv
5372 TV_BSDBT848 = $_tv_bsdbt848
5373 TV_DSHOW = $_tv_dshow
5374 TV_V4L2 = $_tv_v4l2
5375 UNRAR_EXEC = $_unrar_exec
5376 V4L2 = $_v4l2
5377 VCD = $_vcd
5378 VDPAU = $_vdpau
5379 VORBIS = $_vorbis
5380 VSTREAM = $_vstream
5381 WIN32DLL = $_win32dll
5382 WIN32_EMULATION = $_win32_emulation
5383 X11 = $_x11
5384 XANIM_CODECS = $_xanim
5385 XMMS_PLUGINS = $_xmms
5386 XV = $_xv
5387 XVID4 = $_xvid
5388 YUV4MPEG = $_yuv4mpeg
5390 CONFIG_VDPAU = $_vdpau
5391 CONFIG_ZLIB = $_zlib
5393 HAVE_PTHREADS = $_pthreads
5394 HAVE_SHM = $_shm
5395 HAVE_W32THREADS = $_w32threads
5399 #############################################################################
5401 ff_config_enable () {
5402 list=$(echo $1 | tr '[a-z]' '[A-Z]')
5403 item=$(echo $2 | tr '[a-z]' '[A-Z]')
5404 _nprefix=$3;
5405 test -z "$_nprefix" && _nprefix='CONFIG'
5406 for part in $list; do
5407 if $(echo $item | grep -q -E "(^| )$part($| )"); then
5408 echo "#define ${_nprefix}_$part 1"
5409 else
5410 echo "#define ${_nprefix}_$part 0"
5412 done
5415 echo "Creating config.h"
5416 cat > $TMPH << EOF
5417 /*----------------------------------------------------------------------------
5418 ** This file has been automatically generated by configure any changes in it
5419 ** will be lost when you run configure again.
5420 ** Instead of modifying definitions here, use the --enable/--disable options
5421 ** of the configure script! See ./configure --help for details.
5422 *---------------------------------------------------------------------------*/
5424 #ifndef MPLAYER_CONFIG_H
5425 #define MPLAYER_CONFIG_H
5427 #define CONFIGURATION "$configuration"
5429 #define MPLAYER_CONFDIR "$_confdir"
5430 #define MPLAYER_LOCALEDIR "$_localedir"
5432 $def_translation
5434 /* definitions needed by included libraries */
5435 #define HAVE_INTTYPES_H 1
5436 /* libdvdcss */
5437 #define HAVE_ERRNO_H 1
5438 /* libdvdcss + libdvdread */
5439 #define HAVE_LIMITS_H 1
5440 /* libdvdcss */
5441 #define HAVE_UNISTD_H 1
5442 /* libdvdread */
5443 #define STDC_HEADERS 1
5444 #define HAVE_MEMCPY 1
5445 /* libdvdnav */
5446 #define READ_CACHE_TRACE 0
5447 /* libdvdread */
5448 #define HAVE_DLFCN_H 1
5449 $def_dvdcss
5452 /* system headers */
5453 $def_alloca_h
5454 $def_altivec_h
5455 $def_mman_h
5456 $def_mman_has_map_failed
5457 $def_soundcard_h
5458 $def_sys_soundcard_h
5459 $def_sys_sysinfo_h
5460 $def_sys_videoio_h
5461 $def_termios_h
5462 $def_termios_sys_h
5463 $def_winsock2_h
5466 /* system functions */
5467 $def_gethostbyname2
5468 $def_gettimeofday
5469 $def_glob
5470 $def_langinfo
5471 $def_nanosleep
5472 $def_posix_select
5473 $def_select
5474 $def_setenv
5475 $def_setmode
5476 $def_shm
5477 $def_strsep
5478 $def_swab
5479 $def_sysi86
5480 $def_sysi86_iv
5481 $def_termcap
5482 $def_termios
5483 $def_vsscanf
5486 /* system-specific features */
5487 $def_asmalign_pot
5488 $def_builtin_expect
5489 $def_dl
5490 $def_dos_paths
5491 $def_extern_asm
5492 $def_extern_prefix
5493 $def_iconv
5494 $def_kstat
5495 $def_macosx_bundle
5496 $def_macosx_finder
5497 $def_priority
5498 $def_quicktime
5499 $def_restrict_keyword
5500 $def_rtc
5501 $def_unrar_exec
5504 /* configurable options */
5505 $def_charset
5506 $def_crash_debug
5507 $def_debug
5508 $def_fastmemcpy
5509 $def_runtime_cpudetection
5510 $def_sighandler
5511 $def_stream_cache
5512 $def_pthread_cache
5515 /* CPU stuff */
5516 #define __CPU__ $iproc
5517 $def_ebx_available
5518 $def_words_endian
5519 $def_bigendian
5520 $(ff_config_enable "$arch_all" "$arch" "ARCH")
5521 $(ff_config_enable "$subarch_all" "$subarch" "ARCH")
5522 $(ff_config_enable "$cpuexts_all" "$cpuexts" "HAVE")
5525 /* Blu-ray/DVD/VCD/CD */
5526 #define DEFAULT_CDROM_DEVICE "$default_cdrom_device"
5527 #define DEFAULT_DVD_DEVICE "$default_dvd_device"
5528 $def_bluray
5529 $def_bsdi_dvd
5530 $def_cdda
5531 $def_cddb
5532 $def_cdio
5533 $def_cdrom
5534 $def_dvd
5535 $def_dvd_bsd
5536 $def_dvd_darwin
5537 $def_dvd_linux
5538 $def_dvd_openbsd
5539 $def_dvdio
5540 $def_dvdnav
5541 $def_dvdread
5542 $def_hpux_scsi_h
5543 $def_sol_scsi_h
5544 $def_vcd
5547 /* codec libraries */
5548 $def_faad
5549 $def_liba52
5550 $def_libdca
5551 $def_libdv
5552 $def_mad
5553 $def_mpg123
5554 $def_musepack
5555 $def_speex
5556 $def_theora
5557 $def_tremor
5558 $def_vorbis
5559 $def_xvid
5560 $def_zlib
5562 $def_libpostproc
5563 $def_libnut
5566 /* binary codecs */
5567 $def_qtx
5568 $def_qtx_win32
5569 $def_real
5570 $def_win32_loader
5571 $def_win32dll
5572 $def_xanim
5573 $def_xmms
5574 #define BINARY_CODECS_PATH "$_codecsdir"
5575 #define XMMS_INPUT_PLUGIN_DIR "$_xmmsplugindir"
5578 /* Audio output drivers */
5579 $def_alsa
5580 $def_coreaudio
5581 $def_jack
5582 $def_openal
5583 $def_openal_h
5584 $def_ossaudio
5585 $def_ossaudio_devdsp
5586 $def_ossaudio_devmixer
5587 $def_pulse
5588 $def_portaudio
5589 $def_rsound
5591 $def_ladspa
5592 $def_libbs2b
5595 /* input */
5596 $def_apple_ir
5597 $def_apple_remote
5598 $def_ioctl_bt848_h_name
5599 $def_ioctl_meteor_h_name
5600 $def_joystick
5601 $def_lirc
5602 $def_lircc
5603 $def_pvr
5604 $def_radio
5605 $def_radio_bsdbt848
5606 $def_radio_capture
5607 $def_radio_v4l2
5608 $def_tv
5609 $def_tv_bsdbt848
5610 $def_tv_dshow
5611 $def_tv_v4l2
5614 /* font stuff */
5615 $def_ass
5616 $def_enca
5618 /* networking */
5619 $def_closesocket
5620 $def_ftp
5621 $def_inet6
5622 $def_inet_aton
5623 $def_inet_pton
5624 $def_networking
5625 $def_smb
5626 $def_libquvi
5627 $def_socklen_t
5628 $def_vstream
5630 $def_lcms2
5633 /* libvo options */
5634 $def_caca
5635 $def_corevideo
5636 $def_cocoa
5637 $def_sharedbuffer
5638 $def_direct3d
5639 $def_directfb
5640 $def_directx
5641 $def_dvbin
5642 $def_gif
5643 $def_gif_4
5644 $def_gif_tvt_hack
5645 $def_gl
5646 $def_gl_cocoa
5647 $def_gl_win32
5648 $def_gl_x11
5649 $def_gl_sdl
5650 $def_jpeg
5651 $def_md5sum
5652 $def_mng
5653 $def_png
5654 $def_pnm
5655 $def_sdl
5656 $def_sdl_sdl_h
5657 $def_tga
5658 $def_v4l2
5659 $def_vdpau
5660 $def_vm
5661 $def_x11
5662 $def_xdpms
5663 $def_xf86keysym
5664 $def_xinerama
5665 $def_xss
5666 $def_xv
5667 $def_yuv4mpeg
5670 $def_fast_64bit
5671 $def_fast_unaligned
5672 $def_pthreads
5674 /* Use these registers in x86 inline asm. No proper detection yet. */
5675 #define HAVE_EBP_AVAILABLE 1
5677 #endif /* MPLAYER_CONFIG_H */
5680 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
5681 cmp -s "$TMPH" config.h || mv -f "$TMPH" config.h
5683 #############################################################################
5685 cat << EOF
5687 Config files successfully generated by ./configure $configuration !
5689 Install prefix: $_prefix
5690 Config direct.: $_confdir
5692 Byte order: $_byte_order
5693 Optimizing for: $_optimizing
5695 Languages:
5696 Messages (in addition to English): $language_msg
5697 Manual pages: $language_man
5698 Documentation: $language_doc
5700 Enabled optional drivers:
5701 Input: $inputmodules
5702 Codecs: $codecmodules
5703 Audio output: $aomodules
5704 Video output: $vomodules
5706 Disabled optional drivers:
5707 Input: $noinputmodules
5708 Codecs: $nocodecmodules
5709 Audio output: $noaomodules
5710 Video output: $novomodules
5712 'config.h' and 'config.mak' contain your configuration options.
5713 Note: If you alter theses files (for instance CFLAGS) MPlayer may no longer
5714 compile *** DO NOT REPORT BUGS if you tweak these files ***
5716 'make' will now compile MPlayer and 'make install' will install it.
5717 Note: On non-Linux systems you might need to use 'gmake' instead of 'make'.
5722 cat <<EOF
5723 Check $TMPLOG if you wonder why an autodetection failed (make sure
5724 development headers/packages are installed).
5726 NOTE: The --enable-* parameters unconditionally force options on, completely
5727 skipping autodetection. This behavior is unlike what you may be used to from
5728 autoconf-based configure scripts that can decide to override you. This greater
5729 level of control comes at a price. You may have to provide the correct compiler
5730 and linker flags yourself.
5731 If you used one of these options (except --enable-runtime-cpudetection and
5732 similar ones that turn on internal features) and experience a compilation or
5733 linking failure, make sure you have passed the necessary compiler/linker flags
5734 to configure.
5736 If you suspect a bug, please read DOCS/HTML/$language_doc/bugreports.html.
5740 if test "$warn_cflags" = yes; then
5741 cat <<EOF
5743 MPlayer compilation will use the CPPFLAGS/CFLAGS/LDFLAGS set by you,
5744 but:
5746 *** *** DO NOT REPORT BUGS IF IT DOES NOT COMPILE/WORK! *** ***
5748 It is strongly recommended to let MPlayer choose the correct CFLAGS!
5749 To do so, execute 'CFLAGS= ./configure <options>'
5754 # Last move:
5755 rm -rf "$mplayer_tmpdir"