1#! /bin/sh
2#
3# Original version (C) 2000 Pontscho/fresh!mindworkz
4#                      pontscho@makacs.poliod.hu
5#
6# History / Contributors: Check the Subversion log.
7#
8# Cleanups all over the place (c) 2001 pl
9#
10#
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.
17#
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.
21#
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.
24#
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':
31#
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
35#
36#############################################################################
37
38# Prevent locale nonsense from breaking basic text processing utilities
39export LC_ALL=C
40
41# Store the configure line that was used
42configuration="$*"
43
44# utility functions
45tolower() {
46  tr '[A-Z]' '[a-z]'
47}
48
49toupper() {
50  tr '[a-z]' '[A-Z]'
51}
52
53cc_link_o() {
54  eval printf '%s\\n' $CC_LINK_O
55}
56
57# Prefer these macros to full length text !
58# These macros only return an error code - NO display is done
59compile_check() {
60  source="$1"
61  shift
62  echo >> "$TMPLOG"
63  cat "$source" >> "$TMPLOG"
64  echo >> "$TMPLOG"
65  echo "$_cc $($filter_flags $WARNFLAGS $WARN_CFLAGS $CFLAGS $source $extra_cflags $ld_static $extra_ldflags $libs_mplayer $libs_mencoder $(cc_link_o $TMPEXE) $@) $libm" >> "$TMPLOG"
66  rm -f "$TMPEXE"
67  $_cc $($filter_flags $WARNFLAGS $WARN_CFLAGS $CFLAGS "$source" $extra_cflags $ld_static $extra_ldflags $libs_mplayer $libs_mencoder $(cc_link_o $TMPEXE) "$@") $libm >> "$TMPLOG" 2>&1
68  TMPRES="$?"
69  echo >> "$TMPLOG"
70  echo >> "$TMPLOG"
71  return "$TMPRES"
72}
73
74cc_check() {
75  compile_check $TMPC $@
76}
77
78cxx_check() {
79  compile_check $TMPCPP $@ -lstdc++
80}
81
82cpp_condition_check() {
83  inc=""
84  if test -n "$1" ; then
85    inc="#include <$1>"
86  fi
87  cat > $TMPC << EOF
88$inc
89#if !($2)
90#error condition not true: $2
91#endif
92int main(void) { return 0; }
93EOF
94  shift 2
95  compile_check $TMPC $@
96}
97
98cflag_check() {
99  cat > $TMPC << EOF
100int main(void) { return 0; }
101EOF
102  compile_check $TMPC $@
103}
104
105header_check() {
106  cat > $TMPC << EOF
107#include <$1>
108int main(void) { return 0; }
109EOF
110  shift
111  compile_check $TMPC $@
112}
113
114return_check() {
115  cat > $TMPC << EOF
116#include <$1>
117int main(void) { return $2; }
118EOF
119  shift 2
120  compile_check $TMPC $@
121}
122
123statement_check() {
124  cat > $TMPC << EOF
125#include <$1>
126int main(void) { $2; return 0; }
127EOF
128  shift
129  shift
130  compile_check $TMPC $@
131}
132
133define_statement_check() {
134  cat > $TMPC << EOF
135#define $1
136#include <$2>
137int main(void) { $3; return 0; }
138EOF
139  shift 3
140  compile_check $TMPC $@
141}
142
143return_statement_check() {
144  cat > $TMPC << EOF
145#include <$1>
146int main(void) { $2; return $3; }
147EOF
148  shift 3
149  compile_check $TMPC $@
150}
151
152inline_asm_check() {
153  cat > $TMPC << EOF
154int main(void) { __asm__ volatile ($1); return 0; }
155EOF
156  shift
157  compile_check $TMPC $@
158}
159
160# The following checks are special and should only be used with broken and
161# non-self-sufficient headers that do not include all of their dependencies.
162
163header_check_broken() {
164  cat > $TMPC << EOF
165#include <$1>
166#include <$2>
167int main(void) { return 0; }
168EOF
169  shift
170  shift
171  compile_check $TMPC $@
172}
173
174statement_check_broken() {
175  cat > $TMPC << EOF
176#include <$1>
177#include <$2>
178int main(void) { $3; return 0; }
179EOF
180  shift 3
181  compile_check $TMPC $@
182}
183
184yasm_check() {
185  echo >> "$TMPLOG"
186  cat "$TMPS" >> "$TMPLOG"
187  echo >> "$TMPLOG"
188  echo "$_yasm $YASMFLAGS -o $TMPEXE $TMPS $@" >> "$TMPLOG"
189  rm -f "$TMPEXE"
190  $_yasm $YASMFLAGS -o "$TMPEXE" "$TMPS" "$@" >> "$TMPLOG" 2>&1
191  TMPRES="$?"
192  echo >> "$TMPLOG"
193  echo >> "$TMPLOG"
194  return "$TMPRES"
195}
196
197tmp_run() {
198  "$TMPEXE" >> "$TMPLOG" 2>&1
199}
200
201# Display error message, flush temporary file, exit.
202die () {
203  echo
204  echo "Error: $@" >&2
205  echo >&2
206  rm -f "$TMPEXE" "$TMPC" "$TMPS" "$TMPCPP"
207  echo "Check \"$TMPLOG\" if you do not understand why it failed."
208  exit 1
209}
210
211# OS test booleans functions
212issystem() {
213  test "$(echo $system_name | tolower)" = "$(echo $1 | tolower)"
214}
215aix()       { issystem "AIX"; }
216amigaos()   { issystem "AmigaOS"; }
217bsdos()     { issystem "BSD/OS"; }
218cygwin()    { issystem "CYGWIN"; }
219darwin()    { issystem "Darwin"; }
220dragonfly() { issystem "DragonFly"; }
221freebsd()   { issystem "FreeBSD" || issystem "GNU/kFreeBSD"; }
222gnu()       { issystem "GNU"; }
223hpux()      { issystem "HP-UX"; }
224irix()      { issystem "IRIX"; }
225linux()     { issystem "Linux"; }
226mingw32()   { issystem "MINGW32"; }
227morphos()   { issystem "MorphOS"; }
228netbsd()    { issystem "NetBSD"; }
229openbsd()   { issystem "OpenBSD"; }
230os2()       { issystem "OS/2"; }
231qnx()       { issystem "QNX"; }
232sunos()     { issystem "SunOS"; }
233wine()      { issystem "Wine"; }
234win32()     { cygwin || mingw32 || wine; }
235msvc()      { test "$cc_vendor" = "msvc"; }
236
237# arch test boolean functions
238# x86/x86pc is used by QNX
239x86_32() {
240  case "$host_arch" in
241    i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686) return 0 ;;
242    *) return 1 ;;
243  esac
244}
245
246x86_64() {
247  case "$host_arch" in
248    x86_64|amd64) return 0 ;;
249    *) return 1 ;;
250  esac
251}
252
253x86() {
254  x86_32 || x86_64
255}
256
257ppc() {
258  case "$host_arch" in
259    ppc*|powerpc*) return 0;;
260    *) return 1;;
261  esac
262}
263
264sparc() {
265  case "$host_arch" in
266    sparc*) return 0;;
267    *) return 1;;
268  esac
269}
270
271alpha() {
272  case "$host_arch" in
273    alpha*) return 0;;
274    *) return 1;;
275  esac
276}
277
278aarch64() {
279  case "$host_arch" in
280    aarch64*) return 0;;
281    *) return 1;;
282  esac
283}
284
285arm() {
286  case "$host_arch" in
287    arm*|aarch64*) return 0;;
288    *) return 1;;
289  esac
290}
291
292# Use this before starting a check
293echocheck() {
294  echo "============ Checking for $@ ============" >> "$TMPLOG"
295  echo ${_echo_n} "Checking for $@ ... ${_echo_c}"
296}
297
298# Use this to echo the results of a check
299echores() {
300  if test "$res_comment" ; then
301    res_comment="($res_comment)"
302  fi
303  echo "Result is: $@ $res_comment" >> "$TMPLOG"
304  echo "##########################################" >> "$TMPLOG"
305  echo "" >> "$TMPLOG"
306  echo "$@ $res_comment"
307  res_comment=""
308}
309#############################################################################
310
311# Check how echo works in this /bin/sh
312case $(echo -n) in
313  -n)   _echo_n=        _echo_c='\c'    ;;      # SysV echo
314  *)    _echo_n='-n '   _echo_c=        ;;      # BSD echo
315esac
316
317msg_lang_all=$(echo help/help_mp-??.h help/help_mp-??_??.h | sed -e "s:help/help_mp-\(..\).h:\1:g" -e "s:help/help_mp-\(.....\).h:\1:g")
318man_lang_all=$(echo DOCS/man/??/mplayer.1 DOCS/man/??_??/mplayer.1 | sed -e "s:DOCS/man/\(..\)/mplayer.1:\1:g" -e "s:DOCS/man/\(.._..\)/mplayer.1:\1:g")
319doc_lang_all=$(echo DOCS/xml/??/ DOCS/xml/??_??/ | sed -e "s:DOCS/xml/\(..\)/:\1:g" -e "s:DOCS/xml/\(.._..\)/:\1:g")
320
321show_help(){
322cat << EOF
323Usage: $0 [OPTIONS]...
324
325Configuration:
326  -h, --help             display this help and exit
327
328Installation directories:
329  --prefix=DIR           prefix directory for installation [/usr/local]
330  --bindir=DIR           directory for installing binaries [PREFIX/bin]
331  --datadir=DIR          directory for installing machine independent
332                         data files (skins, etc) [PREFIX/share/mplayer]
333  --mandir=DIR           directory for installing man pages [PREFIX/share/man]
334  --confdir=DIR          directory for installing configuration files
335                         [PREFIX/etc/mplayer]
336  --libdir=DIR           directory for object code libraries [PREFIX/lib]
337  --codecsdir=DIR        directory for binary codecs [LIBDIR/codecs]
338
339Optional features:
340  --disable-mencoder     disable MEncoder (A/V encoder) compilation [enable]
341  --disable-mplayer      disable MPlayer compilation [enable]
342  --enable-gui           enable GMPlayer compilation (GTK+ GUI) [disable]
343  --enable-termcap       use termcap database for key codes [autodetect]
344  --enable-termios       use termios database for key codes [autodetect]
345  --disable-iconv        disable iconv for encoding conversion [autodetect]
346  --disable-langinfo     do not use langinfo [autodetect]
347  --enable-lirc          enable LIRC (remote control) support [autodetect]
348  --enable-lircc         enable LIRCCD (LIRC client daemon) input [autodetect]
349  --enable-joystick      enable joystick support [disable]
350  --enable-apple-remote  enable Apple Remote input (Mac OS X only) [autodetect]
351  --enable-apple-ir      enable Apple IR Remote input (Linux only) [autodetect]
352  --disable-vm           disable X video mode extensions [autodetect]
353  --disable-xf86keysym   disable support for multimedia keys [autodetect]
354  --enable-radio         enable radio interface [disable]
355  --enable-radio-capture enable radio capture (through PCI/line-in) [disable]
356  --disable-radio-v4l2   disable Video4Linux2 radio interface [autodetect]
357  --disable-radio-bsdbt848   disable BSD BT848 radio interface [autodetect]
358  --disable-tv           disable TV interface (TV/DVB grabbers) [enable]
359  --disable-tv-v4l1      disable Video4Linux TV interface [autodetect]
360  --disable-tv-v4l2      disable Video4Linux2 TV interface [autodetect]
361  --disable-tv-bsdbt848  disable BSD BT848 interface [autodetect]
362  --disable-pvr          disable Video4Linux2 MPEG PVR [autodetect]
363  --disable-rtc          disable RTC (/dev/rtc) on Linux [autodetect]
364  --disable-networking   disable networking [enable]
365  --enable-winsock2_h    enable winsock2_h [autodetect]
366  --enable-smb           enable Samba (SMB) input [autodetect]
367  --enable-live          enable LIVE555 Streaming Media [autodetect]
368  --enable-nemesi        enable Nemesi Streaming Media [autodetect]
369  --enable-librtmp       enable RTMPDump Streaming Media [autodetect]
370  --disable-vcd          disable VCD support [autodetect]
371  --disable-bluray       disable Blu-ray support [autodetect]
372  --disable-dvdnav       disable libdvdnav [autodetect]
373  --disable-dvdread      disable libdvdread [autodetect]
374  --disable-cdparanoia   disable cdparanoia [autodetect]
375  --disable-cddb         disable cddb [autodetect]
376  --disable-bitmap-font  disable bitmap font support [enable]
377  --disable-freetype     disable FreeType 2 font rendering [autodetect]
378  --disable-fontconfig   disable fontconfig font lookup [autodetect]
379  --disable-unrarexec    disable using of UnRAR executable [enabled]
380  --enable-menu          enable OSD menu (not DVD menu) [disabled]
381  --disable-sortsub      disable subtitle sorting [enabled]
382  --enable-fribidi       enable the FriBiDi libs [autodetect]
383  --disable-enca         disable ENCA charset oracle library [autodetect]
384  --disable-maemo        disable maemo specific features [autodetect]
385  --enable-macosx-finder enable Mac OS X Finder invocation parameter
386                         parsing [disabled]
387  --enable-macosx-bundle enable Mac OS X bundle file locations [autodetect]
388  --disable-inet6        disable IPv6 support [autodetect]
389  --disable-sctp         disable SCTP support [autodetect]
390  --disable-gethostbyname2  gethostbyname2 part of the C library [autodetect]
391  --disable-ftp          disable FTP support [enabled]
392  --disable-vstream      disable TiVo vstream client support [autodetect]
393  --disable-pthreads     disable Posix threads support [autodetect]
394  --disable-w32threads   disable Win32 threads support [autodetect]
395  --disable-os2threads   disable OS/2 threads support [autodetect]
396  --enable-ass-internal  enable internal SSA/ASS subtitle support [autodetect]
397  --disable-ass          disable SSA/ASS subtitle support [autodetect]
398  --enable-rpath         enable runtime linker path for extra libs [disabled]
399  --disable-gnutls       disable GnuTLS [autodetect]
400  --enable-openssl-nondistributable  enable OpenSSL [disable]
401                         due to conflicting MPlayer and OpenSSL licenses, the
402                         resulting binary may be non-distributable.
403
404Codecs:
405  --enable-gif              enable GIF support [autodetect]
406  --enable-png              enable PNG input/output support [autodetect]
407  --enable-mng              enable MNG input/output support [autodetect]
408  --enable-jpeg             enable JPEG input/output support [autodetect]
409  --enable-libcdio          enable libcdio support [autodetect]
410  --enable-liblzo           enable liblzo support [autodetect]
411  --disable-win32dll        disable Win32 DLL support [autodetect]
412  --disable-qtx             disable QuickTime codecs support [enabled]
413  --disable-xanim           disable XAnim codecs support [enabled]
414  --disable-real            disable RealPlayer codecs support [enabled]
415  --disable-xvid            disable Xvid [autodetect]
416  --disable-xvid-lavc       disable Xvid in libavcodec [autodetect]
417  --disable-x264            disable x264 [autodetect]
418  --disable-x264-lavc       disable x264 in libavcodec [autodetect]
419  --disable-libvpx-lavc     disable libvpx in libavcodec [autodetect]
420  --disable-libdav1d-lavc   disable libdav1d in libavcodec [autodetect]
421  --disable-libaom-lavc     disable libaom in libavcodec [autodetect]
422  --disable-libnut          disable libnut [autodetect]
423  --disable-ffmpeg_a        disable static FFmpeg [autodetect]
424  --disable-ffmpeg_so       disable shared FFmpeg [autodetect]
425  --disable-postproc        disable libpostproc [autodetect]
426  --disable-libxml2         disable XML handling, for DASH streams [autodetect]
427  --enable-vf-lavfi         enable libavfilter wrapper [disabled]
428  --disable-libavcodec_mpegaudio_hp disable high precision audio decoding
429                                    in libavcodec [enabled]
430  --enable-tremor           enable integer libvorbis [autodetect]
431  --disable-libvorbis       disable libvorbis support [autodetect]
432  --disable-speex           disable Speex support [autodetect]
433  --disable-libgsm          disable libgsm support [autodetect]
434  --enable-theora           enable OggTheora libraries [autodetect]
435  --enable-faad             enable FAAD2 (AAC) [autodetect]
436  --disable-faac            disable support for FAAC (AAC encoder) [autodetect]
437  --disable-faac-lavc       disable support for FAAC in libavcodec [autodetect]
438  --disable-ladspa          disable LADSPA plugin support [autodetect]
439  --disable-libbs2b         disable libbs2b audio filter support [autodetect]
440  --disable-libdv           disable libdv 0.9.5 en/decoding support [autodetect]
441  --disable-libilbc         disable libilbc decoding support [autodetect]
442  --disable-libopus         disable libopus decoding support [autodetect]
443  --disable-mpg123          disable libmpg123 MP3 decoding support [autodetect]
444  --disable-mad             disable libmad (MPEG audio) support [autodetect]
445  --disable-mp3lame         disable LAME MP3 encoding support [autodetect]
446  --disable-mp3lame-lavc    disable LAME in libavcodec [autodetect]
447  --disable-toolame         disable Toolame (MPEG layer 2) encoding [autodetect]
448  --disable-twolame         disable Twolame (MPEG layer 2) encoding [autodetect]
449  --enable-xmms             enable XMMS input plugin support [disabled]
450  --enable-libdca           enable libdca support [autodetect]
451  --disable-liba52          disable liba52 [autodetect]
452  --disable-libmpeg2        disable libmpeg2 [autodetect]
453  --enable-libmpeg2-internal enable builtin libmpeg2 [disabled]
454  --enable-musepack         enable libmpcdec support (deprecated in favour of libavcodec) [disabled]
455  --disable-libopencore_amrnb disable libopencore_amr narrowband [autodetect]
456  --disable-libopencore_amrwb disable libopencore_amr wideband [autodetect]
457  --disable-libopenjpeg     disable OpenJPEG (JPEG 2000) input/output support [autodetect]
458  --disable-crystalhd       disable CrystalHD support [autodetect]
459  --disable-decoder=DECODER disable specified FFmpeg decoder
460  --enable-decoder=DECODER  enable specified FFmpeg decoder
461  --disable-encoder=ENCODER disable specified FFmpeg encoder
462  --enable-encoder=ENCODER  enable specified FFmpeg encoder
463  --disable-parser=PARSER   disable specified FFmpeg parser
464  --enable-parser=PARSER    enable specified FFmpeg parser
465  --disable-protocol=PROTO  disable specified FFmpeg protocol
466  --enable-protocol=PROTO   enable specified FFmpeg protocol
467  --disable-demuxer=DEMUXER disable specified FFmpeg demuxer
468  --enable-demuxer=DEMUXER  enable specified FFmpeg demuxer
469  --disable-muxer=MUXER     disable specified FFmpeg muxer
470  --enable-muxer=MUXER      enable specified FFmpeg muxer
471
472Video output:
473  --disable-vidix          disable VIDIX [for x86 *nix]
474  --with-vidix-drivers[=*] list of VIDIX drivers to be compiled in
475                           Available: cyberblade, ivtv, mach64, mga, mga_crtc2,
476                           nvidia, pm2, pm3, radeon, rage128, s3, sis, unichrome
477  --disable-vidix-pcidb    disable VIDIX PCI device name database
478  --enable-dhahelper       enable VIDIX dhahelper support
479  --enable-svgalib_helper  enable VIDIX svgalib_helper support
480  --enable-gl              enable OpenGL video output [autodetect]
481  --disable-matrixview     disable OpenGL MatrixView video output [autodetect]
482  --enable-dga2            enable DGA 2 support [autodetect]
483  --enable-dga1            enable DGA 1 support [autodetect]
484  --enable-vesa            enable VESA video output [autodetect]
485  --enable-svga            enable SVGAlib video output [autodetect]
486  --enable-sdl             enable SDL video output [autodetect]
487  --enable-kva             enable KVA video output [autodetect]
488  --enable-aa              enable AAlib video output [autodetect]
489  --enable-caca            enable CACA  video output [autodetect]
490  --enable-ggi             enable GGI video output [autodetect]
491  --enable-ggiwmh          enable GGI libggiwmh extension [autodetect]
492  --enable-direct3d        enable Direct3D video output [autodetect]
493  --enable-directx         enable DirectX video output [autodetect]
494  --enable-dxr2            enable DXR2 video output [autodetect]
495  --enable-dxr3            enable DXR3/H+ video output [autodetect]
496  --enable-v4l2            enable V4L2 Decoder audio/video output [autodetect]
497  --enable-dvb             enable DVB video output [autodetect]
498  --enable-mga             enable mga_vid video output [autodetect]
499  --enable-xmga            enable mga_vid X11 video output [autodetect]
500  --enable-xv              enable Xv video output [autodetect]
501  --enable-xvmc            enable XvMC acceleration [disable]
502  --enable-vda             enable VDA acceleration [autodetect]
503  --enable-vdpau           enable VDPAU acceleration [autodetect]
504  --enable-vm              enable XF86VidMode support [autodetect]
505  --enable-xinerama        enable Xinerama support [autodetect]
506  --enable-x11             enable X11 video output [autodetect]
507  --enable-xshape          enable XShape support [autodetect]
508  --disable-xss            disable screensaver support via xss [autodetect]
509  --enable-fbdev           enable FBDev video output [autodetect]
510  --enable-mlib            enable mediaLib video output (Solaris) [disable]
511  --enable-3dfx            enable obsolete /dev/3dfx video output [disable]
512  --enable-tdfxfb          enable tdfxfb video output [disable]
513  --enable-s3fb            enable s3fb (S3 ViRGE) video output [disable]
514  --enable-wii             enable Nintendo Wii/GameCube video output [disable]
515  --enable-directfb        enable DirectFB video output [autodetect]
516  --enable-zr              enable ZR360[56]7/ZR36060 video output [autodetect]
517  --enable-bl              enable Blinkenlights video output [disable]
518  --enable-tdfxvid         enable tdfx_vid video output [disable]
519  --enable-xvr100          enable SUN XVR-100 video output [autodetect]
520  --disable-tga            disable Targa video output [enable]
521  --disable-pnm            disable PNM video output [enable]
522  --disable-md5sum         disable md5sum video output [enable]
523  --disable-yuv4mpeg       disable yuv4mpeg video output [enable]
524  --disable-corevideo      disable CoreVideo video output [autodetect]
525  --disable-quartz         disable Quartz video output [autodetect]
526
527Audio output:
528  --disable-alsa         disable ALSA audio output [autodetect]
529  --disable-ossaudio     disable OSS audio output [autodetect]
530  --disable-arts         disable aRts audio output [autodetect]
531  --disable-esd          disable esd audio output [autodetect]
532  --disable-pulse        disable Pulseaudio audio output [autodetect]
533  --disable-jack         disable JACK audio output [autodetect]
534  --disable-openal       disable OpenAL audio output [autodetect]
535  --disable-nas          disable NAS audio output [autodetect]
536  --disable-sgiaudio     disable SGI audio output [autodetect]
537  --disable-sndio        disable sndio audio output [autodetect]
538  --disable-sunaudio     disable Sun audio output [autodetect]
539  --disable-kai          disable KAI audio output [autodetect]
540  --disable-dart         disable DART audio output [autodetect]
541  --disable-win32waveout disable Windows waveout audio output [autodetect]
542  --disable-coreaudio    disable CoreAudio audio output [autodetect]
543  --disable-select       disable using select() on the audio device [enable]
544
545Language options:
546  --charset=charset      convert the console messages to this character set
547  --language-doc=lang    language to use for the documentation [en]
548  --language-man=lang    language to use for the man pages [en]
549  --language-msg=lang    language to use for the messages and the GUI [en]
550  --language=lang        default language to use [en]
551  --disable-nls          disable Native Language Support (GUI only) [autodetect]
552Specific options override --language. You can pass a list of languages separated
553by whitespace or commas instead of a single language. Nonexisting translations
554will be dropped from each list. All documentation and man page translations
555available in the list will be installed. This also applies to the messages,
556unless --disable-nls is specified or autodetected, in which case the first
557available translation will be used. The value "all" will activate all
558translations. The LINGUAS environment variable is honored. In all cases the
559fallback is English.
560Available values are: all $msg_lang_all
561
562Miscellaneous options:
563  --enable-runtime-cpudetection    enable runtime CPU detection [disable]
564  --enable-cross-compile enable cross-compilation [autodetect]
565  --cc=COMPILER          C compiler to build MPlayer [gcc]
566  --host-cc=COMPILER     C compiler for tools needed while building [gcc]
567  --as=ASSEMBLER         assembler to build MPlayer [as]
568  --nm=NM                nm tool to build MPlayer [nm]
569  --yasm=YASM            Yasm assembler to build MPlayer [yasm]
570  --strip=STRIP          use strip tool STRIP [strip]
571  --ar=AR                librarian to build MPlayer [ar]
572  --ranlib=RANLIB        ranlib to build MPlayer [ranlib]
573  --windres=WINDRES      windres to build MPlayer [windres]
574  --target=PLATFORM      target platform (i386-linux, arm-linux, etc)
575  --enable-static        build a statically linked binary
576  --with-install=PATH    path to a custom install program
577
578Advanced options:
579  --enable-mmx              enable MMX [autodetect]
580  --enable-mmxext           enable MMX2 (Pentium III, Athlon) [autodetect]
581  --enable-3dnow            enable 3DNow! [autodetect]
582  --enable-3dnowext         enable extended 3DNow! [autodetect]
583  --enable-sse              enable SSE [autodetect]
584  --enable-sse2             enable SSE2 [autodetect]
585  --enable-sse3             enable SSE3 [autodetect]
586  --enable-ssse3            enable SSSE3 [autodetect]
587  --enable-sse4             enable SSE4 [autodetect]
588  --enable-sse42            enable SSE4.2 [autodetect]
589  --enable-avx              enable AVX [autodetect]
590  --enable-avx2             enable AVX2 [autodetect]
591  --enable-xop              enable XOP [autodetect]
592  --enable-fma3             enable FMA3 [autodetect]
593  --enable-fma4             enable FMA4 [autodetect]
594  --enable-shm              enable shm [autodetect]
595  --enable-altivec          enable AltiVec (PowerPC) [autodetect]
596  --enable-armv5te          enable DSP extensions (ARM) [autodetect]
597  --enable-armv6            enable ARMv6 (ARM) [autodetect]
598  --enable-armv6t2          enable ARMv6t2 (ARM) [autodetect]
599  --enable-armvfp           enable ARM VFP (ARM) [autodetect]
600  --enable-vfpv3            enable ARM VFPV3 (ARM) [autodetect]
601  --enable-neon             enable NEON (ARM) [autodetect]
602  --enable-thumb            enable THUMB (ARM) [autodetect]
603  --enable-iwmmxt           enable iWMMXt (ARM) [autodetect]
604  --disable-fastmemcpy      disable 3DNow!/SSE/MMX optimized memcpy [enable]
605  --enable-hardcoded-tables put tables in binary instead of calculating them at startup [disable]
606  --enable-big-endian       force byte order to big-endian [autodetect]
607  --enable-debug[=1-3]      compile-in debugging information [disable]
608  --enable-profile          compile-in profiling information [disable]
609  --disable-sighandler      disable sighandler for crashes [enable]
610  --enable-relocatable      enable compiling as relocatable/PIE executable [auto]
611  --enable-crash-debug      enable automatic gdb attach on crash [disable]
612  --enable-dynamic-plugins  enable dynamic A/V plugins [disable]
613
614Use these options if autodetection fails:
615  --extra-cflags=FLAGS        extra CFLAGS
616  --extra-ldflags=FLAGS       extra LDFLAGS
617  --extra-libs=FLAGS          extra linker flags
618  --extra-libs-mplayer=FLAGS  extra linker flags for MPlayer
619  --extra-libs-mencoder=FLAGS extra linker flags for MEncoder
620  --with-xvmclib=NAME         adapter-specific library name (e.g. XvMCNVIDIA)
621
622  --with-freetype-config=PATH path to freetype-config
623  --with-sdl-config=PATH      path to sdl*-config
624  --with-dvdnav-config=PATH   path to dvdnav-config
625  --with-dvdread-config=PATH  path to dvdread-config
626
627This configure script is NOT autoconf-based, even though its output is similar.
628It will try to autodetect all configuration options. If you --enable an option
629it will be forcefully turned on, skipping autodetection. This can break
630compilation, so you need to know what you are doing.
631EOF
632exit 0
633} #show_help()
634
635# GOTCHA: the variables below defines the default behavior for autodetection
636# and have - unless stated otherwise - at least 2 states : yes no
637# If autodetection is available then the third state is: auto
638_mmx=auto
639_3dnow=auto
640_3dnowext=auto
641_mmxext=auto
642_sse=auto
643_sse2=auto
644_sse3=auto
645_ssse3=auto
646_sse4_1=auto
647_sse4_2=auto
648_avx=auto
649_avx2=auto
650_avx512=no
651_xop=auto
652_fma3=auto
653_fma4=auto
654_cmov=auto
655_fast_cmov=auto
656_fast_clz=auto
657_armv5te=auto
658_armv6=auto
659_armv6t2=auto
660_armvfp=auto
661vfpv3=auto
662setend=auto
663neon=auto
664armthumb=auto
665_iwmmxt=auto
666_mtrr=auto
667_altivec=auto
668_install=@${BSD_INSTALL_PROGRAM}
669_ranlib=ranlib
670_windres=windres
671_cc=cc
672_strip=
673_ar=ar
674_arflags=rc
675# create thin archive to save disk space and I/O
676$_ar 2>&1 | grep -q "\[T\] " && _arflags=rcT
677test "$CC" && _cc="$CC"
678_as=auto
679_nm=auto
680_yasm=yasm
681_runtime_cpudetection=no
682_cross_compile=auto
683_prefix="/usr/local"
684ffmpeg_a=auto
685ffmpeg_so=auto
686postproc=auto
687_libxml2=auto
688_vf_lavfi=no
689_libavcodec_mpegaudio_hp=yes
690_libopencore_amrnb=auto
691_libopencore_amrwb=auto
692libopenjpeg=auto
693_mencoder=yes
694_mplayer=yes
695_x11=auto
696_xshape=auto
697_xss=auto
698_dga1=auto
699_dga2=auto
700_xv=auto
701_xvmc=no  #auto when complete
702_vda=auto
703_vdpau=auto
704_sdl=auto
705_kva=auto
706_direct3d=auto
707_directx=auto
708_win32waveout=auto
709_nas=auto
710_png=auto
711_mng=auto
712_jpeg=auto
713_pnm=yes
714_md5sum=yes
715_yuv4mpeg=yes
716_gif=auto
717_gl=auto
718matrixview=auto
719_ggi=auto
720_ggiwmh=auto
721_aa=auto
722_caca=auto
723_svga=auto
724_vesa=auto
725_fbdev=auto
726_dvb=auto
727_dxr2=auto
728_dxr3=auto
729_v4l2=auto
730_iconv=auto
731_langinfo=auto
732_rtc=auto
733_ossaudio=auto
734_arts=auto
735_esd=auto
736_pulse=auto
737_jack=auto
738_kai=auto
739_dart=auto
740_openal=auto
741_libcdio=auto
742_liblzo=auto
743_mad=auto
744_mp3lame=auto
745_mp3lame_lavc=auto
746_toolame=auto
747_twolame=auto
748_tremor=auto
749_libvorbis=auto
750_speex=auto
751_libgsm=auto
752_theora=auto
753_mpg123=auto
754_liba52=auto
755_libdca=auto
756_libmpeg2=auto
757_libmpeg2_internal=no
758_faad=auto
759_faac=auto
760_ladspa=auto
761_libbs2b=auto
762_libilbc=auto
763_libopus=auto
764_xmms=no
765_vcd=auto
766_bluray=auto
767_dvdnav=auto
768_dvdnavconfig="pkg-config dvdnav"
769type dvdnav-config >/dev/null 2>&1 && _dvdnavconfig=dvdnav-config
770_dvdreadconfig="pkg-config dvdread"
771type dvdread-config >/dev/null 2>&1 && _dvdreadconfig=dvdread-config
772_dvdread=auto
773_xanim=auto
774_real=auto
775_live=auto
776_nemesi=auto
777_librtmp=auto
778_native_rtsp=yes
779_xinerama=auto
780_mga=auto
781_xmga=auto
782_vm=auto
783_xf86keysym=auto
784_mlib=no #broken, thus disabled
785_sgiaudio=auto
786_sndio=auto
787_sunaudio=auto
788_alsa=auto
789_fastmemcpy=yes
790hardcoded_tables=no
791_unrar_exec=auto
792_win32dll=auto
793_select=yes
794_radio=no
795_radio_capture=no
796_radio_v4l=auto
797_radio_v4l2=auto
798_radio_bsdbt848=auto
799_tv=yes
800_tv_v4l1=auto
801_tv_v4l2=auto
802_tv_bsdbt848=auto
803_tv_dshow=auto
804_pvr=auto
805networking=yes
806_winsock2_h=auto
807_struct_pollfd=auto
808_struct_addrinfo=auto
809_getaddrinfo=auto
810_struct_sockaddr_storage=auto
811_smb=auto
812_vidix=auto
813_vidix_pcidb=yes
814_dhahelper=no
815_svgalib_helper=no
816_joystick=no
817crystalhd=auto
818_xvid=auto
819_xvid_lavc=auto
820_x264=auto
821_x264_lavc=auto
822_libvpx_lavc=auto
823_libdav1d_lavc=auto
824_libaom_lavc=auto
825_libnut=auto
826_lirc=auto
827_lircc=auto
828_apple_remote=auto
829_apple_ir=auto
830_gui=no
831_nls=auto
832_termcap=auto
833_termios=auto
834_3dfx=no
835_s3fb=no
836_wii=no
837_tdfxfb=no
838_tdfxvid=no
839_xvr100=auto
840_tga=yes
841_directfb=auto
842_zr=auto
843_bl=no
844#language=en
845_shm=auto
846_charset="UTF-8"
847_dynamic_plugins=no
848_crash_debug=no
849_sighandler=yes
850relocatable=auto
851_libdv=auto
852_cdparanoia=auto
853_cddb=auto
854_big_endian=auto
855_bitmap_font=yes
856_freetype=auto
857_fontconfig=auto
858_menu=no
859_qtx=auto
860_maemo=auto
861_coreaudio=auto
862_corevideo=auto
863_quartz=auto
864quicktime=auto
865_macosx_finder=no
866_macosx_bundle=auto
867_sortsub=yes
868_freetypeconfig='pkg-config freetype2'
869type freetype-config >/dev/null 2>&1 && _freetypeconfig=freetype-config
870_fribidi=auto
871_enca=auto
872_inet6=auto
873_sctp=auto
874_gethostbyname2=auto
875_gnutls=auto
876_openssl=no
877_ftp=auto
878_musepack=no
879_vstream=auto
880_pthreads=auto
881_w32threads=auto
882_os2threads=auto
883_ass=auto
884ass_internal=auto
885_rpath=no
886_asmalign_pot=auto
887_stream_cache=yes
888_priority=no
889def_dos_paths="#define HAVE_DOS_PATHS 0"
890def_stream_cache="#define CONFIG_STREAM_CACHE 1"
891def_path_max_check="#define CONFIG_PATH_MAX_CHECK 0"
892def_priority="#undef CONFIG_PRIORITY"
893def_pthread_cache="#undef PTHREAD_CACHE"
894def_simd_align_32='#define HAVE_SIMD_ALIGN_32 0'
895shmem=no
896
897option_value(){
898  echo $(echo $* | cut -d '=' -f 2-)
899}
900
901option_value_uc(){
902  echo $(option_value $1 | toupper)
903}
904
905for ac_option do
906  case "$ac_option" in
907  --help|-help|-h)
908    show_help
909    ;;
910  --prefix=*)
911    _prefix=$(option_value $ac_option)
912    ;;
913  --bindir=*)
914    _bindir=$(option_value $ac_option)
915    ;;
916  --datadir=*)
917    _datadir=$(option_value $ac_option)
918    ;;
919  --mandir=*)
920    _mandir=$(option_value $ac_option)
921    ;;
922  --confdir=*)
923    _confdir=$(option_value $ac_option)
924    ;;
925  --libdir=*)
926    _libdir=$(option_value $ac_option)
927    ;;
928  --codecsdir=*)
929    _codecsdir=$(option_value $ac_option)
930    ;;
931
932  --with-install=*)
933    _install=$(option_value $ac_option)
934    ;;
935  --with-xvmclib=*)
936    _xvmclib=$(option_value $ac_option)
937    ;;
938
939  --with-sdl-config=*)
940    _sdlconfig=$(option_value $ac_option)
941    ;;
942  --with-freetype-config=*)
943    _freetypeconfig=$(option_value $ac_option)
944    ;;
945  --with-dvdnav-config=*)
946    _dvdnavconfig=$(option_value $ac_option)
947    ;;
948  --with-dvdread-config=*)
949    _dvdreadconfig=$(option_value $ac_option)
950    ;;
951
952  --extra-cflags=*)
953    extra_cflags=$(option_value $ac_option)
954    ;;
955  --extra-ldflags=*)
956    extra_ldflags=$(option_value $ac_option)
957    ;;
958  --extra-libs=*)
959    extra_libs=$(option_value $ac_option)
960    ;;
961  --extra-libs-mplayer=*)
962    libs_mplayer=$(option_value $ac_option)
963    ;;
964  --extra-libs-mencoder=*)
965    libs_mencoder=$(option_value $ac_option)
966    ;;
967
968  --target=*)
969    _target=$(option_value $ac_option)
970    ;;
971  --cc=*)
972    _cc=$(option_value $ac_option)
973    ;;
974  --strip=*)
975    _strip=$(option_value $ac_option)
976    ;;
977  --host-cc=*)
978    _host_cc=$(option_value $ac_option)
979    ;;
980  --as=*)
981    _as=$(option_value $ac_option)
982    ;;
983  --nm=*)
984    _nm=$(option_value $ac_option)
985    ;;
986  --yasm=*)
987    _yasm=$(option_value $ac_option)
988    ;;
989  --ar=*)
990    _ar=$(option_value $ac_option)
991    ;;
992  --ranlib=*)
993    _ranlib=$(option_value $ac_option)
994    ;;
995  --windres=*)
996    _windres=$(option_value $ac_option)
997    ;;
998  --charset=*)
999    _charset=$(option_value $ac_option)
1000    ;;
1001  --language-doc=*)
1002    language_doc=$(option_value $ac_option)
1003    ;;
1004  --language-man=*)
1005    language_man=$(option_value $ac_option)
1006    ;;
1007  --language-msg=*)
1008    language_msg=$(option_value $ac_option)
1009    ;;
1010  --language=*)
1011    language=$(option_value $ac_option)
1012    ;;
1013
1014  --enable-static)
1015    ld_static='-static'
1016    ;;
1017  --disable-static)
1018    ld_static=''
1019    ;;
1020  --enable-profile)
1021    _profile='-pg'
1022    ;;
1023  --disable-profile)
1024    _profile=
1025    ;;
1026  --enable-debug)
1027    _debug='-g'
1028    ;;
1029  --enable-debug=*)
1030    _debug=$(echo $_echo_n '-g'$_echo_c; option_value $ac_option)
1031    ;;
1032  --disable-debug)
1033    _debug=
1034    ;;
1035  --enable-runtime-cpudetection)    _runtime_cpudetection=yes   ;;
1036  --disable-runtime-cpudetection)   _runtime_cpudetection=no    ;;
1037  --enable-cross-compile)           _cross_compile=yes          ;;
1038  --disable-cross-compile)          _cross_compile=no           ;;
1039  --enable-mencoder)    _mencoder=yes   ;;
1040  --disable-mencoder)   _mencoder=no    ;;
1041  --enable-mplayer)     _mplayer=yes    ;;
1042  --disable-mplayer)    _mplayer=no     ;;
1043  --enable-dynamic-plugins) _dynamic_plugins=yes ;;
1044  --disable-dynamic-plugins) _dynamic_plugins=no ;;
1045  --enable-x11)         _x11=yes        ;;
1046  --disable-x11)        _x11=no         ;;
1047  --enable-xshape)      _xshape=yes     ;;
1048  --disable-xshape)     _xshape=no      ;;
1049  --enable-xss)         _xss=yes        ;;
1050  --disable-xss)        _xss=no         ;;
1051  --enable-xv)          _xv=yes         ;;
1052  --disable-xv)         _xv=no          ;;
1053  --enable-xvmc)        _xvmc=yes       ;;
1054  --disable-xvmc)       _xvmc=no        ;;
1055  --enable-vda)         _vda=yes        ;;
1056  --disable-vda)        _vda=no         ;;
1057  --enable-vdpau)       _vdpau=yes      ;;
1058  --disable-vdpau)      _vdpau=no       ;;
1059  --enable-sdl)         _sdl=yes        ;;
1060  --disable-sdl)        _sdl=no         ;;
1061  --enable-kva)         _kva=yes        ;;
1062  --disable-kva)        _kva=no         ;;
1063  --enable-direct3d)    _direct3d=yes   ;;
1064  --disable-direct3d)   _direct3d=no    ;;
1065  --enable-directx)     _directx=yes    ;;
1066  --disable-directx)    _directx=no     ;;
1067  --enable-win32waveout)  _win32waveout=yes ;;
1068  --disable-win32waveout) _win32waveout=no  ;;
1069  --enable-nas)         _nas=yes        ;;
1070  --disable-nas)        _nas=no         ;;
1071  --enable-png)         _png=yes        ;;
1072  --disable-png)        _png=no         ;;
1073  --enable-mng)         _mng=yes        ;;
1074  --disable-mng)        _mng=no         ;;
1075  --enable-jpeg)        _jpeg=yes       ;;
1076  --disable-jpeg)       _jpeg=no        ;;
1077  --enable-libopenjpeg) libopenjpeg=yes ;;
1078  --disable-libopenjpeg)libopenjpeg=no  ;;
1079  --enable-pnm)         _pnm=yes        ;;
1080  --disable-pnm)        _pnm=no         ;;
1081  --enable-md5sum)      _md5sum=yes     ;;
1082  --disable-md5sum)     _md5sum=no      ;;
1083  --enable-yuv4mpeg)    _yuv4mpeg=yes   ;;
1084  --disable-yuv4mpeg)   _yuv4mpeg=no    ;;
1085  --enable-gif)         _gif=yes        ;;
1086  --disable-gif)        _gif=no         ;;
1087  --enable-gl)          _gl=yes         ;;
1088  --disable-gl)         _gl=no          ;;
1089  --enable-matrixview)  matrixview=yes  ;;
1090  --disable-matrixview) matrixview=no   ;;
1091  --enable-ggi)         _ggi=yes        ;;
1092  --disable-ggi)        _ggi=no         ;;
1093  --enable-ggiwmh)      _ggiwmh=yes     ;;
1094  --disable-ggiwmh)     _ggiwmh=no      ;;
1095  --enable-aa)          _aa=yes         ;;
1096  --disable-aa)         _aa=no          ;;
1097  --enable-caca)        _caca=yes       ;;
1098  --disable-caca)       _caca=no        ;;
1099  --enable-svga)        _svga=yes       ;;
1100  --disable-svga)       _svga=no        ;;
1101  --enable-vesa)        _vesa=yes       ;;
1102  --disable-vesa)       _vesa=no        ;;
1103  --enable-fbdev)       _fbdev=yes      ;;
1104  --disable-fbdev)      _fbdev=no       ;;
1105  --enable-dvb)         _dvb=yes        ;;
1106  --disable-dvb)        _dvb=no         ;;
1107  --enable-dxr2)        _dxr2=yes       ;;
1108  --disable-dxr2)       _dxr2=no        ;;
1109  --enable-dxr3)        _dxr3=yes       ;;
1110  --disable-dxr3)       _dxr3=no        ;;
1111  --enable-v4l2)        _v4l2=yes       ;;
1112  --disable-v4l2)       _v4l2=no        ;;
1113  --enable-iconv)       _iconv=yes      ;;
1114  --disable-iconv)      _iconv=no       ;;
1115  --enable-langinfo)    _langinfo=yes   ;;
1116  --disable-langinfo)   _langinfo=no    ;;
1117  --enable-rtc)         _rtc=yes        ;;
1118  --disable-rtc)        _rtc=no         ;;
1119  --enable-libdv)       _libdv=yes      ;;
1120  --disable-libdv)      _libdv=no       ;;
1121  --enable-ossaudio)    _ossaudio=yes   ;;
1122  --disable-ossaudio)   _ossaudio=no    ;;
1123  --enable-arts)        _arts=yes       ;;
1124  --disable-arts)       _arts=no        ;;
1125  --enable-esd)         _esd=yes        ;;
1126  --disable-esd)        _esd=no         ;;
1127  --enable-pulse)       _pulse=yes      ;;
1128  --disable-pulse)      _pulse=no       ;;
1129  --enable-jack)        _jack=yes       ;;
1130  --disable-jack)       _jack=no        ;;
1131  --enable-openal)      _openal=yes     ;;
1132  --disable-openal)     _openal=no      ;;
1133  --enable-kai)         _kai=yes        ;;
1134  --disable-kai)        _kai=no         ;;
1135  --enable-dart)        _dart=yes       ;;
1136  --disable-dart)       _dart=no        ;;
1137  --enable-mad)         _mad=yes        ;;
1138  --disable-mad)        _mad=no         ;;
1139  --enable-mp3lame)     _mp3lame=yes    ;;
1140  --disable-mp3lame)    _mp3lame=no     ;;
1141  --enable-mp3lame-lavc)  _mp3lame_lavc=yes       ;;
1142  --disable-mp3lame-lavc) _mp3lame_lavc=no        ;;
1143  --enable-toolame)     _toolame=yes    ;;
1144  --disable-toolame)    _toolame=no     ;;
1145  --enable-twolame)     _twolame=yes    ;;
1146  --disable-twolame)    _twolame=no     ;;
1147  --enable-libcdio)     _libcdio=yes    ;;
1148  --disable-libcdio)    _libcdio=no     ;;
1149  --enable-liblzo)      _liblzo=yes     ;;
1150  --disable-liblzo)     _liblzo=no      ;;
1151  --enable-libvorbis)   _libvorbis=yes  ;;
1152  --disable-libvorbis)  _libvorbis=no   ;;
1153  --enable-speex)       _speex=yes      ;;
1154  --disable-speex)      _speex=no       ;;
1155  --enable-libgsm)      _libgsm=yes     ;;
1156  --disable-libgsm)     _libgsm=no      ;;
1157  --enable-tremor)      _tremor=yes     ;;
1158  --disable-tremor)     _tremor=no      ;;
1159  --enable-theora)      _theora=yes     ;;
1160  --disable-theora)     _theora=no      ;;
1161  --enable-mpg123)      _mpg123=yes     ;;
1162  --disable-mpg123)     _mpg123=no      ;;
1163  --enable-liba52)      _liba52=yes     ;;
1164  --disable-liba52)     _liba52=no      ;;
1165  --enable-libdca)      _libdca=yes     ;;
1166  --disable-libdca)     _libdca=no      ;;
1167  --enable-libmpeg2)    _libmpeg2=yes   ;;
1168  --disable-libmpeg2)   _libmpeg2=no    ;;
1169  --enable-libmpeg2-internal)    _libmpeg2_internal=yes   ;;
1170  --disable-libmpeg2-internal)   _libmpeg2_internal=no    ;;
1171  --enable-musepack)    _musepack=yes   ;;
1172  --disable-musepack)   _musepack=no    ;;
1173  --enable-faad)        _faad=yes       ;;
1174  --disable-faad)       _faad=no        ;;
1175  --enable-faac)        _faac=yes       ;;
1176  --disable-faac)       _faac=no        ;;
1177  --enable-ladspa)      _ladspa=yes     ;;
1178  --disable-ladspa)     _ladspa=no      ;;
1179  --enable-libbs2b)     _libbs2b=yes    ;;
1180  --disable-libbs2b)    _libbs2b=no     ;;
1181  --enable-libilbc)     _libilbc=yes    ;;
1182  --disable-libilbc)    _libilbc=no     ;;
1183  --enable-libopus)     _libopus=yes    ;;
1184  --disable-libopus)    _libopus=no     ;;
1185  --enable-xmms)        _xmms=yes       ;;
1186  --disable-xmms)       _xmms=no        ;;
1187  --enable-vcd)         _vcd=yes        ;;
1188  --disable-vcd)        _vcd=no         ;;
1189  --enable-bluray)      _bluray=yes     ;;
1190  --disable-bluray)     _bluray=no      ;;
1191  --enable-dvdread)     _dvdread=yes    ;;
1192  --disable-dvdread)    _dvdread=no     ;;
1193  --enable-dvdnav)      _dvdnav=yes     ;;
1194  --disable-dvdnav)     _dvdnav=no      ;;
1195  --enable-xanim)       _xanim=yes      ;;
1196  --disable-xanim)      _xanim=no       ;;
1197  --enable-real)        _real=yes       ;;
1198  --disable-real)       _real=no        ;;
1199  --enable-live)        _live=yes       ;;
1200  --disable-live)       _live=no        ;;
1201  --enable-nemesi)      _nemesi=yes     ;;
1202  --disable-nemesi)     _nemesi=no      ;;
1203  --enable-librtmp)     _librtmp=yes    ;;
1204  --disable-librtmp)    _librtmp=no     ;;
1205  --enable-xinerama)    _xinerama=yes   ;;
1206  --disable-xinerama)   _xinerama=no    ;;
1207  --enable-mga)         _mga=yes        ;;
1208  --disable-mga)        _mga=no         ;;
1209  --enable-xmga)        _xmga=yes       ;;
1210  --disable-xmga)       _xmga=no        ;;
1211  --enable-vm)          _vm=yes         ;;
1212  --disable-vm)         _vm=no          ;;
1213  --enable-xf86keysym)  _xf86keysym=yes ;;
1214  --disable-xf86keysym) _xf86keysym=no  ;;
1215  --enable-mlib)        _mlib=yes       ;;
1216  --disable-mlib)       _mlib=no        ;;
1217  --enable-sunaudio)    _sunaudio=yes   ;;
1218  --disable-sunaudio)   _sunaudio=no    ;;
1219  --enable-sgiaudio)    _sgiaudio=yes   ;;
1220  --disable-sgiaudio)   _sgiaudio=no    ;;
1221  --enable-sndio)       _sndio=yes      ;;
1222  --disable-sndio)      _sndio=no       ;;
1223  --enable-alsa)        _alsa=yes       ;;
1224  --disable-alsa)       _alsa=no        ;;
1225  --enable-tv)          _tv=yes         ;;
1226  --disable-tv)         _tv=no          ;;
1227  --enable-tv-bsdbt848)  _tv_bsdbt848=yes ;;
1228  --disable-tv-bsdbt848) _tv_bsdbt848=no  ;;
1229  --enable-tv-v4l1)     _tv_v4l1=yes    ;;
1230  --disable-tv-v4l1)    _tv_v4l1=no     ;;
1231  --enable-tv-v4l2)     _tv_v4l2=yes    ;;
1232  --disable-tv-v4l2)    _tv_v4l2=no     ;;
1233  --enable-tv-dshow)    _tv_dshow=yes   ;;
1234  --disable-tv-dshow)   _tv_dshow=no    ;;
1235  --enable-radio)       _radio=yes      ;;
1236  --enable-radio-capture)       _radio_capture=yes      ;;
1237  --disable-radio-capture)      _radio_capture=no       ;;
1238  --disable-radio)      _radio=no       ;;
1239  --enable-radio-v4l)   _radio_v4l=yes  ;;
1240  --disable-radio-v4l)  _radio_v4l=no   ;;
1241  --enable-radio-v4l2)  _radio_v4l2=yes ;;
1242  --disable-radio-v4l2) _radio_v4l2=no  ;;
1243  --enable-radio-bsdbt848)      _radio_bsdbt848=yes     ;;
1244  --disable-radio-bsdbt848)     _radio_bsdbt848=no      ;;
1245  --enable-pvr)         _pvr=yes        ;;
1246  --disable-pvr)        _pvr=no         ;;
1247  --enable-fastmemcpy)  _fastmemcpy=yes ;;
1248  --disable-fastmemcpy) _fastmemcpy=no  ;;
1249  --enable-hardcoded-tables)  hardcoded_tables=yes ;;
1250  --disable-hardcoded-tables) hardcoded_tables=no  ;;
1251  --enable-networking)     networking=yes    ;;
1252  --disable-networking)    networking=no     ;;
1253  --enable-winsock2_h)  _winsock2_h=yes ;;
1254  --disable-winsock2_h) _winsock2_h=no  ;;
1255  --enable-smb)         _smb=yes        ;;
1256  --disable-smb)        _smb=no ;;
1257  --enable-vidix)       _vidix=yes      ;;
1258  --disable-vidix)      _vidix=no       ;;
1259  --with-vidix-drivers=*)
1260    _vidix_drivers=$(option_value $ac_option)
1261    ;;
1262  --disable-vidix-pcidb)  _vidix_pcidb=no         ;;
1263  --enable-dhahelper)   _dhahelper=yes  ;;
1264  --disable-dhahelper)  _dhahelper=no   ;;
1265  --enable-svgalib_helper)      _svgalib_helper=yes     ;;
1266  --disable-svgalib_helper)     _svgalib_helper=no      ;;
1267  --enable-joystick)    _joystick=yes   ;;
1268  --disable-joystick)   _joystick=no    ;;
1269  --enable-crystalhd)   crystalhd=yes  ;;
1270  --disable-crystalhd)  crystalhd=no   ;;
1271  --enable-xvid)        _xvid=yes       ;;
1272  --disable-xvid)       _xvid=no        ;;
1273  --enable-xvid-lavc)   _xvid_lavc=yes  ;;
1274  --disable-xvid-lavc)  _xvid_lavc=no   ;;
1275  --enable-x264)        _x264=yes       ;;
1276  --disable-x264)       _x264=no        ;;
1277  --enable-x264-lavc)   _x264_lavc=yes  ;;
1278  --disable-x264-lavc)  _x264_lavc=no   ;;
1279  --enable-libvpx-lavc)   _libvpx_lavc=yes  ;;
1280  --disable-libvpx-lavc)  _libvpx_lavc=no   ;;
1281  --enable-libdav1d-lavc)   _libdav1d_lavc=yes  ;;
1282  --disable-libdav1d-lavc)  _libdav1d_lavc=no   ;;
1283  --enable-libaom-lavc)   _libaom_lavc=yes  ;;
1284  --disable-libaom-lavc)  _libaom_lavc=no   ;;
1285  --enable-libnut)      _libnut=yes     ;;
1286  --disable-libnut)     _libnut=no      ;;
1287  --enable-libopencore_amrnb)   _libopencore_amrnb=yes  ;;
1288  --disable-libopencore_amrnb)  _libopencore_amrnb=no   ;;
1289  --enable-libopencore_amrwb)   _libopencore_amrwb=yes  ;;
1290  --disable-libopencore_amrwb)  _libopencore_amrwb=no   ;;
1291  --enable-ffmpeg_a)    ffmpeg_a=yes    ;;
1292  --disable-ffmpeg_a)   ffmpeg_a=no     ;;
1293  --enable-ffmpeg_so)   ffmpeg_so=yes   ;;
1294  --disable-ffmpeg_so)  ffmpeg_so=no    ;;
1295  --enable-postproc)    postproc=yes    ;;
1296  --disable-postproc)   postproc=no     ;;
1297  --enable-libxml2)     _libxml2=yes    ;;
1298  --disable-libxml2)    _libxml2=no     ;;
1299  --enable-vf-lavfi)    _vf_lavfi=yes   ;;
1300  --disable-vf-lavfi)   _vf_lavfi=no    ;;
1301  --enable-libavcodec_mpegaudio_hp)     _libavcodec_mpegaudio_hp=yes    ;;
1302  --disable-libavcodec_mpegaudio_hp)    _libavcodec_mpegaudio_hp=no     ;;
1303
1304  --enable-lirc)        _lirc=yes       ;;
1305  --disable-lirc)       _lirc=no        ;;
1306  --enable-lircc)       _lircc=yes      ;;
1307  --disable-lircc)      _lircc=no       ;;
1308  --enable-apple-remote)  _apple_remote=yes ;;
1309  --disable-apple-remote) _apple_remote=no  ;;
1310  --enable-apple-ir)    _apple_ir=yes   ;;
1311  --disable-apple-ir)   _apple_ir=no    ;;
1312  --enable-gui)         _gui=yes        ;;
1313  --disable-gui)        _gui=no         ;;
1314  --enable-nls)         _nls=yes        ;;
1315  --disable-nls)        _nls=no         ;;
1316  --enable-termcap)     _termcap=yes    ;;
1317  --disable-termcap)    _termcap=no     ;;
1318  --enable-termios)     _termios=yes    ;;
1319  --disable-termios)    _termios=no     ;;
1320  --enable-3dfx)        _3dfx=yes       ;;
1321  --disable-3dfx)       _3dfx=no        ;;
1322  --enable-s3fb)        _s3fb=yes       ;;
1323  --disable-s3fb)       _s3fb=no        ;;
1324  --enable-wii)         _wii=yes        ;;
1325  --disable-wii)        _wii=no         ;;
1326  --enable-tdfxfb)      _tdfxfb=yes     ;;
1327  --disable-tdfxfb)     _tdfxfb=no      ;;
1328  --disable-tdfxvid)    _tdfxvid=no     ;;
1329  --enable-tdfxvid)     _tdfxvid=yes    ;;
1330  --disable-xvr100)     _xvr100=no      ;;
1331  --enable-xvr100)      _xvr100=yes     ;;
1332  --disable-tga)        _tga=no         ;;
1333  --enable-tga)         _tga=yes        ;;
1334  --enable-directfb)    _directfb=yes   ;;
1335  --disable-directfb)   _directfb=no    ;;
1336  --enable-zr)          _zr=yes         ;;
1337  --disable-zr)         _zr=no          ;;
1338  --enable-bl)          _bl=yes         ;;
1339  --disable-bl)         _bl=no          ;;
1340  --enable-mtrr)        _mtrr=yes       ;;
1341  --disable-mtrr)       _mtrr=no        ;;
1342  --enable-shm)         _shm=yes        ;;
1343  --disable-shm)        _shm=no         ;;
1344  --enable-select)      _select=yes     ;;
1345  --disable-select)     _select=no      ;;
1346  --enable-cdparanoia)  _cdparanoia=yes ;;
1347  --disable-cdparanoia) _cdparanoia=no  ;;
1348  --enable-cddb)        _cddb=yes       ;;
1349  --disable-cddb)       _cddb=no        ;;
1350  --enable-big-endian)  _big_endian=yes ;;
1351  --disable-big-endian) _big_endian=no  ;;
1352  --enable-bitmap-font)    _bitmap_font=yes   ;;
1353  --disable-bitmap-font)   _bitmap_font=no    ;;
1354  --enable-freetype)    _freetype=yes   ;;
1355  --disable-freetype)   _freetype=no    ;;
1356  --enable-fontconfig)  _fontconfig=yes ;;
1357  --disable-fontconfig) _fontconfig=no  ;;
1358  --enable-unrarexec)   _unrar_exec=yes ;;
1359  --disable-unrarexec)  _unrar_exec=no  ;;
1360  --enable-ftp)         _ftp=yes        ;;
1361  --disable-ftp)        _ftp=no         ;;
1362  --enable-vstream)     _vstream=yes    ;;
1363  --disable-vstream)    _vstream=no     ;;
1364  --enable-pthreads)    _pthreads=yes   ;;
1365  --disable-pthreads)   _pthreads=no    ;;
1366  --enable-w32threads)  _w32threads=yes ;;
1367  --disable-w32threads) _w32threads=no  ;;
1368  --enable-os2threads)  _os2threads=yes ;;
1369  --disable-os2threads) _os2threads=no  ;;
1370  --enable-ass)         _ass=yes        ;;
1371  --disable-ass)        _ass=no         ;;
1372  --enable-ass-internal)  ass_internal=yes ;;
1373  --disable-ass-internal) ass_internal=no  ;;
1374  --enable-rpath)       _rpath=yes      ;;
1375  --disable-rpath)      _rpath=no       ;;
1376  --enable-gnutls)       _gnutls=yes    ;;
1377  --disable-gnutls)      _gnutls=no     ;;
1378  --enable-openssl-nondistributable) _openssl=yes ;;
1379
1380  --enable-fribidi)     _fribidi=yes    ;;
1381  --disable-fribidi)    _fribidi=no     ;;
1382
1383  --enable-enca)        _enca=yes       ;;
1384  --disable-enca)       _enca=no        ;;
1385
1386  --enable-inet6)       _inet6=yes      ;;
1387  --disable-inet6)      _inet6=no       ;;
1388
1389  --enable-sctp)        _sctp=yes       ;;
1390  --disable-sctp)       _sctp=no        ;;
1391
1392  --enable-gethostbyname2)      _gethostbyname2=yes     ;;
1393  --disable-gethostbyname2)     _gethostbyname2=no      ;;
1394
1395  --enable-dga1) _dga1=yes ;;
1396  --disable-dga1) _dga1=no ;;
1397  --enable-dga2) _dga2=yes ;;
1398  --disable-dga2) _dga2=no ;;
1399
1400  --enable-menu) _menu=yes ;;
1401  --disable-menu) _menu=no ;;
1402
1403  --enable-qtx) _qtx=yes ;;
1404  --disable-qtx) _qtx=no ;;
1405
1406  --enable-coreaudio) _coreaudio=yes ;;
1407  --disable-coreaudio) _coreaudio=no ;;
1408  --enable-corevideo) _corevideo=yes ;;
1409  --disable-corevideo) _corevideo=no ;;
1410  --enable-quartz) _quartz=yes ;;
1411  --disable-quartz) _quartz=no ;;
1412  --enable-macosx-finder) _macosx_finder=yes ;;
1413  --disable-macosx-finder) _macosx_finder=no ;;
1414  --enable-macosx-bundle) _macosx_bundle=yes ;;
1415  --disable-macosx-bundle) _macosx_bundle=no ;;
1416
1417  --enable-maemo) _maemo=yes ;;
1418  --disable-maemo) _maemo=no ;;
1419
1420  --enable-sortsub) _sortsub=yes ;;
1421  --disable-sortsub) _sortsub=no ;;
1422
1423  --enable-crash-debug) _crash_debug=yes ;;
1424  --disable-crash-debug) _crash_debug=no ;;
1425  --enable-sighandler)  _sighandler=yes  ;;
1426  --disable-sighandler) _sighandler=no   ;;
1427  --enable-relocatable)  relocatable=yes  ;;
1428  --disable-relocatable) relocatable=no   ;;
1429  --enable-win32dll) _win32dll=yes ;;
1430  --disable-win32dll) _win32dll=no ;;
1431
1432  --enable-sse) _sse=yes ;;
1433  --disable-sse) _sse=no ;;
1434  --enable-sse2) _sse2=yes ;;
1435  --disable-sse2) _sse2=no ;;
1436  --enable-sse3) _sse3=yes ;;
1437  --disable-sse3) _sse3=no ;;
1438  --enable-ssse3) _ssse3=yes ;;
1439  --disable-ssse3) _ssse3=no ;;
1440  --enable-sse4) _sse4_1=yes;;
1441  --disable-sse4) _sse4_1=no;;
1442  --enable-sse42) _sse4_2=yes;;
1443  --disable-sse42) _sse4_2=no;;
1444  --enable-avx) _avx=yes;;
1445  --disable-avx) _avx=no;;
1446  --enable-avx2) _avx2=yes;;
1447  --disable-avx2) _avx2=no;;
1448  --enable-xop) _xop=yes;;
1449  --disable-xop) _xop=no;;
1450  --enable-fma3) _fma3=yes;;
1451  --disable-fma3) _fma3=no;;
1452  --enable-fma4) _fma4=yes;;
1453  --disable-fma4) _fma4=no;;
1454  --enable-mmxext) _mmxext=yes ;;
1455  --disable-mmxext) _mmxext=no ;;
1456  --enable-3dnow) _3dnow=yes ;;
1457  --disable-3dnow) _3dnow=no _3dnowext=no ;;
1458  --enable-3dnowext) _3dnow=yes _3dnowext=yes ;;
1459  --disable-3dnowext) _3dnowext=no ;;
1460  --enable-cmov) _cmov=yes ;;
1461  --disable-cmov) _cmov=no ;;
1462  --enable-fast-cmov) _fast_cmov=yes ;;
1463  --disable-fast-cmov) _fast_cmov=no ;;
1464  --enable-fast-clz) _fast_clz=yes ;;
1465  --disable-fast-clz) _fast_clz=no ;;
1466  --enable-altivec) _altivec=yes ;;
1467  --disable-altivec) _altivec=no ;;
1468  --enable-armv5te) _armv5te=yes ;;
1469  --disable-armv5te) _armv5te=no ;;
1470  --enable-armv6) _armv6=yes ;;
1471  --disable-armv6) _armv6=no ;;
1472  --enable-armv6t2) _armv6t2=yes ;;
1473  --disable-armv6t2) _armv6t2=no ;;
1474  --enable-armvfp) _armvfp=yes ;;
1475  --disable-armvfp) _armvfp=no ;;
1476  --enable-vfpv3) vfpv3=yes ;;
1477  --disable-vfpv3) vfpv3=no ;;
1478  --enable-neon) neon=yes ;;
1479  --disable-neon) neon=no ;;
1480  --enable-thumb) armthumb=yes ;;
1481  --disable-thumb) armthumb=no ;;
1482  --enable-iwmmxt) _iwmmxt=yes ;;
1483  --disable-iwmmxt) _iwmmxt=no ;;
1484  --enable-mmx) _mmx=yes ;;
1485  --disable-mmx) # 3DNow! and MMX2 require MMX
1486        _3dnow=no _3dnowext=no _mmx=no _mmxext=no ;;
1487
1488  # Handle these options in a second pass.
1489  --*-decoder=*|--*-encoder=*|--*-parser=*|--*-protocol=*|--*-demuxer=*|--*-muxer=*|--*-filter=*)  ;;
1490
1491  *)
1492    echo "Unknown parameter: $ac_option"
1493    ;;
1494
1495  esac
1496done
1497
1498# Atmos: moved this here, to be correct, if --prefix is specified
1499test -z "$_bindir"  && _bindir="$_prefix/bin"
1500test -z "$_datadir" && _datadir="$_prefix/share/mplayer"
1501test -z "$_mandir"  && _mandir="$_prefix/share/man"
1502test -z "$_confdir" && _confdir="$_prefix/etc/mplayer"
1503test -z "$_libdir"  && _libdir="$_prefix/lib"
1504
1505for tmpdir in "$TMPDIR" "$TEMPDIR" "/tmp" ; do
1506  test "$tmpdir" && break
1507done
1508
1509mplayer_tmpdir="$tmpdir/mplayer-configure-$RANDOM-$$"
1510mkdir $mplayer_tmpdir || die "Unable to create tmpdir."
1511
1512cleanup() {
1513  rm -rf "$mplayer_tmpdir"
1514}
1515
1516trap cleanup EXIT
1517
1518TMPLOG="config.log"
1519TMPC="$mplayer_tmpdir/tmp.c"
1520TMPCPP="$mplayer_tmpdir/tmp.cpp"
1521TMPH="$mplayer_tmpdir/tmp.h"
1522TMPS="$mplayer_tmpdir/tmp.S"
1523# We will update this later once we know the executable suffix
1524TMPEXE="$mplayer_tmpdir/tmp"
1525
1526rm -f "$TMPLOG"
1527echo configuration: $configuration > "$TMPLOG"
1528echo >> "$TMPLOG"
1529
1530list_subparts() {
1531  test ! -e ffmpeg/libav${3} && return 1
1532  pattern="s/^[^#]*${1}.*([^ ,]*, *\([^ ,)]*\).*/\1_${2}/p"
1533  sed -n "$pattern" ffmpeg/libav${3} | toupper
1534  return 0
1535}
1536
1537list_subparts_extern() {
1538  test ! -e ffmpeg/libav${3} && return 1
1539  pattern="s/^[^#]*extern.*${1} *ff_\([^ ]*\)_${2};/\1_${2}/p"
1540  sed -n "$pattern" ffmpeg/libav${3} | toupper
1541  return 0
1542}
1543
1544list_cbs_extern() {
1545  test ! -e ffmpeg/libav${3} && return 1
1546  pattern="s/^[^#]*extern.*${1} *ff_cbs_type_\([^ ]*\);/${2}_\1/p"
1547  sed -n "$pattern" ffmpeg/libav${3} | toupper
1548  return 0
1549}
1550
1551list_subparts_filters() {
1552  test ! -e ffmpeg/libav${1} && return 1
1553  pattern="s/^extern AVFilter ff_([avfsinkrc]{2,5})_([a-zA-Z0-9_]+);/\1_\2_filter/p"
1554  sed -E -n "$pattern" ffmpeg/libav${1} | toupper
1555  return 0
1556}
1557
1558echocheck "ffmpeg/libavcodec/allcodecs.c"
1559libavdecoders_all=$(list_subparts_extern  AVCodec       decoder  codec/allcodecs.c)
1560libavencoders_all=$(list_subparts_extern  AVCodec       encoder  codec/allcodecs.c)
1561libavparsers_all=$(list_subparts_extern   AVCodecParser parser   codec/parsers.c)
1562test $? -eq 0 && _list_subparts=found || _list_subparts="not found"
1563echores "$_list_subparts"
1564
1565echocheck "ffmpeg/libavcodec/hwaccels.h"
1566libavhwaccels_all=$(list_subparts_extern  AVHWAccel hwaccel codec/hwaccels.h)
1567test $? -eq 0 || libavhwaccels_all=$(list_subparts  HWACCEL  hwaccel  codec/allcodecs.c)
1568test $? -eq 0 && _list_subparts=found || _list_subparts="not found"
1569echores "$_list_subparts"
1570
1571echocheck "ffmpeg/libavformat/allformats.c"
1572libavdemuxers_all=$(list_subparts_extern  AVInputFormat    demuxer  format/allformats.c)
1573libavmuxers_all=$(list_subparts_extern    AVOutputFormat   muxer    format/allformats.c)
1574test $? -eq 0 && _list_subparts=found || _list_subparts="not found"
1575echores "$_list_subparts"
1576
1577echocheck "ffmpeg/libavcodec/bitsteram_filters.c"
1578libavbsfs_all=$(list_subparts_extern AVBitStreamFilter bsf codec/bitstream_filters.c)
1579test $? -eq 0 && _list_subparts_extern=found || _list_subparts_extern="not found"
1580echores "$_list_subparts_extern"
1581
1582echocheck "ffmpeg/libavcodec/cbs_internal.h"
1583libavcbs_all=$(list_cbs_extern CodedBitstreamType cbs codec/cbs_internal.h)
1584test $? -eq 0 && _list_subparts_extern=found || _list_subparts_extern="not found"
1585echores "$_list_subparts_extern"
1586
1587echocheck "ffmpeg/libavformat/protocols.c"
1588libavprotocols_all=$(list_subparts_extern URLProtocol protocol format/protocols.c)
1589test $? -eq 0 && _list_subparts_extern=found || _list_subparts_extern="not found"
1590echores "$_list_subparts_extern"
1591
1592echocheck "ffmpeg/libavfilter/allfilters.c"
1593libavfilters_all=$(list_subparts_filters filter/allfilters.c)
1594test $? -eq 0 && _list_subparts=found || _list_subparts="not found"
1595echores "$_list_subparts"
1596
1597# a white space separated list (1st arg)
1598# has an item with the given value (2nd arg)
1599contains_item() {
1600  for item in $1; do
1601    test "$item" = "$2" && return
1602  done
1603  false
1604}
1605filter_out_component() {
1606  eval list=\$libav${1}s
1607  type=$(echo $1 | toupper)
1608  shift
1609  for item in $@; do
1610    filter_patterns="$filter_patterns -e s/[^A-Z0-9_]${item}_${type}//g"
1611  done
1612  echo " $list" | sed $filter_patterns
1613}
1614
1615libavdecoders=$(echo $libavdecoders_all)
1616libavencoders=$(echo $libavencoders_all)
1617libavparsers=$(echo $libavparsers_all)
1618libavbsfs=$(echo $libavbsfs_all)
1619libavcbs=$(echo $libavcbs_all)
1620# Disable all hardware accelerators for now.
1621libavhwaccels=
1622libavdemuxers=$(echo $libavdemuxers_all)
1623libavmuxers=$(echo $libavmuxers_all)
1624libavprotocols=$(echo $libavprotocols_all)
1625libavfilters=$(echo $libavfilters_all)
1626
1627libavdecoders=$(filter_out_component decoder 'LIB[A-Z0-9_]* [A-Z0-9]*_QSV [A-Z0-9]*_MMAL [A-Z0-9]*_MEDIACODEC [A-Z0-9]*_CUVID [A-Z0-9_]*_AT [A-Z0-9]*_RKMPP [A-Z0-9]*_V4L2M2M')
1628libavencoders=$(filter_out_component encoder 'LIB[A-Z0-9_]* [A-Z0-9]*_QSV [A-Z0-9]*_MMAL NVENC[A-Z0-9_]* H264_NVENC[A-Z0-9_]* HEVC_NVENC[A-Z0-9_]* HAP [A-Z0-9]*_VIDEOTOOLBOX [A-Z0-9]*_VAAPI [A-Z0-9]*_OMX [A-Z0-9_]*_AT [A-Z0-9]*_V4L2M2M [A-Z0-9]*_AMF [A-Z0-9]*_MF')
1629libavbsfs=$(filter_out_component bsf 'TRACE_HEADERS [A-Z0-9_]*_METADATA H264_REDUNDANT_PPS FILTER_UNITS')
1630libavdemuxers=$(filter_out_component demuxer 'AVISYNTH LIB[A-Z0-9_]* REDIR VAPOURSYNTH')
1631libavmuxers=$(filter_out_component muxer 'CHROMAPRINT LIB[A-Z0-9_]* RTP RTSP SAP')
1632libavprotocols=$(filter_out_component protocol 'BLURAY FFRTMPCRYPT HTTPS LIB[A-Z0-9_]* TLS TLS_GNUTLS TLS_OPENSSL TLS_SECURETRANSPORT TLS_SCHANNEL')
1633libavfilters=$(filter_out_component filter 'VF_FREI0R[A-Z0-9_]* LIB[A-Z0-9_]* MP VF_OCV')
1634
1635# second pass command line parsing for options needing local FFmpeg checkout
1636for ac_option do
1637  case "$ac_option" in
1638  --enable-decoder=*)   libavdecoders="$libavdecoders   $(option_value_uc $ac_option)" ;;
1639  --enable-encoder=*)   libavencoders="$libavencoders   $(option_value_uc $ac_option)" ;;
1640  --enable-parser=*)    libavparsers="$libavparsers     $(option_value_uc $ac_option)" ;;
1641  --enable-protocol=*)  libavprotocols="$libavprotocols $(option_value_uc $ac_option)" ;;
1642  --enable-demuxer=*)   libavdemuxers="$libavdemuxers   $(option_value_uc $ac_option)" ;;
1643  --enable-muxer=*)     libavmuxers="$libavmuxers       $(option_value_uc $ac_option)" ;;
1644  --enable-filter=*)    libavfilters="$libavfilters     $(option_value_uc $ac_option)" ;;
1645
1646  --disable-decoder=*)  libavdecoders=$(filter_out_component  decoder  "$(option_value_uc $ac_option)") ;;
1647  --disable-encoder=*)  libavencoders=$(filter_out_component  encoder  "$(option_value_uc $ac_option)") ;;
1648  --disable-parser=*)   libavparsers=$(filter_out_component   parser   "$(option_value_uc $ac_option)") ;;
1649  --disable-protocol=*) libavprotocols=$(filter_out_component protocol "$(option_value_uc $ac_option)") ;;
1650  --disable-demuxer=*)  libavdemuxers=$(filter_out_component  demuxer  "$(option_value_uc $ac_option)") ;;
1651  --disable-muxer=*)    libavmuxers=$(filter_out_component    muxer    "$(option_value_uc $ac_option)") ;;
1652  --disable-filter=*)   libavfilters=$(filter_out_component   filter   "$(option_value_uc $ac_option)") ;;
1653  esac
1654done
1655
1656msvc_filter_flags() {
1657  for f; do
1658    case $f in
1659      -fno-common) ;;
1660      -march=*) ;;
1661      -mcpu=*) ;;
1662      -mfpu=*) ;;
1663      -mtune=*) ;;
1664      -pipe) ;;
1665      -M*) ;;
1666      -l*) echo -n ${f#-l}.lib" " ;;
1667      *) echo -n $f" " ;;
1668    esac
1669  done
1670}
1671
1672AR_O='$@'
1673CC_O='-o $@'
1674CC_LINK_O='-o $@'
1675WINDRES_O='-o $@'
1676def_inline_asm='#define HAVE_INLINE_ASM 1'
1677inline_asm=yes
1678filter_flags=echo
1679# Checking CC version...
1680# Intel C++ Compilers (no autoselect, use CC=/some/binary ./configure)
1681if test "$(basename $_cc)" = "icc" || test "$(basename $_cc)" = "ecc"; then
1682  echocheck "$_cc version"
1683  cc_vendor=intel
1684  cc_name=$($_cc -V 2>&1 | head -n 1 | cut -d ',' -f 1)
1685  cc_version=$($_cc -V 2>&1 | head -n 1 | cut -d ',' -f 2 | cut -d ' ' -f 3)
1686  _cc_major=$(echo $cc_version | cut -d '.' -f 1)
1687  _cc_minor=$(echo $cc_version | cut -d '.' -f 2)
1688  # TODO verify older icc/ecc compatibility
1689  case $cc_version in
1690    '')
1691      cc_version="v. ?.??, bad"
1692      cc_fail=yes
1693      ;;
1694    10.1|11.1|12.*|13.*)
1695      cc_version="$cc_version, ok"
1696      ;;
1697    *)
1698      cc_version="$cc_version, bad"
1699      cc_fail=yes
1700      ;;
1701  esac
1702  echores "$cc_version"
1703elif test "$(basename $_cc .exe)" = "cl"; then
1704  echocheck "$_cc version"
1705  cc_vendor=msvc
1706  cc_version=$($_cc 2>&1 | head -n 1 | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
1707  cc_arch=$($_cc 2>&1 | head -n 1 | grep -o 'for [a-zA-Z0-9_-]\+' | cut -d ' ' -f 2)
1708  case $cc_arch in
1709  x64|X64) cc_arch=x86_64 ;;
1710  ARM64|arm64) cc_arch=aarch64 ;;
1711  esac
1712  test -z "$_target" && _target="$cc_arch-mingw32"
1713  extra_cflags="-nologo -we4013 -D__MINGW32__ -D_USE_MATH_DEFINES -Dssize_t=int64_t $extra_cflags"
1714  CC_O='-Fo$@'
1715  CC_LINK_O='-Fe$@'
1716  _ar='lib.exe'
1717  _arflags="-nologo"
1718  AR_O='-out:$@'
1719  _ranlib=':'
1720  _windres='rc.exe'
1721  WINDRES_O='-fo$@'
1722  def_inline_asm='#define HAVE_INLINE_ASM 0'
1723  inline_asm=no
1724  filter_flags=msvc_filter_flags
1725  libs_mplayer="$libs_mplayer -luser32 -lshell32"
1726  test -n "$cc_version" || cc_fail=yes
1727  test "$cc_arch" = "aarch64" && _as="gas-preprocessor.pl -arch aarch64 -as-type armasm -- armasm64.exe" && test $neon = "auto" && neon=yes
1728  echores "$cc_version"
1729else
1730  for _cc in "$_cc" cc cc ; do
1731    cc_name_tmp=$($_cc -v 2>&1 | tail -n 1 | cut -d ' ' -f 1)
1732    if test "$cc_name_tmp" = "gcc"; then
1733      cc_name=$cc_name_tmp
1734      echocheck "$_cc version"
1735      cc_vendor=gnu
1736      cc_version=$($_cc -dumpversion 2>&1)
1737      case $cc_version in
1738        2.96*)
1739          cc_fail=yes
1740          ;;
1741        *)
1742          _cc_major=$(echo ${cc_version%%-*} | cut -d '.' -f 1)
1743          _cc_minor=$(echo ${cc_version%%-*} | cut -d '.' -f 2)
1744          _cc_mini=$(echo ${cc_version%%-*} | cut -d '.' -f 3)
1745          ;;
1746      esac
1747      echores "$cc_version"
1748      break
1749    fi
1750    if $_cc -v 2>&1 | grep -q "clang"; then
1751      echocheck "$_cc version"
1752      cc_vendor=clang
1753      cc_version=$($_cc -dumpversion 2>&1)
1754      res_comment="experimental support only"
1755      echores "clang $cc_version"
1756      break
1757    fi
1758    cc_name_tmp=$($_cc -V 2>&1 | head -n 1 | cut -d ' ' -f 2,3)
1759    if test "$cc_name_tmp" = "Sun C"; then
1760      echocheck "$_cc version"
1761      cc_vendor=sun
1762      cc_version=$($_cc -V 2>&1 | head -n 1 | cut -d ' ' -f 4)
1763      res_comment="experimental support only"
1764      echores "Sun C $cc_version"
1765      break
1766    fi
1767  done
1768fi # icc
1769test "$cc_fail" = yes && die "unsupported compiler version"
1770
1771# Determine our OS name and CPU architecture
1772if test -z "$_target" ; then
1773  # OS name
1774  system_name=$(uname -s 2>&1)
1775  case "$system_name" in
1776  Linux|FreeBSD|NetBSD|OpenBSD|DragonFly|BSD/OS|Darwin|SunOS|QNX|GNU|MorphOS|AIX|AmigaOS|Haiku)
1777    ;;
1778  IRIX*)
1779    system_name=IRIX
1780    ;;
1781  GNU/kFreeBSD)
1782    system_name=FreeBSD
1783    ;;
1784  HP-UX*)
1785    system_name=HP-UX
1786    ;;
1787  [cC][yY][gG][wW][iI][nN]*)
1788    system_name=CYGWIN
1789    ;;
1790  MINGW32*)
1791    system_name=MINGW32
1792    ;;
1793  OS/2*)
1794    system_name=OS/2
1795    ;;
1796  *)
1797    system_name="$system_name-UNKNOWN"
1798    ;;
1799  esac
1800  cpp_condition_check '' 'defined(__MINGW32__)' && system_name=MINGW32
1801
1802
1803  # host's CPU/instruction set
1804  set_host_arch() {
1805  case "$1" in
1806      x86_64|amd64|x64|i[3-9]86*|i86pc|x86|x86pc|k5|k6|k6_2|k6_3|k6-2|k6-3|pentium*|athlon*|i586_i686|i586-i686) host_arch=i386 ;;
1807      ia64) host_arch=ia64 ;;
1808      macppc|powerpc|ppc*|Power*) host_arch=ppc ;;
1809      alpha) host_arch=alpha ;;
1810      sun4*|sparc*) host_arch=sparc ;;
1811      parisc*|hppa*|9000*) host_arch=hppa ;;
1812      aarch64*|ARM64) host_arch=aarch64 ;;
1813      arm*|zaurus|cats) host_arch=arm ;;
1814      sh3|sh4|sh4a) host_arch=sh ;;
1815      s390) host_arch=s390 ;;
1816      s390x) host_arch=s390x ;;
1817      *mips*) host_arch=mips ;;
1818      nios2) host_arch=nios2 ;;
1819      vax) host_arch=vax ;;
1820      xtensa*) host_arch=xtensa ;;
1821      *) host_arch=UNKNOWN ;;
1822  esac
1823  }
1824  set_host_arch "$(uname -m 2>&1)"
1825  if test "$host_arch" = UNKNOWN ; then
1826    set_host_arch "$(uname -p 2>&1)"
1827  fi
1828else # if test -z "$_target"
1829  for component in 3 2; do
1830    system_name=$(echo $_target | cut -d '-' -f $component)
1831    case "$(echo $system_name | tolower)" in
1832      linux) system_name=Linux ;;
1833      freebsd) system_name=FreeBSD ;;
1834      gnu/kfreebsd) system_name=FreeBSD ;;
1835      netbsd) system_name=NetBSD ;;
1836      bsd/os) system_name=BSD/OS ;;
1837      openbsd) system_name=OpenBSD ;;
1838      dragonfly) system_name=DragonFly ;;
1839      sunos) system_name=SunOS ;;
1840      qnx) system_name=QNX ;;
1841      morphos) system_name=MorphOS ;;
1842      amigaos) system_name=AmigaOS ;;
1843      mingw32*) system_name=MINGW32 ;;
1844      wine) system_name=Wine ;;
1845    esac
1846  done
1847  # We need to convert underscores so that values like k6-2 and pentium-mmx can be passed
1848  host_arch=$(echo $_target | cut -d '-' -f 1)
1849  if test $(echo $host_arch) != "x86_64" ; then
1850    host_arch=$(echo $host_arch | tr '_' '-')
1851  fi
1852fi
1853
1854_timer=timer-linux.c
1855_getch=getch2.c
1856
1857if darwin; then
1858  extra_cflags="-mdynamic-no-pic $extra_cflags"
1859  _timer=timer-darwin.c
1860fi
1861
1862if aix ; then
1863  extra_ldflags="$extra_ldflags -lC"
1864fi
1865
1866if irix ; then
1867  _ranlib='ar -r'
1868elif linux ; then
1869  _ranlib='true'
1870fi
1871
1872if win32 ; then
1873  _exesuf=".exe"
1874  extra_cflags="$extra_cflags -fno-common"
1875  # -lwinmm is always needed for osdep/timer-win2.c
1876  timer_libs=-lwinmm
1877  _pe_executable=yes
1878  _timer=timer-win2.c
1879  _priority=yes
1880  def_dos_paths="#define HAVE_DOS_PATHS 1"
1881  def_priority="#define CONFIG_PRIORITY 1"
1882fi
1883
1884if mingw32 ; then
1885  _getch=getch2-win.c
1886  shmem=yes
1887fi
1888
1889if amigaos ; then
1890  _select=no
1891  _sighandler=no
1892  _stream_cache=no
1893  def_stream_cache="#undef CONFIG_STREAM_CACHE"
1894  extra_cflags="-DNEWLIB -D__USE_INLINE__ $extra_cflags"
1895fi
1896
1897if qnx ; then
1898  extra_ldflags="$extra_ldflags -lph"
1899fi
1900
1901if os2 ; then
1902  _exesuf=".exe"
1903  _getch=getch2-os2.c
1904  shmem=yes
1905  _priority=yes
1906  def_dos_paths="#define HAVE_DOS_PATHS 1"
1907  def_priority="#define CONFIG_PRIORITY 1"
1908  def_path_max_check="#define CONFIG_PATH_MAX_CHECK 1"
1909  # On OS/2, passing -static to cc fails at linking time because linking
1910  # statically against libc runtime is prevented on purpose. To avoid this,
1911  # pass -static to a linker directly.
1912  # And ensure that $ld_static should be at first in a library list because it
1913  # has effects only libraries after it.
1914  test -n "$ld_static" && ld_static='-Wl,-static'
1915  # OS/2 linker does not support a thin archive. Remove 'T' flag.
1916  _arflags=$(echo $_arflags | tr -d T)
1917fi
1918
1919if wine ; then
1920  extra_cflags="-fno-pic -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__ -DWINE_NOWINSOCK $extra_cflags"
1921  libs_mplayer="$libs_mplayer -lshell32"
1922fi
1923
1924if darwin && test "$cc_vendor" != "clang" ; then
1925  extra_cflags="-falign-loops=16 -shared-libgcc $extra_cflags"
1926fi
1927
1928TMPEXE="$mplayer_tmpdir/tmp$_exesuf"
1929
1930echocheck "working compiler"
1931cflag_check "" || die "Compiler is not functioning correctly. Check your installation and custom CFLAGS $CFLAGS ."
1932echo "yes"
1933
1934if test -z "$_profile" ; then
1935  cflag_check "-lm" && libm="-lm"
1936else
1937  cflag_check "-lm_p" && libm="-lm_p"
1938fi
1939
1940if test -z "$_target" ; then
1941  cat > $TMPC << EOF
1942int main(void) {
1943    int test[(int)sizeof(char *)-7];
1944    return 0;
1945}
1946EOF
1947if x86 ; then
1948  cc_check && host_arch=x86_64 || host_arch=i386
1949  # Treat x32 as generic architecture without any optimizations.
1950  if test "$host_arch" = 'i386' && cpp_condition_check '' 'defined(__x86_64__)'; then
1951      host_arch=generic
1952  fi
1953fi
1954if ppc ; then
1955  cc_check && host_arch=ppc64 || host_arch=ppc
1956fi
1957if sparc ; then
1958  cc_check && host_arch=sparc64 || host_arch=sparc
1959fi
1960if arm ; then
1961  cc_check && host_arch=aarch64 || host_arch=arm
1962fi
1963fi
1964
1965echo "Detected operating system: $system_name"
1966echo "Detected host architecture: $host_arch"
1967
1968if test "$_runtime_cpudetection" = yes && ! x86 && ! ppc && ! arm; then
1969  die "Runtime CPU detection only works for x86, x86-64 and PPC!"
1970fi
1971
1972echocheck "cross compilation"
1973if test $_cross_compile = auto ; then
1974  _cross_compile=yes
1975  cflag_check "" && "$TMPEXE" 2> /dev/null && _cross_compile=no
1976fi
1977echores $_cross_compile
1978
1979if test $_cross_compile = yes; then
1980  tmp_run() {
1981    return 0
1982  }
1983  test "$_host_cc" || _host_cc=cc
1984fi
1985
1986echocheck "host cc"
1987# we do not support compiling some things with cl.exe yet
1988msvc && test -z "$_host_cc" && _host_cc=cc
1989test "$_host_cc" || _host_cc=$_cc
1990echores $_host_cc
1991
1992# ---
1993
1994# now that we know what compiler should be used for compilation, try to find
1995# out which assembler is used by the $_cc compiler
1996if test "$_as" = auto ; then
1997  # FFmpeg actually expects this to be cc, so do not set this to "as".
1998  _as=$_cc
1999  #_as=$($_cc -print-prog-name=as)
2000  #test -z "$_as" && _as=as
2001fi
2002
2003if test "$_nm" = auto ; then
2004  _nm=$($_cc -print-prog-name=nm)
2005  test -z "$_nm" && _nm=nm
2006fi
2007
2008# XXX: this should be OK..
2009_cpuinfo="echo"
2010
2011if test "$_runtime_cpudetection" = no ; then
2012
2013# Cygwin has /proc/cpuinfo, but only supports Intel CPUs
2014# FIXME: Remove the Cygwin check once AMD CPUs are supported
2015if test -r /proc/cpuinfo && ! cygwin; then
2016  # Linux with /proc mounted, extract CPU information from it
2017  _cpuinfo="cat /proc/cpuinfo"
2018elif test -r /compat/linux/proc/cpuinfo && ! x86 ; then
2019  # FreeBSD with Linux emulation /proc mounted,
2020  # extract CPU information from it
2021  # Don't use it on x86 though, it never reports 3DNow!
2022  _cpuinfo="cat /compat/linux/proc/cpuinfo"
2023elif darwin && ! x86 ; then
2024  # use hostinfo on Darwin
2025  _cpuinfo="hostinfo"
2026elif aix; then
2027  # use 'lsattr' on AIX
2028  _cpuinfo="lsattr -E -l proc0 -a type"
2029elif x86; then
2030  # all other OSes try to extract CPU information from a small helper
2031  # program cpuinfo instead
2032  $_host_cc -o cpuinfo$_exesuf cpuinfo.c
2033  _cpuinfo="./cpuinfo$_exesuf"
2034fi
2035
2036if x86 ; then
2037  # gather more CPU information
2038  pname=$($_cpuinfo | grep 'model name' | cut -d ':' -f 2 | head -n 1)
2039  pvendor=$($_cpuinfo | grep 'vendor_id' | cut -d ':' -f 2  | cut -d ' ' -f 2 | head -n 1)
2040  pfamily=$($_cpuinfo | grep 'cpu family' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
2041  pmodel=$($_cpuinfo | grep -v 'model name' | grep 'model' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
2042  pstepping=$($_cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f 2 | head -n 1)
2043
2044  exts=$($_cpuinfo | egrep 'features|flags' | cut -d ':' -f 2 | head -n 1)
2045
2046  pparam=$(echo $exts | sed -e s/k6_mtrr/mtrr/ -e s/cyrix_arr/mtrr/ -e s/centaur_mcr/mtrr/ \
2047                            -e s/xmm/sse/ -e s/kni/sse/ -e s/pni/sse3/)
2048  # SSE implies MMX2, but not all SSE processors report the mmxext CPU flag.
2049  pparam=$(echo $pparam | sed -e 's/sse/sse mmxext/')
2050
2051  extcheck=kernel_check
2052  msvc && extcheck=yes
2053  for ext in $pparam ; do
2054    eval test \"\$_$ext\" = auto 2>/dev/null && eval _$ext=$extcheck
2055  done
2056
2057  echocheck "CPU vendor"
2058  echores "$pvendor ($pfamily:$pmodel:$pstepping)"
2059
2060  echocheck "CPU type"
2061  echores "$pname"
2062fi
2063
2064fi # test "$_runtime_cpudetection" = no
2065
2066if x86 && test "$_runtime_cpudetection" = no ; then
2067  extcheck() {
2068    if test "$1" = kernel_check ; then
2069      echocheck "kernel support of $2"
2070      cat > $TMPC <<EOF
2071#include <stdlib.h>
2072#include <signal.h>
2073static void catch(int sig) { exit(1); }
2074int main(void) {
2075  signal(SIGILL, catch);
2076  __asm__ volatile ("$3":::"memory"); return 0;
2077}
2078EOF
2079
2080      if cc_check && tmp_run ; then
2081        eval _$2=yes
2082        echores "yes"
2083        _optimizing="$_optimizing $2"
2084        return 0
2085      else
2086        eval _$2=no
2087        echores "failed"
2088        echo "It seems that your kernel does not correctly support $2."
2089        echo "To use $2 extensions in MPlayer, you have to upgrade/recompile your kernel!"
2090        return 1
2091      fi
2092    fi
2093    return 0
2094  }
2095
2096  extcheck $_mmx      'mmx'      'emms'
2097  extcheck $_mmxext   'mmxext'   'sfence'
2098  extcheck $_3dnow    '3dnow'    'femms'
2099  extcheck $_3dnowext '3dnowext' 'pswapd %%mm0, %%mm0'
2100  extcheck $_sse      'sse'      'xorps %%xmm0, %%xmm0' || _gcc3_ext="$_gcc3_ext -mno-sse"
2101  extcheck $_sse2     'sse2'     'xorpd %%xmm0, %%xmm0' || _gcc3_ext="$_gcc3_ext -mno-sse2"
2102  extcheck $_sse3     'sse3'     'addsubps %%xmm0, %%xmm0'
2103  extcheck $_ssse3    'ssse3'    'pabsd %%xmm0, %%xmm0'
2104  extcheck $_sse4_1   'sse4_1'   'pmaxsb %%xmm0, %%xmm0'
2105  extcheck $_sse4_2   'sse4_2'   'pcmpgtq %%xmm0, %%xmm0'
2106  extcheck $_avx      'avx'      'vpabsw %%xmm0, %%xmm0'
2107  extcheck $_avx2     'avx2'     'vextracti128 $0, %%ymm0, %%xmm0'
2108  extcheck $_xop      'xop'      'vpmacsdd %%xmm0, %%xmm1, %%xmm2, %%xmm3'
2109  extcheck $_fma3     'fma3'     'vfmadd132ps %%ymm0, %%ymm1, %%ymm2'
2110  extcheck $_fma4     'fma4'     'vfmaddps %%ymm0, %%ymm1, %%ymm2, %%ymm3'
2111  extcheck $_cmov     'cmov'     'cmovb %%eax,  %%ebx'
2112
2113  echocheck "mtrr support"
2114  if test "$_mtrr" = kernel_check ; then
2115    _mtrr="yes"
2116    _optimizing="$_optimizing mtrr"
2117  fi
2118  echores "$_mtrr"
2119
2120  if test "$_gcc3_ext" != ""; then
2121    # If we had to disable SSE/SSE2 because the active kernel does not
2122    # support this instruction set extension, we also have to tell
2123    # cc to not generate SSE/SSE2 instructions for normal C code.
2124    cflag_check $_march $_gcc3_ext && _march="$_march $_gcc3_ext"
2125  fi
2126
2127fi
2128
2129
2130def_fast_64bit='#define HAVE_FAST_64BIT 0'
2131def_fast_unaligned='#define HAVE_FAST_UNALIGNED 0'
2132def_av_fast_unaligned='#define AV_HAVE_FAST_UNALIGNED 0'
2133def_local_aligned='#define HAVE_LOCAL_ALIGNED 0'
2134def_vsx='#define HAVE_VSX 0'
2135arch_all='X86 IA64 SPARC ARM AVR32 SH4 PPC ALPHA MIPS PA_RISC S390 S390X VAX BFIN XTENSA TOMI GENERIC AARCH64 LOONGARCH LOONGARCH64'
2136subarch_all='X86_32 X86_64 PPC64'
2137case "$host_arch" in
2138  i[3-9]86|x86|x86pc|k5|k6|k6-2|k6-3|pentium*|athlon*|i586-i686)
2139  arch='x86'
2140  subarch='x86_32'
2141  def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
2142  def_av_fast_unaligned='#define AV_HAVE_FAST_UNALIGNED 1'
2143  def_local_aligned='#define HAVE_LOCAL_ALIGNED 1'
2144  iproc=486
2145  proc=i486
2146
2147
2148  if test "$_runtime_cpudetection" = no ; then
2149  case "$pvendor" in
2150  AuthenticAMD)
2151    case "$pfamily" in
2152    3) proc=i386 iproc=386 ;;
2153    4) proc=i486 iproc=486 ;;
2154    5) iproc=586       # LGB: models are: K5/SSA5 K5 K5 K5 ? ? K6 K6 K6-2 K6-3
2155        # K6 model 13 are the K6-2+ and K6-III+, only differing in cache size.
2156        if test "$pmodel" -eq 9 -o "$pmodel" -eq 13; then
2157            proc=k6-3
2158        elif test "$pmodel" -eq 5 -o "$pmodel" -eq 10; then
2159            proc=geode
2160        elif test "$pmodel" -ge 8; then
2161            proc=k6-2
2162        elif test "$pmodel" -ge 6; then
2163            proc=k6
2164        else
2165            proc=i586
2166        fi
2167        ;;
2168    6) iproc=686
2169        # It's a bit difficult to determine the correct type of Family 6
2170        # AMD CPUs just from their signature. Instead, we check directly
2171        # whether it supports SSE.
2172        if test "$_sse" = yes; then
2173            # cc treats athlon-xp, athlon-4 and athlon-mp similarly.
2174            proc=athlon-xp
2175        else
2176            # Again, cc treats athlon and athlon-tbird similarly.
2177            proc=athlon
2178        fi
2179        ;;
2180    15) iproc=686
2181        # k8 CPU type only supported in cc >= 3.4.0, but that will be
2182        # caught and remedied in the optimization tests below.
2183        proc=k8
2184        ;;
2185
2186    *) proc=amdfam10 iproc=686
2187        test $_fast_clz = "auto" && _fast_clz=yes
2188        ;;
2189    esac
2190    ;;
2191  GenuineIntel)
2192    case "$pfamily" in
2193    3) proc=i386 iproc=386 ;;
2194    4) proc=i486 iproc=486 ;;
2195    5) iproc=586
2196        if test "$pmodel" -eq 4 || test "$pmodel" -eq 8; then
2197            proc=pentium-mmx # 4 is desktop, 8 is mobile
2198        else
2199            proc=i586
2200        fi
2201        ;;
2202    6) iproc=686
2203        if test "$pmodel" -eq 28 -o "$pmodel" -eq 38 -o "$pmodel" -eq 54; then
2204            proc=atom
2205        elif test "$pmodel" -ge 15; then
2206            proc=core2
2207        elif test "$pmodel" -eq 9 -o "$pmodel" -ge 13; then
2208            proc=pentium-m
2209        elif test "$pmodel" -ge 7; then
2210            proc=pentium3
2211        elif test "$pmodel" -ge 3; then
2212            proc=pentium2
2213        else
2214            proc=i686
2215        fi
2216        test $_fast_clz = "auto" && _fast_clz=yes
2217        ;;
2218    15) iproc=686
2219        # A nocona in 32-bit mode has no more capabilities than a prescott.
2220        if test "$pmodel" -ge 3; then
2221            proc=prescott
2222        else
2223            proc=pentium4
2224            test $_fast_clz = "auto" && _fast_clz=yes
2225        fi
2226        test $_fast_cmov = "auto" && _fast_cmov=no
2227        ;;
2228    *) proc=prescott iproc=686 ;;
2229    esac
2230    ;;
2231  CentaurHauls)
2232    case "$pfamily" in
2233    5) iproc=586
2234        if test "$pmodel" -ge 8; then
2235            proc=winchip2
2236        elif test "$pmodel" -ge 4; then
2237            proc=winchip-c6
2238        else
2239            proc=i586
2240        fi
2241        ;;
2242    6) iproc=686
2243        if test "$pmodel" -ge 9; then
2244            proc=c3-2
2245        else
2246            proc=c3
2247            iproc=586
2248        fi
2249        ;;
2250    *) proc=i686 iproc=i686 ;;
2251    esac
2252    ;;
2253  unknown)
2254    case "$pfamily" in
2255    3) proc=i386 iproc=386 ;;
2256    4) proc=i486 iproc=486 ;;
2257    *) proc=i586 iproc=586 ;;
2258    esac
2259    ;;
2260  *)
2261    proc=i586 iproc=586 ;;
2262  esac
2263  test $_fast_clz = "auto" && _fast_clz=no
2264  fi # test "$_runtime_cpudetection" = no
2265
2266
2267    # check that cc supports our CPU, if not, fall back to earlier ones
2268    # LGB: check -mcpu and -march swithing step by step with enabling
2269    # to fall back till 386.
2270
2271    # cc >= 3.4.0  doesn't support -mcpu, we have to use -mtune instead
2272
2273    if [ "$cc_vendor" = "gnu" ] && ([ "$_cc_major" -gt 3 ] || ( [ "$_cc_major" = 3 ] && [ "$_cc_minor" -ge 4 ])) ; then
2274        cpuopt=-mtune
2275    else
2276        cpuopt=-mcpu
2277    fi
2278
2279    echocheck "GCC & CPU optimization abilities"
2280  if test "$_runtime_cpudetection" = no ; then
2281    if test $cc_vendor != "intel" && test $cc_vendor != "clang" ; then
2282      cflag_check -march=native && proc=native
2283    fi
2284    if test "$proc" = "amdfam10"; then
2285      cflag_check -march=$proc $cpuopt=$proc || proc=k8
2286    fi
2287    if test "$proc" = "k8"; then
2288      cflag_check -march=$proc $cpuopt=$proc || proc=athlon-xp
2289    fi
2290    if test "$proc" = "athlon-xp"; then
2291      cflag_check -march=$proc $cpuopt=$proc || proc=athlon
2292    fi
2293    if test "$proc" = "k6-3" || test "$proc" = "k6-2"; then
2294      cflag_check -march=$proc $cpuopt=$proc  || proc=k6
2295    fi
2296    if test "$proc" = "k6" || test "$proc" = "c3"; then
2297      if ! cflag_check -march=$proc $cpuopt=$proc; then
2298        if cflag_check -march=i586 $cpuopt=i686; then
2299          proc=i586-i686
2300        else
2301          proc=i586
2302        fi
2303      fi
2304    fi
2305    if test "$proc" = "atom" ; then
2306      cflag_check -march=$proc $cpuopt=$proc || proc=core2
2307    fi
2308    if test "$proc" = "prescott" ; then
2309      cflag_check -march=$proc $cpuopt=$proc || proc=pentium4
2310    fi
2311    if test "$proc" = "core2" ; then
2312      cflag_check -march=$proc $cpuopt=$proc || proc=pentium-m
2313    fi
2314    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
2315      cflag_check -march=$proc $cpuopt=$proc  || proc=i686
2316    fi
2317    if test "$proc" = "i686" || test "$proc" = "pentium-mmx" || test "$proc" = "winchip-c6" || test "$proc" = "winchip2"; then
2318      cflag_check -march=$proc $cpuopt=$proc  || proc=i586
2319    fi
2320    if test "$proc" = "i586"; then
2321      cflag_check -march=$proc $cpuopt=$proc  || proc=i486
2322    fi
2323    if test "$proc" = "i486" ; then
2324      cflag_check -march=$proc $cpuopt=$proc  || proc=i386
2325    fi
2326    if test "$proc" = "i386" ; then
2327      cflag_check -march=$proc $cpuopt=$proc  || proc=error
2328    fi
2329    if test "$proc" = "error" ; then
2330        echores "CPU optimization disabled. CPU not recognized or your compiler is too old."
2331      _mcpu=""
2332      _march=""
2333      _optimizing=""
2334    elif test "$proc" = "i586-i686"; then
2335      _march="-march=i586"
2336      _mcpu="$cpuopt=i686"
2337      _optimizing="$proc"
2338    else
2339      _march="-march=$proc"
2340      _mcpu="$cpuopt=$proc"
2341      _optimizing="$proc"
2342    fi
2343  else # if test "$_runtime_cpudetection" = no
2344    _mcpu="$cpuopt=generic"
2345    # at least i586 required, for __atomic_fetch_add builtin
2346    _march="-march=i586"
2347    cflag_check $_mcpu || _mcpu="$cpuopt=i686"
2348    cflag_check $_mcpu || _mcpu=""
2349    cflag_check $_march $_mcpu || _march=""
2350  fi
2351
2352    ## Gabucino : --target takes effect here (hopefully...) by overwriting
2353    ##             autodetected mcpu/march parameters
2354    if test "$_target" ; then
2355      # TODO: it may be a good idea to check GCC and fall back in all cases
2356      if test "$host_arch" = "i586-i686"; then
2357        _march="-march=i586"
2358        _mcpu="$cpuopt=i686"
2359      else
2360        _march="-march=$host_arch"
2361        _mcpu="$cpuopt=$host_arch"
2362      fi
2363
2364      proc="$host_arch"
2365
2366      case "$proc" in
2367        i386) iproc=386 ;;
2368        i486) iproc=486 ;;
2369        i586|k5|k6|k6-2|k6-3|pentium|pentium-mmx) iproc=586 ;;
2370        i686|athlon*|pentium*) iproc=686 ;;
2371        *) iproc=586 ;;
2372      esac
2373    fi
2374
2375    if test $_cmov = "yes" && test $_fast_cmov = "auto" ; then
2376        _fast_cmov="yes"
2377    else
2378        _fast_cmov="no"
2379    fi
2380    test $_fast_clz = "auto" && _fast_clz=yes
2381
2382    echores "$proc"
2383    ;;
2384
2385  ia64)
2386    arch='ia64'
2387    def_fast_64bit='#define HAVE_FAST_64BIT 1'
2388    iproc='ia64'
2389    ;;
2390
2391  x86_64|amd64|x64)
2392    arch='x86'
2393    subarch='x86_64'
2394    def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
2395    def_av_fast_unaligned='#define AV_HAVE_FAST_UNALIGNED 1'
2396    def_local_aligned='#define HAVE_LOCAL_ALIGNED 1'
2397    def_fast_64bit='#define HAVE_FAST_64BIT 1'
2398    iproc='x86_64'
2399
2400    # cc >= 3.4.0  doesn't support -mcpu, we have to use -mtune instead
2401    if test "$cc_vendor" = "gnu" && test "$_cc_major" -gt 3 -o "$_cc_major" -eq 3 -a "$_cc_minor" -ge 4 ; then
2402        cpuopt=-mtune
2403    else
2404        cpuopt=-mcpu
2405    fi
2406    if test "$_runtime_cpudetection" = no ; then
2407      case "$pvendor" in
2408      AuthenticAMD)
2409        case "$pfamily" in
2410        15) proc=k8
2411          test $_fast_clz = "auto" && _fast_clz=no
2412          ;;
2413        *) proc=amdfam10;;
2414        esac
2415        ;;
2416      GenuineIntel)
2417        case "$pfamily" in
2418        6)
2419          if test "$pmodel" -eq 28 -o "$pmodel" -eq 38 -o "$pmodel" -eq 54; then
2420            proc=atom
2421          elif test "$pmodel" -ge 42; then
2422            proc=corei7-avx
2423          elif test "$pmodel" -ge 26; then
2424            proc=corei7
2425          else
2426            proc=core2
2427          fi
2428          ;;
2429        *)
2430          # 64-bit prescotts exist, but as far as GCC is concerned they
2431          # have the same capabilities as a nocona.
2432          proc=nocona
2433          test $_fast_cmov = "auto" && _fast_cmov=no
2434          test $_fast_clz = "auto" && _fast_clz=no
2435          ;;
2436        esac
2437        ;;
2438      *)
2439        proc=error;;
2440      esac
2441    fi # test "$_runtime_cpudetection" = no
2442
2443    echocheck "GCC & CPU optimization abilities"
2444    # This is a stripped-down version of the i386 fallback.
2445    if test "$_runtime_cpudetection" = no ; then
2446      if test $cc_vendor != "intel" && test $cc_vendor != "clang" ; then
2447        cflag_check -march=native && proc=native
2448      fi
2449      # --- AMD processors ---
2450      if test "$proc" = "amdfam10"; then
2451        cflag_check -march=$proc $cpuopt=$proc || proc=k8
2452      fi
2453      if test "$proc" = "k8"; then
2454        cflag_check -march=$proc $cpuopt=$proc || proc=athlon-xp
2455      fi
2456      # This will fail if cc version < 3.3, which is OK because earlier
2457      # versions don't really support 64-bit on amd64.
2458      # Is this a valid assumption? -Corey
2459      if test "$proc" = "athlon-xp"; then
2460        cflag_check -march=$proc $cpuopt=$proc || proc=error
2461      fi
2462      # --- Intel processors ---
2463      if test "$proc" = "atom" || test "$proc" = "corei7-avx" || test "$proc" = "corei7"; then
2464        cflag_check -march=$proc $cpuopt=$proc || proc=core2
2465      fi
2466      if test "$proc" = "core2"; then
2467        cflag_check -march=$proc $cpuopt=$proc || proc=x86-64
2468      fi
2469      if test "$proc" = "x86-64"; then
2470        cflag_check -march=$proc $cpuopt=$proc || proc=nocona
2471      fi
2472      if test "$proc" = "nocona"; then
2473        cflag_check -march=$proc $cpuopt=$proc || proc=pentium4
2474      fi
2475      if test "$proc" = "pentium4"; then
2476        cflag_check -march=$proc $cpuopt=$proc || proc=error
2477      fi
2478
2479      _march="-march=$proc"
2480      _mcpu="$cpuopt=$proc"
2481      if test "$proc" = "error" ; then
2482        echores "CPU optimization disabled. CPU not recognized or your compiler is too old."
2483        _mcpu=""
2484        _march=""
2485      fi
2486    else # if test "$_runtime_cpudetection" = no
2487      # x86-64 is an undocumented option, an intersection of k8 and nocona.
2488      _march="-march=x86-64"
2489      _mcpu="$cpuopt=generic"
2490      cflag_check $_mcpu || _mcpu="x86-64"
2491      cflag_check $_mcpu || _mcpu=""
2492      cflag_check $_march $_mcpu || _march=""
2493    fi
2494
2495    _optimizing="$proc"
2496    test $_fast_cmov = "auto" && _fast_cmov=yes
2497    test $_fast_clz = "auto" && _fast_clz=yes
2498
2499    echores "$proc"
2500    ;;
2501
2502  sparc|sparc64)
2503    arch='sparc'
2504    iproc='sparc'
2505    if test "$host_arch" = "sparc64" ; then
2506      _vis='yes'
2507      proc='ultrasparc'
2508      def_fast_64bit='#define HAVE_FAST_64BIT 1'
2509    elif sunos ; then
2510        echocheck "CPU type"
2511        karch=$(uname -m)
2512        case "$(echo $karch)" in
2513            sun4) proc=v7 ;;
2514            sun4c) proc=v7 ;;
2515            sun4d) proc=v8 ;;
2516            sun4m) proc=v8 ;;
2517            sun4u) proc=ultrasparc _vis='yes' ;;
2518            sun4v) proc=v9 ;;
2519            *) proc=v8 ;;
2520        esac
2521        echores "$proc"
2522    else
2523        proc=v8
2524    fi
2525    _mcpu="-mcpu=$proc"
2526    _optimizing="$proc"
2527    ;;
2528
2529  aarch64|ARM64)
2530    arch='aarch64'
2531    iproc='aarch64'
2532    if test "$_runtime_cpudetection" = no ; then
2533      cflag_check -march=native -mcpu=native -mfpu=auto && _march="-march=native -mcpu=native -mfpu=auto"
2534    fi
2535    ;;
2536
2537  arm*)
2538    arch='arm'
2539    iproc='arm'
2540    def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
2541    def_av_fast_unaligned='#define AV_HAVE_FAST_UNALIGNED 1'
2542    def_local_aligned='#define HAVE_LOCAL_ALIGNED 1'
2543    test $_fast_clz = "auto" && _fast_clz=yes
2544    if test "$_runtime_cpudetection" = no ; then
2545      cflag_check -march=native -mcpu=native -mfpu=auto && _march="-march=native -mcpu=native -mfpu=auto"
2546    fi
2547    ;;
2548
2549  avr32)
2550    arch='avr32'
2551    def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
2552    def_av_fast_unaligned='#define AV_HAVE_FAST_UNALIGNED 1'
2553    iproc='avr32'
2554    test $_fast_clz = "auto" && _fast_clz=yes
2555    ;;
2556
2557  sh|sh4)
2558    arch='sh4'
2559    iproc='sh4'
2560    ;;
2561
2562  ppc*|powerpc*)
2563    arch='ppc'
2564    def_dcbzl='#define HAVE_DCBZL 0'
2565    def_vsx='#define HAVE_VSX 0'
2566    def_fast_unaligned='#define HAVE_FAST_UNALIGNED 1'
2567    def_av_fast_unaligned='#define AV_HAVE_FAST_UNALIGNED 1'
2568    def_local_aligned='#define HAVE_LOCAL_ALIGNED 1'
2569    iproc='ppc'
2570
2571    if test "$host_arch" = "ppc64" ; then
2572      subarch='ppc64'
2573      def_fast_64bit='#define HAVE_FAST_64BIT 1'
2574    fi
2575    echocheck "CPU type"
2576    case $system_name in
2577      Linux)
2578        proc=$($_cpuinfo | grep 'cpu' | cut -d ':' -f 2 | cut -d ',' -f 1 | cut -b 2- | head -n 1)
2579        if test -n "$($_cpuinfo | grep altivec)"; then
2580            test $_altivec = auto && _altivec=yes
2581        fi
2582        ;;
2583      Darwin)
2584        proc=$($_cpuinfo | grep "Processor type" | cut -f 3 -d ' ' | sed 's/ppc//')
2585        if [ $(sysctl -n hw.vectorunit) -eq 1 -o \
2586            "$(sysctl -n hw.optional.altivec 2> /dev/null)" = "1" ]; then
2587            test $_altivec = auto && _altivec=yes
2588        fi
2589        ;;
2590      NetBSD)
2591        # only cc 3.4 works reliably with AltiVec code under NetBSD
2592        case $cc_version in
2593            2*|3.0*|3.1*|3.2*|3.3*)
2594                ;;
2595            *)
2596                if [ $(sysctl -n machdep.altivec) -eq 1 ]; then
2597                    test $_altivec = auto && _altivec=yes
2598                fi
2599                ;;
2600        esac
2601        ;;
2602      AIX)
2603        proc=$($_cpuinfo | grep 'type' | cut -f 2 -d ' ' | sed 's/PowerPC_//')
2604        ;;
2605    esac
2606    if test "$_altivec" = yes; then
2607        echores "$proc altivec"
2608    else
2609        _altivec=no
2610        echores "$proc"
2611    fi
2612
2613    echocheck "GCC & CPU optimization abilities"
2614
2615    if test -n "$proc"; then
2616        case "$proc" in
2617            601) _march='-mcpu=601' _mcpu='-mtune=601' ;;
2618            603) _march='-mcpu=603' _mcpu='-mtune=603' ;;
2619            603e|603ev) _march='-mcpu=603e' _mcpu='-mtune=603e' ;;
2620            604|604e|604r|604ev) _march='-mcpu=604' _mcpu='-mtune=604' ;;
2621            740|740/750|745/755) _march='-mcpu=740' _mcpu='-mtune=740' ;;
2622            750|750CX) _march='-mcpu=750' _mcpu='-mtune=750' ;;
2623            POWER)  _march='-mcpu=power'  _mcpu='-mtune=power'  ;;
2624            POWER2) _march='-mcpu=power2' _mcpu='-mtune=power2' ;;
2625            POWER3) _march='-mcpu=power3' _mcpu='-mtune=power3' ;;
2626            *) ;;
2627        esac
2628        # cc 3.1(.1) and up supports 7400 and 7450
2629        if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "1" || test "$_cc_major" -ge "4"; then
2630            case "$proc" in
2631                7400*|7410*) _march='-mcpu=7400' _mcpu='-mtune=7400' ;;
2632                7447*|7450*|7455*) _march='-mcpu=7450' _mcpu='-mtune=7450' ;;
2633                *) ;;
2634            esac
2635        fi
2636        # cc 3.2 and up supports 970
2637        if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "3" || test "$_cc_major" -ge "4"; then
2638            case "$proc" in
2639                970*|PPC970*) _march='-mcpu=970' _mcpu='-mtune=970'
2640                      def_dcbzl='#define HAVE_DCBZL 1' ;;
2641                *) ;;
2642            esac
2643        fi
2644        # cc 3.3 and up supports POWER4
2645        if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "3" || test "$_cc_major" -ge "4"; then
2646            case "$proc" in
2647                POWER4) _march='-mcpu=power4' _mcpu='-mtune=power4' ;;
2648                *) ;;
2649            esac
2650        fi
2651        # cc 3.4 and up supports 440*
2652        if test "$_cc_major" -ge "3" && test "$_cc_minor" -ge "4" || test "$_cc_major" -ge "4"; then
2653            case "$proc" in
2654                440EP*) _march='-mcpu=440fp' _mcpu='-mtune=440fp' ;;
2655                440G* ) _march='-mcpu=440'   _mcpu='-mtune=440'   ;;
2656                *) ;;
2657            esac
2658        fi
2659        # cc 4.0 and up supports POWER5
2660        if test "$_cc_major" -ge "4"; then
2661            case "$proc" in
2662                POWER5*) _march='-mcpu=power5' _mcpu='-mtune=power5' ;;
2663                *) ;;
2664            esac
2665        fi
2666        # cc 4.2 and up supports POWER6
2667        if test "$_cc_major" -ge "4" && test "$_cc_minor" -ge "2" || test "$_cc_major" -ge "5"; then
2668            case "$proc" in
2669                POWER6*) _march='-mcpu=power6' _mcpu='-mtune=power6' ;;
2670                *) ;;
2671            esac
2672        fi
2673        # cc 4.5 and up supports POWER7
2674        if test "$_cc_major" -ge "4" && test "$_cc_minor" -ge "5" || test "$_cc_major" -ge "5"; then
2675            case "$proc" in
2676                POWER7*) _march='-mcpu=power7' _mcpu='-mtune=power7'
2677                      def_vsx='#define HAVE_VSX 1' ;;
2678                *) ;;
2679            esac
2680        fi
2681        # cc 4.9 and up supports POWER8
2682        if test "$_cc_major" -ge "4" && test "$_cc_minor" -ge "9" || test "$_cc_major" -ge "5"; then
2683            case "$proc" in
2684                POWER8*) _march='-mcpu=power8' _mcpu='-mtune=power8'
2685                      def_vsx='#define HAVE_VSX 1' ;;
2686                *) ;;
2687            esac
2688        fi
2689    fi
2690
2691    if test -n "$_mcpu"; then
2692        _optimizing=$(echo $_mcpu | cut -c 8-)
2693        echores "$_optimizing"
2694    else
2695        echores "none"
2696    fi
2697
2698    test $_fast_clz = "auto" && _fast_clz=yes
2699
2700    ;;
2701
2702  alpha*)
2703    arch='alpha'
2704    iproc='alpha'
2705
2706    echocheck "CPU type"
2707    cat > $TMPC << EOF
2708int main(void) {
2709    unsigned long ver, mask;
2710    __asm__ ("implver %0" : "=r" (ver));
2711    __asm__ ("amask %1, %0" : "=r" (mask) : "r" (-1));
2712    printf("%ld-%x\n", ver, ~mask);
2713    return 0;
2714}
2715EOF
2716    $_cc -o "$TMPEXE" "$TMPC"
2717    case $("$TMPEXE") in
2718
2719        0-0)    proc="ev4";   _mvi="0";;
2720        1-0)    proc="ev5";   _mvi="0";;
2721        1-1)    proc="ev56";  _mvi="0";;
2722        1-101)  proc="pca56"; _mvi="1";;
2723        2-303)  proc="ev6";   _mvi="1";;
2724        2-307)  proc="ev67";  _mvi="1";;
2725        2-1307) proc="ev68";  _mvi="1";;
2726    esac
2727    echores "$proc"
2728
2729    echocheck "GCC & CPU optimization abilities"
2730    if test "$proc" = "ev68" ; then
2731      cc_check -mcpu=$proc || proc=ev67
2732    fi
2733    if test "$proc" = "ev67" ; then
2734      cc_check -mcpu=$proc || proc=ev6
2735    fi
2736    _mcpu="-mcpu=$proc"
2737    echores "$proc"
2738
2739    test $_fast_clz = "auto" && _fast_clz=yes
2740
2741    _optimizing="$proc"
2742    ;;
2743
2744  nios2)
2745    arch='nios2'
2746    iproc='nios2'
2747    ;;
2748
2749  mips*)
2750    arch='mips'
2751    iproc='mips'
2752
2753    if irix ; then
2754        echocheck "CPU type"
2755        proc=$(hinv -c processor | grep CPU | cut -d " " -f3)
2756        case "$(echo $proc)" in
2757            R3000) _march='-mips1' _mcpu='-mtune=r2000' ;;
2758            R4000) _march='-mips3' _mcpu='-mtune=r4000' ;;
2759            R4400) _march='-mips3' _mcpu='-mtune=r4400' ;;
2760            R4600) _march='-mips3' _mcpu='-mtune=r4600' ;;
2761            R5000) _march='-mips4' _mcpu='-mtune=r5000' ;;
2762            R8000|R10000|R12000|R14000|R16000) _march='-mips4' _mcpu='-mtune=r8000' ;;
2763        esac
2764        # cc < 3.x does not support -mtune.
2765        if test "$cc_vendor" = "gnu" && test "$_cc_major" -lt 3 ; then
2766            _mcpu=''
2767        fi
2768        echores "$proc"
2769    fi
2770
2771    test $_fast_clz = "auto" && _fast_clz=yes
2772
2773    ;;
2774
2775  hppa)
2776    arch='pa_risc'
2777    iproc='PA-RISC'
2778    ;;
2779
2780  s390)
2781    arch='s390'
2782    iproc='390'
2783    ;;
2784
2785  s390x)
2786    arch='s390x'
2787    iproc='390x'
2788    ;;
2789
2790  vax)
2791    arch='vax'
2792    iproc='vax'
2793    ;;
2794
2795  xtensa)
2796    arch='xtensa'
2797    iproc='xtensa'
2798    ;;
2799
2800  generic)
2801    arch='generic'
2802    ;;
2803  arc)
2804    arch='arc'
2805    iproc='arc'
2806    ;;
2807
2808  *)
2809    echo "The architecture of your CPU ($host_arch) is not supported by this configure script"
2810    echo "It seems nobody has ported MPlayer to your OS or CPU type yet."
2811    die "unsupported architecture $host_arch"
2812    ;;
2813esac # case "$host_arch" in
2814
2815if test "$_runtime_cpudetection" = yes ; then
2816  if x86 ; then
2817    test "$_cmov"     != no && _cmov=yes
2818    x86_32 && _cmov=no
2819    test "$_mmx"      != no && _mmx=yes
2820    test "$_3dnow"    != no && _3dnow=yes
2821    test "$_3dnowext" != no && _3dnowext=yes
2822    test "$_mmxext"   != no && _mmxext=yes
2823    test "$_sse"      != no && _sse=yes
2824    test "$_sse2"     != no && _sse2=yes
2825    test "$_sse3"     != no && _sse3=yes
2826    test "$_ssse3"    != no && _ssse3=yes
2827    test "$_sse4_1"   != no && _sse4_1=yes
2828    test "$_sse4_2"   != no && _sse4_2=yes
2829    test "$_avx"      != no && _avx=yes
2830    test "$_avx2"     != no && _avx2=yes
2831    test "$_xop"      != no && _xop=yes
2832    test "$_fma3"     != no && _fma3=yes
2833    test "$_fma4"     != no && _fma4=yes
2834    test "$_mtrr"     != no && _mtrr=yes
2835  fi
2836  if ppc; then
2837    _altivec=yes
2838  fi
2839fi
2840
2841test "$_avx" != no && def_simd_align_32='#define HAVE_SIMD_ALIGN_32 1'
2842
2843# endian testing
2844echocheck "byte order"
2845if test "$_big_endian" = auto ; then
2846  cat > $TMPC <<EOF
2847short ascii_name[] = {
2848  'M' << 8 | 'P', 'l' << 8 | 'a', 'y' << 8 | 'e', 'r' << 8 | 'B',
2849  'i' << 8 | 'g', 'E' << 8 | 'n', 'd' << 8 | 'i', 'a' << 8 | 'n', 0 };
2850int main(void) { return (long)ascii_name; }
2851EOF
2852  if cc_check ; then
2853    # stdin is used to make "strings" not try something clever like
2854    # parse executable section headers (and possibly fail in the process)
2855    if strings < $TMPEXE | grep -q -l MPlayerBigEndian ; then
2856      _big_endian=yes
2857    else
2858      _big_endian=no
2859    fi
2860  else
2861    echo ${_echo_n} "failed to autodetect byte order, defaulting to ${_echo_c}"
2862  fi
2863fi
2864if test "$_big_endian" = yes ; then
2865  _byte_order='big-endian'
2866  def_bigendian='#define HAVE_BIGENDIAN 1'
2867  def_av_bigendian='#define AV_HAVE_BIGENDIAN 1'
2868else
2869  _byte_order='little-endian'
2870  def_bigendian='#define HAVE_BIGENDIAN 0'
2871  def_av_bigendian='#define AV_HAVE_BIGENDIAN 0'
2872fi
2873echores "$_byte_order"
2874
2875
2876echocheck "extern symbol prefix"
2877cat > $TMPC << EOF
2878int ff_extern;
2879EOF
2880cc_check -c || die "Symbol mangling check failed."
2881sym=$($_nm -P -g $TMPEXE | grep ff_extern)
2882extern_prefix=${sym%%ff_extern*}
2883def_extern_asm="#define EXTERN_ASM $extern_prefix"
2884def_extern_prefix="#define EXTERN_PREFIX \"$extern_prefix\""
2885echores $extern_prefix
2886
2887
2888echocheck "assembler support of -pipe option"
2889# -I. helps to detect compilers that just misunderstand -pipe like Sun C
2890cflag_check -pipe -I. && _pipe="-pipe" && echores "yes" || echores "no"
2891
2892
2893if darwin && test "$cc_vendor" = "gnu" ; then
2894echocheck "GCC support of -mstackrealign"
2895# GCC 4.2 and some earlier Apple versions support this flag on x86. Since
2896# Mac OS X/Intel has an ABI different from Windows this is needed to avoid
2897# crashes when loading Win32 DLLs. Unfortunately some cc versions create
2898# wrong code with this flag, but this can be worked around by adding
2899# -fno-unit-at-a-time as described in the blog post at
2900# http://www.dribin.org/dave/blog/archives/2006/12/05/missing_third_param/
2901cat > $TMPC << EOF
2902__attribute__((noinline)) static int foo3(int i1, int i2, int i3) { return i3; }
2903int main(void) { return foo3(1, 2, 3) == 3 ? 0 : 1; }
2904EOF
2905  cc_check -O4 -mstackrealign && tmp_run && cflags_stackrealign=-mstackrealign
2906  test -z "$cflags_stackrealign" && cc_check -O4 -mstackrealign -fno-unit-at-a-time &&
2907    tmp_run && cflags_stackrealign="-mstackrealign -fno-unit-at-a-time"
2908  test -n "$cflags_stackrealign" && echores "yes" || echores "no"
2909fi # if darwin && test "$cc_vendor" = "gnu" ; then
2910
2911
2912# Checking for CFLAGS
2913_install_strip="-s"
2914if test -z "$_strip"; then
2915  _strip=strip
2916else
2917  _install_strip="$_install_strip --strip-program=$_strip"
2918fi
2919if test -z "$CFLAGS" || test "$_profile" != "" || test "$_debug" != ""; then
2920  if test "$cc_vendor" = "intel" ; then
2921    CFLAGS="-O2 $_march $_mcpu $_pipe -fomit-frame-pointer"
2922    WARNFLAGS="-wd167 -wd556 -wd144"
2923  elif test "$cc_vendor" = "sun" ; then
2924    CFLAGS="-O2 $_march $_mcpu $_pipe -xc99 -xregs=frameptr"
2925  elif test "$cc_vendor" = "clang"; then
2926    CFLAGS="-O2 $_march $_pipe"
2927  elif test "$cc_vendor" != "gnu" ; then
2928    CFLAGS="-O2 $_march $_mcpu $_pipe"
2929  else
2930    CFLAGS="-O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
2931    WARNFLAGS="-Wall -Wno-switch -Wno-parentheses -Wpointer-arith -Wredundant-decls -Werror=format-security"
2932    WARN_CFLAGS="-Werror-implicit-function-declaration"
2933    extra_ldflags="$extra_ldflags -ffast-math"
2934  fi
2935
2936  if test "$_profile" != "" || test "$_debug" != ""; then
2937    CFLAGS="-O2 $_march $_mcpu $_pipe $_debug $_profile"
2938    WARNFLAGS="-W -Wall $WARNFLAGS"
2939    _install_strip=
2940  fi
2941else
2942  warn_cflags=yes
2943fi
2944
2945CFLAGS="-D_ISOC99_SOURCE -I. -Iffmpeg $CFLAGS"
2946HOSTCFLAGS="-D_ISOC99_SOURCE -I. -Iffmpeg -O3"
2947
2948# On glibc, add some more CPPFLAGS for enabling required functionality.
2949cpp_condition_check features.h "defined __GLIBC__" &&
2950  CFLAGS="-D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $CFLAGS" &&
2951  HOSTCFLAGS="-D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $HOSTCFLAGS"
2952
2953if cygwin; then
2954  CFLAGS="-D_XOPEN_SOURCE=600 $CFLAGS"
2955fi
2956
2957if test "$cc_vendor" = "gnu" ; then
2958  cflag_check -fno-tree-vectorize && CFLAGS="$CFLAGS -fno-tree-vectorize"
2959  cflag_check -Wundef && WARNFLAGS="-Wundef $WARNFLAGS"
2960  cflag_check -std=gnu99 && WARN_CFLAGS="-std=gnu99 $WARN_CFLAGS"
2961  cflag_check -Wdeclaration-after-statement && WARN_CFLAGS="-Wdeclaration-after-statement $WARN_CFLAGS"
2962  cflag_check -Wno-pointer-sign && WARN_CFLAGS="-Wno-pointer-sign $WARN_CFLAGS"
2963  cflag_check -Wdisabled-optimization && WARN_CFLAGS="-Wdisabled-optimization $WARN_CFLAGS"
2964  cflag_check -Wmissing-prototypes && WARN_CFLAGS="-Wmissing-prototypes $WARN_CFLAGS"
2965  cflag_check -Wstrict-prototypes && WARN_CFLAGS="-Wstrict-prototypes $WARN_CFLAGS"
2966fi
2967
2968# This provides significant size savings on cc
2969# I will cause worse backtraces when debug info is missing though,
2970# but having non-stripable debug info is not really a desirable feature.
2971# Unfortunately MinGW toolchains seem to have a bug where it tries
2972# to use SjLj exception handling even if not supported by the toolchain,
2973# causing linking failure for C++ code like demux_rtp.cpp
2974if ! mingw32 ; then
2975cflag_check -fno-asynchronous-unwind-tables && CFLAGS="$CFLAGS -fno-asynchronous-unwind-tables"
2976fi
2977cflag_check -mno-omit-leaf-frame-pointer && cflags_no_omit_leaf_frame_pointer="-mno-omit-leaf-frame-pointer"
2978cflag_check -MMD -MP && DEPFLAGS="-MMD -MP"
2979
2980
2981if test -n "$LDFLAGS" ; then
2982  extra_ldflags="$extra_ldflags $LDFLAGS"
2983  warn_cflags=yes
2984elif test "$cc_vendor" = "intel" ; then
2985  extra_ldflags="$extra_ldflags -i-static"
2986fi
2987if test -n "$CPPFLAGS" ; then
2988  extra_cflags="$extra_cflags $CPPFLAGS"
2989  warn_cflags=yes
2990fi
2991
2992
2993# try to create a relocatable binary by default
2994echocheck "relocatable binary"
2995if test $relocatable = "auto" ; then
2996  if test -n "$ld_static" ; then
2997    relocatable=no
2998    res_comment="PIE + static assumed to be broken"
2999  elif win32 && ! wine ; then
3000    relocatable=no
3001    res_comment="unnecessary and broken on win32"
3002  elif x86_32 && cflag_check -pie ; then
3003    extra_ldflags="$extra_ldflags -pie"
3004    relocatable=yes
3005    res_comment="non-PIC"
3006  elif x86_64 && cflag_check -fpie -pie ; then
3007    extra_ldflags="$extra_ldflags -fpie -pie"
3008    extra_cflags="$extra_cflags -fpie"
3009    relocatable=yes
3010    res_comment="fast PIC"
3011  else
3012    relocatable=no
3013    res_comment="unavailable or untested architecture"
3014  fi
3015elif test $relocatable = "yes" ; then
3016  if return_check "stdint.h" '(intptr_t)"test" >> 16' -pie ; then
3017    extra_ldflags="$extra_ldflags -pie"
3018    res_comment="non-PIC"
3019  else
3020    extra_ldflags="$extra_ldflags -fpie -pie"
3021    extra_cflags="$extra_cflags -fpie"
3022    res_comment="possibly slow PIC!"
3023  fi
3024fi
3025echores $relocatable
3026
3027if x86_32 ; then
3028  # Checking assembler (_as) compatibility...
3029  # Added workaround for older as that reads from stdin by default - atmos
3030  as_version=$(echo '' | $_as -version 2>&1 | sed -n 's/^.*assembler \(version \)*\([0-9.]*\).*$/\2/p')
3031  echocheck "assembler ($_as $as_version)"
3032
3033  _pref_as_version='2.9.1'
3034  echo 'nop' > $TMPS
3035  if test "$_mmx" = yes ; then
3036    echo 'emms' >> $TMPS
3037  fi
3038  if test "$_3dnow" = yes ; then
3039    _pref_as_version='2.10.1'
3040    echo 'femms' >> $TMPS
3041  fi
3042  if test "$_3dnowext" = yes ; then
3043    _pref_as_version='2.10.1'
3044    echo 'pswapd %mm0, %mm0' >> $TMPS
3045  fi
3046  if test "$_mmxext" = yes ; then
3047    _pref_as_version='2.10.1'
3048    echo 'movntq %mm0, (%eax)' >> $TMPS
3049  fi
3050  if test "$_sse" = yes ; then
3051    _pref_as_version='2.10.1'
3052    echo 'xorps %xmm0, %xmm0' >> $TMPS
3053  fi
3054  #if test "$_sse2" = yes ; then
3055  #  _pref_as_version='2.11'
3056  #  echo 'xorpd %xmm0, %xmm0' >> $TMPS
3057  #fi
3058  if test "$_cmov" = yes ; then
3059    _pref_as_version='2.10.1'
3060    echo 'cmovb %eax, %ebx' >> $TMPS
3061  fi
3062  if test "$_ssse3" = yes ; then
3063    _pref_as_version='2.16.92'
3064    echo 'pabsd %xmm0, %xmm1' >> $TMPS
3065  fi
3066  $_as $TMPS -o $TMPEXE > /dev/null 2>&1 || as_verc_fail=yes
3067
3068  if test "$as_verc_fail" != yes ; then
3069    echores "ok"
3070  else
3071    res_comment="Upgrade binutils to ${_pref_as_version} or use --disable-ssse3 etc."
3072    echores "failed"
3073    die "obsolete binutils version"
3074  fi
3075
3076fi #if x86_32
3077
3078
3079# Check if we need to compile as PIC for this combination of architecture, toolchain,
3080# cc configuration (e.g. hardened or not) and compiler options.
3081# Needs to be after the relocatable handling, since PIE changes whether we need PIC or not.
3082echocheck "PIC"
3083def_pic='#define CONFIG_PIC 0'
3084pic=no
3085cpp_condition_check '' 'defined(__PIC__) || defined(__pic__) || defined(PIC)' && pic=yes
3086# This check is needed to work around issues with clang on OSX when compiling 64 bit relocatable binaries.
3087if x86_64 && test "$relocatable" = "yes" && test "$pic" = "no"; then
3088  res_comment="Broken compiler incorrectly claims PIC not necessary for PIE"
3089  pic=yes
3090fi
3091echores $pic
3092if test "$pic" = "yes" ; then
3093  extra_cflags="$extra_cflags -DPIC" && def_pic='#define CONFIG_PIC 1'
3094fi
3095
3096
3097def_bswap='#define HAVE_BSWAP 0'
3098def_ebx_available='#define HAVE_EBX_AVAILABLE 0'
3099def_xmm_clobbers='#define HAVE_XMM_CLOBBERS 0'
3100
3101if x86_64 && ! msvc; then
3102inline_asm_check '"mov (%eax), %eax"' || die "Your binutils version is too old to compile for 64-bit (on OSX try --cc=clang)"
3103fi
3104
3105if x86 ; then
3106
3107echocheck ".align is a power of two"
3108if test "$_asmalign_pot" = auto ; then
3109_asmalign_pot=no
3110inline_asm_check '".align 3"' && _asmalign_pot=yes
3111fi
3112if test "$_asmalign_pot" = "yes" ; then
3113  def_asmalign_pot='#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\n\t"'
3114else
3115  def_asmalign_pot='#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\n\t"'
3116fi
3117echores $_asmalign_pot
3118
3119
3120echocheck "ebx availability"
3121ebx_available=no
3122cat > $TMPC << EOF
3123int main(void) {
3124    int x;
3125    __asm__ volatile(
3126        "xor %0, %0"
3127        :"=b"(x)
3128        // just adding ebx to clobber list seems unreliable with some
3129        // compilers, e.g. Haiku's cc 2.95
3130    );
3131    // and the above check does not work for OSX 64 bit...
3132    __asm__ volatile("":::"%ebx");
3133    return 0;
3134}
3135EOF
3136cc_check && ebx_available=yes && def_ebx_available='#define HAVE_EBX_AVAILABLE 1'
3137echores $ebx_available
3138
3139
3140echocheck "yasm"
3141if test -z "$YASMFLAGS" ; then
3142  if darwin ; then
3143    x86_64 && objformat="macho64" || objformat="macho"
3144  elif win32 && ! wine ; then
3145    objformat="win32"
3146  elif os2 ; then
3147    _yasm=nasm
3148    objformat="aout"
3149  else
3150    objformat="elf"
3151  fi
3152  yasmdefines=""
3153  # currently tested for Linux x86, x86_64
3154  test "$pic" = "yes"      && yasmdefines="$yasmdefines -DPIC"
3155  test -n "$extern_prefix" && yasmdefines="$yasmdefines -DPREFIX"
3156
3157  YASMFLAGS="-f $objformat $yasmdefines"
3158  x86_64 && YASMFLAGS="$YASMFLAGS -m amd64"
3159  case "$objformat" in
3160    elf) test $_debug && YASMFLAGS="$YASMFLAGS -g dwarf2" ;;
3161  esac
3162else
3163  warn_cflags=yes
3164fi
3165
3166echo "pextrd [eax], xmm0, 1" > $TMPS
3167yasm_features_all="cpunop"
3168if test "$_yasm" ; then
3169  if ! yasm_check ; then
3170    if x86_64 ; then
3171      case "$objformat" in
3172        elf)   objformat=elf64 ;;
3173        win32) objformat=win64 ;;
3174      esac
3175    fi
3176    YASMFLAGS="-f $objformat $yasmdefines"
3177    yasm_check || ! x86 || die "yasm not found, use --yasm='' if you really want to compile without"
3178    echo "CPU amdnop" > $TMPS
3179    yasm_check && yasm_features="cpunop"
3180  fi
3181fi
3182if test $_yasm ; then
3183  def_yasm='#define HAVE_YASM 1
3184#define HAVE_X86ASM 1'
3185  have_yasm="yes"
3186  echores "$_yasm"
3187else
3188  def_yasm='#define HAVE_YASM 0
3189#define HAVE_X86ASM 0'
3190  have_yasm="no"
3191  echores "no"
3192fi
3193
3194echocheck "bswap"
3195echo 'bswap %eax' > $TMPS
3196$_as $TMPS -o $TMPEXE > /dev/null 2>&1 && def_bswap='#define HAVE_BSWAP 1' && bswap=yes || bswap=no
3197echores "$bswap"
3198
3199
3200echocheck "xmm clobbers"
3201inline_asm_check '"":::"%xmm0"' &&
3202  def_xmm_clobbers='#define HAVE_XMM_CLOBBERS 1' &&
3203  xmm_clobbers=yes || xmm_clobbers=no
3204echores "$xmm_clobbers"
3205
3206else
3207  _yasm=''
3208  def_yasm='#define HAVE_YASM 0
3209#define HAVE_X86ASM 0'
3210  have_yasm="no"
3211fi #if x86
3212
3213echocheck "as_func"
3214def_as_func='#define HAVE_AS_FUNC 0'
3215echo '.func test
3216.endfunc' > $TMPS
3217$_as $TMPS -o $TMPEXE > /dev/null 2>&1 && def_as_func='#define HAVE_AS_FUNC 1' && as_func=yes || as_func=no
3218echores "$as_func"
3219
3220#FIXME: This should happen before the check for CFLAGS..
3221def_altivec_h='#define HAVE_ALTIVEC_H 0'
3222if ppc && ( test "$_altivec" = yes || test "$_runtime_cpudetection" = yes ) ; then
3223
3224    # check if AltiVec is supported by the compiler, and how to enable it
3225    echocheck "GCC AltiVec flags"
3226    if $(cflag_check -maltivec -mabi=altivec) ; then
3227    _altivec_gcc_flags="-maltivec -mabi=altivec"
3228    # check if <altivec.h> should be included
3229        if $(header_check altivec.h $_altivec_gcc_flags) ; then
3230            def_altivec_h='#define HAVE_ALTIVEC_H 1'
3231            inc_altivec_h='#include <altivec.h>'
3232        else
3233            if $(cflag_check -faltivec) ; then
3234                _altivec_gcc_flags="-faltivec"
3235            else
3236                _altivec=no
3237                _altivec_gcc_flags="none, AltiVec disabled"
3238            fi
3239        fi
3240    fi
3241    echores "$_altivec_gcc_flags"
3242
3243    # check if the compiler supports braces for vector declarations
3244    cat > $TMPC << EOF
3245$inc_altivec_h
3246int main(void) { (vector int) {1}; return 0; }
3247EOF
3248    cc_check $_altivec_gcc_flags || die "You need a compiler that supports {} in AltiVec vector declarations."
3249
3250    # Disable runtime cpudetection if we cannot generate AltiVec code or
3251    # AltiVec is disabled by the user.
3252    test "$_runtime_cpudetection" = yes && test "$_altivec" = no \
3253        && _runtime_cpudetection=no
3254
3255    # Show that we are optimizing for AltiVec (if enabled and supported).
3256    test "$_runtime_cpudetection" = no && test "$_altivec" = yes \
3257        && _optimizing="$_optimizing altivec"
3258
3259    # If AltiVec is enabled, make sure the correct flags turn up in CFLAGS.
3260    test "$_altivec" = yes && CFLAGS="$CFLAGS $_altivec_gcc_flags"
3261fi
3262
3263if ppc ; then
3264def_xform_asm='#define HAVE_XFORM_ASM 0'
3265xform_asm=no
3266echocheck "XFORM ASM support"
3267inline_asm_check '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)' &&
3268  xform_asm=yes && def_xform_asm='#define HAVE_XFORM_ASM 1'
3269echores "$xform_asm"
3270
3271def_ibm_asm='#define HAVE_IBM_ASM 0'
3272ibm_asm=no
3273echocheck "IBM ASM support"
3274inline_asm_check '"add 0, 0, 0"' &&
3275  ibm_asm=yes && def_ibm_asm='#define HAVE_IBM_ASM 1'
3276echores "$ibm_asm"
3277
3278def_gnu_as='#define HAVE_GNU_AS 0'
3279gnu_as=no
3280echocheck "GNU assembler"
3281inline_asm_check '".macro m n\n\\n:.int 0\n.endm\nm x"' &&
3282  gnu_as=yes && def_gnu_as='#define HAVE_GNU_AS 1'
3283echores "$gnu_as"
3284
3285fi
3286
3287if arm ; then
3288  echocheck "ARMv5TE (Enhanced DSP Extensions)"
3289  if test $_armv5te = "auto" ; then
3290    _armv5te=no
3291    inline_asm_check '"qadd r0, r0, r0"' && _armv5te=yes
3292  fi
3293  echores "$_armv5te"
3294
3295  test $_armv5te = "yes" && test $_fast_clz = "auto" && _fast_clz=yes
3296
3297  echocheck "ARMv6 (SIMD instructions)"
3298  if test $_armv6 = "auto" ; then
3299    _armv6=no
3300    inline_asm_check '"sadd16 r0, r0, r0"' && _armv6=yes
3301  fi
3302  echores "$_armv6"
3303
3304  echocheck "ARMv6t2 (SIMD instructions)"
3305  if test $_armv6t2 = "auto" ; then
3306    _armv6t2=no
3307    inline_asm_check '"movt r0, #0"' && _armv6t2=yes
3308  fi
3309  echores "$_armv6t2"
3310
3311  echocheck "ARM VFP"
3312  if test $_armvfp = "auto" ; then
3313    _armvfp=no
3314    inline_asm_check '"fadds s0, s0, s0"' && _armvfp=yes
3315    inline_asm_check '"fmadd d0,    d0,    d1,    d2"' && _armvfp=yes
3316  fi
3317  echores "$_armvfp"
3318
3319  echocheck "ARM VFPV3"
3320  if test $vfpv3 = "auto" ; then
3321    vfpv3=no
3322    inline_asm_check '"vmov.f32 s0, #1.0"' && vfpv3=yes
3323  fi
3324  echores "$vfpv3"
3325
3326  echocheck "ARM setend"
3327  if test $setend = "auto" ; then
3328    setend=no
3329    inline_asm_check '"setend be"' && setend=yes
3330  fi
3331  echores "$setend"
3332
3333  echocheck "ARM setend"
3334  if test $setend = "auto" ; then
3335    setend=no
3336    inline_asm_check '"setend be"' && setend=yes
3337  fi
3338  echores "$setend"
3339
3340  echocheck "softfloat ABI"
3341  softfloat=yes
3342  cpp_condition_check '' 'defined(__ARM_PCS_VFP) || (!defined(__ARM_PCS) && !defined(__SOFTFP__))' && softfloat=no
3343  if test $softfloat = "yes" ; then
3344    def_vfp_args='#define HAVE_VFP_ARGS 0'
3345  else
3346    def_vfp_args='#define HAVE_VFP_ARGS 1'
3347  fi
3348  echores "$softfloat"
3349
3350  echocheck "ARM NEON"
3351  if test $neon = "auto" ; then
3352    neon=no
3353    inline_asm_check '"vadd.i16 q0, q0, q0"' && neon=yes
3354    inline_asm_check '"ext   v0.8B, v0.8B, v1.8B, #1"' && neon=yes
3355  fi
3356  echores "$neon"
3357
3358  echocheck "ARM NEON intrinsics"
3359  neon_intrinsics=no
3360  statement_check "arm_neon.h" "int16x8_t test = vdupq_n_s16(0)" && neon_intrinsics=yes
3361  echores "$neon_intrinsics"
3362
3363  echocheck "ARM THUMB"
3364  if test $armthumb = "auto" ; then
3365    armthumb=no
3366  fi
3367  if test $armthumb = "yes" ; then
3368    extra_cflags="$extra_cflags -mthumb"
3369    def_armthumb='#define CONFIG_THUMB 1'
3370  else
3371    aarch64 || extra_cflags="$extra_cflags -marm"
3372    def_armthumb='#define CONFIG_THUMB 0'
3373  fi
3374  echores "$armthumb"
3375
3376  echocheck "iWMMXt (Intel XScale SIMD instructions)"
3377  if test $_iwmmxt = "auto" ; then
3378    _iwmmxt=no
3379    inline_asm_check '"wunpckelub wr6, wr4"' && _iwmmxt=yes
3380  fi
3381  echores "$_iwmmxt"
3382fi
3383
3384intrinsics="none"
3385cpuexts_all='ALTIVEC XOP AVX AVX2 AVX512 FMA3 FMA4 MMX MMX2 MMXEXT AMD3DNOW AMD3DNOWEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE42 FAST_CMOV I686 FAST_CLZ ARMV5TE ARMV6 ARMV6T2 ARMV8 VFP VFPV3 SETEND NEON INTRINSICS_NEON IWMMXT MMI VIS MVI'
3386test "$_altivec"   = yes && cpuexts="ALTIVEC $cpuexts"
3387test "$_mmx"       = yes && cpuexts="MMX $cpuexts"
3388test "$_mmxext"    = yes && cpuexts="MMX2 $cpuexts"
3389test "$_mmxext"    = yes && cpuexts="MMXEXT $cpuexts"
3390test "$_3dnow"     = yes && cpuexts="AMD3DNOW $cpuexts"
3391test "$_3dnowext"  = yes && cpuexts="AMD3DNOWEXT $cpuexts"
3392test "$_sse"       = yes && cpuexts="SSE $cpuexts"
3393test "$_sse2"      = yes && cpuexts="SSE2 $cpuexts"
3394test "$_sse3"      = yes && cpuexts="SSE3 $cpuexts"
3395test "$_ssse3"     = yes && cpuexts="SSSE3 $cpuexts"
3396test "$_sse4_1"    = yes && cpuexts="SSE4 $cpuexts"
3397test "$_sse4_2"    = yes && cpuexts="SSE42 $cpuexts"
3398test "$_avx"       = yes && cpuexts="AVX $cpuexts"
3399test "$_avx2"      = yes && cpuexts="AVX2 $cpuexts"
3400test "$_avx512"    = yes && cpuexts="AVX512 $cpuexts"
3401test "$_xop"       = yes && cpuexts="XOP $cpuexts"
3402test "$_fma3"      = yes && cpuexts="FMA3 $cpuexts"
3403test "$_fma4"      = yes && cpuexts="FMA4 $cpuexts"
3404test "$_cmov"      = yes && cpuexts="I686 $cpuexts"
3405test "$_fast_cmov" = yes && cpuexts="FAST_CMOV $cpuexts"
3406test "$_fast_clz"  = yes && cpuexts="FAST_CLZ $cpuexts"
3407test "$_armv5te"   = yes && cpuexts="ARMV5TE $cpuexts"
3408test "$_armv6"     = yes && cpuexts="ARMV6 $cpuexts"
3409test "$_armv6t2"   = yes && cpuexts="ARMV6T2 $cpuexts"
3410aarch64 && cpuexts="ARMV8 $cpuexts"
3411test "$_armvfp"    = yes && cpuexts="VFP $cpuexts"
3412test "$vfpv3"      = yes && cpuexts="VFPV3 $cpuexts"
3413test "$setend"     = yes && cpuexts="SETEND $cpuexts"
3414test "$neon"       = yes && cpuexts="NEON $cpuexts"
3415test "$neon_intrinsics" = yes && cpuexts="INTRINSICS_NEON $cpuexts" && intrinsics="neon"
3416test "$_iwmmxt"    = yes && cpuexts="IWMMXT $cpuexts"
3417test "$_vis"       = yes && cpuexts="VIS $cpuexts"
3418test "$_mvi"       = yes && cpuexts="MVI $cpuexts"
3419cpuexts_external=""
3420test "$have_yasm"  = yes && cpuexts_external="$cpuexts"
3421cpuexts_inline="$cpuexts"
3422test "$inline_asm" = no && cpuexts_inline=""
3423
3424# Checking kernel version...
3425if x86_32 && linux ; then
3426  _k_verc_problem=no
3427  kernel_version=$(uname -r 2>&1)
3428  echocheck "$system_name kernel version"
3429  case "$kernel_version" in
3430    '') kernel_version="?.??"; _k_verc_fail=yes;;
3431    [0-1].[0-9].[0-9]*|2.[0-3].[0-9]*)
3432      _k_verc_problem=yes;;
3433  esac
3434  if test "$_k_verc_problem" = yes && test "$_sse" = yes ; then
3435    _k_verc_fail=yes
3436  fi
3437  if test "$_k_verc_fail" ; then
3438    echores "$kernel_version, fail"
3439    echo "WARNING! If you want to run MPlayer on this system, get prepared for problems!"
3440    echo "2.2.x has limited SSE support. Upgrade the kernel or use --disable-sse if you"
3441    echo "experience crashes. MPlayer tries to autodetect if your kernel correctly"
3442    echo "supports SSE, but you have been warned! If you are using a kernel older than"
3443    echo "2.2.x you must upgrade it to get SSE support!"
3444#    die "Your kernel is too old for this CPU." # works fine on some 2.2.x so don't die (later check will test)
3445  else
3446    echores "$kernel_version, ok"
3447  fi
3448fi
3449
3450######################
3451# MAIN TESTS GO HERE #
3452######################
3453
3454
3455echocheck "langinfo"
3456if test "$_langinfo" = auto ; then
3457  _langinfo=no
3458  statement_check langinfo.h 'nl_langinfo(CODESET)' && _langinfo=yes
3459fi
3460if test "$_langinfo" = yes ; then
3461  def_langinfo='#define HAVE_LANGINFO 1'
3462else
3463  def_langinfo='#undef HAVE_LANGINFO'
3464fi
3465echores "$_langinfo"
3466
3467
3468echocheck "NLS"
3469test "$_nls" = auto && _nls="$_gui"
3470if test "$_nls" = yes -a "$_gui" = no; then
3471  _nls=no
3472  res_comment="disabled because --enable-gui not specified"
3473fi
3474if test "$_nls" = yes; then
3475  def_nls='#define ENABLE_NLS 1'
3476else
3477  def_nls='#undef ENABLE_NLS'
3478fi
3479echores "$_nls"
3480
3481
3482echocheck "language"
3483# Set preferred languages, "all" uses English as main language.
3484test -z "$language" && language=$LINGUAS
3485test -z "$language_doc" && language_doc=$language
3486test -z "$language_man" && language_man=$language
3487test -z "$language_msg" && language_msg=$language
3488language_doc=$(echo $language_doc | tr , " ")
3489language_man=$(echo $language_man | tr , " ")
3490language_msg=$(echo $language_msg | tr , " ")
3491
3492test "$language_doc" = "all" && language_doc=$doc_lang_all
3493test "$language_man" = "all" && language_man=$man_lang_all
3494if test "$language_msg" = "all"; then
3495  test "$_nls" = yes && language_msg=$msg_lang_all || language_msg=en
3496fi
3497
3498# Prune non-existing translations from language lists.
3499# If NLS is disabled, set message translation to the first available language.
3500# Fall back on English.
3501for lang in $language_doc ; do
3502  test -d DOCS/xml/$lang && tmp_language_doc="$tmp_language_doc $lang"
3503done
3504language_doc=$tmp_language_doc
3505test -z "$language_doc" && language_doc=en
3506
3507for lang in $language_man ; do
3508  test -d DOCS/man/$lang && tmp_language_man="$tmp_language_man $lang"
3509done
3510language_man=$tmp_language_man
3511test -z "$language_man" && language_man=en
3512
3513for lang in $language_msg ; do
3514  if test -f "help/help_mp-${lang}.h"; then
3515    if test "$_nls" = no; then
3516      tmp_en=yes
3517      tmp_language_msg=$lang
3518      language_msg_main=$lang
3519      break
3520    else # _nls, and if more than one language then English is main and must come first
3521      test -n "$tmp_language_msg" && language_msg_main=en
3522      if test "$lang" = en; then
3523        tmp_en=yes
3524        tmp_language_msg="$lang $tmp_language_msg"
3525      else
3526        tmp_language_msg="$tmp_language_msg $lang"
3527      fi
3528      test -z "$language_msg_main" && language_msg_main=$lang
3529    fi
3530  fi
3531done
3532language_msg=$tmp_language_msg
3533test "$language_msg_main" = en -a -z "$tmp_en" && language_msg="en $language_msg"
3534test -z "$language_msg" && language_msg=en && language_msg_main=en
3535_mp_help="help/help_mp-${language_msg_main}.h"
3536language_doc=$(echo $language_doc | tr -s " ")
3537language_man=$(echo $language_man | tr -s " ")
3538language_msg=$(echo $language_msg | tr -s " ")
3539echores "messages: $language_msg - man pages: $language_man - documentation: $language_doc"
3540
3541
3542if test "$_nls" = yes && $(echo "$language_msg" | grep -q " "); then
3543  echocheck "Perl"
3544  if test -z "$(which perl)"; then
3545    echores "no"
3546    echo "configure error: Perl not found; required for NLS"
3547    exit 1
3548  fi
3549  echores "$_nls"
3550  echocheck "msgfmt"
3551  if test -z "$(which msgfmt)"; then
3552    echores "no"
3553    echo "configure error: msgfmt not found; required for NLS"
3554    exit 1
3555  fi
3556  echores "$_nls"
3557fi
3558
3559
3560echocheck "enable sighandler"
3561if test "$_sighandler" = yes ; then
3562  def_sighandler='#define CONFIG_SIGHANDLER 1'
3563else
3564  def_sighandler='#undef CONFIG_SIGHANDLER'
3565fi
3566echores "$_sighandler"
3567
3568echocheck "runtime cpudetection"
3569if test "$_runtime_cpudetection" = yes ; then
3570  _optimizing="Runtime CPU-Detection enabled"
3571  def_runtime_cpudetection='#define CONFIG_RUNTIME_CPUDETECT 1'
3572else
3573  def_runtime_cpudetection='#define CONFIG_RUNTIME_CPUDETECT 0'
3574fi
3575echores "$_runtime_cpudetection"
3576
3577
3578echocheck "restrict keyword"
3579for restrict_keyword in restrict __restrict __restrict__ ; do
3580  echo "void foo(char * $restrict_keyword p); int main(void) { return 0; }" > $TMPC
3581  if cc_check; then
3582    def_restrict_keyword=$restrict_keyword
3583    break;
3584  fi
3585done
3586if [ -n "$def_restrict_keyword" ]; then
3587  echores "$def_restrict_keyword"
3588else
3589  echores "none"
3590fi
3591# Avoid infinite recursion loop ("#define restrict restrict")
3592if [ "$def_restrict_keyword" != "restrict" ]; then
3593  def_restrict_keyword="#define restrict $def_restrict_keyword"
3594else
3595  def_restrict_keyword=""
3596fi
3597
3598
3599echocheck "__builtin_expect"
3600# GCC branch prediction hint
3601cat > $TMPC << EOF
3602static int foo(int a) {
3603    a = __builtin_expect(a, 10);
3604    return a == 10 ? 0 : 1;
3605}
3606int main(void) { return foo(10) && foo(0); }
3607EOF
3608_builtin_expect=no
3609cc_check && _builtin_expect=yes
3610if test "$_builtin_expect" = yes ; then
3611  def_builtin_expect='#define HAVE_BUILTIN_EXPECT 1'
3612else
3613  def_builtin_expect='#undef HAVE_BUILTIN_EXPECT'
3614fi
3615echores "$_builtin_expect"
3616
3617
3618echocheck "kstat"
3619_kstat=no
3620statement_check kstat.h 'kstat_open()' -lkstat && _kstat=yes
3621if test "$_kstat" = yes ; then
3622  def_kstat="#define HAVE_LIBKSTAT 1"
3623  extra_ldflags="$extra_ldflags -lkstat"
3624else
3625  def_kstat="#undef HAVE_LIBKSTAT"
3626fi
3627echores "$_kstat"
3628
3629
3630for func in atanf cbrt cbrtf cosf expf exp2 exp2f isnan isfinite isinf llrint llrintf log2 log2f log10f lrint lrintf rint round roundf sinf trunc truncf erf; do
3631echocheck $func
3632eval _$func=no
3633statement_check math.h "${func}(2.0)" && eval _$func=yes
3634if eval test "x\$_$func" = "xyes"; then
3635  eval def_$func="\"#define HAVE_$(echo $func | toupper) 1\""
3636  echores yes
3637else
3638  eval def_$func="\"#define HAVE_$(echo $func | toupper) 0\""
3639  echores no
3640fi
3641done
3642
3643
3644for func in atan2f fminf ldexpf powf hypot; do
3645echocheck $func
3646eval _$func=no
3647statement_check math.h "${func}(1.0,1.0)" && eval _$func=yes
3648if eval test "x\$_$func" = "xyes"; then
3649  eval def_$func="\"#define HAVE_$(echo $func | toupper) 1\""
3650  echores yes
3651else
3652  eval def_$func="\"#define HAVE_$(echo $func | toupper) 0\""
3653  echores no
3654fi
3655done
3656
3657
3658echocheck "mkstemp"
3659_mkstemp=no
3660statement_check stdlib.h 'mkstemp("")' && _mkstemp=yes
3661if test "$_mkstemp" = yes ; then
3662  def_mkstemp='#define HAVE_MKSTEMP 1'
3663else
3664  def_mkstemp='#define HAVE_MKSTEMP 0'
3665fi
3666echores "$_mkstemp"
3667
3668echocheck "gmtime_r"
3669_gmtime_r=no
3670statement_check time.h 'gmtime_r(0, 0)' && _gmtime_r=yes
3671if test "$_gmtime_r" = yes ; then
3672  def_gmtime_r='#define HAVE_GMTIME_R 1'
3673else
3674  def_gmtime_r='#define HAVE_GMTIME_R 0'
3675fi
3676echores "$_gmtime_r"
3677
3678echocheck "localtime_r"
3679_localtime_r=no
3680statement_check time.h 'localtime_r(0, 0)' && _localtime_r=yes
3681if test "$_localtime_r" = yes ; then
3682  def_localtime_r='#define HAVE_LOCALTIME_R 1'
3683else
3684  def_localtime_r='#define HAVE_LOCALTIME_R 0'
3685fi
3686echores "$_localtime_r"
3687
3688echocheck "nanosleep"
3689_nanosleep=no
3690statement_check time.h 'nanosleep(0, 0)' && _nanosleep=yes
3691if test "$_nanosleep" = yes ; then
3692  def_nanosleep='#define HAVE_NANOSLEEP 1'
3693else
3694  def_nanosleep='#undef HAVE_NANOSLEEP'
3695fi
3696echores "$_nanosleep"
3697
3698echocheck "windows.h"
3699windows_h=no
3700def_windows_h='#define HAVE_WINDOWS_H 0'
3701header_check windows.h && windows_h=yes && def_windows_h='#define HAVE_WINDOWS_H 1' && extra_cflags="$extra_cflags -D_WIN32_WINNT=0x0600"
3702echores "$windows_h"
3703
3704echocheck "socklib"
3705# for Solaris (socket stuff is in -lsocket, gethostbyname and friends in -lnsl):
3706cat > $TMPC << EOF
3707#include <netdb.h>
3708#include <sys/socket.h>
3709int main(void) { gethostbyname(0); socket(AF_INET, SOCK_STREAM, 0); return 0; }
3710EOF
3711_socklib=no
3712for ld_tmp in "" "-lsocket -ldnet" "-lsocket -lnsl" "-lnsl" "-lsocket" ; do
3713  cc_check $ld_tmp && ld_sock="$ld_tmp" && _socklib=yes && break
3714done
3715test $_socklib = yes && test $_winsock2_h = auto && _winsock2_h=no
3716if test $_winsock2_h = auto ; then
3717  _winsock2_h=no
3718  statement_check winsock2.h 'gethostbyname(0)' -lws2_32 && ld_sock="-lws2_32" && _winsock2_h=yes
3719fi
3720test "$ld_sock" && res_comment="using $ld_sock"
3721echores "$_socklib"
3722
3723
3724if test $_winsock2_h = yes ; then
3725  ld_sock="-lws2_32"
3726  def_winsock2_h='#define HAVE_WINSOCK2_H 1'
3727  cc_check_winsock2_h='-DHAVE_WINSOCK2_H=1'
3728else
3729  def_winsock2_h='#define HAVE_WINSOCK2_H 0'
3730  cc_check_winsock2_h='-DHAVE_WINSOCK2_H=0'
3731fi
3732
3733echocheck "struct pollfd"
3734if test "$_struct_pollfd" = auto; then
3735  _struct_pollfd=no
3736  cat > $TMPC << EOF
3737#if HAVE_WINSOCK2_H
3738#include <winsock2.h>
3739#else
3740#include <poll.h>
3741#endif
3742int main(void) { struct pollfd p; return 0; }
3743EOF
3744  cc_check $cc_check_winsock2_h && _struct_pollfd=yes
3745fi
3746echores "$_struct_pollfd"
3747
3748if test "$_struct_pollfd" = yes; then
3749  def_struct_pollfd="#define HAVE_STRUCT_POLLFD 1"
3750else
3751  def_struct_pollfd="#define HAVE_STRUCT_POLLFD 0"
3752fi
3753
3754echocheck "netdb.h, struct addrinfo"
3755if test "$_struct_addrinfo" = auto; then
3756  _struct_addrinfo=no
3757  cat > $TMPC << EOF
3758#if HAVE_WINSOCK2_H
3759#include <winsock2.h>
3760#include <ws2tcpip.h>
3761#else
3762#include <sys/types.h>
3763#include <sys/socket.h>
3764#include <netdb.h>
3765#endif
3766int main(void) { struct addrinfo ai; return 0; }
3767EOF
3768  cc_check $cc_check_winsock2_h && _struct_addrinfo=yes
3769fi
3770echores "$_struct_addrinfo"
3771
3772if test "$_struct_addrinfo" = yes; then
3773  def_struct_addrinfo="#define HAVE_STRUCT_ADDRINFO 1"
3774else
3775  def_struct_addrinfo="#define HAVE_STRUCT_ADDRINFO 0"
3776fi
3777
3778
3779echocheck "netdb.h, getaddrinfo()"
3780if test "$_getaddrinfo" = auto; then
3781  _getaddrinfo=no
3782  cat > $TMPC << EOF
3783#if HAVE_WINSOCK2_H
3784#include <winsock2.h>
3785#else
3786#include <sys/types.h>
3787#include <sys/socket.h>
3788#include <netdb.h>
3789#endif
3790int main(void) { getaddrinfo(0, 0, 0, 0); return 0; }
3791EOF
3792  cc_check $cc_check_winsock2_h && _getaddrinfo=yes
3793fi
3794echores "$_getaddrinfo"
3795
3796if test "$_getaddrinfo" = yes; then
3797  def_getaddrinfo="#define HAVE_GETADDRINFO 1"
3798else
3799  def_getaddrinfo="#define HAVE_GETADDRINFO 0"
3800fi
3801
3802
3803echocheck "sockaddr_storage"
3804if test "$_struct_sockaddr_storage" = auto; then
3805  _struct_sockaddr_storage=no
3806  cat > $TMPC << EOF
3807#if HAVE_WINSOCK2_H
3808#include <winsock2.h>
3809#else
3810#include <sys/types.h>
3811#include <sys/socket.h>
3812#endif
3813int main(void) { struct sockaddr_storage sas; return 0; }
3814EOF
3815  cc_check $cc_check_winsock2_h && _struct_sockaddr_storage=yes
3816fi
3817echores "$_struct_sockaddr_storage"
3818
3819if test "$_struct_sockaddr_storage" = yes; then
3820  def_struct_sockaddr_storage="#define HAVE_STRUCT_SOCKADDR_STORAGE 1"
3821else
3822  def_struct_sockaddr_storage="#define HAVE_STRUCT_SOCKADDR_STORAGE 0"
3823fi
3824
3825
3826echocheck "struct ipv6_mreq"
3827_struct_ipv6_mreq=no
3828def_struct_ipv6_mreq="#define HAVE_STRUCT_IPV6_MREQ 0"
3829cat > $TMPC << EOF
3830#if HAVE_WINSOCK2_H
3831#include <ws2tcpip.h>
3832#else
3833#include <netinet/in.h>
3834#endif
3835int main(void) { struct ipv6_mreq mreq6; return 0; }
3836EOF
3837cc_check $cc_check_winsock2_h && _struct_ipv6_mreq=yes &&
3838  def_struct_ipv6_mreq="#define HAVE_STRUCT_IPV6_MREQ 1"
3839echores "$_struct_ipv6_mreq"
3840
3841
3842echocheck "struct sockaddr_in6"
3843_struct_sockaddr_in6=no
3844def_struct_sockaddr_in6="#define HAVE_STRUCT_SOCKADDR_IN6 0"
3845cat > $TMPC << EOF
3846#if HAVE_WINSOCK2_H
3847#include <ws2tcpip.h>
3848#else
3849#include <netinet/in.h>
3850#endif
3851int main(void) { struct sockaddr_in6 addr; return 0; }
3852EOF
3853cc_check $cc_check_winsock2_h && _struct_sockaddr_in6=yes &&
3854  def_struct_sockaddr_in6="#define HAVE_STRUCT_SOCKADDR_IN6 1"
3855echores "$_struct_sockaddr_in6"
3856
3857
3858echocheck "struct sockaddr sa_len"
3859_struct_sockaddr_sa_len=no
3860def_struct_sockaddr_sa_len="#define HAVE_STRUCT_SOCKADDR_SA_LEN 0"
3861cat > $TMPC << EOF
3862#if HAVE_WINSOCK2_H
3863#include <winsock2.h>
3864#else
3865#include <sys/types.h>
3866#include <sys/socket.h>
3867#endif
3868int main(void) { const void *p = &((struct sockaddr *)0)->sa_len; return 0; }
3869EOF
3870cc_check $cc_check_winsock2_h && _struct_sockaddr_sa_len=yes &&
3871  def_struct_sockaddr_sa_len="#define HAVE_STRUCT_SOCKADDR_SA_LEN 1"
3872echores "$_struct_sockaddr_sa_len"
3873
3874
3875echocheck "arpa/inet.h"
3876arpa_inet_h=no
3877def_arpa_inet_h='#define HAVE_ARPA_INET_H 0'
3878header_check arpa/inet.h && arpa_inet_h=yes &&
3879  def_arpa_inet_h='#define HAVE_ARPA_INET_H 1'
3880echores "$arpa_inet_h"
3881
3882
3883echocheck "inet_pton()"
3884def_inet_pton='#define HAVE_INET_PTON 0'
3885inet_pton=no
3886for ld_tmp in "$ld_sock" "$ld_sock -lresolv" ; do
3887  statement_check arpa/inet.h 'inet_pton(0, 0, 0)' $ld_tmp && inet_pton=yes && break
3888done
3889if test $inet_pton = yes ; then
3890  test "$ld_tmp" && res_comment="using $ld_tmp"
3891  def_inet_pton='#define HAVE_INET_PTON 1'
3892fi
3893echores "$inet_pton"
3894
3895
3896echocheck "inet_aton()"
3897def_inet_aton='#define HAVE_INET_ATON 0'
3898inet_aton=no
3899for ld_tmp in "$ld_sock" "$ld_sock -lresolv" ; do
3900  define_statement_check _BSD_SOURCE arpa/inet.h 'inet_aton(0, 0)' $ld_tmp && inet_aton=yes && break
3901done
3902if test $inet_aton = yes ; then
3903  test "$ld_tmp" && res_comment="using $ld_tmp"
3904  def_inet_aton='#define HAVE_INET_ATON 1'
3905fi
3906echores "$inet_aton"
3907
3908
3909echocheck "socklen_t"
3910_socklen_t=no
3911cat > $TMPC << EOF
3912#if HAVE_WINSOCK2_H
3913#include <ws2tcpip.h>
3914#else
3915#include <sys/socket.h>
3916#include <sys/types.h>
3917#endif
3918int main(void) { socklen_t v = 0; return 0; }
3919EOF
3920cc_check $cc_check_winsock2_h && _socklen_t=yes
3921if test "$_socklen_t" = yes ; then
3922  def_socklen_t='#define HAVE_SOCKLEN_T 1'
3923else
3924  def_socklen_t='#define HAVE_SOCKLEN_T 0'
3925fi
3926echores "$_socklen_t"
3927
3928
3929echocheck "closesocket()"
3930_closesocket=no
3931statement_check winsock2.h 'closesocket(~0)' $ld_sock && _closesocket=yes
3932if test "$_closesocket" = yes ; then
3933  def_closesocket='#define HAVE_CLOSESOCKET 1'
3934else
3935  def_closesocket='#define HAVE_CLOSESOCKET 0'
3936fi
3937echores "$_closesocket"
3938
3939
3940echocheck "networking"
3941test $_winsock2_h = no && test $inet_pton = no &&
3942  test $inet_aton = no && networking=no
3943if test "$networking" = yes ; then
3944  def_network='#define CONFIG_NETWORK 1'
3945  def_networking='#define CONFIG_NETWORKING 1'
3946  def_rtpdec='#define CONFIG_RTPDEC 1'
3947  extra_ldflags="$extra_ldflags $ld_sock"
3948  inputmodules="networking $inputmodules"
3949else
3950  noinputmodules="networking $noinputmodules"
3951  def_network='#define CONFIG_NETWORK 0'
3952  def_networking='#undef CONFIG_NETWORKING'
3953  def_rtpdec='#define CONFIG_RTPDEC 0'
3954  libavprotocols=$(filter_out_component protocol 'GOPHER HTTP MMSH MMST RTMP RTP SCTP TCP UDP')
3955  libavdemuxers=$(filter_out_component demuxer 'RTP RTSP SAP SDP')
3956fi
3957echores "$networking"
3958
3959
3960echocheck "inet6"
3961if test "$_inet6" = auto ; then
3962  cat > $TMPC << EOF
3963#include <sys/types.h>
3964#if !defined(_WIN32)
3965#include <sys/socket.h>
3966#include <netinet/in.h>
3967#else
3968#include <ws2tcpip.h>
3969#endif
3970int main(void) { struct sockaddr_in6 six; socket(AF_INET6, SOCK_STREAM, AF_INET6); return 0; }
3971EOF
3972  _inet6=no
3973  if cc_check $ld_sock ; then
3974    _inet6=yes
3975  fi
3976fi
3977if test "$_inet6" = yes ; then
3978  def_inet6='#define HAVE_AF_INET6 1'
3979else
3980  def_inet6='#undef HAVE_AF_INET6'
3981fi
3982echores "$_inet6"
3983
3984
3985echocheck "gethostbyname2"
3986if test "$_gethostbyname2" = auto ; then
3987cat > $TMPC << EOF
3988#define _BSD_SOURCE
3989#include <sys/types.h>
3990#include <sys/socket.h>
3991#include <netdb.h>
3992int main(void) { gethostbyname2("", AF_INET); return 0; }
3993EOF
3994  _gethostbyname2=no
3995  if cc_check ; then
3996    _gethostbyname2=yes
3997  fi
3998fi
3999if test "$_gethostbyname2" = yes ; then
4000  def_gethostbyname2='#define HAVE_GETHOSTBYNAME2 1'
4001else
4002  def_gethostbyname2='#undef HAVE_GETHOSTBYNAME2'
4003fi
4004echores "$_gethostbyname2"
4005
4006echocheck "SCTP"
4007if test "$_sctp" = auto ; then
4008  _sctp=no
4009  if header_check netinet/sctp.h; then
4010    _sctp=yes
4011  fi
4012fi
4013if test "$_sctp" = no ; then
4014  libavprotocols=$(filter_out_component protocol 'SCTP')
4015fi
4016echores "$_sctp"
4017
4018echocheck "sys/un.h"
4019un_h=no
4020header_check sys/un.h && un_h=yes
4021if test "$un_h" = "no" ; then
4022  libavprotocols=$(filter_out_component protocol 'UNIX')
4023fi
4024echores "$un_h"
4025
4026echocheck "sys/poll.h"
4027poll_h=no
4028def_poll_h='#define HAVE_POLL_H 0'
4029header_check sys/poll.h && poll_h=yes &&
4030  def_poll_h='#define HAVE_POLL_H 1'
4031echores "$poll_h"
4032
4033echocheck "unistd.h"
4034unistd_h=no
4035def_unistd_h='#define HAVE_UNISTD_H 0'
4036header_check unistd.h && unistd_h=yes &&
4037  def_unistd_h='#define HAVE_UNISTD_H 1'
4038echores "$unistd_h"
4039
4040echocheck "emmintrin.h (SSE intrinsics)"
4041emmintrin_h=no
4042def_emmintrin_h='#define HAVE_EMMINTRIN_H 0'
4043  cat > $TMPC << EOF
4044#include <emmintrin.h>
4045
4046#ifndef _MSC_VER
4047__attribute__((target("sse2")))
4048#endif
4049static int sse2test(int i) {
4050    __m128i mmi = _mm_set1_epi16(i);
4051    mmi = _mm_add_epi16(mmi, mmi);
4052    return _mm_extract_epi16(mmi, 2);
4053}
4054
4055int main(int argc, char **argv) {
4056    return sse2test(argc);
4057}
4058EOF
4059cc_check && emmintrin_h=yes &&
4060  def_emmintrin_h='#define HAVE_EMMINTRIN_H 1'
4061echores "$emmintrin_h"
4062
4063echocheck "inttypes.h (required)"
4064_inttypes=no
4065header_check inttypes.h && _inttypes=yes
4066echores "$_inttypes"
4067
4068if test "$_inttypes" = no ; then
4069  echocheck "sys/bitypes.h (inttypes.h predecessor)"
4070  header_check sys/bitypes.h && _inttypes=yes
4071  if test "$_inttypes" = yes ; then
4072    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."
4073  else
4074    die "Cannot find header either inttypes.h or bitypes.h. There is no chance for compilation to succeed."
4075  fi
4076fi
4077
4078
4079echocheck "int_fastXY_t in inttypes.h"
4080_fast_inttypes=no
4081statement_check "inttypes.h" 'volatile int_fast16_t v = 0' && _fast_inttypes=yes
4082if test "$_fast_inttypes" = no ; then
4083  def_fast_inttypes='
4084    typedef signed char int_fast8_t;
4085    typedef signed int  int_fast16_t;
4086    typedef signed int  int_fast32_t;
4087    typedef signed long long int_fast64_t;
4088    typedef unsigned char uint_fast8_t;
4089    typedef unsigned int  uint_fast16_t;
4090    typedef unsigned int  uint_fast32_t;
4091    typedef unsigned long long uint_fast64_t;'
4092fi
4093echores "$_fast_inttypes"
4094
4095
4096echocheck "stdatomic.h"
4097stdatomic_h=no
4098# need to use statement_check because some implementations (Rasbian) create a dependency
4099# on libatomic, in which case we rather want to use the fallback
4100statement_check stdatomic.h "atomic_int_least64_t a; atomic_fetch_add_explicit(&a, 5, memory_order_relaxed)" && stdatomic_h=yes
4101echores "$stdatomic_h"
4102if test "$stdatomic_h" = no ; then
4103  if msvc ; then
4104    CFLAGS="-Icompat/atomics/win32 $CFLAGS"
4105  else
4106    CFLAGS="-Icompat/atomics/gcc $CFLAGS"
4107    if ! statement_check ffmpeg/compat/atomics/gcc/stdatomic.h "atomic_int_least64_t a; atomic_fetch_add_explicit(&a, 5, memory_order_relaxed)" ; then
4108        # These are the only ones needing 64-bit atomics.
4109        # They are not worth adding a dependency or even worse switching to a
4110        # badly inefficient pthreads-based atomics implementation
4111        libavmuxers=$(filter_out_component muxer 'FIFO FIFO_TEST')
4112    fi
4113  fi
4114fi
4115
4116echocheck "malloc.h"
4117_malloc=no
4118header_check malloc.h && _malloc=yes
4119if test "$_malloc" = yes ; then
4120  def_malloc_h='#define HAVE_MALLOC_H 1'
4121else
4122  def_malloc_h='#define HAVE_MALLOC_H 0'
4123fi
4124echores "$_malloc"
4125
4126
4127echocheck "aligned malloc"
4128aligned_malloc=no
4129def_aligned_malloc='#define HAVE_ALIGNED_MALLOC 0'
4130statement_check malloc.h '_aligned_malloc(1, 32)' && aligned_malloc=yes &&
4131  def_aligned_malloc='#define HAVE_ALIGNED_MALLOC 1'
4132echores "$aligned_malloc"
4133
4134
4135echocheck "memalign()"
4136# XXX restrict to x86 ? extend to other CPUs/cacheline sizes ?
4137def_memalign_hack='#define CONFIG_MEMALIGN_HACK 0'
4138_memalign=no
4139statement_check malloc.h 'memalign(64, sizeof(char))' && _memalign=yes
4140if test "$_memalign" = yes ; then
4141  def_memalign='#define HAVE_MEMALIGN 1'
4142else
4143  def_memalign='#define HAVE_MEMALIGN 0'
4144fi
4145echores "$_memalign"
4146
4147
4148echocheck "posix_memalign()"
4149posix_memalign=no
4150def_posix_memalign='#define HAVE_POSIX_MEMALIGN 0'
4151statement_check stdlib.h 'posix_memalign(NULL, 0, 0)' &&
4152    posix_memalign=yes && def_posix_memalign='#define HAVE_POSIX_MEMALIGN 1'
4153echores "$posix_memalign"
4154
4155
4156echocheck "alloca.h"
4157_alloca=no
4158statement_check alloca.h 'alloca(0)' && _alloca=yes
4159if test "$_alloca" = yes ; then
4160  def_alloca_h='#define HAVE_ALLOCA_H 1'
4161else
4162  def_alloca_h='#undef HAVE_ALLOCA_H'
4163fi
4164echores "$_alloca"
4165
4166
4167echocheck "fastmemcpy"
4168if test "$_fastmemcpy" = yes ; then
4169  def_fastmemcpy='#define CONFIG_FASTMEMCPY 1'
4170else
4171  def_fastmemcpy='#undef CONFIG_FASTMEMCPY'
4172fi
4173echores "$_fastmemcpy"
4174
4175
4176echocheck "hard-coded tables"
4177if test "$hardcoded_tables" = yes ; then
4178  def_hardcoded_tables='#define CONFIG_HARDCODED_TABLES 1'
4179  mak_hardcoded_tables='CONFIG_HARDCODED_TABLES = yes'
4180else
4181  def_hardcoded_tables='#define CONFIG_HARDCODED_TABLES 0'
4182fi
4183echores "$hardcoded_tables"
4184
4185
4186echocheck "mman.h"
4187_mman=no
4188statement_check sys/mman.h 'mmap(0, 0, 0, 0, 0, 0)' && _mman=yes
4189if test "$_mman" = yes ; then
4190  def_mmap='#define HAVE_MMAP 1'
4191  def_mman_h='#define HAVE_SYS_MMAN_H 1'
4192else
4193  def_mmap='#define HAVE_MMAP 0'
4194  def_mman_h='#define HAVE_SYS_MMAN_H 0'
4195  os2 && mmap=no
4196fi
4197echores "$_mman"
4198
4199_mman_has_map_failed=no
4200statement_check sys/mman.h 'void *p = MAP_FAILED' && _mman_has_map_failed=yes
4201if test "$_mman_has_map_failed" = yes ; then
4202  def_mman_has_map_failed=''
4203else
4204  def_mman_has_map_failed='#define MAP_FAILED ((void *) -1)'
4205fi
4206
4207
4208echocheck "mprotect"
4209mprotect=no
4210def_mprotect='#define HAVE_MPROTECT 0'
4211statement_check_broken stddef.h sys/mman.h 'mprotect(NULL, 0, 0)' && mprotect=yes
4212echores "$mprotect"
4213
4214
4215echocheck "dynamic loader"
4216_dl=no
4217for ld_tmp in "" -ldl; do
4218  statement_check dlfcn.h 'dlopen("", 0)' $ld_tmp && ld_dl="$ld_tmp" && _dl=yes && break
4219done
4220if test "$_dl" = yes ; then
4221  def_dl='#define HAVE_LIBDL 1'
4222else
4223  def_dl='#undef HAVE_LIBDL'
4224fi
4225echores "$_dl"
4226
4227
4228echocheck "dynamic a/v plugins support"
4229if test "$_dl" = no ; then
4230  _dynamic_plugins=no
4231fi
4232if test "$_dynamic_plugins" = yes ; then
4233  def_dynamic_plugins='#define CONFIG_DYNAMIC_PLUGINS 1'
4234else
4235  def_dynamic_plugins='#undef CONFIG_DYNAMIC_PLUGINS'
4236fi
4237echores "$_dynamic_plugins"
4238
4239
4240def_threads='#define HAVE_THREADS 0'
4241def_pthreads='#define HAVE_PTHREADS 0'
4242def_w32threads='#define HAVE_W32THREADS 0'
4243def_os2threads='#define HAVE_OS2THREADS 0'
4244
4245echocheck "pthread"
4246if linux ; then
4247  THREAD_CFLAGS=-D_REENTRANT
4248elif freebsd || netbsd || openbsd || bsdos ; then
4249  THREAD_CFLAGS=
4250fi
4251if test "$_pthreads" = auto ; then
4252cat > $TMPC << EOF
4253#include <pthread.h>
4254static void *func(void *arg) { return arg; }
4255int main(void) { pthread_t tid; return pthread_create(&tid, 0, func, 0) == 0 ? 0 : 1; }
4256EOF
4257_pthreads=no
4258if ! hpux ; then
4259  for ld_tmp in "-lpthread" "-pthread" ; do
4260    # for crosscompilation, we cannot execute the program, be happy if we can link statically
4261    cc_check $THREAD_CFLAGS $ld_tmp && (tmp_run || test "$ld_static") && ld_pthread="$ld_tmp" && _pthreads=yes && break
4262  done
4263fi
4264fi
4265if test "$_pthreads" = yes ; then
4266  test $ld_pthread && res_comment="using $ld_pthread"
4267  def_pthreads='#define HAVE_PTHREADS 1'
4268  def_threads='#define HAVE_THREADS 1'
4269  extra_cflags="$extra_cflags $THREAD_CFLAGS"
4270else
4271  res_comment="v4l, v4l2, ao_nas, win32 loader disabled"
4272  def_pthreads='#define HAVE_PTHREADS 0'
4273  _nas=no ; _tv_v4l1=no ; _tv_v4l2=no
4274  mingw32 || _win32dll=no
4275fi
4276echores "$_pthreads"
4277
4278pthread_cancel=no
4279if test "$_pthreads" = yes ; then
4280  echocheck "pthread_cancel"
4281cat > $TMPC << EOF
4282#include <pthread.h>
4283int main(void) { pthread_t t; return pthread_cancel(t); }
4284EOF
4285  cc_check $ld_pthread && pthread_cancel=yes
4286  echores "$pthread_cancel"
4287fi
4288if test "$pthread_cancel" = yes ; then
4289  def_pthread_cancel='#define HAVE_PTHREAD_CANCEL 1'
4290else
4291  def_pthread_cancel='#define HAVE_PTHREAD_CANCEL 0'
4292fi
4293
4294if cygwin ; then
4295  if test "$_pthreads" = yes ; then
4296    def_pthread_cache="#define PTHREAD_CACHE 1"
4297  else
4298    _stream_cache=no
4299    def_stream_cache="#undef CONFIG_STREAM_CACHE"
4300  fi
4301fi
4302
4303
4304if win32; then
4305echocheck "w32threads"
4306if test "$_pthreads" = yes ; then
4307  res_comment="using pthread instead"
4308  _w32threads=no
4309fi
4310if test "$_w32threads" = auto ; then
4311  _w32threads=no
4312  mingw32 && _w32threads=yes
4313fi
4314test "$_w32threads" = yes && def_threads='#define HAVE_THREADS 1' && def_w32threads='#define HAVE_W32THREADS 1'
4315echores "$_w32threads"
4316fi #if win32; then
4317
4318
4319echocheck "direct.h"
4320_direct_h=no
4321def_direct_h='#define HAVE_DIRECT_H 0'
4322header_check direct.h && _direct_h=yes && def_direct_h='#define HAVE_DIRECT_H 1'
4323echores "$_direct_h"
4324
4325
4326if os2 ; then
4327echocheck "os2threads"
4328if test "$_pthreads" = yes ; then
4329  res_comment="using pthread instead"
4330  _os2threads=no
4331fi
4332if test "$_os2threads" = auto ; then
4333  _os2threads=no
4334  os2 && _os2threads=yes
4335fi
4336test "$_os2threads" = yes && def_threads='#define HAVE_THREADS 1' && def_os2threads='#define HAVE_OS2THREADS 1'
4337echores "$_os2threads"
4338fi #if os2
4339
4340if test "$_os2threads" = yes || test "$_w32threads" = yes || test "$_pthreads" = yes ; then
4341    _threads=yes
4342else
4343    _threads=no
4344fi
4345
4346
4347echocheck "io.h"
4348_io_h=no
4349header_check io.h && _io_h=yes
4350if [ $_io_h = yes ]; then
4351  def_io_h='#define HAVE_IO_H 1'
4352else
4353  def_io_h='#define HAVE_IO_H 0'
4354fi
4355echores "$_io_h"
4356
4357
4358echocheck "rpath"
4359if test "$_rpath" = yes ; then
4360  for I in $(echo $extra_ldflags | sed 's/-L//g') ; do
4361    tmp="$tmp $(echo $I | sed 's/.*/ -L& -Wl,-R&/')"
4362  done
4363extra_ldflags=$tmp
4364fi
4365echores "$_rpath"
4366
4367echocheck "iconv"
4368if test "$_iconv" = auto ; then
4369  cat > $TMPC << EOF
4370#include <stdio.h>
4371#include <unistd.h>
4372#include <iconv.h>
4373#define INBUFSIZE 1024
4374#define OUTBUFSIZE 4096
4375
4376char inbuffer[INBUFSIZE];
4377char outbuffer[OUTBUFSIZE];
4378
4379int main(void) {
4380  size_t numread;
4381  iconv_t icdsc;
4382  char *tocode="UTF-8";
4383  char *fromcode="cp1250";
4384  if ((icdsc = iconv_open(tocode, fromcode)) != (iconv_t)(-1)) {
4385    while ((numread = read(0, inbuffer, INBUFSIZE))) {
4386      char *iptr=inbuffer;
4387      char *optr=outbuffer;
4388      size_t inleft=numread;
4389      size_t outleft=OUTBUFSIZE;
4390      if (iconv(icdsc, &iptr, &inleft, &optr, &outleft)
4391          != (size_t)(-1)) {
4392        write(1, outbuffer, OUTBUFSIZE - outleft);
4393      }
4394    }
4395    if (iconv_close(icdsc) == -1)
4396      ;
4397  }
4398  return 0;
4399}
4400EOF
4401  _iconv=no
4402  for ld_tmp in "" "-L$_prefix/lib " "-L/usr/local/lib -liconv" "-liconv" "-liconv $ld_dl" ; do
4403    cc_check $ld_tmp && extra_ldflags="$extra_ldflags $ld_tmp" &&
4404      ld_iconv="$ld_tmp" && _iconv=yes && break
4405  done
4406fi
4407if test "$_iconv" = yes ; then
4408  def_iconv='#define CONFIG_ICONV 1'
4409else
4410  def_iconv='#undef CONFIG_ICONV'
4411fi
4412echores "$_iconv"
4413
4414
4415echocheck "soundcard.h"
4416_soundcard_h=no
4417def_soundcard_h='#undef HAVE_SOUNDCARD_H'
4418def_sys_soundcard_h='#undef HAVE_SYS_SOUNDCARD_H'
4419for _soundcard_header in "sys/soundcard.h" "soundcard.h"; do
4420  header_check $_soundcard_header && _soundcard_h=yes &&
4421    res_comment="$_soundcard_header" && break
4422done
4423
4424if test "$_soundcard_h" = yes ; then
4425  if test $_soundcard_header = "sys/soundcard.h"; then
4426    def_sys_soundcard_h='#define HAVE_SYS_SOUNDCARD_H 1'
4427  else
4428    def_soundcard_h='#define HAVE_SOUNDCARD_H 1'
4429  fi
4430fi
4431echores "$_soundcard_h"
4432
4433
4434echocheck "termcap"
4435if test "$_termcap" = auto ; then
4436  _termcap=no
4437  for ld_tmp in "/usr/lib/libncurses.so" "-ltinfo" "-ltermcap"; do
4438    statement_check term.h 'tgetent(0, 0)' $ld_tmp &&
4439      extra_ldflags="$extra_ldflags $ld_tmp" &&
4440      ld_termcap="$ld_tmp" && _termcap=yes && break
4441  done
4442fi
4443if test "$_termcap" = yes ; then
4444  def_termcap='#define HAVE_TERMCAP 1'
4445  test $ld_termcap && res_comment="using $ld_termcap"
4446else
4447  def_termcap='#undef HAVE_TERMCAP'
4448fi
4449echores "$_termcap"
4450
4451
4452echocheck "termios"
4453def_termios='#undef HAVE_TERMIOS'
4454def_termios_h='#undef HAVE_TERMIOS_H'
4455def_termios_sys_h='#undef HAVE_SYS_TERMIOS_H'
4456if test "$_termios" = auto ; then
4457  _termios=no
4458  for _termios_header in "termios.h" "sys/termios.h"; do
4459  header_check $_termios_header && _termios=yes &&
4460    res_comment="using $_termios_header" && break
4461done
4462fi
4463
4464if test "$_termios" = yes ; then
4465  def_termios='#define HAVE_TERMIOS 1'
4466  if test "$_termios_header" = "termios.h" ; then
4467    def_termios_h='#define HAVE_TERMIOS_H 1'
4468  else
4469    def_termios_sys_h='#define HAVE_SYS_TERMIOS_H 1'
4470  fi
4471fi
4472echores "$_termios"
4473
4474
4475echocheck "shm"
4476if test "$_shm" = auto ; then
4477  _shm=no
4478  statement_check sys/shm.h 'shmget(0, 0, 0); shmat(0, 0, 0); shmctl(0, 0, 0)' && _shm=yes
4479fi
4480if test "$_shm" = yes ; then
4481  def_shm='#define HAVE_SHM 1'
4482else
4483  def_shm='#undef HAVE_SHM'
4484fi
4485echores "$_shm"
4486
4487
4488echocheck "strsep()"
4489strsep=yes
4490def_strsep='#define HAVE_STRSEP 1'
4491define_statement_check _BSD_SOURCE string.h 'char *s = "Hello, world!"; strsep(&s, ",")' ||
4492    { strsep=no ; def_strsep='#undef HAVE_STRSEP' ; }
4493echores "$strsep"
4494
4495
4496echocheck "vsscanf()"
4497vsscanf=yes
4498def_vsscanf='#define HAVE_VSSCANF 1'
4499statement_check_broken stdarg.h stdio.h 'va_list ap; vsscanf("foo", "bar", ap)' ||
4500    { vsscanf=no ; def_vsscanf='#undef HAVE_VSSCANF' ; }
4501echores "$vsscanf"
4502
4503
4504echocheck "POSIX select()"
4505cat > $TMPC << EOF
4506#include <stdio.h>
4507#include <stdlib.h>
4508#include <sys/types.h>
4509#include <string.h>
4510#include <sys/time.h>
4511#include <unistd.h>
4512int main(void) {int nfds = 1; fd_set readfds; struct timeval timeout; select(nfds, &readfds, NULL, NULL, &timeout); return 0; }
4513EOF
4514_posix_select=no
4515def_posix_select='#undef HAVE_POSIX_SELECT'
4516#select() of kLIBC (OS/2) supports socket only
4517! os2 && cc_check && _posix_select=yes &&
4518    def_posix_select='#define HAVE_POSIX_SELECT 1'
4519echores "$_posix_select"
4520
4521
4522echocheck "audio select()"
4523if test "$_select" = no ; then
4524  def_select='#undef HAVE_AUDIO_SELECT'
4525elif test  "$_select" = yes ; then
4526  def_select='#define HAVE_AUDIO_SELECT 1'
4527fi
4528echores "$_select"
4529
4530
4531echocheck "gettimeofday()"
4532gettimeofday=yes
4533def_gettimeofday='#define HAVE_GETTIMEOFDAY 1'
4534statement_check_broken stddef.h sys/time.h 'struct timeval tv; gettimeofday(&tv, NULL)' ||
4535    { gettimeofday=no ; def_gettimeofday='#undef HAVE_GETTIMEOFDAY' ; }
4536echores "$gettimeofday"
4537
4538
4539echocheck "clock_gettime()"
4540clock_gettime=no
4541def_clock_gettime='#undef HAVE_CLOCK_GETTIME'
4542for ld_tmp in "" "-lrt" ; do
4543  if statement_check_broken stddef.h time.h 'struct timespec tp; clock_gettime(CLOCK_MONOTONIC, &tp)' $ld_tmp ; then
4544    clock_gettime=yes
4545    def_clock_gettime='#define HAVE_CLOCK_GETTIME 1'
4546    extra_ldflags="$extra_ldflags $ld_tmp"
4547    break
4548  fi
4549done
4550echores "$clock_gettime"
4551
4552
4553echocheck "glob()"
4554# glob_win disables a Windows-specific glob() replacement.
4555glob=yes
4556glob_win=yes
4557def_glob='#define HAVE_GLOB 1'
4558statement_check glob.h 'glob("filename", 0, 0, 0)' ||
4559    { glob=no ; def_glob='#undef HAVE_GLOB' ;
4560      mingw32 && glob_win=no ; }
4561echores "$glob"
4562
4563
4564echocheck "setenv()"
4565setenv=yes
4566def_setenv='#define HAVE_SETENV 1'
4567statement_check stdlib.h 'setenv("", "", 0)' ||
4568    { setenv=no ; def_setenv='#define HAVE_SETENV 0' ; }
4569echores "$setenv"
4570
4571
4572echocheck "setmode()"
4573_setmode=no
4574def_setmode='#define HAVE_SETMODE 0'
4575statement_check io.h 'setmode(0, 0)' && _setmode=yes && def_setmode='#define HAVE_SETMODE 1'
4576echores "$_setmode"
4577
4578
4579if sunos; then
4580echocheck "sysi86()"
4581_sysi86=no
4582def_sysi86='#define HAVE_SYSI86 0'
4583statement_check sys/sysi86.h 'int sysi86(int, void*); sysi86(0)' &&
4584  _sysi86=yes && def_sysi86='#define HAVE_SYSI86 1'
4585echores "$_sysi86"
4586fi #if sunos
4587
4588
4589echocheck "sys/sysinfo.h"
4590_sys_sysinfo=no
4591statement_check sys/sysinfo.h 'struct sysinfo s_info; s_info.mem_unit=0; sysinfo(&s_info)' && _sys_sysinfo=yes
4592if test "$_sys_sysinfo" = yes ; then
4593  def_sys_sysinfo_h='#define HAVE_SYS_SYSINFO_H 1'
4594else
4595  def_sys_sysinfo_h='#undef HAVE_SYS_SYSINFO_H'
4596fi
4597echores "$_sys_sysinfo"
4598
4599
4600if darwin; then
4601
4602echocheck "Mac OS X Finder Support"
4603def_macosx_finder='#undef CONFIG_MACOSX_FINDER'
4604if test "$_macosx_finder" = yes ; then
4605  def_macosx_finder='#define CONFIG_MACOSX_FINDER 1'
4606  extra_ldflags="$extra_ldflags -framework Carbon"
4607fi
4608echores "$_macosx_finder"
4609
4610echocheck "Mac OS X Bundle file locations"
4611def_macosx_bundle='#undef CONFIG_MACOSX_BUNDLE'
4612test "$_macosx_bundle" = auto && _macosx_bundle=$_macosx_finder
4613if test "$_macosx_bundle" = yes ; then
4614  def_macosx_bundle='#define CONFIG_MACOSX_BUNDLE 1'
4615  extra_ldflags="$extra_ldflags -framework Carbon"
4616fi
4617echores "$_macosx_bundle"
4618
4619echocheck "Apple Remote"
4620if test "$_apple_remote" = auto ; then
4621  _apple_remote=no
4622  cat > $TMPC <<EOF
4623#include <stdio.h>
4624#include <IOKit/IOCFPlugIn.h>
4625int main(void) {
4626  io_iterator_t hidObjectIterator = (io_iterator_t)NULL;
4627  CFMutableDictionaryRef hidMatchDictionary;
4628  IOReturn ioReturnValue;
4629
4630  // Set up a matching dictionary to search the I/O Registry by class.
4631  // name for all HID class devices
4632  hidMatchDictionary = IOServiceMatching("AppleIRController");
4633
4634  // Now search I/O Registry for matching devices.
4635  ioReturnValue = IOServiceGetMatchingServices(kIOMasterPortDefault,
4636                      hidMatchDictionary, &hidObjectIterator);
4637
4638  // If search is unsuccessful, return nonzero.
4639  if (ioReturnValue != kIOReturnSuccess ||
4640                       !IOIteratorIsValid(hidObjectIterator)) {
4641    return 1;
4642  }
4643  return 0;
4644}
4645EOF
4646  cc_check -framework IOKit && _apple_remote=yes
4647fi
4648if test "$_apple_remote" = yes ; then
4649  def_apple_remote='#define CONFIG_APPLE_REMOTE 1'
4650  libs_mplayer="$libs_mplayer -framework IOKit -framework Cocoa"
4651else
4652  def_apple_remote='#undef CONFIG_APPLE_REMOTE'
4653fi
4654echores "$_apple_remote"
4655
4656fi #if darwin
4657
4658if linux; then
4659
4660echocheck "Apple IR"
4661if test "$_apple_ir" = auto ; then
4662  _apple_ir=no
4663  statement_check linux/input.h 'struct input_event ev; struct input_id id' && _apple_ir=yes
4664fi
4665if test "$_apple_ir" = yes ; then
4666  def_apple_ir='#define CONFIG_APPLE_IR 1'
4667else
4668  def_apple_ir='#undef CONFIG_APPLE_IR'
4669fi
4670echores "$_apple_ir"
4671fi #if linux
4672
4673echocheck "pkg-config"
4674_pkg_config=pkg-config
4675if $($_pkg_config --version > /dev/null 2>&1); then
4676  if test "$ld_static"; then
4677    _pkg_config="$_pkg_config --static"
4678  fi
4679  echores "yes"
4680else
4681  _pkg_config=false
4682  echores "no"
4683fi
4684
4685
4686echocheck "GnuTLS"
4687if test "$_gnutls" = auto ; then
4688  _gnutls=no
4689  if $_pkg_config --exists gnutls ; then
4690	  statement_check gnutls/gnutls.h 'gnutls_global_init()' $($_pkg_config --libs --cflags gnutls) &&
4691      _gnutls=yes
4692  fi
4693fi
4694if test "$_gnutls" = yes ; then
4695  def_gnutls='#define CONFIG_GNUTLS 1'
4696  libavprotocols="$libavprotocols HTTPS_PROTOCOL"
4697  if contains_item "$libavprotocols_all" 'TLS_GNUTLS_PROTOCOL' ; then
4698      libavprotocols="$libavprotocols TLS_GNUTLS_PROTOCOL"
4699  else
4700      libavprotocols="$libavprotocols TLS_PROTOCOL"
4701  fi
4702  extra_cflags="$extra_cflags $($_pkg_config --cflags gnutls)"
4703  extra_ldflags="$extra_ldflags $($_pkg_config --libs gnutls)"
4704else
4705  def_gnutls='#define CONFIG_GNUTLS 0'
4706fi
4707echores "$_gnutls"
4708
4709echocheck "OpenSSL"
4710if test "$_openssl" = yes ; then
4711  def_openssl='#define CONFIG_OPENSSL 1'
4712  libavprotocols="$libavprotocols HTTPS_PROTOCOL"
4713  if contains_item "$libavprotocols_all" 'TLS_OPENSSL_PROTOCOL' ; then
4714      libavprotocols="$libavprotocols TLS_OPENSSL_PROTOCOL"
4715  else
4716      libavprotocols="$libavprotocols TLS_PROTOCOL"
4717  fi
4718  extra_cflags="$extra_cflags $($_pkg_config --cflags openssl)"
4719  extra_ldflags="$extra_ldflags $($_pkg_config --libs openssl)"
4720else
4721  def_openssl='#define CONFIG_OPENSSL 0'
4722fi
4723echores "$_openssl"
4724
4725echocheck "Samba support (libsmbclient)"
4726if test "$_smb" = yes; then
4727  extra_ldflags="$extra_ldflags -lsmbclient"
4728fi
4729if test "$_smb" = auto; then
4730  _smb=no
4731  pkg_inc=$($_pkg_config --cflags smbclient 2>/dev/null)
4732  for ld_tmp in "-lsmbclient" "-lsmbclient $ld_dl" "-lsmbclient $ld_dl -lnsl" "-lsmbclient $ld_dl -lssl -lnsl" ; do
4733    statement_check libsmbclient.h 'smbc_opendir("smb://")' $ld_tmp &&
4734      extra_ldflags="$extra_ldflags $ld_tmp" && _smb=yes && break
4735    statement_check libsmbclient.h 'smbc_opendir("smb://")' $ld_tmp $pkg_inc &&
4736      extra_ldflags="$extra_ldflags $ld_tmp" && extra_cflags="$extra_cflags $pkg_inc" && _smb=yes && break
4737  done
4738fi
4739
4740if test "$_smb" = yes; then
4741    def_smb="#define CONFIG_LIBSMBCLIENT 1"
4742    inputmodules="smb $inputmodules"
4743else
4744    def_smb="#undef CONFIG_LIBSMBCLIENT"
4745    noinputmodules="smb $noinputmodules"
4746fi
4747echores "$_smb"
4748
4749
4750#########
4751# VIDEO #
4752#########
4753
4754
4755echocheck "/dev/mga_vid"
4756if test "$_mga" = auto ; then
4757  _mga=no
4758  test -c /dev/mga_vid && _mga=yes
4759fi
4760if test "$_mga" = yes ; then
4761  def_mga='#define CONFIG_MGA 1'
4762  vomodules="mga $vomodules"
4763else
4764  def_mga='#undef CONFIG_MGA'
4765  novomodules="mga $novomodules"
4766fi
4767echores "$_mga"
4768
4769
4770echocheck "tdfxfb"
4771if test "$_tdfxfb" = yes ; then
4772  def_tdfxfb='#define CONFIG_TDFXFB 1'
4773  vomodules="tdfxfb $vomodules"
4774else
4775  def_tdfxfb='#undef CONFIG_TDFXFB'
4776  novomodules="tdfxfb $novomodules"
4777fi
4778echores "$_tdfxfb"
4779
4780echocheck "s3fb"
4781if test "$_s3fb" = yes ; then
4782  def_s3fb='#define CONFIG_S3FB 1'
4783  vomodules="s3fb $vomodules"
4784else
4785  def_s3fb='#undef CONFIG_S3FB'
4786  novomodules="s3fb $novomodules"
4787fi
4788echores "$_s3fb"
4789
4790echocheck "wii"
4791if test "$_wii" = yes ; then
4792  def_wii='#define CONFIG_WII 1'
4793  vomodules="wii $vomodules"
4794else
4795  def_wii='#undef CONFIG_WII'
4796  novomodules="wii $novomodules"
4797fi
4798echores "$_wii"
4799
4800echocheck "tdfxvid"
4801if test "$_tdfxvid" = yes ; then
4802  def_tdfxvid='#define CONFIG_TDFX_VID 1'
4803  vomodules="tdfx_vid $vomodules"
4804else
4805  def_tdfxvid='#undef CONFIG_TDFX_VID'
4806  novomodules="tdfx_vid $novomodules"
4807fi
4808echores "$_tdfxvid"
4809
4810echocheck "xvr100"
4811if test "$_xvr100" = auto ; then
4812cat > $TMPC << EOF
4813#include <unistd.h>
4814#include <sys/fbio.h>
4815#include <sys/visual_io.h>
4816int main(void) {
4817struct vis_identifier ident;
4818struct fbgattr attr;
4819ioctl(0, VIS_GETIDENTIFIER, &ident);
4820ioctl(0, FBIOGATTR, &attr);
4821return 0;
4822}
4823EOF
4824  _xvr100=no
4825  cc_check && _xvr100=yes
4826fi
4827if test "$_xvr100" = yes ; then
4828  def_xvr100='#define CONFIG_XVR100 1'
4829  vomodules="xvr100 $vomodules"
4830else
4831  def_tdfxvid='#undef CONFIG_XVR100'
4832  novomodules="xvr100 $novomodules"
4833fi
4834echores "$_xvr100"
4835
4836echocheck "tga"
4837if test "$_tga" = yes ; then
4838  def_tga='#define CONFIG_TGA 1'
4839  vomodules="tga $vomodules"
4840else
4841  def_tga='#undef CONFIG_TGA'
4842  novomodules="tga $novomodules"
4843fi
4844echores "$_tga"
4845
4846
4847echocheck "md5sum support"
4848if test "$_md5sum" = yes; then
4849  def_md5sum="#define CONFIG_MD5SUM 1"
4850  vomodules="md5sum $vomodules"
4851else
4852  def_md5sum="#undef CONFIG_MD5SUM"
4853  novomodules="md5sum $novomodules"
4854fi
4855echores "$_md5sum"
4856
4857
4858echocheck "yuv4mpeg support"
4859if test "$_yuv4mpeg" = yes; then
4860  def_yuv4mpeg="#define CONFIG_YUV4MPEG 1"
4861  vomodules="yuv4mpeg $vomodules"
4862else
4863  def_yuv4mpeg="#undef CONFIG_YUV4MPEG"
4864  novomodules="yuv4mpeg $novomodules"
4865fi
4866echores "$_yuv4mpeg"
4867
4868
4869echocheck "bl"
4870if test "$_bl" = yes ; then
4871  def_bl='#define CONFIG_BL 1'
4872  vomodules="bl $vomodules"
4873else
4874  def_bl='#undef CONFIG_BL'
4875  novomodules="bl $novomodules"
4876fi
4877echores "$_bl"
4878
4879
4880echocheck "DirectFB"
4881if test "$_directfb" = auto ; then
4882  _directfb=no
4883  cat > $TMPC << EOF
4884#include <directfb.h>
4885#include <directfb_version.h>
4886#if (DIRECTFB_MAJOR_VERSION << 16 | DIRECTFB_MINOR_VERSION << 8 | DIRECTFB_MICRO_VERSION) < (0 << 16 | 9 << 8 | 22)
4887#error "DirectFB version too old."
4888#endif
4889int main(void) { DirectFBInit(0, 0); return 0; }
4890EOF
4891  for inc_tmp in "" -I/usr/local/include/directfb -I/usr/include/directfb -I/usr/local/include; do
4892    cc_check $inc_tmp -ldirectfb &&
4893      _directfb=yes && extra_cflags="$extra_cflags $inc_tmp" && break
4894  done
4895fi
4896if test "$_directfb" = yes ; then
4897  def_directfb='#define CONFIG_DIRECTFB 1'
4898  vomodules="directfb dfbmga $vomodules"
4899  libs_mplayer="$libs_mplayer -ldirectfb"
4900else
4901  def_directfb='#undef CONFIG_DIRECTFB'
4902  novomodules="directfb dfbmga $novomodules"
4903fi
4904echores "$_directfb"
4905
4906
4907echocheck "X11 headers presence"
4908  _x11_headers="no"
4909  res_comment="check if the dev(el) packages are installed"
4910  for I in $(echo $extra_cflags | sed s/-I//g) /usr/include ; do
4911    if test -f "$I/X11/Xlib.h" ; then
4912      _x11_headers="yes"
4913      res_comment=""
4914      break
4915    fi
4916  done
4917  if test $_cross_compile = no; then
4918    for I in /usr/X11/include /usr/X11R7/include /usr/local/include /usr/local/include \
4919             /usr/include/X11R6 /usr/openwin/include ; do
4920      if test -f "$I/X11/Xlib.h" ; then
4921        extra_cflags="$extra_cflags -I$I"
4922        _x11_headers="yes"
4923        res_comment="using $I"
4924        break
4925      fi
4926    done
4927  fi
4928echores "$_x11_headers"
4929
4930
4931echocheck "X11"
4932if test "$_x11" = auto && test "$_x11_headers" = yes ; then
4933  for I in "" -L/usr/X11R7/lib -L/usr/local/lib -L/usr/local/lib -L/usr/lib/X11R6 \
4934           -L/usr/X11/lib -L/usr/lib32 -L/usr/openwin/lib -L/usr/local/lib64 -L/usr/local/lib64 \
4935           -L/usr/lib ; do
4936    if netbsd; then
4937      ld_tmp="$I -lXext -lX11 $ld_pthread -Wl,-R$(echo $I | sed s/^-L//)"
4938    else
4939      ld_tmp="$I -lXext -lX11 $ld_pthread"
4940    fi
4941    statement_check X11/Xutil.h 'XCreateWindow(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)' $ld_tmp &&
4942      libs_mplayer="$libs_mplayer $ld_tmp" && _x11=yes && break
4943  done
4944fi
4945if test "$_x11" = yes ; then
4946  def_x11='#define CONFIG_X11 1'
4947  vomodules="x11 xover $vomodules"
4948else
4949  _x11=no
4950  def_x11='#undef CONFIG_X11'
4951  novomodules="x11 $novomodules"
4952  res_comment="check if the dev(el) packages are installed"
4953fi
4954echores "$_x11"
4955
4956echocheck "Xss screensaver extensions"
4957if test "$_xss" = auto ; then
4958  _xss=no
4959  statement_check "X11/extensions/scrnsaver.h" 'XScreenSaverSuspend(NULL, True)' -lXss && _xss=yes
4960fi
4961if test "$_xss" = yes ; then
4962  def_xss='#define CONFIG_XSS 1'
4963  libs_mplayer="$libs_mplayer -lXss"
4964else
4965  def_xss='#undef CONFIG_XSS'
4966fi
4967echores "$_xss"
4968
4969echocheck "DPMS"
4970_xdpms3=no
4971_xdpms4=no
4972if test "$_x11" = yes ; then
4973  cat > $TMPC <<EOF
4974#include <X11/Xmd.h>
4975#include <X11/Xlib.h>
4976#include <X11/Xutil.h>
4977#include <X11/Xatom.h>
4978#include <X11/extensions/dpms.h>
4979int main(void) { DPMSQueryExtension(0, 0, 0); return 0; }
4980EOF
4981  cc_check -lXdpms && _xdpms3=yes
4982  statement_check_broken X11/Xlib.h X11/extensions/dpms.h 'DPMSQueryExtension(0, 0, 0)' -lXext && _xdpms4=yes
4983fi
4984if test "$_xdpms4" = yes ; then
4985  def_xdpms='#define CONFIG_XDPMS 1'
4986  res_comment="using Xdpms 4"
4987  echores "yes"
4988elif test "$_xdpms3" = yes ; then
4989  def_xdpms='#define CONFIG_XDPMS 1'
4990  libs_mplayer="$libs_mplayer -lXdpms"
4991  res_comment="using Xdpms 3"
4992  echores "yes"
4993else
4994  def_xdpms='#undef CONFIG_XDPMS'
4995  echores "no"
4996fi
4997
4998
4999echocheck "Xv"
5000if test "$_xv" = auto && test "$_x11" = yes ; then
5001  _xv=no
5002  statement_check_broken X11/Xlib.h X11/extensions/Xvlib.h 'XvGetPortAttribute(0, 0, 0, 0)' -lXv && _xv=yes
5003fi
5004
5005if test "$_xv" = yes ; then
5006  def_xv='#define CONFIG_XV 1'
5007  libs_mplayer="$libs_mplayer -lXv"
5008  vomodules="xv $vomodules"
5009else
5010  def_xv='#undef CONFIG_XV'
5011  novomodules="xv $novomodules"
5012fi
5013echores "$_xv"
5014
5015
5016echocheck "XvMC"
5017if test "$_xvmc" != no  && test "$_xv" = yes ; then
5018  _xvmc=no
5019  cat > $TMPC <<EOF
5020#include <X11/Xlib.h>
5021#include <X11/extensions/Xvlib.h>
5022#include <X11/extensions/XvMClib.h>
5023int main(void) {
5024  XvMCQueryExtension(0, 0, 0);
5025  XvMCCreateContext(0, 0, 0, 0, 0, 0, 0);
5026  return 0; }
5027EOF
5028  for ld_tmp in $_xvmclib XvMCNVIDIA XvMCW I810XvMC ; do
5029    cc_check -lXvMC -l$ld_tmp && _xvmc=yes && _xvmclib="$ld_tmp" && break
5030  done
5031fi
5032if test "$_xvmc" = yes ; then
5033  def_xvmc='#define CONFIG_XVMC 1'
5034  libs_mplayer="$libs_mplayer -lXvMC"
5035  test -n "$_xvmclib" && libs_mplayer="$libs_mplayer -l$_xvmclib"
5036  vomodules="xvmc $vomodules"
5037  res_comment="using $_xvmclib"
5038  libavhwaccels="$libavhwaccels MPEG1_XVMC_HWACCEL MPEG2_XVMC_HWACCEL"
5039else
5040  def_xvmc='#define CONFIG_XVMC 0'
5041  novomodules="xvmc $novomodules"
5042  libavdecoders=$(filter_out_component decoder 'MPEG_XVMC')
5043fi
5044echores "$_xvmc"
5045
5046
5047echocheck "Video Decode Acceleration (VDA)"
5048if test "$_vda" = auto ; then
5049  _vda=no
5050  header_check VideoDecodeAcceleration/VDADecoder.h && _vda=yes
5051fi
5052if test "$_vda" = yes ; then
5053  def_vda='#define CONFIG_VDA 1'
5054  extra_ldflags="$extra_ldflags -framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
5055  libavhwaccels="$libavhwaccels H264_VDA_HWACCEL H264_VDA_OLD_HWACCEL"
5056else
5057  def_vda='#define CONFIG_VDA 0'
5058  libavdecoders=$(filter_out_component decoder '[A-Z0-9]*_VDA')
5059fi
5060echores "$_vda"
5061
5062
5063echocheck "VDPAU"
5064if test "$_vdpau" = auto && test "$_x11" = yes ; then
5065  _vdpau=no
5066  if test "$_dl" = yes ; then
5067    return_statement_check vdpau/vdpau_x11.h 'vdp_device_create_x11(0, 0, 0, 0)' VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 -lvdpau && _vdpau=yes
5068    return_statement_check vdpau/vdpau_x11.h 'vdp_device_create_x11(0, 0, 0, 0)' VDP_DECODER_PROFILE_HEVC_MAIN -lvdpau && _vdpau_hevc=yes
5069  fi
5070fi
5071if test "$_vdpau" = yes ; then
5072  def_vdpau='#define CONFIG_VDPAU 1'
5073  libs_mplayer="$libs_mplayer -lvdpau"
5074  vomodules="vdpau $vomodules"
5075  libavhwaccels="$libavhwaccels H263_VDPAU_HWACCEL H264_VDPAU_HWACCEL MPEG1_VDPAU_HWACCEL MPEG2_VDPAU_HWACCEL MPEG4_VDPAU_HWACCEL VC1_VDPAU_HWACCEL WMV3_VDPAU_HWACCEL"
5076  if test "$_vdpau_hevc" = yes ; then
5077    libavhwaccels="$libavhwaccels HEVC_VDPAU_HWACCEL"
5078  fi
5079else
5080  def_vdpau='#define CONFIG_VDPAU 0'
5081  novomodules="vdpau $novomodules"
5082  libavdecoders=$(filter_out_component decoder '[A-Z0-9]*_VDPAU')
5083fi
5084echores "$_vdpau"
5085
5086
5087echocheck "Xinerama"
5088if test "$_xinerama" = auto && test "$_x11" = yes ; then
5089  _xinerama=no
5090  statement_check X11/extensions/Xinerama.h 'XineramaIsActive(0)' -lXinerama && _xinerama=yes
5091fi
5092
5093if test "$_xinerama" = yes ; then
5094  def_xinerama='#define CONFIG_XINERAMA 1'
5095  libs_mplayer="$libs_mplayer -lXinerama"
5096else
5097  def_xinerama='#undef CONFIG_XINERAMA'
5098fi
5099echores "$_xinerama"
5100
5101
5102# Note: the -lXxf86vm library is the VideoMode extension and though it's not
5103# needed for DGA, AFAIK every distribution packages together with DGA stuffs
5104# named 'X extensions' or something similar.
5105# This check may be useful for future MPlayer versions (to change resolution)
5106# If you run into problems, remove '-lXxf86vm'.
5107echocheck "Xxf86vm"
5108if test "$_vm" = auto && test "$_x11" = yes ; then
5109  _vm=no
5110  statement_check_broken X11/Xlib.h X11/extensions/xf86vmode.h 'XF86VidModeQueryExtension(0, 0, 0)' -lXxf86vm && _vm=yes
5111fi
5112if test "$_vm" = yes ; then
5113  def_vm='#define CONFIG_XF86VM 1'
5114  libs_mplayer="$libs_mplayer -lXxf86vm"
5115else
5116  def_vm='#undef CONFIG_XF86VM'
5117fi
5118echores "$_vm"
5119
5120# Check for the presence of special keycodes, like audio control buttons
5121# that XFree86 might have.  Used to be bundled with the xf86vm check, but
5122# has nothing to do with xf86vm and XFree 3.x has xf86vm but does NOT
5123# have these new keycodes.
5124echocheck "XF86keysym"
5125if test "$_xf86keysym" = auto && test "$_x11" = yes ; then
5126  _xf86keysym=no
5127  return_check X11/XF86keysym.h XF86XK_AudioPause && _xf86keysym=yes
5128fi
5129if test "$_xf86keysym" = yes ; then
5130  def_xf86keysym='#define CONFIG_XF86XK 1'
5131else
5132  def_xf86keysym='#undef CONFIG_XF86XK'
5133fi
5134echores "$_xf86keysym"
5135
5136echocheck "DGA"
5137if test "$_dga2" = auto && test "$_x11" = yes ; then
5138  _dga2=no
5139  statement_check_broken X11/Xlib.h X11/extensions/xf86dga.h 'XDGASetViewport(0, 0, 0, 0, 0)' -lXxf86dga && _dga2=yes
5140fi
5141if test "$_dga1" = auto && test "$_dga2" = no && test "$_vm" = yes ; then
5142  _dga1=no
5143  statement_check_broken X11/Xlib.h X11/extensions/xf86dga.h 'XF86DGASetViewPort(0, 0, 0, 0)' -lXxf86dga -lXxf86vm && _dga1=yes
5144fi
5145
5146_dga=no
5147def_dga='#undef CONFIG_DGA'
5148def_dga1='#undef CONFIG_DGA1'
5149def_dga2='#undef CONFIG_DGA2'
5150if test "$_dga1" = yes ; then
5151  _dga=yes
5152  def_dga1='#define CONFIG_DGA1 1'
5153  res_comment="using DGA 1.0"
5154elif test "$_dga2" = yes ; then
5155  _dga=yes
5156  def_dga2='#define CONFIG_DGA2 1'
5157  res_comment="using DGA 2.0"
5158fi
5159if test "$_dga" = yes ; then
5160  def_dga='#define CONFIG_DGA 1'
5161  libs_mplayer="$libs_mplayer -lXxf86dga"
5162  vomodules="dga $vomodules"
5163else
5164  novomodules="dga $novomodules"
5165fi
5166echores "$_dga"
5167
5168
5169echocheck "xmga"
5170if test "$_xmga" = auto ; then
5171  _xmga=no
5172  test "$_x11" = yes && test "$_mga" = yes && _xmga=yes
5173fi
5174if test "$_xmga" = yes ; then
5175  def_xmga='#define CONFIG_XMGA 1'
5176  vomodules="xmga $vomodules"
5177else
5178  def_xmga='#undef CONFIG_XMGA'
5179  novomodules="xmga $novomodules"
5180fi
5181echores "$_xmga"
5182
5183
5184echocheck "3dfx"
5185if test "$_3dfx" = yes && test "$_dga" = yes ; then
5186  def_3dfx='#define CONFIG_3DFX 1'
5187  vomodules="3dfx $vomodules"
5188else
5189  def_3dfx='#undef CONFIG_3DFX'
5190  novomodules="3dfx $novomodules"
5191fi
5192echores "$_3dfx"
5193
5194
5195echocheck "VIDIX"
5196def_vidix='#undef CONFIG_VIDIX'
5197def_vidix_drv_cyberblade='#undef CONFIG_VIDIX_DRV_CYBERBLADE'
5198_vidix_drv_cyberblade=no
5199def_vidix_drv_ivtv='#undef CONFIG_VIDIX_DRV_IVTV'
5200_vidix_drv_ivtv=no
5201def_vidix_drv_mach64='#undef CONFIG_VIDIX_DRV_MACH64'
5202_vidix_drv_mach64=no
5203def_vidix_drv_mga='#undef CONFIG_VIDIX_DRV_MGA'
5204_vidix_drv_mga=no
5205def_vidix_drv_mga_crtc2='#undef CONFIG_VIDIX_DRV_MGA_CRTC2'
5206_vidix_drv_mga_crtc2=no
5207def_vidix_drv_nvidia='#undef CONFIG_VIDIX_DRV_NVIDIA'
5208_vidix_drv_nvidia=no
5209def_vidix_drv_pm2='#undef CONFIG_VIDIX_DRV_PM2'
5210_vidix_drv_pm2=no
5211def_vidix_drv_pm3='#undef CONFIG_VIDIX_DRV_PM3'
5212_vidix_drv_pm3=no
5213def_vidix_drv_radeon='#undef CONFIG_VIDIX_DRV_RADEON'
5214_vidix_drv_radeon=no
5215def_vidix_drv_rage128='#undef CONFIG_VIDIX_DRV_RAGE128'
5216_vidix_drv_rage128=no
5217def_vidix_drv_s3='#undef CONFIG_VIDIX_DRV_S3'
5218_vidix_drv_s3=no
5219def_vidix_drv_sh_veu='#undef CONFIG_VIDIX_DRV_SH_VEU'
5220_vidix_drv_sh_veu=no
5221def_vidix_drv_sis='#undef CONFIG_VIDIX_DRV_SIS'
5222_vidix_drv_sis=no
5223def_vidix_drv_unichrome='#undef CONFIG_VIDIX_DRV_UNICHROME'
5224_vidix_drv_unichrome=no
5225if test "$_vidix" = auto ; then
5226  _vidix=no
5227  x86 && (linux || freebsd || netbsd || openbsd || dragonfly || sunos || win32) && _vidix=yes
5228  win32 && ! header_check ddk/ntddk.h && _vidix=no
5229  x86_64 && ! linux && _vidix=no
5230  (ppc || alpha) && linux && _vidix=yes
5231fi
5232echores "$_vidix"
5233
5234if test "$_vidix" = yes ; then
5235  def_vidix='#define CONFIG_VIDIX 1'
5236  vomodules="cvidix $vomodules"
5237  # FIXME: ivtv driver temporarily disabled until we have a proper test
5238  #test "$_vidix_drivers" || _vidix_drivers="cyberblade ivtv mach64 mga mga_crtc2 nvidia pm2 pm3 radeon rage128 s3 sh_veu sis unichrome"
5239  test "$_vidix_drivers" || _vidix_drivers="cyberblade mach64 mga mga_crtc2 nvidia pm2 pm3 radeon rage128 s3 sh_veu sis unichrome"
5240
5241  # some VIDIX drivers are architecture and os-specific, discard them elsewhere
5242  x86 || _vidix_drivers=$(echo $_vidix_drivers | sed -e s/cyberblade// -e s/sis// -e s/unichrome// -e s/s3//)
5243  (test $host_arch = "sh" && linux) || _vidix_drivers=$(echo $_vidix_drivers | sed s/sh_veu//)
5244
5245  for driver in $_vidix_drivers ; do
5246    uc_driver=$(echo $driver | toupper)
5247    eval _vidix_drv_${driver}=yes
5248    eval def_vidix_drv_${driver}=\"\#define CONFIG_VIDIX_DRV_${uc_driver} 1\"
5249  done
5250
5251  echocheck "VIDIX PCI device name database"
5252  echores "$_vidix_pcidb"
5253  if test "$_vidix_pcidb" = yes ; then
5254    _vidix_pcidb_val=1
5255  else
5256    _vidix_pcidb_val=0
5257  fi
5258
5259  echocheck "VIDIX dhahelper support"
5260  test "$_dhahelper" = yes && cflags_dhahelper=-DCONFIG_DHAHELPER
5261  echores "$_dhahelper"
5262
5263  echocheck "VIDIX svgalib_helper support"
5264  test "$_svgalib_helper" = yes && cflags_svgalib_helper=-DCONFIG_SVGAHELPER
5265  echores "$_svgalib_helper"
5266
5267else
5268  novomodules="cvidix $novomodules"
5269fi
5270
5271if test "$_vidix" = yes && win32; then
5272  winvidix=yes
5273  vomodules="winvidix $vomodules"
5274  libs_mplayer="$libs_mplayer -lgdi32"
5275else
5276  novomodules="winvidix $novomodules"
5277fi
5278if test "$_vidix" = yes && test "$_x11" = yes; then
5279  xvidix=yes
5280  vomodules="xvidix $vomodules"
5281else
5282  novomodules="xvidix $novomodules"
5283fi
5284
5285
5286echocheck "GGI"
5287if test "$_ggi" = auto ; then
5288  _ggi=no
5289  statement_check ggi/ggi.h 'ggiInit()' -lggi && _ggi=yes
5290fi
5291if test "$_ggi" = yes ; then
5292  def_ggi='#define CONFIG_GGI 1'
5293  libs_mplayer="$libs_mplayer -lggi"
5294  vomodules="ggi $vomodules"
5295else
5296  def_ggi='#undef CONFIG_GGI'
5297  novomodules="ggi $novomodules"
5298fi
5299echores "$_ggi"
5300
5301echocheck "GGI extension: libggiwmh"
5302if test "$_ggiwmh" = auto ; then
5303  _ggiwmh=no
5304  statement_check ggi/wmh.h 'ggiWmhInit()' -lggi -lggiwmh && _ggiwmh=yes
5305fi
5306# needed to get right output on obscure combination
5307# like --disable-ggi --enable-ggiwmh
5308if test "$_ggi" = yes && test "$_ggiwmh" = yes ; then
5309  def_ggiwmh='#define CONFIG_GGIWMH 1'
5310  libs_mplayer="$libs_mplayer -lggiwmh"
5311else
5312  _ggiwmh=no
5313  def_ggiwmh='#undef CONFIG_GGIWMH'
5314fi
5315echores "$_ggiwmh"
5316
5317
5318echocheck "AA"
5319if test "$_aa" = auto ; then
5320  cat > $TMPC << EOF
5321#include <aalib.h>
5322int main(void) {
5323aa_context *c;
5324aa_renderparams *p;
5325aa_init(0, 0, 0);
5326c = aa_autoinit(&aa_defparams);
5327p = aa_getrenderparams();
5328aa_autoinitkbd(c, 0);
5329return 0; }
5330EOF
5331  _aa=no
5332  for ld_tmp in "-laa" ; do
5333    cc_check $ld_tmp && libs_mplayer="$libs_mplayer $ld_tmp" && _aa=yes && break
5334  done
5335fi
5336if test "$_aa" = yes ; then
5337  def_aa='#define CONFIG_AA 1'
5338  if cygwin ; then
5339    libs_mplayer="$libs_mplayer $(aalib-config --libs | cut -d " " -f 2,5,6)"
5340  fi
5341  vomodules="aa $vomodules"
5342else
5343  def_aa='#undef CONFIG_AA'
5344  novomodules="aa $novomodules"
5345fi
5346echores "$_aa"
5347
5348
5349echocheck "CACA"
5350if test "$_caca" = auto ; then
5351  _caca=no
5352  if ( caca-config --version ) >> "$TMPLOG" 2>&1 ; then
5353  cat > $TMPC << EOF
5354#include <caca.h>
5355#ifdef CACA_API_VERSION_1
5356  #include <caca0.h>
5357#endif
5358int main(void) { caca_init(); return 0; }
5359EOF
5360  cc_check $(caca-config --libs) && _caca=yes
5361  fi
5362fi
5363if test "$_caca" = yes ; then
5364  def_caca='#define CONFIG_CACA 1'
5365  extra_cflags="$extra_cflags $(caca-config --cflags)"
5366  libs_mplayer="$libs_mplayer $(caca-config --libs)"
5367  vomodules="caca $vomodules"
5368else
5369  def_caca='#undef CONFIG_CACA'
5370  novomodules="caca $novomodules"
5371fi
5372echores "$_caca"
5373
5374
5375echocheck "SVGAlib"
5376if test "$_svga" = auto ; then
5377  _svga=no
5378  header_check vga.h -lvga && _svga=yes
5379fi
5380if test "$_svga" = yes ; then
5381  def_svga='#define CONFIG_SVGALIB 1'
5382  libs_mplayer="$libs_mplayer -lvga"
5383  vomodules="svga $vomodules"
5384else
5385  def_svga='#undef CONFIG_SVGALIB'
5386  novomodules="svga $novomodules"
5387fi
5388echores "$_svga"
5389
5390
5391echocheck "FBDev"
5392if test "$_fbdev" = auto ; then
5393  _fbdev=no
5394  linux && _fbdev=yes
5395fi
5396if test "$_fbdev" = yes ; then
5397  def_fbdev='#define CONFIG_FBDEV 1'
5398  vomodules="fbdev $vomodules"
5399else
5400  def_fbdev='#undef CONFIG_FBDEV'
5401  novomodules="fbdev $novomodules"
5402fi
5403echores "$_fbdev"
5404
5405
5406
5407echocheck "DVB"
5408if test "$_dvb" = auto ; then
5409  _dvb=no
5410cat >$TMPC << EOF
5411#include <poll.h>
5412#include <sys/ioctl.h>
5413#include <stdio.h>
5414#include <time.h>
5415#include <unistd.h>
5416#include <linux/dvb/dmx.h>
5417#include <linux/dvb/frontend.h>
5418#include <linux/dvb/video.h>
5419#include <linux/dvb/audio.h>
5420int main(void) {return 0;}
5421EOF
5422  for inc_tmp in "" "-I/usr/src/DVB/include" ; do
5423    cc_check $inc_tmp && _dvb=yes &&
5424      extra_cflags="$extra_cflags $inc_tmp" && break
5425  done
5426fi
5427echores "$_dvb"
5428if test "$_dvb" = yes ; then
5429  _dvbin=yes
5430  inputmodules="dvb $inputmodules"
5431  def_dvb='#define CONFIG_DVB 1'
5432  def_dvbin='#define CONFIG_DVBIN 1'
5433  aomodules="mpegpes(dvb) $aomodules"
5434  vomodules="mpegpes(dvb) $vomodules"
5435else
5436  _dvbin=no
5437  noinputmodules="dvb $noinputmodules"
5438  def_dvb='#undef CONFIG_DVB'
5439  def_dvbin='#undef CONFIG_DVBIN '
5440  aomodules="mpegpes(file) $aomodules"
5441  vomodules="mpegpes(file) $vomodules"
5442fi
5443
5444
5445if darwin; then
5446
5447echocheck "QuickTime"
5448if test "$quicktime" = auto ; then
5449  quicktime=no
5450  statement_check QuickTime/QuickTime.h 'ImageDescription *desc; EnterMovies(); ExitMovies()' -framework QuickTime && quicktime=yes
5451fi
5452if test "$quicktime" = yes ; then
5453  # Carbon framework needed for symbols like SoundConverterOpen and DisposeGWorld
5454  extra_ldflags="$extra_ldflags -framework QuickTime -framework Carbon"
5455  def_quicktime='#define CONFIG_QUICKTIME 1'
5456else
5457  def_quicktime='#undef CONFIG_QUICKTIME'
5458  _quartz=no
5459fi
5460echores $quicktime
5461
5462echocheck "Quartz"
5463if test "$_quartz" = auto ; then
5464  _quartz=no
5465  statement_check Carbon/Carbon.h 'CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false)' -framework Carbon && _quartz=yes
5466fi
5467if test "$_quartz" = yes ; then
5468  libs_mplayer="$libs_mplayer -framework Carbon"
5469  def_quartz='#define CONFIG_QUARTZ 1'
5470  vomodules="quartz $vomodules"
5471else
5472  def_quartz='#undef CONFIG_QUARTZ'
5473  novomodules="quartz $novomodules"
5474fi
5475echores $_quartz
5476
5477echocheck "CoreVideo"
5478if test "$_corevideo" = auto ; then
5479  cat > $TMPC <<EOF
5480#include <Carbon/Carbon.h>
5481#include <CoreServices/CoreServices.h>
5482#include <OpenGL/OpenGL.h>
5483#include <QuartzCore/CoreVideo.h>
5484int main(void) { return 0; }
5485EOF
5486  _corevideo=no
5487  cc_check -framework Carbon -framework Cocoa -framework QuartzCore -framework OpenGL && _corevideo=yes
5488fi
5489if test "$_corevideo" = yes ; then
5490  vomodules="corevideo $vomodules"
5491  libs_mplayer="$libs_mplayer -framework Carbon -framework Cocoa -framework QuartzCore -framework OpenGL"
5492  def_corevideo='#define CONFIG_COREVIDEO 1'
5493else
5494  novomodules="corevideo $novomodules"
5495  def_corevideo='#undef CONFIG_COREVIDEO'
5496fi
5497echores "$_corevideo"
5498
5499fi #if darwin
5500
5501
5502echocheck "PNG support"
5503if test "$_png" = auto ; then
5504  _png=no
5505  if irix ; then
5506    # Don't check for -lpng on IRIX since it has its own libpng
5507    # incompatible with the GNU libpng
5508    res_comment="disabled on irix (not GNU libpng)"
5509  else
5510cat > $TMPC << EOF
5511#include <stdio.h>
5512#include <string.h>
5513#include <png.h>
5514int main(void) {
5515  printf("png.h : %s\n", PNG_LIBPNG_VER_STRING);
5516  printf("libpng: %s\n", png_libpng_ver);
5517  return strcmp(PNG_LIBPNG_VER_STRING, png_libpng_ver);
5518}
5519EOF
5520    cc_check -lpng -lz && _png=yes
5521  fi
5522fi
5523echores "$_png"
5524if test "$_png" = yes ; then
5525  def_png='#define CONFIG_PNG 1'
5526  extra_ldflags="$extra_ldflags -lpng -lz"
5527else
5528  def_png='#undef CONFIG_PNG'
5529fi
5530
5531echocheck "MNG support"
5532if test "$_mng" = auto ; then
5533  _mng=no
5534  cat > $TMPC << EOF
5535#define MNG_NO_INCLUDE_JNG
5536#include <libmng.h>
5537int main(void) { return !mng_version_text(); }
5538EOF
5539  for mnglibs in '-lmng -lz' '-lmng -ljpeg -lz' ; do
5540    cc_check $mnglibs && _mng=yes && break
5541  done
5542fi
5543echores "$_mng"
5544if test "$_mng" = yes ; then
5545  def_mng='#define CONFIG_MNG 1'
5546  extra_ldflags="$extra_ldflags $mnglibs"
5547  vomodules="mng $vomodules"
5548else
5549  def_mng='#undef CONFIG_MNG'
5550  novomodules="mng $novomodules"
5551fi
5552
5553echocheck "JPEG support"
5554if test "$_jpeg" = auto ; then
5555  _jpeg=no
5556  header_check_broken stdio.h jpeglib.h -ljpeg && _jpeg=yes
5557fi
5558echores "$_jpeg"
5559
5560if test "$_jpeg" = yes ; then
5561  def_jpeg='#define CONFIG_JPEG 1'
5562  vomodules="jpeg $vomodules"
5563  extra_ldflags="$extra_ldflags -ljpeg"
5564else
5565  def_jpeg='#undef CONFIG_JPEG'
5566  novomodules="jpeg $novomodules"
5567fi
5568
5569
5570echocheck "OpenJPEG (JPEG 2000) support"
5571if test "$libopenjpeg" = auto ; then
5572  libopenjpeg=no
5573  if test "$ffmpeg_a" = no ; then
5574    res_comment="dynamic linking to libopenjpeg is irrelevant when using dynamic FFmpeg"
5575  else
5576    cat > $TMPC << EOF
5577#include <openjpeg.h>
5578
5579int main(void) {
5580  opj_dparameters_t dec_params; opj_set_default_decoder_parameters(&dec_params);
5581  return opj_decode(0,0,0);
5582}
5583EOF
5584    if $_pkg_config --exists "libopenjp2 >= 2.1.0" ; then
5585      inc_libopenjpeg=$($_pkg_config --silence-errors --cflags libopenjp2)
5586      ld_libopenjpeg=$($_pkg_config --silence-errors --libs libopenjp2)
5587      cc_check $inc_libopenjpeg $ld_libopenjpeg        &&
5588        libopenjpeg=yes                                &&
5589        extra_cflags="$extra_cflags $inc_libopenjpeg"  &&
5590        extra_ldflags="$extra_ldflags $ld_libopenjpeg"
5591    fi
5592  fi
5593fi
5594echores "$libopenjpeg"
5595if test "$libopenjpeg" = yes ; then
5596  def_libopenjpeg='#define CONFIG_LIBOPENJPEG 1'
5597  libavdecoders="$libavdecoders LIBOPENJPEG_DECODER"
5598  libavencoders="$libavencoders LIBOPENJPEG_ENCODER"
5599  codecmodules="OpenJPEG $codecmodules"
5600else
5601  def_libopenjpeg='#define CONFIG_LIBOPENJPEG 0'
5602  nocodecmodules="OpenJPEG $nocodecmodules"
5603fi
5604
5605
5606echocheck "PNM support"
5607if test "$_pnm" = yes; then
5608  def_pnm="#define CONFIG_PNM 1"
5609  vomodules="pnm $vomodules"
5610else
5611  def_pnm="#undef CONFIG_PNM"
5612  novomodules="pnm $novomodules"
5613fi
5614echores "$_pnm"
5615
5616
5617
5618echocheck "GIF support"
5619# This is to appease people who want to force GIF support.
5620# If it is forced to yes, then we still do checks to determine
5621# which GIF library to use.
5622if test "$_gif" = yes ; then
5623  _force_gif=yes
5624  _gif=auto
5625fi
5626
5627gif_new=no
5628if test "$_gif" = auto ; then
5629  _gif=no
5630  for ld_gif in "-lungif" "-lgif" ; do
5631    statement_check gif_lib.h 'QuantizeBuffer(0, 0, 0, 0, 0, 0, 0, 0)' $ld_gif && _gif=yes && break
5632    statement_check_broken stdlib.h gif_lib.h 'GifQuantizeBuffer(0, 0, 0, 0, 0, 0, 0, 0)' $ld_gif && _gif=yes && gif_new=yes && break
5633  done
5634fi
5635
5636# If no library was found, and the user wants support forced,
5637# then we force it on with libgif, as this is the safest
5638# assumption IMHO.  (libungif & libregif both create symbolic
5639# links to libgif.  We also assume that no x11 support is needed,
5640# because if you are forcing this, then you _should_ know what
5641# you are doing.  [ Besides, package maintainers should never
5642# have compiled x11 deps into libungif in the first place. ] )
5643# </rant>
5644#   --Joey
5645if test "$_force_gif" = yes && test "$_gif" = no ; then
5646  _gif=yes
5647  ld_gif="-lgif"
5648fi
5649
5650if test "$_gif" = yes ; then
5651  def_gif='#define CONFIG_GIF 1'
5652  codecmodules="gif $codecmodules"
5653  vomodules="gif89a $vomodules"
5654  res_comment=""
5655  def_gif_4='#undef CONFIG_GIF_4'
5656  extra_ldflags="$extra_ldflags $ld_gif"
5657
5658  cat > $TMPC << EOF
5659#include <signal.h>
5660#include <stdio.h>
5661#include <stdlib.h>
5662#include <gif_lib.h>
5663static void catch(int sig) { exit(1); }
5664int main(void) {
5665  signal(SIGSEGV, catch);  // catch segfault
5666  printf("EGifPutExtensionFirst is at address %p\n", EGifPutExtensionFirst);
5667  EGifSetGifVersion("89a");   // this will segfault a buggy gif lib.
5668  return 0;
5669}
5670EOF
5671  if cc_check "$ld_gif" ; then
5672    def_gif_4='#define CONFIG_GIF_4 1'
5673  elif test "$gif_new" = no ; then
5674    res_comment="old version, some encoding functions disabled"
5675  fi
5676else
5677  def_gif='#undef CONFIG_GIF'
5678  def_gif_4='#undef CONFIG_GIF_4'
5679  novomodules="gif89a $novomodules"
5680  nocodecmodules="gif $nocodecmodules"
5681fi
5682echores "$_gif"
5683
5684
5685case "$_gif" in yes*)
5686  echocheck "broken giflib workaround"
5687  def_gif_tvt_hack='#define CONFIG_GIF_TVT_HACK 1'
5688  if statement_check_broken stdio.h gif_lib.h 'GifFileType gif = {.UserData = NULL}; printf("UserData is at address %p\n", gif.UserData)' "$ld_gif" ; then
5689    def_gif_tvt_hack='#undef CONFIG_GIF_TVT_HACK'
5690    echores "disabled"
5691  else
5692    echores "enabled"
5693  fi
5694  ;;
5695esac
5696
5697
5698echocheck "VESA support"
5699if test "$_vesa" = auto ; then
5700  _vesa=no
5701  statement_check vbe.h 'vbeInit()' -lvbe -llrmi && _vesa=yes
5702fi
5703if test "$_vesa" = yes ; then
5704  def_vesa='#define CONFIG_VESA 1'
5705  libs_mplayer="$libs_mplayer -lvbe -llrmi"
5706  vomodules="vesa $vomodules"
5707else
5708  def_vesa='#undef CONFIG_VESA'
5709  novomodules="vesa $novomodules"
5710fi
5711echores "$_vesa"
5712
5713#################
5714# VIDEO + AUDIO #
5715#################
5716
5717
5718echocheck "SDL"
5719inc_tmp=""
5720ld_tmp=""
5721def_sdl_sdl_h="#undef CONFIG_SDL_SDL_H"
5722if test -z "$_sdlconfig" ; then
5723  if ( sdl-config --version ) >>"$TMPLOG" 2>&1 ; then
5724    _sdlconfig="sdl-config"
5725  else
5726    _sdlconfig=false
5727  fi
5728fi
5729if test "$_sdl" = auto || test "$_sdl" = yes ; then
5730  cat > $TMPC << EOF
5731#ifdef CONFIG_SDL_SDL_H
5732#include <SDL/SDL.h>
5733#else
5734#include <SDL.h>
5735#endif
5736#ifndef __APPLE__
5737// we allow SDL hacking our main() only on OSX
5738#undef main
5739#endif
5740int main(int argc, char *argv[]) {
5741  SDL_Init(SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE);
5742  return 0;
5743}
5744EOF
5745  _sdl=no
5746  for ld_tmp in "-lSDL" "-lSDL -lpthread" "-lSDL -lwinmm -lgdi32" "-lSDL -lwinmm -lgdi32 -ldxguid" ; do
5747    if cc_check -DCONFIG_SDL_SDL_H $inc_tmp $ld_tmp ; then
5748      _sdl=yes
5749      def_sdl_sdl_h="#define CONFIG_SDL_SDL_H 1"
5750      break
5751    fi
5752  done
5753  if test "$_sdl" = no && "$_sdlconfig" --version >>"$TMPLOG" 2>&1 ; then
5754    res_comment="using $_sdlconfig"
5755    if cygwin ; then
5756      inc_tmp="$($_sdlconfig --cflags | cut -d " " -f 1,5,6 | sed s/no-cygwin/cygwin/)"
5757      ld_tmp="$($_sdlconfig --libs | cut -d " " -f 1,4,6 | sed s/no-cygwin/cygwin/)"
5758    elif mingw32 ; then
5759      inc_tmp=$($_sdlconfig --cflags | sed s/-Dmain=SDL_main//)
5760      ld_tmp=$($_sdlconfig --libs | sed -e s/-mwindows// -e s/-lmingw32//)
5761    else
5762      inc_tmp="$($_sdlconfig --cflags)"
5763      ld_tmp="$($_sdlconfig --libs)"
5764    fi
5765    if cc_check $inc_tmp $ld_tmp >>"$TMPLOG" 2>&1 ; then
5766          _sdl=yes
5767    elif cc_check $inc_tmp $ld_tmp -lstdc++ >>"$TMPLOG" 2>&1 ; then
5768          # HACK for Haiku SDL
5769          ld_tmp="$ld_tmp -lstdc++"
5770          _sdl=yes
5771     fi
5772  fi
5773fi
5774if test "$_sdl" = yes ; then
5775  def_sdl='#define CONFIG_SDL 1'
5776  extra_cflags="$extra_cflags $inc_tmp"
5777  libs_mplayer="$libs_mplayer $ld_tmp"
5778  vomodules="sdl $vomodules"
5779  aomodules="sdl $aomodules"
5780else
5781  def_sdl='#undef CONFIG_SDL'
5782  novomodules="sdl $novomodules"
5783  noaomodules="sdl $noaomodules"
5784fi
5785echores "$_sdl"
5786
5787
5788echocheck "SDL image"
5789sdl_image=no
5790if test "$_sdl" = yes ; then
5791  header_check SDL/SDL_image.h -lSDL_image && sdl_image=yes
5792fi
5793echores "$sdl_image"
5794
5795
5796# make sure this stays below CoreVideo to avoid issues due to namespace
5797# conflicts between -lGL and -framework OpenGL
5798echocheck "OpenGL"
5799#Note: this test is run even with --enable-gl since we autodetect linker flags
5800if test "$_gl" != no ; then
5801  cat > $TMPC << EOF
5802#ifdef GL_WIN32
5803#include <windows.h>
5804#include <GL/gl.h>
5805#elif defined(GL_SDL)
5806#include <GL/gl.h>
5807#ifdef CONFIG_SDL_SDL_H
5808#include <SDL/SDL.h>
5809#else
5810#include <SDL.h>
5811#endif
5812#ifndef __APPLE__
5813// we allow SDL hacking our main() only on OSX
5814#undef main
5815#endif
5816#elif defined(GL_EGL_X11)
5817#include <GL/gl.h>
5818#include <X11/Xlib.h>
5819#include <EGL/egl.h>
5820#elif defined(GL_EGL_ANDROID)
5821#include <GLES/gl.h>
5822#include <EGL/egl.h>
5823#else
5824#include <GL/gl.h>
5825#include <X11/Xlib.h>
5826#include <GL/glx.h>
5827#endif
5828int main(int argc, char *argv[]) {
5829#ifdef GL_WIN32
5830  HDC dc;
5831  wglCreateContext(dc);
5832#elif defined(GL_SDL)
5833  SDL_GL_SwapBuffers();
5834#elif defined(GL_EGL_X11) || defined(GL_EGL_ANDROID)
5835  EGLDisplay eglDisplay = EGL_NO_DISPLAY;
5836  eglInitialize(eglDisplay, NULL, NULL);
5837#else
5838  glXCreateContext(NULL, NULL, NULL, True);
5839#endif
5840#if !defined(GL_EGL_X11) && !defined(GL_EGL_ANDROID)
5841  glFinish();
5842#endif
5843  return 0;
5844}
5845EOF
5846  _gl=no
5847  for ld_tmp in "" -lGL "-lGL -lXdamage" "-lGL $ld_pthread" ; do
5848    if test "$_x11" = yes && cc_check $ld_tmp ; then
5849      _gl=yes
5850      _gl_x11=yes
5851      libs_mplayer="$libs_mplayer $ld_tmp $ld_dl"
5852      break
5853    fi
5854  done
5855  if win32 && cc_check -DGL_WIN32 -lopengl32 ; then
5856    _gl=yes
5857    _gl_win32=yes
5858    libs_mplayer="$libs_mplayer -lopengl32 -lgdi32"
5859  fi
5860  # last so it can reuse any linker etc. flags detected before
5861  if test "$_sdl" = yes ; then
5862    if cc_check -DGL_SDL ||
5863       cc_check -DCONFIG_SDL_SDL_H -DGL_SDL ; then
5864      _gl=yes
5865      _gl_sdl=yes
5866    elif cc_check -DGL_SDL -lGL ||
5867       cc_check -DCONFIG_SDL_SDL_H -DGL_SDL -lGL ; then
5868      _gl=yes
5869      _gl_sdl=yes
5870      libs_mplayer="$libs_mplayer -lGL"
5871    fi
5872  fi
5873  if test "$_corevideo" = yes ; then
5874    _gl=yes
5875    _gl_osx=yes
5876  fi
5877else
5878  _gl=no
5879fi
5880if test "$_gl" = yes ; then
5881  def_gl='#define CONFIG_GL 1'
5882  res_comment="backends:"
5883  if test "$_gl_win32" = yes ; then
5884    def_gl_win32='#define CONFIG_GL_WIN32 1'
5885    res_comment="$res_comment win32"
5886  fi
5887  if test "$_gl_x11" = yes ; then
5888    def_gl_x11='#define CONFIG_GL_X11 1'
5889    res_comment="$res_comment x11"
5890  fi
5891  if test "$_gl_egl_android" = yes ; then
5892    def_gl_egl_android='#define CONFIG_GL_EGL_ANDROID 1'
5893    res_comment="$res_comment egl_android"
5894  fi
5895  if test "$_gl_egl_x11" = yes ; then
5896    def_gl_egl_x11='#define CONFIG_GL_EGL_X11 1'
5897    res_comment="$res_comment egl_x11"
5898  fi
5899  if test "$_gl_sdl" = yes ; then
5900    def_gl_sdl='#define CONFIG_GL_SDL 1'
5901    res_comment="$res_comment sdl"
5902  fi
5903  if test "$_gl_osx" = yes ; then
5904    def_gl_osx='#define CONFIG_GL_OSX 1'
5905    res_comment="$res_comment osx"
5906  fi
5907  vomodules="opengl $vomodules"
5908else
5909  def_gl='#undef CONFIG_GL'
5910  def_gl_win32='#undef CONFIG_GL_WIN32'
5911  def_gl_x11='#undef CONFIG_GL_X11'
5912  def_gl_egl_android='#undef CONFIG_GL_EGL_ANDROID'
5913  def_gl_egl_x11='#undef CONFIG_GL_EGL_X11'
5914  def_gl_sdl='#undef CONFIG_GL_SDL'
5915  def_gl_osx='#undef CONFIG_GL_OSX'
5916  novomodules="opengl $novomodules"
5917fi
5918echores "$_gl"
5919
5920
5921echocheck "MatrixView"
5922if test "$matrixview" = auto ; then
5923  matrixview="$_gl"
5924fi
5925if test "$matrixview" = yes ; then
5926  vomodules="matrixview $vomodules"
5927  def_matrixview='#define CONFIG_MATRIXVIEW 1'
5928else
5929  novomodules="matrixview $novomodules"
5930  def_matrixview='#undef CONFIG_MATRIXVIEW'
5931fi
5932echores "$matrixview"
5933
5934
5935if os2 ; then
5936echocheck "KVA (SNAP/WarpOverlay!/VMAN/DIVE)"
5937if test "$_kva" = auto; then
5938  _kva=no;
5939  header_check_broken os2.h kva.h -lkva && _kva=yes
5940fi
5941if test "$_kva" = yes ; then
5942  def_kva='#define CONFIG_KVA 1'
5943  libs_mplayer="$libs_mplayer -lkva"
5944  vomodules="kva $vomodules"
5945else
5946  def_kva='#undef CONFIG_KVA'
5947  novomodules="kva $novomodules"
5948fi
5949echores "$_kva"
5950fi #if os2
5951
5952
5953if win32; then
5954
5955echocheck "Windows waveout"
5956if test "$_win32waveout" = auto ; then
5957  _win32waveout=no
5958  header_check_broken windows.h mmsystem.h -lwinmm && _win32waveout=yes
5959fi
5960if test "$_win32waveout" = yes ; then
5961  def_win32waveout='#define CONFIG_WIN32WAVEOUT 1'
5962  libs_mplayer="$libs_mplayer -lwinmm"
5963  aomodules="win32 $aomodules"
5964else
5965  def_win32waveout='#undef CONFIG_WIN32WAVEOUT'
5966  noaomodules="win32 $noaomodules"
5967fi
5968echores "$_win32waveout"
5969
5970echocheck "Direct3D"
5971if test "$_direct3d" = auto ; then
5972  _direct3d=no
5973  header_check d3d9.h && _direct3d=yes
5974fi
5975if test "$_direct3d" = yes ; then
5976  def_direct3d='#define CONFIG_DIRECT3D 1'
5977  vomodules="direct3d $vomodules"
5978else
5979  def_direct3d='#undef CONFIG_DIRECT3D'
5980  novomodules="direct3d $novomodules"
5981fi
5982echores "$_direct3d"
5983
5984echocheck "Directx"
5985if test "$_directx" = auto ; then
5986  cat > $TMPC << EOF
5987#include <windows.h>
5988#include <ddraw.h>
5989#include <dsound.h>
5990int main(void) { return 0; }
5991EOF
5992  _directx=no
5993  cc_check -lgdi32 && _directx=yes
5994fi
5995if test "$_directx" = yes ; then
5996  def_directx='#define CONFIG_DIRECTX 1'
5997  libs_mplayer="$libs_mplayer -lgdi32"
5998  vomodules="directx $vomodules"
5999  aomodules="dsound $aomodules"
6000else
6001  def_directx='#undef CONFIG_DIRECTX'
6002  novomodules="directx $novomodules"
6003  noaomodules="dsound $noaomodules"
6004fi
6005echores "$_directx"
6006
6007fi #if win32; then
6008
6009
6010echocheck "DXR2"
6011if test "$_dxr2" = auto; then
6012  _dxr2=no
6013  for inc_tmp in "" -I/usr/local/include/dxr2 -I/usr/include/dxr2; do
6014    header_check dxr2ioctl.h $inc_tmp && _dxr2=yes &&
6015      extra_cflags="$extra_cflags $inc_tmp" && break
6016  done
6017fi
6018if test "$_dxr2" = yes; then
6019  def_dxr2='#define CONFIG_DXR2 1'
6020  aomodules="dxr2 $aomodules"
6021  vomodules="dxr2 $vomodules"
6022else
6023  def_dxr2='#undef CONFIG_DXR2'
6024  noaomodules="dxr2 $noaomodules"
6025  novomodules="dxr2 $novomodules"
6026fi
6027echores "$_dxr2"
6028
6029echocheck "DXR3/H+"
6030if test "$_dxr3" = auto ; then
6031  _dxr3=no
6032  header_check linux/em8300.h && _dxr3=yes
6033fi
6034if test "$_dxr3" = yes ; then
6035  def_dxr3='#define CONFIG_DXR3 1'
6036  vomodules="dxr3 $vomodules"
6037else
6038  def_dxr3='#undef CONFIG_DXR3'
6039  novomodules="dxr3 $novomodules"
6040fi
6041echores "$_dxr3"
6042
6043
6044echocheck "V4L2 MPEG Decoder"
6045if test "$_v4l2" = auto ; then
6046  cat > $TMPC << EOF
6047#include <sys/time.h>
6048#include <linux/videodev2.h>
6049#include <linux/version.h>
6050int main(void) {
6051#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
6052#error kernel headers too old, need 2.6.22
6053#endif
6054  struct v4l2_ext_controls ctrls;
6055  ctrls.ctrl_class = V4L2_CTRL_CLASS_MPEG;
6056  return 0;
6057}
6058EOF
6059  _v4l2=no
6060  cc_check && _v4l2=yes
6061fi
6062if test "$_v4l2" = yes ; then
6063  def_v4l2='#define CONFIG_V4L2_DECODER 1'
6064  vomodules="v4l2 $vomodules"
6065  aomodules="v4l2 $aomodules"
6066else
6067  def_v4l2='#undef CONFIG_V4L2_DECODER'
6068  novomodules="v4l2 $novomodules"
6069  noaomodules="v4l2 $noaomodules"
6070fi
6071echores "$_v4l2"
6072
6073
6074
6075#########
6076# AUDIO #
6077#########
6078
6079
6080echocheck "OSS Audio"
6081if test "$_ossaudio" = auto ; then
6082  _ossaudio=no
6083  return_check $_soundcard_header SNDCTL_DSP_SETFRAGMENT && _ossaudio=yes
6084fi
6085if test "$_ossaudio" = yes ; then
6086  def_ossaudio='#define CONFIG_OSS_AUDIO 1'
6087  aomodules="oss $aomodules"
6088  _real_ossaudio=no
6089  cpp_condition_check "$_soundcard_header" OPEN_SOUND_SYSTEM &&
6090      _real_ossaudio=yes
6091  if test "$_real_ossaudio" = yes; then
6092      def_ossaudio_devdsp='#define PATH_DEV_DSP "/dev/dsp"'
6093  elif netbsd || openbsd ; then
6094      def_ossaudio_devdsp='#define PATH_DEV_DSP "/dev/sound"'
6095      extra_ldflags="$extra_ldflags -lossaudio"
6096  else
6097      def_ossaudio_devdsp='#define PATH_DEV_DSP "/dev/dsp"'
6098  fi
6099  def_ossaudio_devmixer='#define PATH_DEV_MIXER "/dev/mixer"'
6100else
6101  def_ossaudio='#undef CONFIG_OSS_AUDIO'
6102  def_ossaudio_devdsp='#define PATH_DEV_DSP ""'
6103  def_ossaudio_devmixer='#define PATH_DEV_MIXER ""'
6104  noaomodules="oss $noaomodules"
6105fi
6106echores "$_ossaudio"
6107
6108
6109echocheck "aRts"
6110if test "$_arts" = auto ; then
6111  _arts=no
6112  if ( artsc-config --version ) >> "$TMPLOG" 2>&1 ; then
6113    statement_check artsc.h 'arts_init()' $(artsc-config --libs) $(artsc-config --cflags) &&
6114      _arts=yes
6115  fi
6116fi
6117
6118if test "$_arts" = yes ; then
6119  def_arts='#define CONFIG_ARTS 1'
6120  aomodules="arts $aomodules"
6121  libs_mplayer="$libs_mplayer $(artsc-config --libs)"
6122  extra_cflags="$extra_cflags $(artsc-config --cflags)"
6123else
6124  noaomodules="arts $noaomodules"
6125fi
6126echores "$_arts"
6127
6128
6129echocheck "EsounD"
6130if test "$_esd" = auto ; then
6131  _esd=no
6132  if ( esd-config --version ) >> "$TMPLOG" 2>&1 ; then
6133    statement_check esd.h 'esd_open_sound("test")' $(esd-config --libs) $(esd-config --cflags) && _esd=yes
6134  fi
6135fi
6136echores "$_esd"
6137
6138if test "$_esd" = yes ; then
6139  def_esd='#define CONFIG_ESD 1'
6140  aomodules="esd $aomodules"
6141  libs_mplayer="$libs_mplayer $(esd-config --libs)"
6142  extra_cflags="$extra_cflags $(esd-config --cflags)"
6143
6144  echocheck "esd_get_latency()"
6145  statement_check esd.h 'esd_get_latency(0)' $(esd-config --libs) $(esd-config --cflags) &&
6146    _esd_latency=yes && def_esd_latency='#define CONFIG_ESD_LATENCY 1'
6147  echores "$_esd_latency"
6148else
6149  def_esd='#undef CONFIG_ESD'
6150  def_esd_latency='#undef CONFIG_ESD_LATENCY'
6151  noaomodules="esd $noaomodules"
6152fi
6153
6154
6155echocheck "NAS"
6156if test "$_nas" = auto ; then
6157  _nas=no
6158  header_check audio/audiolib.h -laudio -lXt && _nas=yes
6159fi
6160if test "$_nas" = yes ; then
6161  def_nas='#define CONFIG_NAS 1'
6162  libs_mplayer="$libs_mplayer -laudio -lXt"
6163  aomodules="nas $aomodules"
6164else
6165  noaomodules="nas $noaomodules"
6166  def_nas='#undef CONFIG_NAS'
6167fi
6168echores "$_nas"
6169
6170
6171echocheck "pulse"
6172if test "$_pulse" = auto ; then
6173  _pulse=no
6174  if $_pkg_config --exists 'libpulse >= 0.9' ; then
6175    header_check pulse/pulseaudio.h $($_pkg_config --libs --cflags libpulse) &&
6176      _pulse=yes
6177  fi
6178fi
6179echores "$_pulse"
6180
6181if test "$_pulse" = yes ; then
6182  def_pulse='#define CONFIG_PULSE 1'
6183  aomodules="pulse $aomodules"
6184  libs_mplayer="$libs_mplayer $($_pkg_config --libs libpulse)"
6185  extra_cflags="$extra_cflags $($_pkg_config --cflags libpulse)"
6186else
6187  def_pulse='#undef CONFIG_PULSE'
6188  noaomodules="pulse $noaomodules"
6189fi
6190
6191
6192echocheck "JACK"
6193if test "$_jack" = auto ; then
6194  _jack=yes
6195  if statement_check jack/jack.h 'jack_client_open("test", JackUseExactName, NULL)' -ljack ; then
6196    libs_mplayer="$libs_mplayer -ljack"
6197  elif statement_check jack/jack.h 'jack_client_open("test", JackUseExactName, NULL)' $($_pkg_config --libs --cflags --silence-errors jack) ; then
6198    libs_mplayer="$libs_mplayer $($_pkg_config --libs jack)"
6199    extra_cflags="$extra_cflags "$($_pkg_config --cflags jack)""
6200  else
6201    _jack=no
6202  fi
6203fi
6204
6205if test "$_jack" = yes ; then
6206  def_jack='#define CONFIG_JACK 1'
6207  aomodules="jack $aomodules"
6208else
6209  noaomodules="jack $noaomodules"
6210fi
6211echores "$_jack"
6212
6213echocheck "OpenAL"
6214if test "$_openal" = auto ; then
6215  _openal=no
6216cat > $TMPC << EOF
6217#ifdef OPENAL_AL_H
6218#include <OpenAL/al.h>
6219#else
6220#include <AL/al.h>
6221#endif
6222int main(void) {
6223  alSourceQueueBuffers(0, 0, 0);
6224  return 0;
6225}
6226EOF
6227  for I in "-lopenal" "-lopenal32" "-framework OpenAL" ; do
6228    cc_check $I && _openal=yes && break
6229    cc_check -DOPENAL_AL_H=1 $I && def_openal_h='#define OPENAL_AL_H 1' && _openal=yes && break
6230  done
6231  test "$_openal" = yes && libs_mplayer="$libs_mplayer $I"
6232fi
6233if test "$_openal" = yes ; then
6234  def_openal='#define CONFIG_OPENAL 1'
6235  aomodules="openal $aomodules"
6236else
6237  noaomodules="openal $noaomodules"
6238fi
6239echores "$_openal"
6240
6241
6242echocheck "ALSA audio"
6243if test "$_alloca" = yes && test "$_alsa" = auto ; then
6244  _alsa=no
6245  header_check alsa/asoundlib.h -lasound $ld_dl $ld_pthread && _alsa=yes
6246fi
6247if test "$_alsa" = yes ; then
6248  aomodules="alsa $aomodules"
6249  def_alsa='#define CONFIG_ALSA 1'
6250  extra_ldflags="$extra_ldflags -lasound $ld_dl $ld_pthread"
6251else
6252  noaomodules="alsa $noaomodules"
6253  def_alsa='#undef CONFIG_ALSA'
6254fi
6255echores "$_alsa"
6256
6257
6258echocheck "Sun audio"
6259if test "$_sunaudio" = auto ; then
6260  cat > $TMPC << EOF
6261#include <sys/types.h>
6262#include <sys/audioio.h>
6263int main(void) { audio_info_t info; AUDIO_INITINFO(&info); return 0; }
6264EOF
6265  _sunaudio=no
6266  cc_check && _sunaudio=yes
6267fi
6268if test "$_sunaudio" = yes ; then
6269  def_sunaudio='#define CONFIG_SUN_AUDIO 1'
6270  aomodules="sun $aomodules"
6271else
6272  def_sunaudio='#undef CONFIG_SUN_AUDIO'
6273  noaomodules="sun $noaomodules"
6274fi
6275echores "$_sunaudio"
6276
6277
6278def_mlib='#define CONFIG_MLIB 0'
6279if sunos; then
6280echocheck "Sun mediaLib"
6281if test "$_mlib" = auto ; then
6282  _mlib=no
6283  cc_check mlib.h "mlib_VideoColorYUV2ABGR420(0, 0, 0, 0, 0, 0, 0, 0, 0)" -lmlib &&
6284    _mlib=yes && def_mlib='#define CONFIG_MLIB 1'
6285fi
6286echores "$_mlib"
6287fi #if sunos
6288
6289
6290if darwin; then
6291echocheck "CoreAudio"
6292if test "$_coreaudio" = auto ; then
6293  cat > $TMPC <<EOF
6294#include <CoreAudio/CoreAudio.h>
6295#include <AudioToolbox/AudioToolbox.h>
6296#include <AudioUnit/AudioUnit.h>
6297int main(void) { return 0; }
6298EOF
6299  _coreaudio=no
6300  cc_check -framework CoreAudio -framework AudioUnit -framework AudioToolbox && _coreaudio=yes
6301fi
6302if test "$_coreaudio" = yes ; then
6303  libs_mplayer="$libs_mplayer -framework CoreAudio -framework AudioUnit -framework AudioToolbox"
6304  def_coreaudio='#define CONFIG_COREAUDIO 1'
6305  aomodules="coreaudio $aomodules"
6306else
6307  def_coreaudio='#undef CONFIG_COREAUDIO'
6308  noaomodules="coreaudio $noaomodules"
6309fi
6310echores $_coreaudio
6311fi #if darwin
6312
6313
6314if irix; then
6315echocheck "SGI audio"
6316if test "$_sgiaudio" = auto ; then
6317  _sgiaudio=no
6318  header_check dmedia/audio.h && _sgiaudio=yes
6319fi
6320if test "$_sgiaudio" = "yes" ; then
6321  def_sgiaudio='#define CONFIG_SGI_AUDIO 1'
6322  libs_mplayer="$libs_mplayer -laudio"
6323  aomodules="sgi $aomodules"
6324else
6325  def_sgiaudio='#undef CONFIG_SGI_AUDIO'
6326  noaomodules="sgi $noaomodules"
6327fi
6328echores "$_sgiaudio"
6329fi #if irix
6330
6331
6332echocheck "sndio audio"
6333if test "$_sndio" = auto ; then
6334  _sndio=no
6335  statement_check sndio.h 'sio_open(SIO_DEVANY, SIO_PLAY, 0)' -lsndio && _sndio=yes
6336fi
6337if test "$_sndio" = yes ; then
6338  def_sndio='#define CONFIG_SNDIO_AUDIO 1'
6339  aomodules="sndio $aomodules"
6340  extra_ldflags="$extra_ldflags -lsndio"
6341else
6342  def_sndio='#undef CONFIG_SNDIO_AUDIO'
6343  noaomodules="sndio $noaomodules"
6344fi
6345echores "$_sndio"
6346
6347
6348if os2 ; then
6349echocheck "KAI (UNIAUD/DART)"
6350if test "$_kai" = auto; then
6351  _kai=no;
6352  header_check_broken os2.h kai.h -lkai && _kai=yes
6353fi
6354if test "$_kai" = yes ; then
6355  def_kai='#define CONFIG_KAI 1'
6356  libs_mplayer="$libs_mplayer -lkai"
6357  aomodules="kai $aomodules"
6358else
6359  def_kai='#undef CONFIG_KAI'
6360  noaomodules="kai $noaomodules"
6361fi
6362echores "$_kai"
6363
6364echocheck "DART"
6365if test "$_dart" = auto; then
6366  _dart=no;
6367  header_check_broken os2.h dart.h -ldart && _dart=yes
6368fi
6369if test "$_dart" = yes ; then
6370  def_dart='#define CONFIG_DART 1'
6371  libs_mplayer="$libs_mplayer -ldart"
6372  aomodules="dart $aomodules"
6373else
6374  def_dart='#undef CONFIG_DART'
6375  noaomodules="dart $noaomodules"
6376fi
6377echores "$_dart"
6378fi #if os2
6379
6380
6381# set default CD/DVD devices
6382if win32 || os2 ; then
6383  default_cdrom_device="D:"
6384elif darwin ; then
6385  default_cdrom_device="/dev/disk1"
6386elif dragonfly ; then
6387  default_cdrom_device="/dev/cd0"
6388elif freebsd ; then
6389  default_cdrom_device="/dev/cd0"
6390elif openbsd ; then
6391  default_cdrom_device="/dev/rcd0c"
6392elif sunos ; then
6393  default_cdrom_device="/vol/dev/aliases/cdrom0"
6394  # Solaris 10 and newer use HAL instead of the vold daemon.
6395  test $(uname -r | sed 's/^5\.//') -gt 10 && default_cdrom_device="/cdrom/cdrom0"
6396elif amigaos ; then
6397  default_cdrom_device="a1ide.device:2"
6398else
6399  default_cdrom_device="/dev/cd0"
6400fi
6401
6402if win32 || os2 || dragonfly || openbsd || sunos || amigaos ; then
6403  default_dvd_device=$default_cdrom_device
6404elif darwin ; then
6405  default_dvd_device="/dev/rdiskN"
6406else
6407  default_dvd_device="/dev/cd0"
6408fi
6409
6410
6411echocheck "VCD support"
6412if test "$_vcd" = auto; then
6413  _vcd=no
6414  if linux || freebsd || netbsd || openbsd || dragonfly || bsdos || darwin || sunos || os2; then
6415    _vcd=yes
6416  elif mingw32; then
6417  header_check ddk/ntddcdrm.h && _vcd=yes
6418  fi
6419fi
6420if test "$_vcd" = yes; then
6421  inputmodules="vcd $inputmodules"
6422  def_vcd='#define CONFIG_VCD 1'
6423else
6424  def_vcd='#undef CONFIG_VCD'
6425  noinputmodules="vcd $noinputmodules"
6426  res_comment="not supported on this OS"
6427fi
6428echores "$_vcd"
6429
6430
6431
6432echocheck "Blu-ray support"
6433if test "$_bluray" = auto ; then
6434  _bluray=no
6435  statement_check libbluray/bluray.h 'bd_get_title_info(0, 0, 0)' -lbluray && _bluray=yes
6436fi
6437if test "$_bluray" = yes ; then
6438  def_bluray='#define CONFIG_LIBBLURAY 1'
6439  extra_ldflags="$extra_ldflags -lbluray"
6440  inputmodules="bluray $inputmodules"
6441else
6442  def_bluray='#undef CONFIG_LIBBLURAY'
6443  noinputmodules="bluray $noinputmodules"
6444fi
6445echores "$_bluray"
6446
6447echocheck "dvdread"
6448if test "$_dvdread" = auto ; then
6449  _dvdread=no
6450    _dvdreadcflags=$($_dvdreadconfig --cflags 2> /dev/null)
6451    _dvdreadlibs=$($_dvdreadconfig --libs 2> /dev/null)
6452    if statement_check dvdread/dvd_reader.h 'DVDOpen("test")' $_dvdreadcflags $_dvdreadlibs ; then
6453      _dvdread=yes
6454      extra_cflags="$extra_cflags $_dvdreadcflags"
6455      extra_ldflags="$extra_ldflags $_dvdreadlibs"
6456    fi
6457fi
6458
6459if test "$_dvdread" = yes; then
6460  def_dvdread='#define CONFIG_DVDREAD 1'
6461  extra_ldflags="$extra_ldflags"
6462  inputmodules="dvdread $inputmodules"
6463else
6464  _dvdnav=no
6465  def_dvdread='#undef CONFIG_DVDREAD'
6466  noinputmodules="dvdread $noinputmodules"
6467fi
6468echores "$_dvdread"
6469
6470
6471echocheck "libcdio"
6472header_check cdio/cdda.h && _inc_paranoia=cdio || _inc_paranoia=cdio/paranoia
6473if test "$_libcdio" = auto ; then
6474        cat > $TMPC << EOF
6475#include <stdio.h>
6476#include <cdio/version.h>
6477#include <$_inc_paranoia/cdda.h>
6478#include <$_inc_paranoia/paranoia.h>
6479int main(void) {
6480    void *test = cdda_verbose_set;
6481    printf("%s\n", CDIO_VERSION);
6482    return test == (void *)1;
6483}
6484EOF
6485        _libcdio=no
6486    for ld_tmp in "" "-lwinmm" ; do
6487        ld_tmp="-lcdio_cdda -lcdio -lcdio_paranoia $ld_tmp"
6488        cc_check $ld_tmp && _libcdio=yes &&
6489            extra_ldflags="$extra_ldflags $ld_tmp" && break
6490    done
6491    if test "$_libcdio" = no && $_pkg_config --exists libcdio_paranoia ; then
6492      inc_tmp=$($_pkg_config --cflags libcdio_paranoia)
6493      ld_tmp=$($_pkg_config --libs libcdio_paranoia)
6494      cc_check $inc_tmp $ld_tmp && _libcdio=yes &&
6495        extra_ldflags="$extra_ldflags $ld_tmp" && extra_cflags="$extra_cflags $inc_tmp"
6496    fi
6497fi
6498if test "$_libcdio" = yes ; then
6499    _cdda='yes'
6500    _cdparanoia=no
6501    def_libcdio='#define CONFIG_LIBCDIO 1'
6502    if test "$_inc_paranoia" = cdio ; then
6503      def_cdio_paranoia_h='#define HAVE_CDIO_PARANOIA_H 1'
6504      def_cdio_paranoia_paranoia_h='#define HAVE_CDIO_PARANOIA_PARANOIA_H 0'
6505    else
6506      def_cdio_paranoia_h='#define HAVE_CDIO_PARANOIA_H 0'
6507      def_cdio_paranoia_paranoia_h='#define HAVE_CDIO_PARANOIA_PARANOIA_H 1'
6508    fi
6509    def_havelibcdio='yes'
6510else
6511    _libcdio=no
6512    def_libcdio='#undef CONFIG_LIBCDIO'
6513    def_cdio_paranoia_h='#define HAVE_CDIO_PARANOIA_H 0'
6514    def_cdio_paranoia_paranoia_h='#define HAVE_CDIO_PARANOIA_PARANOIA_H 0'
6515    def_havelibcdio='no'
6516fi
6517echores "$_libcdio"
6518
6519echocheck "cdparanoia"
6520if test "$_cdparanoia" = auto ; then
6521    _cdparanoia=no
6522    for inc_tmp in "" "-I/usr/include/cdda" "-I/usr/local/include/cdda" ; do
6523      statement_check_broken cdda_interface.h cdda_paranoia.h 'paranoia_cachemodel_size(NULL, 0)' $inc_tmp -lcdda_interface -lcdda_paranoia &&
6524        _cdparanoia=yes && extra_cflags="$extra_cflags $inc_tmp" && break
6525    done
6526fi
6527if test "$_cdparanoia" = yes ; then
6528    _cdda='yes'
6529    extra_ldflags="$extra_ldflags -lcdda_interface -lcdda_paranoia"
6530    openbsd && extra_ldflags="$extra_ldflags -lutil"
6531elif test "$_libcdio" = yes ; then
6532    res_comment='using libcdio'
6533fi
6534echores "$_cdparanoia"
6535
6536
6537if test "$_cdda" = yes ; then
6538    test $_cddb = auto && test $networking = yes && _cddb=yes
6539    def_cdparanoia='#define CONFIG_CDDA 1'
6540    inputmodules="cdda $inputmodules"
6541else
6542    def_cdparanoia='#undef CONFIG_CDDA'
6543    noinputmodules="cdda $noinputmodules"
6544fi
6545
6546if test "$_cddb" = yes ; then
6547    def_cddb='#define CONFIG_CDDB 1'
6548    inputmodules="cddb $inputmodules"
6549else
6550    _cddb=no
6551    def_cddb='#undef CONFIG_CDDB'
6552    noinputmodules="cddb $noinputmodules"
6553fi
6554
6555echocheck "bitmap font support"
6556if test "$_bitmap_font" = yes ; then
6557  def_bitmap_font="#define CONFIG_BITMAP_FONT 1"
6558else
6559  def_bitmap_font="#undef CONFIG_BITMAP_FONT"
6560fi
6561echores "$_bitmap_font"
6562
6563
6564echocheck "freetype >= 2.0.9"
6565
6566# freetype depends on iconv
6567if test "$_iconv" = no ; then
6568    _freetype=no
6569    res_comment="iconv support needed"
6570fi
6571
6572if test "$_freetype" = auto ; then
6573    test -n "$ld_static" && _freetypeconfig="$_freetypeconfig --static"
6574    if ( $_freetypeconfig --version ) >/dev/null 2>&1 ; then
6575        cat > $TMPC << EOF
6576#include <stdio.h>
6577#include <ft2build.h>
6578#include FT_FREETYPE_H
6579#if ((FREETYPE_MAJOR < 2) || ((FREETYPE_MINOR == 0) && (FREETYPE_PATCH < 9)))
6580#error "Need FreeType 2.0.9 or newer"
6581#endif
6582int main(void) {
6583    FT_Library library;
6584    FT_Init_FreeType(&library);
6585    return 0;
6586}
6587EOF
6588        _freetype=no
6589        cc_check $($_freetypeconfig --cflags) $($_freetypeconfig --libs) && _freetype=yes
6590    else
6591        _freetype=no
6592    fi
6593fi
6594if test "$_freetype" = yes ; then
6595    def_freetype='#define CONFIG_FREETYPE 1'
6596    extra_cflags="$extra_cflags $($_freetypeconfig --cflags)"
6597    extra_ldflags="$extra_ldflags $($_freetypeconfig --libs)"
6598else
6599    def_freetype='#undef CONFIG_FREETYPE'
6600fi
6601echores "$_freetype"
6602
6603if test "$_freetype" = no ; then
6604    _fontconfig=no
6605    res_comment="FreeType support needed"
6606fi
6607echocheck "fontconfig"
6608if test "$_fontconfig" = auto ; then
6609        cat > $TMPC << EOF
6610#include <stdio.h>
6611#include <stdlib.h>
6612#include <fontconfig/fontconfig.h>
6613#if FC_VERSION < 20402
6614#error At least version 2.4.2 of Fontconfig required
6615#endif
6616int main(void) {
6617    int err = FcInit();
6618    if (err == FcFalse) {
6619        printf("Could not initialize Fontconfig library.\n");
6620        exit(err);
6621    }
6622    return 0;
6623}
6624EOF
6625  _fontconfig=no
6626  for ld_tmp in "" "-lexpat -lfreetype" "-lexpat -lfreetype -lz" "-lexpat -lfreetype -lz " ; do
6627    ld_tmp="-lfontconfig $ld_tmp"
6628    cc_check $ld_tmp && _fontconfig=yes && extra_ldflags="$extra_ldflags $ld_tmp" && break
6629  done
6630  if test "$_fontconfig" = no && $_pkg_config --exists fontconfig ; then
6631    inc_tmp=$($_pkg_config --cflags fontconfig)
6632    ld_tmp=$($_pkg_config --libs fontconfig)
6633    cc_check $inc_tmp $ld_tmp && _fontconfig=yes &&
6634      extra_ldflags="$extra_ldflags $ld_tmp" && extra_cflags="$extra_cflags $inc_tmp"
6635  fi
6636fi
6637if test "$_fontconfig" = yes ; then
6638    def_fontconfig='#define CONFIG_FONTCONFIG 1'
6639else
6640    def_fontconfig='#undef CONFIG_FONTCONFIG'
6641fi
6642echores "$_fontconfig"
6643
6644
6645echocheck "fribidi with charsets"
6646if test "$_fribidi" = auto ; then
6647    cat > $TMPC << EOF
6648#include <stdlib.h>
6649#include <fribidi/fribidi.h>
6650FriBidiParType test;
6651int main(void) {
6652    if (fribidi_parse_charset("UTF-8") != FRIBIDI_CHAR_SET_UTF8)
6653       exit(1);
6654    return 0;
6655}
6656EOF
6657    _fribidi=no
6658    cc_check -lfribidi && _fribidi=yes && extra_ldflags="$extra_ldflags -lfribidi"
6659    if $_pkg_config --exists fribidi > /dev/null 2>&1 &&
6660       test "$_fribidi" = no ; then
6661        inc_tmp="$($_pkg_config --cflags fribidi)"
6662        ld_tmp="$($_pkg_config --libs fribidi)"
6663        cc_check $inc_tmp $ld_tmp && _fribidi=yes &&
6664            extra_cflags="$extra_cflags $inc_tmp" &&
6665            extra_ldflags="$extra_ldflags $ld_tmp"
6666    fi
6667fi
6668if test "$_fribidi" = yes ; then
6669    def_fribidi='#define CONFIG_FRIBIDI 1'
6670else
6671    def_fribidi='#undef CONFIG_FRIBIDI'
6672fi
6673echores "$_fribidi"
6674
6675
6676echocheck "SSA/ASS support"
6677# libass depends on FreeType
6678if test "$_freetype" = no ; then
6679    _ass=no
6680    ass_internal=no
6681    res_comment="FreeType and FriBiDi support needed"
6682fi
6683
6684if test "$_ass" = auto ; then
6685    cat > $TMPC << EOF
6686#include <ft2build.h>
6687#include FT_FREETYPE_H
6688#if ((FREETYPE_MAJOR < 2) || (FREETYPE_MINOR < 2) || ((FREETYPE_MINOR == 2) && (FREETYPE_PATCH < 1)))
6689#error "Need FreeType 2.2.1 or newer"
6690#endif
6691int main(void) { return 0; }
6692EOF
6693    _ass=no
6694    cc_check $($_freetypeconfig --cflags) $($_freetypeconfig --libs) && _ass=yes
6695    if test "$_ass" = no ; then
6696        res_comment="FreeType >= 2.2.1 needed"
6697    elif test "$ass_internal" != yes ; then
6698        cat > $TMPC << EOF
6699#include <ass/ass.h>
6700int main(void) {
6701#if !defined(LIBASS_VERSION) || LIBASS_VERSION < 0x00910000
6702#error "libass version too old"
6703#endif
6704  ass_process_force_style(0);
6705  return 0;
6706}
6707EOF
6708        if cc_check -lass ; then
6709            res_comment="external"
6710            extra_ldflags="$extra_ldflags -lass"
6711        elif test "$ass_internal" = auto ; then
6712            ass_internal=yes
6713        else
6714            _ass=no
6715        fi
6716    fi
6717fi
6718if test "$_ass" = yes ; then
6719    def_ass='#define CONFIG_ASS 1'
6720else
6721    def_ass='#undef CONFIG_ASS'
6722fi
6723if test "$ass_internal" = yes ; then
6724    def_ass_internal='#define CONFIG_ASS_INTERNAL 1'
6725else
6726    def_ass_internal='#undef CONFIG_ASS_INTERNAL'
6727    ass_internal=no
6728fi
6729echores "$_ass"
6730
6731
6732echocheck "ENCA"
6733if test "$_enca" = auto ; then
6734    _enca=no
6735    if statement_check enca.h 'enca_get_languages(NULL)' -lenca; then
6736      _enca=yes
6737    elif $_pkg_config --exists enca; then
6738      if statement_check enca.h 'enca_get_languages(NULL)' $($_pkg_config --cflags --libs enca); then
6739        _enca=yes
6740        extra_cflags="$extra_cflags $($_pkg_config --cflags enca)"
6741        extra_ldflags="$extra_ldflags $($_pkg_config --libs enca)"
6742      fi
6743    fi
6744fi
6745    if test "$_enca" = yes ; then
6746        def_enca='#define CONFIG_ENCA 1'
6747        extra_ldflags="$extra_ldflags -lenca"
6748    else
6749        def_enca='#undef CONFIG_ENCA'
6750    fi
6751echores "$_enca"
6752
6753
6754echocheck "zlib"
6755_zlib=no
6756statement_check zlib.h 'inflate(0, Z_NO_FLUSH)' -lz && _zlib=yes
6757if test "$_zlib" = yes ; then
6758  def_zlib='#define CONFIG_ZLIB 1'
6759  extra_ldflags="$extra_ldflags -lz"
6760  extra_cflags="$extra_cflags -DZLIB_CONST"
6761  # necessary for vf_screenshot
6762  mplayer_encoders="$mplayer_encoders PNG_ENCODER"
6763else
6764  def_zlib='#define CONFIG_ZLIB 0'
6765  libavdecoders=$(filter_out_component decoder 'APNG FLASHSV FLASHSV2 PNG ZMBV ZLIB DXA EXR G2M LSCR MSCC MVHA MWSC RASC RSCC SCREENPRESSO SRGC TDSC TSCC ZEROCODEC WCMV')
6766  libavencoders=$(filter_out_component encoder 'APNG FLASHSV FLASHSV2 PNG ZMBV ZLIB')
6767fi
6768echores "$_zlib"
6769
6770
6771echocheck "bzlib"
6772bzlib=no
6773def_bzlib='#define CONFIG_BZLIB 0'
6774statement_check bzlib.h 'BZ2_bzlibVersion()' /usr/lib/libbz2.so && bzlib=yes
6775if test "$bzlib" = yes ; then
6776  def_bzlib='#define CONFIG_BZLIB 1'
6777  extra_ldflags="$extra_ldflags /usr/lib/libbz2.so"
6778fi
6779echores "$bzlib"
6780
6781
6782echocheck "RTC"
6783if test "$_rtc" = auto ; then
6784  cat > $TMPC << EOF
6785#include <sys/ioctl.h>
6786#ifdef __linux__
6787#include <linux/rtc.h>
6788#else
6789#include <rtc.h>
6790#define RTC_PIE_ON RTCIO_PIE_ON
6791#endif
6792int main(void) { return RTC_PIE_ON; }
6793EOF
6794  _rtc=no
6795  cc_check && _rtc=yes
6796  ppc && _rtc=no
6797fi
6798if test "$_rtc" = yes ; then
6799  def_rtc='#define HAVE_RTC 1'
6800else
6801  def_rtc='#undef HAVE_RTC'
6802fi
6803echores "$_rtc"
6804
6805
6806echocheck "liblzo2 support"
6807if test "$_liblzo" = auto ; then
6808  _liblzo=no
6809  statement_check lzo/lzo1x.h 'lzo_init()' -llzo2 && _liblzo=yes
6810fi
6811if test "$_liblzo" = yes ; then
6812  def_liblzo='#define CONFIG_LIBLZO 1'
6813  extra_ldflags="$extra_ldflags -llzo2"
6814  codecmodules="liblzo $codecmodules"
6815else
6816  def_liblzo='#undef CONFIG_LIBLZO'
6817  nocodecmodules="liblzo $nocodecmodules"
6818fi
6819echores "$_liblzo"
6820
6821
6822echocheck "mad support"
6823if test "$_mad" = auto ; then
6824  _mad=no
6825  statement_check mad.h 'mad_synth_init(0)' -lmad && _mad=yes
6826fi
6827if test "$_mad" = yes ; then
6828  def_mad='#define CONFIG_LIBMAD 1'
6829  extra_ldflags="$extra_ldflags -lmad"
6830  codecmodules="libmad $codecmodules"
6831else
6832  def_mad='#undef CONFIG_LIBMAD'
6833  nocodecmodules="libmad $nocodecmodules"
6834fi
6835echores "$_mad"
6836
6837echocheck "Twolame"
6838if test "$_twolame" = auto ; then
6839  _twolame=no
6840  statement_check twolame.h 'twolame_init()' -ltwolame && _twolame=yes
6841fi
6842if test "$_twolame" = yes ; then
6843  def_twolame='#define CONFIG_TWOLAME 1'
6844  libs_mencoder="$libs_mencoder -ltwolame"
6845  codecmodules="twolame $codecmodules"
6846else
6847  def_twolame='#undef CONFIG_TWOLAME'
6848  nocodecmodules="twolame $nocodecmodules"
6849fi
6850echores "$_twolame"
6851
6852echocheck "Toolame"
6853if test "$_toolame" = auto ; then
6854  _toolame=no
6855if test "$_twolame" = yes ; then
6856  res_comment="disabled by twolame"
6857else
6858  statement_check toolame.h 'toolame_init()' -ltoolame && _toolame=yes
6859fi
6860fi
6861if test "$_toolame" = yes ; then
6862  def_toolame='#define CONFIG_TOOLAME 1'
6863  libs_mencoder="$libs_mencoder -ltoolame"
6864  codecmodules="toolame $codecmodules"
6865else
6866  def_toolame='#undef CONFIG_TOOLAME'
6867  nocodecmodules="toolame $nocodecmodules"
6868fi
6869if test "$_toolamedir" ; then
6870  res_comment="using $_toolamedir"
6871fi
6872echores "$_toolame"
6873
6874echocheck "OggVorbis support"
6875if test "$_tremor" = auto; then
6876  _tremor=no
6877  statement_check tremor/ivorbiscodec.h 'vorbis_synthesis(0, 0)' -logg -lvorbisidec && _tremor=yes && _libvorbis=no
6878fi
6879if test "$_libvorbis" = auto; then
6880  _libvorbis=no
6881  for vorbislibs in '-lvorbisenc -lvorbis -logg' '-lvorbis -logg' ; do
6882    statement_check vorbis/vorbisenc.h 'vorbis_encode_ctl(0, 0, 0); ogg_stream_clear(0)' $vorbislibs && _libvorbis=yes && break
6883  done
6884fi
6885if test "$_tremor" = yes ; then
6886  _vorbis=yes
6887  def_vorbis='#define CONFIG_OGGVORBIS 1'
6888  def_tremor='#define CONFIG_TREMOR 1'
6889  codecmodules="tremor $codecmodules"
6890  res_comment="integer libvorbis"
6891  extra_ldflags="$extra_ldflags -logg -lvorbisidec"
6892elif test "$_libvorbis" = yes ; then
6893  _vorbis=yes
6894  def_vorbis='#define CONFIG_OGGVORBIS 1'
6895  codecmodules="libvorbis $codecmodules"
6896  res_comment="libvorbis"
6897  extra_ldflags="$extra_ldflags $vorbislibs"
6898  libavencoders="$libavencoders LIBVORBIS_ENCODER"
6899else
6900  _vorbis=no
6901  nocodecmodules="libvorbis $nocodecmodules"
6902fi
6903echores "$_vorbis"
6904
6905echocheck "libspeex (version >= 1.1 required)"
6906if test "$_speex" = auto ; then
6907  _speex=no
6908  cat > $TMPC << EOF
6909#include <stddef.h>
6910#include <speex/speex.h>
6911int main(void) { SpeexBits bits; void *dec = NULL; speex_decode_int(dec, &bits, dec); return 0; }
6912EOF
6913  cc_check -lspeex && _speex=yes
6914fi
6915if test "$_speex" = yes ; then
6916  def_speex='#define CONFIG_SPEEX 1'
6917  extra_ldflags="$extra_ldflags -lspeex"
6918  codecmodules="speex $codecmodules"
6919else
6920  def_speex='#undef CONFIG_SPEEX'
6921  nocodecmodules="speex $nocodecmodules"
6922fi
6923echores "$_speex"
6924
6925echocheck "libgsm"
6926if test "$_libgsm" = auto ; then
6927  _libgsm=no
6928  statement_check gsm.h 'gsm_create()' -lgsm && _libgsm=yes
6929fi
6930if test "$_libgsm" = yes ; then
6931  def_libgsm='#define CONFIG_LIBGSM 1'
6932  extra_ldflags="$extra_ldflags -lgsm"
6933  libavencoders="$libavencoders LIBGSM_ENCODER LIBGSM_MS_ENCODER"
6934  libavdecoders="$libavdecoders LIBGSM_DECODER LIBGSM_MS_DECODER"
6935  codecmodules="libgsm $codecmodules"
6936else
6937  def_libgsm='#define CONFIG_LIBGSM 0'
6938  nocodecmodules="libgsm $nocodecmodules"
6939fi
6940echores "$_libgsm"
6941
6942echocheck "OggTheora support"
6943if test "$_theora" = auto ; then
6944  _theora=no
6945  ld_theora="-ltheoradec -logg"
6946  statement_check theora/theoradec.h 'th_info_init(NULL)' $ld_theora &&
6947    extra_ldflags="$extra_ldflags $ld_theora" && _theora=yes
6948  if test _theora = no; then
6949    ld_theora=$($_pkg_config --silence-errors --libs theoradec)
6950    inc_theora=$($_pkg_config --silence-errors --cflags theoradec)
6951    statement_check theora/theoradec.h 'th_info_init(NULL)' $inc_theora $ld_theora &&
6952      extra_ldflags="$extra_ldflags $ld_theora" &&
6953      extra_cflags="$extra_cflags $inc_theora" && _theora=yes
6954  fi
6955fi
6956if test "$_theora" = yes ; then
6957  def_theora='#define CONFIG_OGGTHEORA 1'
6958  codecmodules="libtheora $codecmodules"
6959  # when --enable-theora is forced, we'd better provide a probably sane
6960  # $ld_theora than nothing
6961  test -z "$ld_theora" && extra_ldflags="$extra_ldflags -ltheoradec -logg"
6962else
6963  def_theora='#undef CONFIG_OGGTHEORA'
6964  nocodecmodules="libtheora $nocodecmodules"
6965fi
6966echores "$_theora"
6967
6968# Any version of libmpg123 that knows MPG123_RESYNC_LIMIT shall be fine.
6969# That is, 1.2.0 onwards. Recommened is 1.14 onwards, though.
6970echocheck "mpg123 support"
6971def_mpg123='#undef CONFIG_MPG123'
6972if test "$_mpg123" = auto; then
6973  _mpg123=no
6974  statement_check mpg123.h 'mpg123_param(NULL, MPG123_RESYNC_LIMIT, -1, 0.)' -lmpg123 &&
6975      _mpg123=yes && extra_ldflags="$extra_ldflags -lmpg123"
6976fi
6977if test "$_mpg123" = yes ; then
6978  def_mpg123='#define CONFIG_MPG123 1'
6979  codecmodules="mpg123 $codecmodules"
6980else
6981  nocodecmodules="mpg123 $nocodecmodules"
6982fi
6983echores "$_mpg123"
6984
6985echocheck "liba52 support"
6986def_liba52='#undef CONFIG_LIBA52'
6987if test "$_liba52" = auto ; then
6988  _liba52=no
6989  statement_check_broken inttypes.h a52dec/a52.h 'a52_state_t *testHand; testHand=a52_init(0)' -la52 &&
6990    _liba52=yes && extra_ldflags="$extra_ldflags -la52"
6991fi
6992if test "$_liba52" = yes ; then
6993  def_liba52='#define CONFIG_LIBA52 1'
6994  codecmodules="liba52 $codecmodules"
6995else
6996  nocodecmodules="liba52 $nocodecmodules"
6997fi
6998echores "$_liba52"
6999
7000
7001echocheck "libmpeg2 support"
7002if test "$_libmpeg2_internal" = auto ; then
7003  if alpha && test cc_vendor=gnu; then
7004    case $cc_version in
7005      2*|3.0*|3.1*) # cannot compile MVI instructions
7006        _libmpeg2_internal=no
7007        ;;
7008    esac
7009  else
7010    _libmpeg2=yes
7011    _libmpeg2_internal=yes
7012    res_comment="internal"
7013  fi
7014fi
7015if test "$_libmpeg2" = auto ; then
7016  _libmpeg2=no
7017  header_check_broken stdint.h mpeg2dec/mpeg2.h -lmpeg2 &&
7018    _libmpeg2=yes && extra_ldflags="$extra_ldflags -lmpeg2"
7019fi
7020
7021def_libmpeg2='#undef CONFIG_LIBMPEG2'
7022def_libmpeg2_internal='#undef CONFIG_LIBMPEG2_INTERNAL'
7023if test "$_libmpeg2" = yes ; then
7024  def_libmpeg2='#define CONFIG_LIBMPEG2 1'
7025  if test "$_libmpeg2_internal" = yes ; then
7026    def_libmpeg2_internal='#define CONFIG_LIBMPEG2_INTERNAL 1'
7027    codecmodules="libmpeg2(internal) $codecmodules"
7028  else
7029    codecmodules="libmpeg2 $codecmodules"
7030  fi
7031else
7032  nocodecmodules="libmpeg2 $nocodecmodules"
7033fi
7034echores "$_libmpeg2"
7035
7036
7037echocheck "libdca support"
7038if test "$_libdca" = auto ; then
7039  _libdca=no
7040  for ld_dca in -ldca -ldts ; do
7041    statement_check_broken stdint.h dca.h 'dca_init(0)' $ld_dca &&
7042      extra_ldflags="$extra_ldflags $ld_dca" && _libdca=yes && break
7043  done
7044fi
7045if test "$_libdca" = yes ; then
7046  def_libdca='#define CONFIG_LIBDCA 1'
7047  codecmodules="libdca $codecmodules"
7048else
7049  def_libdca='#undef CONFIG_LIBDCA'
7050  nocodecmodules="libdca $nocodecmodules"
7051fi
7052echores "$_libdca"
7053
7054echocheck "libmpcdec (musepack, version >= 1.2.1 required)"
7055if test "$_musepack" = yes ; then
7056  _musepack=no
7057  cat > $TMPC << EOF
7058#include <stddef.h>
7059#include <mpcdec/mpcdec.h>
7060int main(void) {
7061  mpc_streaminfo info;
7062  mpc_decoder decoder;
7063  mpc_decoder_set_streaminfo(&decoder, &info);
7064  mpc_decoder_decode_frame(&decoder, NULL, 0, NULL);
7065  return 0;
7066}
7067EOF
7068  cc_check -lmpcdec && _musepack=yes
7069fi
7070if test "$_musepack" = yes ; then
7071  def_musepack='#define CONFIG_MUSEPACK 1'
7072  extra_ldflags="$extra_ldflags -lmpcdec"
7073  codecmodules="musepack $codecmodules"
7074else
7075  def_musepack='#undef CONFIG_MUSEPACK'
7076  nocodecmodules="musepack $nocodecmodules"
7077fi
7078echores "$_musepack"
7079
7080
7081echocheck "FAAC support"
7082if test "$_faac" = auto && test "$_mencoder" = yes ; then
7083  cat > $TMPC <<EOF
7084#include <inttypes.h>
7085#include <faac.h>
7086int main(void) { unsigned long x, y; faacEncOpen(48000, 2, &x, &y); return 0; }
7087EOF
7088  _faac=no
7089  for ld_faac in "-lfaac" "-lfaac -lmp4v2 -lstdc++" ; do
7090    cc_check $ld_faac && libs_mencoder="$libs_mencoder $ld_faac" && _faac=yes && break
7091  done
7092fi
7093if test "$_faac" = yes ; then
7094  def_faac="#define CONFIG_FAAC 1"
7095  codecmodules="faac $codecmodules"
7096else
7097  def_faac="#undef CONFIG_FAAC"
7098  nocodecmodules="faac $nocodecmodules"
7099fi
7100echores "$_faac"
7101
7102
7103echocheck "FAAD2 support"
7104if test "$_faad" = auto ; then
7105  _faad=no
7106  cat > $TMPC << EOF
7107#include <faad.h>
7108#ifndef FAAD_MIN_STREAMSIZE
7109#error Too old version
7110#endif
7111int main(void) { faacDecHandle testhand; faacDecFrameInfo testinfo;
7112    testhand = faacDecOpen(); faacDecInit(0, 0, 0, 0, 0); return 0; }
7113EOF
7114  cc_check -lfaad && _faad=yes
7115fi
7116
7117def_faad='#undef CONFIG_FAAD'
7118if test "$_faad" = yes ; then
7119  def_faad='#define CONFIG_FAAD 1'
7120  extra_ldflags="$extra_ldflags -lfaad"
7121  codecmodules="faad2 $codecmodules"
7122else
7123  nocodecmodules="faad2 $nocodecmodules"
7124fi
7125echores "$_faad"
7126
7127
7128echocheck "libilbc support"
7129if test "$_libilbc" = auto; then
7130  _libilbc=no
7131  statement_check ilbc.h 'WebRtcIlbcfix_InitDecode(0, 0, 0);' -lilbc && _libilbc=yes
7132fi
7133echores "$_libilbc"
7134if test "$_libilbc" = yes ; then
7135  def_libilbc='#define CONFIG_LIBILBC 1'
7136  extra_ldflags="$extra_ldflags -lilbc"
7137  libavdecoders="$libavdecoders LIBILBC_DECODER"
7138  codecmodules="ilbc $codecmodules"
7139else
7140  def_libilbc='#define CONFIG_ILBC 0'
7141  nocodecmodules="ilbc $nocodecmodules"
7142fi
7143
7144
7145echocheck "libopus decoding support"
7146if test "$_libopus" = auto ; then
7147  _libopus=no
7148  if $_pkg_config --exists 'opus' ; then
7149    statement_check opus_multistream.h 'opus_multistream_decoder_create(0,0,0,0,0,0)' $($_pkg_config --libs --cflags opus) &&
7150      _libopus=yes
7151  fi
7152fi
7153if test "$_libopus" = yes ; then
7154  def_libopus='#define CONFIG_LIBOPUS 1'
7155  libavdecoders="$libavdecoders LIBOPUS_DECODER"
7156  extra_cflags="$extra_cflags $($_pkg_config --cflags opus)"
7157  extra_ldflags="$extra_ldflags $($_pkg_config --libs opus)"
7158  codecmodules="libopus $codecmodules"
7159else
7160  nocodecmodules="libopus $nocodecmodules"
7161  def_libopus='#undef CONFIG_LIBOPUS'
7162fi
7163echores "$_libopus"
7164
7165
7166echocheck "LADSPA plugin support"
7167if test "$_ladspa" = auto ; then
7168  _ladspa=no
7169  statement_check ladspa.h 'LADSPA_Descriptor ld = {0}' && _ladspa=yes
7170fi
7171if test "$_ladspa" = yes; then
7172  def_ladspa="#define CONFIG_LADSPA 1"
7173else
7174  def_ladspa="#undef CONFIG_LADSPA"
7175fi
7176echores "$_ladspa"
7177
7178
7179echocheck "libbs2b audio filter support"
7180if test "$_libbs2b" = auto ; then
7181  cat > $TMPC <<EOF
7182#include <bs2b.h>
7183#if BS2B_VERSION_MAJOR < 3
7184#error Please use libbs2b >= 3.0.0, older versions are not supported.
7185#endif
7186int main(void) {
7187    t_bs2bdp filter;
7188    filter=bs2b_open();
7189    bs2b_close(filter);
7190    return 0;
7191}
7192EOF
7193  _libbs2b=no
7194  if $_pkg_config --exists libbs2b ; then
7195    inc_tmp=$($_pkg_config --cflags libbs2b)
7196    ld_tmp=$($_pkg_config --libs libbs2b)
7197    cc_check $inc_tmp $ld_tmp && extra_ldflags="$extra_ldflags $ld_tmp" &&
7198      extra_cflags="$extra_cflags $inc_tmp" && _libbs2b=yes
7199  else
7200    for inc_tmp in "" -I/usr/include/bs2b -I/usr/local/include \
7201        -I/usr/local/include/bs2b ; do
7202      if cc_check $inc_tmp -lbs2b ; then
7203        extra_ldflags="$extra_ldflags -lbs2b"
7204        extra_cflags="$extra_cflags $inc_tmp"
7205        _libbs2b=yes
7206        break
7207      fi
7208    done
7209  fi
7210fi
7211def_libbs2b="#undef CONFIG_LIBBS2B"
7212test "$_libbs2b" = yes && def_libbs2b="#define CONFIG_LIBBS2B 1"
7213echores "$_libbs2b"
7214
7215
7216if test -z "$_codecsdir" ; then
7217  for dir in "$_libdir/codecs" "$_libdir/win32" /usr/local/lib/codecs \
7218             /usr/lib/codecs /usr/local/lib/win32 /usr/lib/win32 ; do
7219    if test -d "$dir" ; then
7220      _codecsdir="$dir"
7221      break;
7222    fi;
7223  done
7224fi
7225# Fall back on default directory.
7226if test -z "$_codecsdir" ; then
7227  _codecsdir="$_libdir/codecs"
7228  mingw32 || os2 && _codecsdir="codecs"
7229fi
7230
7231
7232echocheck "Win32 codecs"
7233if test "$_win32dll" = auto ; then
7234  _win32dll=no
7235  if x86_32 && ! qnx; then
7236    _win32dll=yes
7237  fi
7238fi
7239_win32_emulation=no
7240if test "$_win32dll" = yes ; then
7241  def_win32dll='#define CONFIG_WIN32DLL 1'
7242  if ! win32 ; then
7243    def_win32_loader='#define WIN32_LOADER 1'
7244    _win32_emulation=yes
7245  else
7246    extra_ldflags="$extra_ldflags -ladvapi32 -lole32"
7247    res_comment="using native windows"
7248  fi
7249  codecmodules="win32 $codecmodules"
7250else
7251  def_win32dll='#undef CONFIG_WIN32DLL'
7252  def_win32_loader='#undef WIN32_LOADER'
7253  nocodecmodules="win32 $nocodecmodules"
7254fi
7255echores "$_win32dll"
7256
7257
7258echocheck "XAnim codecs"
7259if test "$_xanim" = auto ; then
7260  _xanim=no
7261  res_comment="dynamic loader support needed"
7262  if test "$_dl" = yes ; then
7263    _xanim=yes
7264  fi
7265fi
7266if test "$_xanim" = yes ; then
7267  def_xanim='#define CONFIG_XANIM 1'
7268  codecmodules="xanim $codecmodules"
7269else
7270  def_xanim='#undef CONFIG_XANIM'
7271  nocodecmodules="xanim $nocodecmodules"
7272fi
7273echores "$_xanim"
7274
7275
7276echocheck "RealPlayer codecs"
7277if test "$_real" = auto ; then
7278  _real=no
7279  res_comment="dynamic loader support needed"
7280  if test "$_dl" = yes || test "$_win32dll" = yes &&
7281     (linux || freebsd || netbsd || openbsd || dragonfly || darwin || win32 || os2) ; then
7282    _real=yes
7283  fi
7284fi
7285if test "$_real" = yes ; then
7286  def_real='#define CONFIG_REALCODECS 1'
7287  codecmodules="real $codecmodules"
7288else
7289  def_real='#undef CONFIG_REALCODECS'
7290  nocodecmodules="real $nocodecmodules"
7291fi
7292echores "$_real"
7293
7294
7295echocheck "QuickTime codecs"
7296_qtx_emulation=no
7297def_qtx_win32='#undef CONFIG_QTX_CODECS_WIN32'
7298if test "$_qtx" = auto ; then
7299  test "$_win32dll" = yes || test "$quicktime" = yes && _qtx=yes
7300fi
7301if test "$_qtx" = yes ; then
7302    def_qtx='#define CONFIG_QTX_CODECS 1'
7303    win32 && _qtx_codecs_win32=yes && def_qtx_win32='#define CONFIG_QTX_CODECS_WIN32 1'
7304    codecmodules="qtx $codecmodules"
7305    darwin || win32 || _qtx_emulation=yes
7306else
7307    def_qtx='#undef CONFIG_QTX_CODECS'
7308    nocodecmodules="qtx $nocodecmodules"
7309fi
7310echores "$_qtx"
7311
7312echocheck "Nemesi Streaming Media libraries"
7313if test "$_nemesi" = auto  && test "$networking" = yes ; then
7314    _nemesi=no
7315    if $_pkg_config libnemesi --atleast-version=0.6.3 ; then
7316        extra_cflags="$extra_cflags $($_pkg_config --cflags libnemesi)"
7317        extra_ldflags="$extra_ldflags $($_pkg_config --libs libnemesi)"
7318        _nemesi=yes
7319    fi
7320fi
7321if test "$_nemesi" = yes; then
7322    _native_rtsp=no
7323    def_nemesi='#define CONFIG_LIBNEMESI 1'
7324    inputmodules="nemesi $inputmodules"
7325else
7326    _native_rtsp="$networking"
7327    _nemesi=no
7328    def_nemesi='#undef CONFIG_LIBNEMESI'
7329    noinputmodules="nemesi $noinputmodules"
7330fi
7331echores "$_nemesi"
7332
7333echocheck "LIVE555 Streaming Media libraries"
7334if test "$_live" = auto  && test "$networking" = yes ; then
7335  cat > $TMPCPP << EOF
7336#define RTSPCLIENT_SYNCHRONOUS_INTERFACE 1
7337#include <liveMedia.hh>
7338#if (LIVEMEDIA_LIBRARY_VERSION_INT < 1141257600)
7339#error Please upgrade to version 2006.03.03 or later of the "LIVE555 Streaming Media" libraries - available from <www.live555.com/liveMedia/>
7340#endif
7341#include "BasicUsageEnvironment.hh"
7342int main(void) { RTSPClient::createNew(*BasicUsageEnvironment::createNew(*BasicTaskScheduler::createNew()), 0, "", 0); return 0; }
7343EOF
7344
7345  _live=no
7346  for I in $extra_cflags "-I$_libdir/live" "-I/usr/lib/live" "-I/usr/lib64/live" "-I/usr/local/live" "-I/usr/local/lib/live" ; do
7347    _livelibdir=$(echo $I| sed s/-I//)
7348    inc_tmp="-I$_livelibdir/liveMedia/include \
7349             -I$_livelibdir/UsageEnvironment/include \
7350             -I$_livelibdir/BasicUsageEnvironment/include \
7351             -I$_livelibdir/groupsock/include"
7352    ld_tmp="$_livelibdir/liveMedia/libliveMedia.a \
7353            $_livelibdir/BasicUsageEnvironment/libBasicUsageEnvironment.a \
7354            $_livelibdir/UsageEnvironment/libUsageEnvironment.a \
7355            $_livelibdir/groupsock/libgroupsock.a \
7356            -lstdc++ $ld_sock"
7357    test -e "$_livelibdir/BasicUsageEnvironment/libBasicUsageEnvironment.a" &&
7358        cxx_check $inc_tmp $ld_tmp &&
7359      extra_ldflags="$ld_tmp $extra_ldflags" &&
7360      extra_cxxflags="$inc_tmp" &&
7361      _live=yes && break
7362  done
7363  if test "$_live" != yes ; then
7364      for ld_tmp in "-lliveMedia -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment -lstdc++" "-lliveMedia_pic -lgroupsock_pic -lBasicUsageEnvironment_pic -lUsageEnvironment_pic -lstdc++" ; do
7365          inc_tmp="-I/usr/include/liveMedia -I/usr/include/UsageEnvironment -I/usr/include/BasicUsageEnvironment -I/usr/include/groupsock"
7366          cxx_check $inc_tmp $ld_tmp && _live_dist=yes && break
7367      done
7368  fi
7369fi
7370if test "$_live" = yes && test "$networking" = yes; then
7371  test $_livelibdir && res_comment="using $_livelibdir"
7372  def_live='#define CONFIG_LIVE555 1'
7373 inputmodules="live555 $inputmodules"
7374elif test "$_live_dist" = yes && test "$networking" = yes; then
7375  res_comment="using distribution version"
7376  _live="yes"
7377  def_live='#define CONFIG_LIVE555 1'
7378  extra_ldflags="$extra_ldflags $ld_tmp"
7379  extra_cxxflags="$inc_tmp"
7380 inputmodules="live555 $inputmodules"
7381else
7382  _live=no
7383  def_live='#undef CONFIG_LIVE555'
7384  noinputmodules="live555 $noinputmodules"
7385fi
7386echores "$_live"
7387
7388echocheck "RTMPDump Streaming Media library"
7389if test "$_librtmp" = auto  && test "$networking" = yes ; then
7390  statement_check librtmp/rtmp.h 'RTMP_Socket(NULL)' -lrtmp &&
7391    _librtmp=yes && extra_ldflags="$extra_ldflags -lrtmp"
7392  if test "$_librtmp" != yes && $_pkg_config --exists librtmp ; then
7393    inc_tmp=$($_pkg_config --cflags librtmp)
7394    ld_tmp=$($_pkg_config --libs librtmp)
7395    cc_check $inc_tmp $ld_tmp && _librtmp=yes &&
7396      extra_ldflags="$extra_ldflags $ld_tmp" &&
7397      extra_cflags="$extra_cflags $inc_tmp"
7398  fi
7399fi
7400if test "$_librtmp" = yes && test "$networking" = yes; then
7401  nolibrtmp=no
7402  def_librtmp='#define CONFIG_LIBRTMP 1'
7403  inputmodules="librtmp $inputmodules"
7404
7405  if $_pkg_config --exists librtmp; then
7406	_inc_tmp=$($_pkg_config --cflags librtmp)
7407	_ld_tmp=$($_pkg_config --libs librtmp)
7408  else
7409	_inc_tmp="-I${LOCALBASE}/include"
7410	_ld_tmp="-L${LOCALBASE}/lib -lrtmp -lz -lssl -lcrypto"
7411  fi
7412  extra_ldflags="$extra_ldflags $_ld_tmp"
7413  extra_cflags="$extra_cflags $_inc_tmp"
7414else
7415  nolibrtmp=yes
7416  _librtmp=no
7417  def_librtmp='#define CONFIG_LIBRTMP 0'
7418  noinputmodules="librtmp $noinputmodules"
7419  libavprotocols=$(filter_out_component protocol 'LIBRTMP LIBRTMPE LIBRTMPS LIBRTMPT LIBRTMPTE')
7420fi
7421echores "$_librtmp"
7422
7423
7424echocheck "FFmpeg"
7425if test "$ffmpeg_a" = auto ; then
7426  ffmpeg_a=no
7427  test -d ffmpeg/libavcodec && ffmpeg_a=yes && ffmpeg_so=no
7428fi
7429if test "$ffmpeg_so" = auto ; then
7430  ffmpeg_so=no
7431  if $_pkg_config --exists libavutil ; then
7432    inc_ffmpeg=$($_pkg_config --cflags libswscale libswresample libavformat libavcodec libavutil)
7433    ld_tmp=$($_pkg_config --libs libswscale libswresample libavformat libavcodec libavutil)
7434    header_check libavutil/avutil.h $inc_ffmpeg $ld_tmp &&
7435      extra_cflags="$extra_cflags $inc_ffmpeg" &&
7436      extra_ldflags="$extra_ldflags $ld_tmp" && ffmpeg_so=yes && ffmpeg=yes
7437  elif header_check libavutil/avutil.h -lswscale -lswresample -lavformat -lavcodec -lavutil ; then
7438    extra_ldflags="$extra_ldflags -lswscale -lswresample -lavformat -lavcodec -lavutil"
7439    ffmpeg_so=yes
7440  fi
7441fi
7442
7443ffmpeg=no
7444test "$ffmpeg_a" = yes && ffmpeg=yes
7445test "$ffmpeg_so" = yes && ffmpeg=yes
7446
7447if test "$ffmpeg" = yes; then
7448  test -e config.h || touch config.h
7449  def_ffmpeg='#define CONFIG_FFMPEG 1'
7450  if test "$ffmpeg_a" = yes ; then
7451    codecmodules="ffmpeg(internal) $codecmodules"
7452    def_ffmpeg_a='#define CONFIG_FFMPEG_A 1'
7453  elif test "$ffmpeg_so" = yes ; then
7454    codecmodules="ffmpeg $codecmodules"
7455    def_ffmpeg_so='#define CONFIG_FFMPEG_SO 1'
7456    res_comment="using shared FFmpeg, but static FFmpeg is recommended"
7457  fi
7458else
7459  def_ffmpeg='#undef CONFIG_FFMPEG'
7460  def_ffmpeg_a='#undef CONFIG_FFMPEG_A'
7461  def_ffmpeg_so='#undef CONFIG_FFMPEG_SO'
7462  nocodecmodules="ffmpeg $nocodecmodules"
7463  if test "$_mplayer" = yes || test "$_mencoder" = yes ; then
7464    echo "Compiling without FFmpeg is currently not supported/working."
7465    echo "Please contact us if that is an issue for you."
7466    die "both internal and external FFmpeg missing"
7467  fi
7468fi
7469test "$_vf_lavfi" = yes && def_vf_lavfi='#define CONFIG_VF_LAVFI 1'|| libavfilters=''
7470test "$_libavcodec_mpegaudio_hp" = yes &&
7471  def_libavcodec_mpegaudio_hp='#define CONFIG_MPEGAUDIO_HP 1' &&
7472  mak_libavcodec_mpegaudio_hp='CONFIG_MPEGAUDIO_HP = yes'
7473echores "$ffmpeg"
7474
7475
7476echocheck "libpostproc"
7477if test "$postproc" = auto ; then
7478  postproc=no
7479  if test "$ffmpeg_a" = yes && test -d ffmpeg/libpostproc ; then
7480    postproc=yes
7481  elif $_pkg_config --exists libpostproc ; then
7482    inc_postproc=$($_pkg_config --cflags libpostproc)
7483    ld_tmp=$($_pkg_config --libs libpostproc)
7484    header_check libpostproc/postprocess.h $inc_postproc $ld_tmp &&
7485      extra_cflags="$extra_cflags $inc_postproc" &&
7486      extra_ldflags="$extra_ldflags $ld_tmp" && postproc=yes
7487  elif header_check libpostproc/postprocess.h -lpostproc ; then
7488    extra_ldflags="$extra_ldflags -lpostproc"
7489    postproc=yes
7490  fi
7491fi
7492if test "$postproc" = yes; then
7493  def_postproc='#define CONFIG_POSTPROC 1'
7494else
7495  def_postproc='#undef CONFIG_POSTPROC'
7496fi
7497echores "$postproc"
7498
7499
7500echocheck "libxml2"
7501if test "$_libxml2" = auto ; then
7502    _libxml2=no
7503    if test "$ffmpeg_a" = yes && $_pkg_config --exists libxml-2.0 ; then
7504            cat > $TMPC << EOF
7505#include <libxml/xmlstring.h>
7506int main(void) {
7507  xmlChar *str = "";
7508  return xmlStrlen(str);
7509}
7510EOF
7511        inc_tmp=$($_pkg_config --cflags libxml-2.0)
7512        ld_tmp=$($_pkg_config --libs libxml-2.0)
7513        cc_check $inc_tmp $ld_tmp && _libxml2=yes
7514        if test "$_libxml2" = yes; then
7515            extra_cflags="$extra_cflags $inc_tmp"
7516            extra_ldflags="$extra_ldflags $ld_tmp"
7517        fi
7518    else
7519        test "$ffmpeg_a" = no && res_comment="dynamic linking to libxml2 is irrelevant when using dynamic FFmpeg"
7520    fi
7521fi
7522if test "$_libxml2" = "no" ; then
7523    libavdemuxers=$(filter_out_component demuxer 'DASH')
7524fi
7525echores "$_libxml2"
7526
7527
7528echocheck "libopencore_amr narrowband"
7529if test "$_libopencore_amrnb" = auto ; then
7530  _libopencore_amrnb=no
7531  statement_check opencore-amrnb/interf_dec.h 'Decoder_Interface_init()' -lopencore-amrnb && _libopencore_amrnb=yes
7532  if test "$ffmpeg_a" != yes ; then
7533    _libopencore_amrnb=no
7534    res_comment="ffmpeg (static) is required by libopencore_amrnb, sorry"
7535  fi
7536fi
7537if test "$_libopencore_amrnb" = yes ; then
7538  _libopencore_amr=yes
7539  extra_ldflags="$extra_ldflags -lopencore-amrnb"
7540  def_libopencore_amrnb='#define CONFIG_LIBOPENCORE_AMRNB 1'
7541  libavdecoders="$libavdecoders LIBOPENCORE_AMRNB_DECODER"
7542  libavencoders="$libavencoders LIBOPENCORE_AMRNB_ENCODER"
7543  codecmodules="libopencore_amrnb $codecmodules"
7544else
7545  def_libopencore_amrnb='#define CONFIG_LIBOPENCORE_AMRNB 0'
7546  nocodecmodules="libopencore_amrnb $nocodecmodules"
7547fi
7548echores "$_libopencore_amrnb"
7549
7550
7551echocheck "libopencore_amr wideband"
7552if test "$_libopencore_amrwb" = auto ; then
7553  _libopencore_amrwb=no
7554  statement_check opencore-amrwb/dec_if.h 'D_IF_init()' -lopencore-amrwb && _libopencore_amrwb=yes
7555  if test "$ffmpeg_a" != yes ; then
7556    _libopencore_amrwb=no
7557    res_comment="ffmpeg (static) is required by libopencore_amrwb, sorry"
7558  fi
7559fi
7560if test "$_libopencore_amrwb" = yes ; then
7561  _libopencore_amr=yes
7562  extra_ldflags="$extra_ldflags -lopencore-amrwb"
7563  def_libopencore_amrwb='#define CONFIG_LIBOPENCORE_AMRWB 1'
7564  libavdecoders="$libavdecoders LIBOPENCORE_AMRWB_DECODER"
7565  codecmodules="libopencore_amrwb $codecmodules"
7566else
7567  def_libopencore_amrwb='#define LIBOPENCORE_AMRWB 0'
7568  nocodecmodules="libopencore_amrwb $nocodecmodules"
7569fi
7570echores "$_libopencore_amrwb"
7571
7572
7573echocheck "libdv-0.9.5+"
7574if test "$_libdv" = auto ; then
7575  _libdv=no
7576  statement_check libdv/dv.h 'dv_encoder_new(1, 1, 1)' -ldv $ld_pthread && _libdv=yes
7577fi
7578if test "$_libdv" = yes ; then
7579  def_libdv='#define CONFIG_LIBDV095 1'
7580  extra_ldflags="$extra_ldflags -ldv"
7581  codecmodules="libdv $codecmodules"
7582else
7583  def_libdv='#undef CONFIG_LIBDV095'
7584  nocodecmodules="libdv $nocodecmodules"
7585fi
7586echores "$_libdv"
7587
7588echocheck "CrystalHD"
7589if test "$crystalhd" = auto ; then
7590   crystalhd=no
7591   statement_check_broken libcrystalhd/bc_dts_types.h libcrystalhd/libcrystalhd_if.h 'DtsCrystalHDVersion(0, 0)' -lcrystalhd && crystalhd=yes
7592fi
7593
7594if test "$crystalhd" = yes ; then
7595   extra_ldflags="$extra_ldflags -lcrystalhd"
7596   def_crystalhd="#define CONFIG_CRYSTALHD 1"
7597   codecmodules="crystalhd $codecmodules"
7598else
7599   def_crystalhd="#define CONFIG_CRYSTALHD 0"
7600   nocodecmodules="crystalhd $nocodecmodules"
7601   libavdecoders=$(filter_out_component decoder '[A-Z0-9]*_CRYSTALHD')
7602fi
7603echores "$crystalhd"
7604
7605echocheck "Xvid"
7606if test "$_xvid" = auto ; then
7607  _xvid=no
7608  for ld_tmp in "-lxvidcore" "-lxvidcore $ld_pthread" ; do
7609    statement_check xvid.h 'xvid_plugin_ssim_t xs; xvid_global(0, 0, 0, 0)' $ld_tmp &&
7610      extra_ldflags="$extra_ldflags $ld_tmp" && _xvid=yes && break
7611  done
7612fi
7613
7614if test "$_xvid" = yes ; then
7615  def_xvid='#define CONFIG_XVID4 1'
7616  codecmodules="xvid $codecmodules"
7617else
7618  def_xvid='#undef CONFIG_XVID4'
7619  nocodecmodules="xvid $nocodecmodules"
7620fi
7621echores "$_xvid"
7622
7623echocheck "Xvid two pass plugin"
7624if test "$_mencoder" = yes && test "$_xvid" = yes && test "$_xvid_lavc" = auto ; then
7625  statement_check xvid.h 'xvid_plugin_2pass2_t s; s.vbv_size = 0' && _xvid_lavc=yes
7626fi
7627if test "$_xvid_lavc" = yes ; then
7628  def_xvid_lavc='#define CONFIG_LIBXVID 1'
7629  libavencoders="$libavencoders LIBXVID_ENCODER"
7630else
7631  _xvid_lavc=no
7632  def_xvid_lavc='#define CONFIG_LIBXVID 0'
7633fi
7634echores "$_xvid_lavc"
7635
7636
7637echocheck "x264"
7638if test "$_x264" = auto && test "$_mencoder" = yes ; then
7639  cat > $TMPC << EOF
7640#include <inttypes.h>
7641#include <x264.h>
7642#if !(X264_BUILD >= 118)
7643#error We do not support old versions of x264. Get the latest from git.
7644#endif
7645int main(void) { x264_encoder_open((void*)0); return 0; }
7646EOF
7647  _x264=no
7648  for ld_x264 in "-lx264 $ld_pthread" ; do
7649    cc_check $ld_x264 && libs_mencoder="$libs_mencoder $ld_x264" && _x264=yes && break
7650  done
7651fi
7652
7653if test "$_x264" = yes ; then
7654  def_x264='#define CONFIG_X264 1'
7655  codecmodules="x264 $codecmodules"
7656  test "$_x264_lavc" = auto && _x264_lavc=yes
7657  if test "$_x264_lavc" = yes ; then
7658    def_x264_lavc='#define CONFIG_LIBX264 1'
7659    libs_mplayer="$libs_mplayer $ld_x264"
7660    libavencoders="$libavencoders LIBX264_ENCODER"
7661  fi
7662else
7663  _x264_lavc=no
7664  def_x264='#undef CONFIG_X264'
7665  def_x264_lavc='#define CONFIG_LIBX264 0'
7666  nocodecmodules="x264 $nocodecmodules"
7667fi
7668res_comment="in FFmpeg: $_x264_lavc"
7669echores "$_x264"
7670
7671
7672echocheck "libvpx"
7673if test "$_libvpx_lavc" = auto; then
7674  _libvpx_lavc=no
7675  if test "$ffmpeg_a" != yes; then
7676    res_comment="dynamic linking to libvpx is irrelevant when using dynamic FFmpeg"
7677  else
7678    cat > $TMPC << EOF
7679#include <vpx/vpx_encoder.h>
7680#include <vpx/vpx_decoder.h>
7681#include <vpx/vp8dx.h>
7682#include <vpx/vp8cx.h>
7683struct vpx_codec_ctx decoder;
7684int main(void) {
7685  vpx_codec_dec_init(NULL, &vpx_codec_vp8_dx_algo, NULL, 0);
7686  vpx_codec_enc_init(NULL, &vpx_codec_vp8_dx_algo, NULL, 0);
7687  return VPX_CQ + VP8E_SET_MAX_INTRA_BITRATE_PCT;
7688}
7689EOF
7690    cc_check -lvpx && _libvpx_lavc=yes && extra_ldflags="$extra_ldflags -lvpx"
7691  fi
7692fi
7693if test "$_libvpx_lavc" = yes ; then
7694  def_libvpx_lavc='#define CONFIG_LIBVPX 1'
7695  libavdecoders="$libavdecoders LIBVPX_VP8_DECODER"
7696  libavencoders="$libavencoders LIBVPX_VP8_ENCODER"
7697  codecmodules="libvpx $codecmodules"
7698else
7699  def_libvpx_lavc='#define CONFIG_LIBVPX 0'
7700  nocodecmodules="libvpx $nocodecmodules"
7701fi
7702echores "$_libvpx_lavc"
7703
7704
7705echocheck "libdav1d"
7706if test "$_libdav1d_lavc" = auto; then
7707  _libdav1d_lavc=no
7708  if test "$ffmpeg_a" != yes; then
7709    res_comment="dynamic linking to libdav1d is irrelevant when using dynamic FFmpeg"
7710  else
7711    cat > $TMPC << EOF
7712#include <dav1d/dav1d.h>
7713int main(void) {
7714    const char *version_lib = dav1d_version();
7715    return version_lib[0];
7716}
7717EOF
7718    for ld_tmp in "-ldav1d" "-ldav1d $ld_pthread" ; do
7719      cc_check $ld_tmp && _libdav1d_lavc=yes && extra_ldflags="$extra_ldflags $ld_tmp" && break
7720    done
7721  fi
7722fi
7723if test "$_libdav1d_lavc" = yes ; then
7724  def_libdav1d_lavc='#define CONFIG_LIBDAV1D 1'
7725  libavdecoders="$libavdecoders LIBDAV1D_DECODER"
7726  codecmodules="libdav1d $codecmodules"
7727else
7728  def_libdav1d_lavc='#define CONFIG_LIBDAV1D 0'
7729  nocodecmodules="libdav1d $nocodecmodules"
7730fi
7731echores "$_libdav1d_lavc"
7732
7733
7734echocheck "libaom"
7735if test "$_libaom_lavc" = auto; then
7736  _libaom_lavc=no
7737  if test "$ffmpeg_a" != yes; then
7738    res_comment="dynamic linking to libaom is irrelevant when using dynamic FFmpeg"
7739  else
7740    cat > $TMPC << EOF
7741#include <aom/aom_decoder.h>
7742int main(void) {
7743    const char *version_lib = aom_codec_version_str();
7744    return version_lib[0];
7745}
7746EOF
7747    for ld_tmp in "-laom" "-laom $ld_pthread" ; do
7748      cc_check $ld_tmp && _libaom_lavc=yes && extra_ldflags="$extra_ldflags $ld_tmp" && break
7749    done
7750  fi
7751fi
7752if test "$_libaom_lavc" = yes ; then
7753  def_libaom_lavc='#define CONFIG_LIBAOM 1'
7754  libavdecoders="$libavdecoders LIBAOM_AV1_DECODER"
7755  codecmodules="libaom $codecmodules"
7756else
7757  def_libaom_lavc='#define CONFIG_LIBAOM 0'
7758  nocodecmodules="libaom $nocodecmodules"
7759fi
7760echores "$_libaom_lavc"
7761
7762
7763echocheck "libnut"
7764if test "$_libnut" = auto ; then
7765  _libnut=no
7766   statement_check libnut.h 'nut_context_tt * nut; nut_error(0)' -lnut && _libnut=yes
7767fi
7768
7769if test "$_libnut" = yes ; then
7770  def_libnut='#define CONFIG_LIBNUT 1'
7771  extra_ldflags="$extra_ldflags -lnut"
7772else
7773  def_libnut='#undef CONFIG_LIBNUT'
7774fi
7775echores "$_libnut"
7776
7777#check must be done after FFmpeg one
7778echocheck "zr"
7779if test "$_zr" = auto && test "$ffmpeg_a" = yes ; then
7780  #36067's seem to identify themselves as 36057PQC's, so the line
7781  #below should work for 36067's and 36057's.
7782  if grep -q -s -e "Multimedia video controller: Zoran Corporation ZR36057" /proc/pci ; then
7783    _zr=yes
7784  else
7785    _zr=no
7786  fi
7787fi
7788if test "$_zr" = yes ; then
7789    def_zr='#define CONFIG_ZR 1'
7790    vomodules="zr zr2 $vomodules"
7791    mplayer_encoders="$mplayer_encoders MJPEG_ENCODER"
7792else
7793    _zr=no
7794    def_zr='#undef CONFIG_ZR'
7795    novomodules="zr zr2 $novomodules"
7796fi
7797echores "$_zr"
7798
7799
7800echocheck "libmp3lame"
7801def_mp3lame='#undef CONFIG_MP3LAME'
7802def_mp3lame_lavc="#define CONFIG_LIBMP3LAME 0"
7803def_mp3lame_preset='#undef CONFIG_MP3LAME_PRESET'
7804def_mp3lame_preset_medium='#undef CONFIG_MP3LAME_PRESET_MEDIUM'
7805if test "$_mp3lame" = auto && test "$_mencoder" = yes; then
7806  _mp3lame=no
7807  statement_check lame/lame.h 'lame_set_VBR_quality(NULL, 0)' -lmp3lame &&
7808    _mp3lame=yes && _mp3lame_lavc=yes
7809fi
7810if test "$_mp3lame" = yes ; then
7811  def_mp3lame="#define CONFIG_MP3LAME 1"
7812  ld_mp3lame=-lmp3lame
7813  libs_mencoder="$libs_mencoder $ld_mp3lame"
7814  statement_check lame/lame.h 'lame_set_preset(NULL, STANDARD_FAST)' $ld_mp3lame && def_mp3lame_preset="#define CONFIG_MP3LAME_PRESET 1"
7815  statement_check lame/lame.h 'lame_set_preset(NULL,   MEDIUM_FAST)' $ld_mp3lame && def_mp3lame_preset_medium="#define CONFIG_MP3LAME_PRESET_MEDIUM 1"
7816  if test "$_mp3lame_lavc" = yes ; then
7817    def_mp3lame_lavc="#define CONFIG_LIBMP3LAME 1"
7818    libavencoders="$libavencoders LIBMP3LAME_ENCODER"
7819    libs_mplayer="$libs_mplayer $ld_mp3lame"
7820  fi
7821else
7822  _mp3lame_lavc=no
7823fi
7824res_comment="in FFmpeg: $_mp3lame_lavc"
7825echores "$_mp3lame"
7826
7827
7828echocheck "mencoder"
7829if test "$_mencoder" = no ; then
7830  # mpeg1video for vf_lavc, snow for vf_uspp / vf_mcdeint,
7831  libavencoders="$mplayer_encoders MPEG1VIDEO_ENCODER H263_ENCODER SNOW_ENCODER"
7832fi
7833echores "$_mencoder"
7834
7835
7836echocheck "UnRAR executable"
7837if test "$_unrar_exec" = auto ; then
7838    _unrar_exec="yes"
7839    mingw32 && _unrar_exec="no"
7840fi
7841if test "$_unrar_exec" = yes ; then
7842    def_unrar_exec='#define CONFIG_UNRAR_EXEC 1'
7843else
7844    def_unrar_exec='#undef CONFIG_UNRAR_EXEC'
7845fi
7846echores "$_unrar_exec"
7847
7848echocheck "TV interface"
7849if test "$_tv" = yes ; then
7850  def_tv='#define CONFIG_TV 1'
7851  inputmodules="tv $inputmodules"
7852else
7853  noinputmodules="tv $noinputmodules"
7854  def_tv='#undef CONFIG_TV'
7855fi
7856echores "$_tv"
7857
7858
7859if freebsd || netbsd || openbsd || dragonfly || bsdos ; then
7860  echocheck "*BSD BT848 bt8xx header"
7861  _ioctl_bt848_h=no
7862  for file in "machine/ioctl_bt848.h" \
7863            "dev/bktr/ioctl_bt848.h" \
7864            "dev/video/bktr/ioctl_bt848.h" \
7865            "dev/ic/bt8xx.h" ; do
7866    cat > $TMPC <<EOF
7867#include <sys/types.h>
7868#include <sys/ioctl.h>
7869#include <$file>
7870int main(void) { ioctl(0, TVTUNER_GETFREQ, 0); return 0; }
7871EOF
7872    if cc_check ; then
7873     _ioctl_bt848_h=yes
7874     _ioctl_bt848_h_name="$file"
7875     break;
7876    fi
7877  done
7878  if test "$_ioctl_bt848_h" = yes ; then
7879    def_ioctl_bt848_h_name="#define IOCTL_BT848_H_NAME <$_ioctl_bt848_h_name>"
7880    res_comment="using $_ioctl_bt848_h_name"
7881  else
7882    def_ioctl_bt848_h_name="#undef IOCTL_BT848_H_NAME"
7883  fi
7884  echores "$_ioctl_bt848_h"
7885
7886  echocheck "*BSD ioctl_meteor.h"
7887  _ioctl_meteor_h=no
7888  for ioctl_meteor_h_path in "machine/ioctl_meteor.h" "dev/bktr/ioctl_meteor.h" "dev/video/bktr/ioctl_meteor.h" ; do
7889    statement_check_broken "sys/types.h" "$ioctl_meteor_h_path" 'ioctl(0, METEORSINPUT, 0)' &&
7890      _ioctl_meteor_h=yes && break
7891  done
7892  if test "$_ioctl_meteor_h" = yes ; then
7893    def_ioctl_meteor_h_name="#define IOCTL_METEOR_H_NAME <$ioctl_meteor_h_path>"
7894    res_comment="using $ioctl_meteor_h_path"
7895  else
7896    def_ioctl_meteor_h_name="#undef IOCTL_METEOR_H_NAME"
7897  fi
7898  echores "$_ioctl_meteor_h"
7899
7900  echocheck "*BSD BrookTree 848 TV interface"
7901  if test "$_tv_bsdbt848" = auto ; then
7902    _tv_bsdbt848=no
7903    if test "$_tv" = yes ; then
7904      cat > $TMPC <<EOF
7905#include <sys/types.h>
7906$def_ioctl_meteor_h_name
7907$def_ioctl_bt848_h_name
7908#ifdef IOCTL_METEOR_H_NAME
7909#include IOCTL_METEOR_H_NAME
7910#endif
7911#ifdef IOCTL_BT848_H_NAME
7912#include IOCTL_BT848_H_NAME
7913#endif
7914int main(void) {
7915 ioctl(0, METEORSINPUT, 0);
7916 ioctl(0, TVTUNER_GETFREQ, 0);
7917 return 0;
7918}
7919EOF
7920      cc_check && _tv_bsdbt848=yes
7921    fi
7922  fi
7923  if test "$_tv_bsdbt848" = yes ; then
7924    def_tv_bsdbt848='#define CONFIG_TV_BSDBT848 1'
7925    inputmodules="tv-bsdbt848 $inputmodules"
7926  else
7927    def_tv_bsdbt848='#undef CONFIG_TV_BSDBT848'
7928    noinputmodules="tv-bsdbt848 $noinputmodules"
7929  fi
7930  echores "$_tv_bsdbt848"
7931fi #if freebsd || netbsd || openbsd || dragonfly || bsdos
7932
7933
7934echocheck "DirectShow TV interface"
7935if test "$_tv_dshow" = auto && test "$_tv" = yes && win32 && ! msvc ; then
7936    _tv_dshow=no
7937    statement_check ole2.h 'void* p; CoCreateInstance((GUID*)&GUID_NULL, NULL, CLSCTX_INPROC_SERVER, &GUID_NULL, &p)' -lole32 -luuid && _tv_dshow=yes
7938fi
7939if test "$_tv_dshow" = yes ; then
7940  inputmodules="tv-dshow $inputmodules"
7941  def_tv_dshow='#define CONFIG_TV_DSHOW 1'
7942  extra_ldflags="$extra_ldflags -lole32 -luuid"
7943else
7944  _tv_dshow=no
7945  noinputmodules="tv-dshow $noinputmodules"
7946  def_tv_dshow='#undef CONFIG_TV_DSHOW'
7947fi
7948echores "$_tv_dshow"
7949
7950
7951echocheck "Video 4 Linux TV interface"
7952if test "$_tv_v4l1" = auto && test "$_tv" = yes && linux ; then
7953    _tv_v4l1=no
7954    header_check_broken sys/time.h linux/videodev.h && _tv_v4l1=yes
7955fi
7956if test "$_tv_v4l1" = yes ; then
7957  _audio_input=yes
7958  _tv_v4l=yes
7959  def_tv_v4l='#define CONFIG_TV_V4L 1'
7960  def_tv_v4l1='#define CONFIG_TV_V4L1 1'
7961  inputmodules="tv-v4l $inputmodules"
7962else
7963  _tv_v4l1=no
7964  noinputmodules="tv-v4l1 $noinputmodules"
7965  def_tv_v4l='#undef CONFIG_TV_V4L'
7966fi
7967echores "$_tv_v4l1"
7968
7969
7970echocheck "Video 4 Linux 2 TV interface"
7971if test "$_tv_v4l2" = auto && test "$_tv" = yes ; then
7972    _tv_v4l2=no
7973    if linux ; then
7974        header_check_broken sys/time.h linux/videodev2.h && _tv_v4l2=yes
7975    else
7976        header_check sys/videoio.h && _tv_v4l2=yes &&
7977            def_sys_videoio_h='#define HAVE_SYS_VIDEOIO_H 1'
7978    fi
7979fi
7980if test "$_tv_v4l2" = yes ; then
7981  _audio_input=yes
7982  _tv_v4l=yes
7983  def_tv_v4l='#define CONFIG_TV_V4L 1'
7984  def_tv_v4l2='#define CONFIG_TV_V4L2 1'
7985  inputmodules="tv-v4l2 $inputmodules"
7986else
7987  noinputmodules="tv-v4l2 $noinputmodules"
7988  def_tv_v4l2='#undef CONFIG_TV_V4L2'
7989fi
7990echores "$_tv_v4l2"
7991
7992
7993echocheck "Radio interface"
7994if test "$_radio" = yes ; then
7995  def_radio='#define CONFIG_RADIO 1'
7996  inputmodules="radio $inputmodules"
7997  if test "$_alsa" != yes -a "$_ossaudio" != yes ; then
7998    _radio_capture=no
7999  fi
8000  if test "$_radio_capture" = yes ; then
8001    _audio_input=yes
8002    def_radio_capture="#define CONFIG_RADIO_CAPTURE 1"
8003  else
8004    def_radio_capture="#undef CONFIG_RADIO_CAPTURE"
8005  fi
8006else
8007  noinputmodules="radio $noinputmodules"
8008  def_radio='#undef CONFIG_RADIO'
8009  def_radio_capture="#undef CONFIG_RADIO_CAPTURE"
8010  _radio_capture=no
8011fi
8012echores "$_radio"
8013echocheck "Capture for Radio interface"
8014echores "$_radio_capture"
8015
8016
8017echocheck "Video 4 Linux 2 Radio interface"
8018if test "$_radio_v4l2" = auto && test "$_radio" = yes && linux ; then
8019    _radio_v4l2=no
8020    header_check linux/videodev2.h && _radio_v4l2=yes
8021fi
8022if test "$_radio_v4l2" = yes ; then
8023  def_radio_v4l2='#define CONFIG_RADIO_V4L2 1'
8024else
8025  _radio_v4l2=no
8026  def_radio_v4l2='#undef CONFIG_RADIO_V4L2'
8027fi
8028echores "$_radio_v4l2"
8029
8030
8031echocheck "Video 4 Linux Radio interface"
8032if test "$_radio_v4l" = auto && test "$_radio" = yes && linux ; then
8033    _radio_v4l=no
8034    header_check linux/videodev.h && _radio_v4l=yes
8035fi
8036if test "$_radio_v4l" = yes ; then
8037  def_radio_v4l='#define CONFIG_RADIO_V4L 1'
8038else
8039  _radio_v4l=no
8040  def_radio_v4l='#undef CONFIG_RADIO_V4L'
8041fi
8042echores "$_radio_v4l"
8043
8044if freebsd || netbsd || openbsd || dragonfly || bsdos &&
8045  test "$_radio" = yes && test "$_radio_bsdbt848" = auto ; then
8046echocheck "*BSD BrookTree 848 Radio interface"
8047   _radio_bsdbt848=no
8048    cat > $TMPC <<EOF
8049#include <sys/types.h>
8050$def_ioctl_bt848_h_name
8051#ifdef IOCTL_BT848_H_NAME
8052#include IOCTL_BT848_H_NAME
8053#endif
8054int main(void) { ioctl(0, RADIO_GETFREQ, 0); return 0; }
8055EOF
8056    cc_check && _radio_bsdbt848=yes
8057echores "$_radio_bsdbt848"
8058fi #if freebsd || netbsd || openbsd || dragonfly || bsdos && _radio && _radio_bsdbt848
8059
8060if test "$_radio_bsdbt848" = yes ; then
8061  def_radio_bsdbt848='#define CONFIG_RADIO_BSDBT848 1'
8062else
8063  _radio_bsdbt848=no
8064  def_radio_bsdbt848='#undef CONFIG_RADIO_BSDBT848'
8065fi
8066
8067if test "$_radio_v4l" = no && test "$_radio_v4l2" = no &&
8068   test "$_radio_bsdbt848" = no && test "$_radio" = yes ; then
8069    die "Radio driver requires BSD BT848,  V4L or V4L2!"
8070fi
8071
8072echocheck "Video 4 Linux 2 MPEG PVR interface"
8073if test "$_pvr" = auto && test "$_tv_v4l2" = yes && linux ; then
8074 _pvr=no
8075  cat > $TMPC <<EOF
8076#include <sys/time.h>
8077#include <linux/videodev2.h>
8078int main(void) {
8079  struct v4l2_ext_controls ext;
8080  return ext.controls->value;
8081}
8082EOF
8083  cc_check && _pvr=yes
8084fi
8085if test "$_pvr" = yes ; then
8086  def_pvr='#define CONFIG_PVR 1'
8087  inputmodules="pvr $inputmodules"
8088else
8089  _pvr=no
8090  noinputmodules="pvr $noinputmodules"
8091  def_pvr='#undef CONFIG_PVR'
8092fi
8093echores "$_pvr"
8094
8095
8096echocheck "ftp"
8097if test "$_ftp" = "auto" && test "$networking" = "yes" ; then
8098    _ftp=yes
8099fi
8100if test "$_ftp" = yes ; then
8101  def_ftp='#define CONFIG_FTP 1'
8102  inputmodules="ftp $inputmodules"
8103else
8104  noinputmodules="ftp $noinputmodules"
8105  def_ftp='#undef CONFIG_FTP'
8106fi
8107echores "$_ftp"
8108
8109echocheck "vstream client"
8110if test "$_vstream" = auto ; then
8111  _vstream=no
8112  cat > $TMPC <<EOF
8113#include <vstream-client.h>
8114void vstream_error(const char *format, ... ) {}
8115int main(void) { vstream_start(); return 0; }
8116EOF
8117  cc_check -lvstream-client && _vstream=yes
8118fi
8119if test "$_vstream" = yes ; then
8120  def_vstream='#define CONFIG_VSTREAM 1'
8121  inputmodules="vstream $inputmodules"
8122  extra_ldflags="$extra_ldflags -lvstream-client"
8123else
8124  noinputmodules="vstream $noinputmodules"
8125  def_vstream='#undef CONFIG_VSTREAM'
8126fi
8127echores "$_vstream"
8128
8129
8130echocheck "OSD menu"
8131if test "$_menu" = yes ; then
8132    def_menu='#define CONFIG_MENU 1'
8133    test $_dvbin = "yes" && _menu_dvbin=yes
8134else
8135def_menu='#undef CONFIG_MENU'
8136    _menu_dvbin=no
8137fi
8138echores "$_menu"
8139
8140
8141echocheck "Subtitles sorting"
8142if test "$_sortsub" = yes ; then
8143    def_sortsub='#define CONFIG_SORTSUB 1'
8144else
8145    def_sortsub='#undef CONFIG_SORTSUB'
8146fi
8147echores "$_sortsub"
8148
8149
8150echocheck "XMMS inputplugin support"
8151if test "$_xmms" = yes ; then
8152  if ( xmms-config --version ) >/dev/null 2>&1 ; then
8153      _xmmsplugindir=$(xmms-config --input-plugin-dir)
8154      _xmmslibdir=$(xmms-config --exec-prefix)/lib
8155  else
8156      _xmmsplugindir=/usr/lib/xmms/Input
8157      _xmmslibdir=/usr/lib
8158  fi
8159
8160  def_xmms='#define CONFIG_XMMS 1'
8161  if darwin ; then
8162     extra_ldflags="$extra_ldflags ${_xmmslibdir}/libxmms.dylib"
8163  else
8164     extra_ldflags="$extra_ldflags ${_xmmslibdir}/libxmms.so.1 -export-dynamic"
8165  fi
8166else
8167  def_xmms='#undef CONFIG_XMMS'
8168fi
8169echores "$_xmms"
8170
8171
8172# --------------- GUI specific tests begin -------------------
8173echocheck "GUI"
8174echores "$_gui"
8175if test "$_gui" = yes ; then
8176
8177  # Required libraries
8178  test "$ffmpeg" != yes && die "The GUI requires FFmpeg."
8179  test "$ffmpeg_so" = yes ||
8180    case "$libavdecoders" in
8181      *PNG_DECODER*) ;;
8182      *) die "The GUI requires libavcodec with PNG support (needs zlib)." ;;
8183    esac
8184  test "$_freetype" = no && test "$_bitmap_font" = no &&
8185    die "The GUI requires either FreeType or bitmap font support."
8186
8187  if ! win32 ; then
8188    _gui_gtk=yes
8189    test "$_x11" != yes && die "The GUI requires X11."
8190
8191    echocheck "XShape extension"
8192    if test "$_xshape" = auto ; then
8193      _xshape=no
8194      cat > $TMPC << EOF
8195#include <X11/Xlib.h>
8196#include <X11/extensions/shape.h>
8197#include <stdlib.h>
8198int main(void) {
8199  char *name = ":0.0";
8200  Display *wsDisplay;
8201  int exitvar = 0;
8202  int eventbase, errorbase;
8203  if (getenv("DISPLAY"))
8204      name=getenv("DISPLAY");
8205  wsDisplay=XOpenDisplay(name);
8206  if (!XShapeQueryExtension(wsDisplay, &eventbase, &errorbase))
8207      exitvar=1;
8208  XCloseDisplay(wsDisplay);
8209  return exitvar;
8210}
8211EOF
8212      cc_check -lXext && _xshape=yes
8213    fi
8214    if test "$_xshape" = yes ; then
8215      def_xshape='#define CONFIG_XSHAPE 1'
8216    else
8217      def_xshape='#undef CONFIG_XSHAPE'
8218      res_comment="some skins will look ugly without it"
8219    fi
8220    echores "$_xshape"
8221
8222    # Check for GTK+ 2
8223    echocheck "GTK+ version"
8224
8225    if $_pkg_config --exists gtk+-2.0 ; then
8226      _gtk=$($_pkg_config --modversion "gtk+-2.0 >= 2.4.0" 2>&1)
8227      if [ $? -eq 0 ]; then
8228        extra_cflags="$extra_cflags $($_pkg_config --cflags gtk+-2.0 2>/dev/null)"
8229        libs_mplayer="$libs_mplayer $($_pkg_config --libs gtk+-2.0 2>/dev/null)"
8230        echores "$_gtk"
8231      else
8232        res_comment="too old"
8233        echores "$($_pkg_config --modversion gtk+-2.0 2>/dev/null)"
8234        die "$_gtk"
8235      fi
8236
8237      # Check for specific minimum version of GLib
8238      # (version 2.4.0, required by GTK+ 2.4.0, would have been
8239      # checked automatically, but doesn't meet our requirements)
8240      echocheck "GLib version"
8241      if $_pkg_config --exists glib-2.0 ; then
8242        _glib=$($_pkg_config --modversion "glib-2.0 >= 2.6.0" 2>&1)
8243        if [ $? -eq 0 ]; then
8244          libs_mplayer="$libs_mplayer $($_pkg_config --libs glib-2.0 2>/dev/null)"
8245          echores "$_glib"
8246        else
8247          res_comment="too old"
8248          echores "$($_pkg_config --modversion glib-2.0 2>/dev/null)"
8249          die "$_glib"
8250        fi
8251
8252        def_gui='#define CONFIG_GUI 1'
8253      else
8254        echores "no"
8255        die "GLib version 2 devel packages were not found (required for GUI)."
8256      fi
8257    else
8258      echores "no"
8259      die "GTK+ version 2 devel packages were not found (required for GUI)."
8260    fi
8261
8262  else #if ! win32
8263    _gui_win32=yes
8264    libs_mplayer="$libs_mplayer -lcomdlg32 -lcomctl32 -lshell32 -lkernel32"
8265    def_gui='#define CONFIG_GUI 1'
8266  fi #if ! win32
8267
8268else #if test "$_gui"
8269  def_gui='#undef CONFIG_GUI'
8270fi #if test "$_gui"
8271# --------------- GUI specific tests end -------------------
8272
8273
8274if test "$_charset" != "noconv" ; then
8275  def_charset="#define MSG_CHARSET \"$_charset\""
8276else
8277  def_charset="#undef MSG_CHARSET"
8278  _charset="UTF-8"
8279fi
8280
8281if test -n "$_charset" && test "$_charset" != "UTF-8" ; then
8282echocheck "iconv program"
8283iconv -f UTF-8 -t $_charset ${_mp_help} > /dev/null 2>> "$TMPLOG"
8284if test "$?" -ne 0 ; then
8285  echores "no"
8286    echo "No working iconv program found, use "
8287    echo "--charset=UTF-8 to continue anyway."
8288    echo "If you also have problems with iconv library functions use --charset=noconv."
8289    echo "Messages in the GTK+ interface will be broken then."
8290    exit 1
8291else
8292  echores "yes"
8293fi
8294fi
8295
8296#############################################################################
8297
8298echocheck "automatic gdb attach"
8299if test "$_crash_debug" = yes ; then
8300  def_crash_debug='#define CONFIG_CRASH_DEBUG 1'
8301else
8302  def_crash_debug='#undef CONFIG_CRASH_DEBUG'
8303  _crash_debug=no
8304fi
8305echores "$_crash_debug"
8306
8307echocheck "compiler support for noexecstack"
8308if cflag_check -Wl,-z,noexecstack ; then
8309  extra_ldflags="-Wl,-z,noexecstack $extra_ldflags"
8310  echores "yes"
8311else
8312  echores "no"
8313fi
8314
8315echocheck "linker support for --nxcompat --no-seh --dynamicbase"
8316if cflag_check "-Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase" ; then
8317  extra_ldflags="-Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase $extra_ldflags"
8318  echores "yes"
8319else
8320  echores "no"
8321fi
8322
8323echocheck "linker support for --large-address-aware"
8324if cflag_check "-Wl,--large-address-aware" ; then
8325  extra_ldflags="-Wl,--large-address-aware $extra_ldflags"
8326  echores "yes"
8327else
8328  echores "no"
8329fi
8330
8331echocheck "linker support for --version-script"
8332if cflag_check "-Wl,--version-script,disable" ; then
8333  extra_ldflags="-Wl,--version-script,disable $extra_ldflags"
8334  echores "yes"
8335else
8336  echores "no"
8337fi
8338
8339
8340# Dynamic linking flags
8341# (FIXME: 'echocheck "dynamic linking"' above and modify here accordingly)
8342ld_dl_dynamic=''
8343freebsd || netbsd || openbsd || dragonfly || bsdos && ld_dl_dynamic='-rdynamic'
8344if test "$_real" = yes || test "$_xanim" = yes && ! win32 && ! qnx && ! darwin && ! os2 && ! sunos; then
8345  ld_dl_dynamic='-rdynamic'
8346fi
8347
8348extra_ldflags="$extra_ldflags $ld_pthread $ld_dl $ld_dl_dynamic"
8349bsdos && extra_ldflags="$extra_ldflags -ldvd"
8350(netbsd || openbsd) && x86_32 && extra_ldflags="$extra_ldflags -li386"
8351
8352def_debug='#undef MP_DEBUG'
8353test "$_debug" != "" && def_debug='#define MP_DEBUG 1'
8354
8355
8356echocheck "joystick"
8357def_joystick='#undef CONFIG_JOYSTICK'
8358if test "$_joystick" = yes ; then
8359  if linux || freebsd ; then
8360    # TODO add some check
8361    def_joystick='#define CONFIG_JOYSTICK 1'
8362  else
8363    _joystick="no"
8364    res_comment="unsupported under $system_name"
8365  fi
8366fi
8367echores "$_joystick"
8368
8369echocheck "lirc"
8370if test "$_lirc" = auto ; then
8371  _lirc=no
8372  header_check lirc/lirc_client.h -llirc_client && _lirc=yes
8373fi
8374if test "$_lirc" = yes ; then
8375  def_lirc='#define CONFIG_LIRC 1'
8376  libs_mplayer="$libs_mplayer -llirc_client"
8377else
8378  def_lirc='#undef CONFIG_LIRC'
8379fi
8380echores "$_lirc"
8381
8382echocheck "lircc"
8383if test "$_lircc" = auto ; then
8384  _lircc=no
8385  header_check lirc/lircc.h -llircc && _lircc=yes
8386fi
8387if test "$_lircc" = yes ; then
8388  def_lircc='#define CONFIG_LIRCC 1'
8389  libs_mplayer="$libs_mplayer -llircc"
8390else
8391  def_lircc='#undef CONFIG_LIRCC'
8392fi
8393echores "$_lircc"
8394
8395if arm; then
8396# Detect Maemo development platform libraries availability (http://www.maemo.org),
8397# they are used when run on Nokia 770|8x0
8398echocheck "maemo (Nokia 770|8x0)"
8399if test "$_maemo" = auto ; then
8400  _maemo=no
8401  statement_check libosso.h 'osso_initialize('', '', 0, NULL)' $($_pkg_config --cflags --libs libosso 2>/dev/null) && _maemo=yes
8402fi
8403if test "$_maemo" = yes ; then
8404  def_maemo='#define CONFIG_MAEMO 1'
8405  extra_cflags="$extra_cflags $($_pkg_config --cflags libosso)"
8406  extra_ldflags="$extra_ldflags $($_pkg_config --libs libosso) -lXsp"
8407else
8408  def_maemo='#undef CONFIG_MAEMO'
8409fi
8410echores "$_maemo"
8411fi
8412
8413#############################################################################
8414
8415# On OS/2 nm supports only a.out. So the -Zomf compiler option to generate
8416# the OMF format needs to come after the 'extern symbol prefix' check, which
8417# uses nm.
8418if os2 ; then
8419  extra_ldflags="$extra_ldflags -Zomf -Zstack 16384 -Zbin-files -Zargs-wild -Zhigh-mem"
8420fi
8421
8422# linker paths should be the same for mencoder and mplayer
8423ld_tmp=""
8424for I in $libs_mplayer ; do
8425  _tmp=$(echo $I | sed -e 's/^-L.*$//')
8426  if test -z "$_tmp" ; then
8427    extra_ldflags="$extra_ldflags $I"
8428  else
8429    ld_tmp="$ld_tmp $I"
8430  fi
8431done
8432libs_mplayer=$ld_tmp
8433
8434
8435#############################################################################
8436
8437CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
8438
8439CXXFLAGS=" $CFLAGS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
8440
8441echocheck "DVD support (libdvdnav)"
8442if test "$_dvdnav" = auto ; then
8443  _dvdnav=no
8444  _dvdnavdir=$($_dvdnavconfig --cflags)
8445  _dvdnavlibs=$($_dvdnavconfig --libs)
8446  statement_check_broken stdint.h dvdnav/dvdnav.h 'dvdnav_t *dvd = 0; dvdnav_open(&dvd, 0)' $_dvdnavdir $_dvdnavlibs $ld_dl $ld_pthread && _dvdnav=yes
8447fi
8448if test "$_dvdnav" = yes ; then
8449  def_dvdnav='#define CONFIG_DVDNAV 1'
8450  extra_cflags="$extra_cflags $($_dvdnavconfig --cflags)"
8451  extra_ldflags="$extra_ldflags $($_dvdnavconfig --libs)"
8452  inputmodules="dvdnav $inputmodules"
8453else
8454  def_dvdnav='#undef CONFIG_DVDNAV'
8455  noinputmodules="dvdnav $noinputmodules"
8456fi
8457echores "$_dvdnav"
8458
8459extra_ldflags="$extra_ldflags $libm"
8460
8461# DO NOT ADD ANY TESTS THAT USE LINKER FLAGS HERE (like cc_check).
8462# Read dvdnav comment above.
8463
8464
8465# XML documentation tests
8466echocheck "XML catalogs"
8467for try_catalog in \
8468  /etc/sgml/catalog \
8469  /usr/share/xml/docbook/*/catalog.xml \
8470  /opt/local/share/xml/docbook-xml/*/catalog.xml \
8471  /opt/local/share/xml/docbook/*/catalog.xml \
8472  /usr/share/sgml/docbook/*/*catalog \
8473  /usr/share/apps/ksgmltools2/customization/en/catalog \
8474  /usr/share/sgml/catalog \
8475  /usr/local/share/sgml/catalog \
8476  /usr/lib/sgml/catalog \
8477  /usr/local/lib/sgml/catalog \
8478  /usr/share/docbook-xml42/catalog.xml \
8479  /usr/share/sgml/docbook/xmlcatalog; do
8480  if test -f "$try_catalog"; then
8481    catalog=$try_catalog
8482    break
8483  fi
8484done
8485
8486if test -n "$catalog"; then
8487  echores "SGML catalog"
8488  catalog_opts=--catalogs
8489else
8490  echores "No SGML catalog found."
8491fi
8492
8493echocheck "XML chunked stylesheet"
8494for try_chunk_xsl in \
8495  /usr/share/xml/docbook/*/html/chunk.xsl \
8496  /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/html/chunk.xsl \
8497  /usr/share/sgml/docbook/yelp/docbook/html/chunk.xsl \
8498  /usr/local/share/sgml/docbook/stylesheet/xsl/nwalsh/html/chunk.xsl \
8499  /usr/local/share/sgml/docbook/yelp/docbook/html/chunk.xsl \
8500  /usr/share/docbook-xsl/html/chunk.xsl \
8501  /usr/share/sgml/docbook/xsl-stylesheets*/html/chunk.xsl \
8502  /usr/share/xml/docbook/stylesheet/nwalsh/current/html/chunk.xsl \
8503  /opt/local/share/xsl/docbook-xsl/html/chunk.xsl; do
8504  if test -f "$try_chunk_xsl"; then
8505    chunk_xsl=$try_chunk_xsl
8506    break
8507  fi
8508done
8509
8510if test -z "$chunk_xsl"; then
8511  chunk_xsl=http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
8512  echores "not found, using default"
8513  fake_chunk_xsl=yes
8514else
8515  echores "chunk.xsl"
8516fi
8517
8518echocheck "XML monolithic stylesheet"
8519for try_docbook_xsl in \
8520  /usr/share/xml/docbook/*/html/docbook.xsl \
8521  /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/html/docbook.xsl \
8522  /usr/share/sgml/docbook/yelp/docbook/html/docbook.xsl \
8523  /usr/local/share/sgml/docbook/stylesheet/xsl/nwalsh/html/docbook.xsl \
8524  /usr/local/share/sgml/docbook/yelp/docbook/html/docbook.xsl \
8525  /usr/share/docbook-xsl/html/docbook.xsl \
8526  /usr/share/sgml/docbook/xsl-stylesheets*/html/docbook.xsl \
8527  /usr/share/xml/docbook/stylesheet/nwalsh/current/html/docbook.xsl \
8528  /opt/local/share/xsl/docbook-xsl/html/docbook.xsl; do
8529  if test -f "$try_docbook_xsl"; then
8530    docbook_xsl=$try_docbook_xsl
8531    break
8532  fi
8533done
8534
8535if test -z "$docbook_xsl"; then
8536  docbook_xsl=http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
8537  echores "not found, using default"
8538else
8539  echores "docbook.xsl"
8540fi
8541
8542cat > DOCS/xml/html-chunk.xsl << EOF
8543<?xml version="1.0" encoding="utf-8"?>
8544<!-- **************************************************
8545     This file is generated automatically. DO NOT EDIT.
8546     ************************************************** -->
8547<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8548                version="1.0">
8549
8550  <xsl:import href="$chunk_xsl"/>
8551  <xsl:include href="html-common.xsl"/>
8552
8553</xsl:stylesheet>
8554EOF
8555
8556cat > DOCS/xml/html-single.xsl << EOF
8557<?xml version="1.0" encoding="utf-8"?>
8558<!-- **************************************************
8559     This file is generated automatically. DO NOT EDIT.
8560     ************************************************** -->
8561<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
8562                version="1.0">
8563
8564  <xsl:import href="$docbook_xsl"/>
8565  <xsl:include href="html-common.xsl"/>
8566
8567</xsl:stylesheet>
8568EOF
8569
8570echocheck "XML DTD"
8571#FIXME: This should prefer higher version numbers, not the other way around ..
8572for try_dtd in \
8573  /usr/share/xml/docbook/*/dtd/4*/docbookx.dtd \
8574  /usr/share/xml/docbook/*/docbookx.dtd \
8575  /usr/share/sgml/docbook/*/docbookx.dtd \
8576  /usr/share/sgml/docbook/dtd/*/docbookx.dtd \
8577  /usr/share/sgml/docbook/dtd/xml/*/docbookx.dtd \
8578  /usr/share/docbook-xml*/docbookx.dtd \
8579  /opt/local/share/xml/docbook*/*/docbookx.dtd \
8580  /usr/share/apps/ksgmltools2/docbook/*/docbookx.dtd; do
8581  if test -f "$try_dtd"; then
8582    dtd=$try_dtd
8583    break
8584  fi
8585done
8586
8587if test -z "$dtd"; then
8588  dtd=http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd
8589  echores "not found, using default"
8590else
8591  echores "docbookx.dtd"
8592fi
8593
8594for lang in $language_doc; do
8595  cat > DOCS/xml/$lang/main.xml << EOF
8596<?xml version="1.0" encoding="utf-8" standalone="no"?>
8597<!-- **************************************************
8598     This file is generated automatically. DO NOT EDIT.
8599     ************************************************** -->
8600<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
8601    "$dtd"
8602[
8603<!ENTITY bugreports.xml SYSTEM "bugreports.xml">
8604<!ENTITY documentation.xml SYSTEM "documentation.xml">
8605<!ENTITY encoding-guide.xml SYSTEM "encoding-guide.xml">
8606<!ENTITY faq.xml SYSTEM "faq.xml">
8607<!ENTITY install.xml SYSTEM "install.xml">
8608<!ENTITY mencoder.xml SYSTEM "mencoder.xml">
8609<!ENTITY ports.xml SYSTEM "ports.xml">
8610<!ENTITY skin.xml SYSTEM "skin.xml">
8611<!ENTITY usage.xml SYSTEM "usage.xml">
8612<!ENTITY video.xml SYSTEM "video.xml">
8613]>
8614<book id="index" lang="$lang">
8615&documentation.xml;
8616&install.xml;
8617&usage.xml;
8618&video.xml;
8619&ports.xml;
8620&mencoder.xml;
8621&encoding-guide.xml;
8622&faq.xml;
8623&bugreports.xml;
8624&skin.xml;
8625</book>
8626EOF
8627
8628done
8629
8630echocheck "valid XSLT processor"
8631if xsltproc --version > /dev/null 2>&1; then
8632  if test -z "$fake_chunk_xsl"; then
8633    echores "xsltproc"
8634    xsltcommand="xsltproc $catalog_opts -o"
8635  else
8636    echores "Found xsltproc but no stylesheets on your system."
8637    echores "xsltproc is unusable without stylesheets."
8638  fi
8639else
8640  echores "xsltproc not found"
8641fi
8642
8643#############################################################################
8644
8645mak_enable () {
8646list=$(echo $1 | toupper)
8647item=$(echo $2 | toupper)
8648nprefix=$3;
8649suffix=$4
8650for part in $list; do
8651  name="${nprefix}_${part}$suffix"
8652  if $(echo $item | grep -q -E "(^| )$part($| )"); then
8653    echo "$name = yes"
8654  else
8655    echo "!$name = yes"
8656  fi
8657done
8658}
8659
8660# This should be last
8661if msvc ; then
8662  CFLAGS="$CFLAGS -Icompatinc"
8663fi
8664
8665#############################################################################
8666echo "Creating config.mak"
8667cat > config.mak << EOF
8668# -------- Generated by configure -----------
8669
8670# Ensure that locale settings do not interfere with shell commands.
8671export LC_ALL = C
8672
8673CONFIGURATION = $configuration
8674
8675CHARSET = $_charset
8676DOC_LANGS = $language_doc
8677DOC_LANG_ALL = $doc_lang_all
8678MAN_LANGS = $language_man
8679MAN_LANG_ALL = $man_lang_all
8680MSG_LANGS = $language_msg
8681
8682CATALOG = $catalog
8683XMLLINT_COMMAND = xmllint --noout --noent --postvalid $catalog_opts
8684XSLT_COMMAND = $xsltcommand
8685
8686prefix  = \$(DESTDIR)$_prefix
8687BINDIR  = \$(DESTDIR)$_bindir
8688DATADIR = \$(DESTDIR)$_datadir
8689LIBDIR  = \$(DESTDIR)$_libdir
8690MANDIR  = \$(DESTDIR)$_mandir
8691CONFDIR = \$(DESTDIR)$_confdir
8692
8693AR      = $_ar
8694ARFLAGS = $_arflags
8695AR_O    = $AR_O
8696AS      = $_as
8697CC      = $_cc
8698CXX     = $_cc
8699HOST_CC = $_host_cc
8700INSTALL = $_install
8701INSTALLSTRIP = $_install_strip
8702WINDRES = $_windres
8703WINDRES_O = $WINDRES_O
8704
8705CFLAGS   = $($filter_flags $WARNFLAGS $WARN_CFLAGS $CFLAGS $extra_cflags)
8706CXXFLAGS = $($filter_flags $WARNFLAGS $CXXFLAGS $extra_cflags $extra_cxxflags)
8707CC_DEPFLAGS = $($filter_flags $DEPFLAGS)
8708
8709CFLAGS_DHAHELPER         = $cflags_dhahelper
8710CFLAGS_NO_OMIT_LEAF_FRAME_POINTER = $cflags_no_omit_leaf_frame_pointer
8711CFLAGS_STACKREALIGN      = $cflags_stackrealign
8712CFLAGS_SVGALIB_HELPER    = $cflags_svgalib_helper
8713
8714EXTRALIBS          = $($filter_flags $ld_static $extra_ldflags $timer_libs $extra_libs)
8715EXTRALIBS_MPLAYER  = $($filter_flags $libs_mplayer)
8716EXTRALIBS_MENCODER = $($filter_flags $libs_mencoder)
8717
8718MP_MSG_LIBS = $ld_iconv $ld_termcap $timer_libs
8719
8720GETCH = $_getch
8721HELP_FILE = $_mp_help
8722TIMER = $_timer
8723
8724EXESUF      = $_exesuf
8725EXESUFS_ALL = .exe
8726
8727ARCH = $arch
8728$(mak_enable "$arch_all"    "$arch"    ARCH)
8729$(mak_enable "$subarch_all" "$subarch" ARCH)
8730$(mak_enable "$cpuexts_all" "$cpuexts" HAVE)
8731$(mak_enable "$cpuexts_all" "$cpuexts_external" HAVE _EXTERNAL)
8732$(mak_enable "$cpuexts_all" "$cpuexts_inline" HAVE _INLINE)
8733
8734MENCODER = $_mencoder
8735MPLAYER  = $_mplayer
8736
8737# operating system features which have local fallbacks
8738GETTIMEOFDAY = $gettimeofday
8739GLOB         = $glob
8740GLOB_WIN     = $glob_win
8741MMAP         = $mmap
8742SETENV       = $setenv
8743SHMEM        = $shmem
8744STRSEP       = $strsep
8745VSSCANF      = $vsscanf
8746
8747# features
87483DFX = $_3dfx
8749AA = $_aa
8750ALSA = $_alsa
8751APPLE_IR = $_apple_ir
8752APPLE_REMOTE = $_apple_remote
8753ARTS = $_arts
8754AUDIO_INPUT = $_audio_input
8755BITMAP_FONT = $_bitmap_font
8756BL = $_bl
8757CACA = $_caca
8758CDDA = $_cdda
8759CDDB = $_cddb
8760COREAUDIO = $_coreaudio
8761COREVIDEO = $_corevideo
8762DART = $_dart
8763DGA = $_dga
8764DIRECT3D = $_direct3d
8765DIRECTFB = $_directfb
8766DIRECTX = $_directx
8767DVBIN = $_dvbin
8768DVDNAV = $_dvdnav
8769DVDREAD = $_dvdread
8770DXR2 = $_dxr2
8771DXR3 = $_dxr3
8772ESD = $_esd
8773FAAC=$_faac
8774FAAD = $_faad
8775FASTMEMCPY = $_fastmemcpy
8776FBDEV = $_fbdev
8777FREETYPE = $_freetype
8778FTP = $_ftp
8779GIF = $_gif
8780GGI = $_ggi
8781GL = $_gl
8782GL_WIN32 = $_gl_win32
8783GL_X11 = $_gl_x11
8784GL_EGL_X11 = $_gl_egl_x11
8785GL_SDL = $_gl_sdl
8786GL_OSX = $_gl_osx
8787MATRIXVIEW = $matrixview
8788GUI = $_gui
8789GUI_GTK = $_gui_gtk
8790GUI_WIN32 = $_gui_win32
8791HAVE_POSIX_SELECT = $_posix_select
8792HAVE_SYS_MMAN_H = $_mman
8793HAVE_WINDOWS_H = $windows_h
8794JACK = $_jack
8795JOYSTICK = $_joystick
8796JPEG = $_jpeg
8797KAI = $_kai
8798KVA = $_kva
8799LADSPA = $_ladspa
8800LIBA52 = $_liba52
8801LIBASS = $_ass
8802LIBASS_INTERNAL = $ass_internal
8803LIBBLURAY = $_bluray
8804LIBBS2B = $_libbs2b
8805LIBDCA = $_libdca
8806LIBDV = $_libdv
8807LIBLZO = $_liblzo
8808LIBMAD = $_mad
8809LIBMENU = $_menu
8810LIBMENU_DVBIN = $_menu_dvbin
8811LIBMPEG2 = $_libmpeg2
8812LIBMPEG2_INTERNAL = $_libmpeg2_internal
8813LIBNEMESI = $_nemesi
8814LIBNUT = $_libnut
8815LIBSMBCLIENT = $_smb
8816LIBTHEORA = $_theora
8817LIRC = $_lirc
8818LIVE555 = $_live
8819MACOSX_FINDER = $_macosx_finder
8820MD5SUM = $_md5sum
8821MGA = $_mga
8822MNG = $_mng
8823MP3LAME = $_mp3lame
8824MPG123 = $_mpg123
8825MUSEPACK = $_musepack
8826NAS = $_nas
8827NATIVE_RTSP = $_native_rtsp
8828NETWORKING = $networking
8829OPENAL = $_openal
8830OSS = $_ossaudio
8831PE_EXECUTABLE = $_pe_executable
8832PNG = $_png
8833PNM = $_pnm
8834POSTPROC = $postproc
8835PRIORITY = $_priority
8836PULSE = $_pulse
8837PVR = $_pvr
8838QTX_CODECS = $_qtx
8839QTX_CODECS_WIN32 = $_qtx_codecs_win32
8840QTX_EMULATION = $_qtx_emulation
8841QUARTZ = $_quartz
8842RADIO=$_radio
8843RADIO_CAPTURE=$_radio_capture
8844REAL_CODECS = $_real
8845S3FB = $_s3fb
8846SDL = $_sdl
8847SDL_IMAGE = $sdl_image
8848SPEEX = $_speex
8849STREAM_CACHE = $_stream_cache
8850SGIAUDIO = $_sgiaudio
8851SNDIO = $_sndio
8852SUNAUDIO = $_sunaudio
8853SVGA = $_svga
8854TDFXFB = $_tdfxfb
8855TDFXVID = $_tdfxvid
8856TGA = $_tga
8857TOOLAME=$_toolame
8858TV = $_tv
8859TV_BSDBT848 = $_tv_bsdbt848
8860TV_DSHOW = $_tv_dshow
8861TV_V4L  = $_tv_v4l
8862TV_V4L1 = $_tv_v4l1
8863TV_V4L2 = $_tv_v4l2
8864TWOLAME=$_twolame
8865UNRAR_EXEC = $_unrar_exec
8866V4L2 = $_v4l2
8867VCD = $_vcd
8868VDA = $_vda
8869VDPAU = $_vdpau
8870VESA = $_vesa
8871VIDIX = $_vidix
8872VIDIX_PCIDB = $_vidix_pcidb_val
8873VIDIX_CYBERBLADE=$_vidix_drv_cyberblade
8874VIDIX_IVTV=$_vidix_drv_ivtv
8875VIDIX_MACH64=$_vidix_drv_mach64
8876VIDIX_MGA=$_vidix_drv_mga
8877VIDIX_MGA_CRTC2=$_vidix_drv_mga_crtc2
8878VIDIX_NVIDIA=$_vidix_drv_nvidia
8879VIDIX_PM2=$_vidix_drv_pm2
8880VIDIX_PM3=$_vidix_drv_pm3
8881VIDIX_RADEON=$_vidix_drv_radeon
8882VIDIX_RAGE128=$_vidix_drv_rage128
8883VIDIX_S3=$_vidix_drv_s3
8884VIDIX_SH_VEU=$_vidix_drv_sh_veu
8885VIDIX_SIS=$_vidix_drv_sis
8886VIDIX_UNICHROME=$_vidix_drv_unichrome
8887VORBIS = $_vorbis
8888VSTREAM = $_vstream
8889WII = $_wii
8890WIN32DLL = $_win32dll
8891WIN32WAVEOUT = $_win32waveout
8892WIN32_EMULATION = $_win32_emulation
8893WINVIDIX = $winvidix
8894X11 = $_x11
8895X264 = $_x264
8896XANIM_CODECS = $_xanim
8897XMGA = $_xmga
8898XMMS_PLUGINS = $_xmms
8899XV = $_xv
8900XVID4 = $_xvid
8901XVIDIX = $xvidix
8902XVMC = $_xvmc
8903XVR100 = $_xvr100
8904YUV4MPEG = $_yuv4mpeg
8905ZR = $_zr
8906
8907# FFmpeg
8908FFMPEG     = $ffmpeg
8909FFMPEG_A   = $ffmpeg_a
8910
8911CONFIG_AVCODEC  = $ffmpeg_a
8912CONFIG_AVDEVICE = $ffmpeg_a
8913CONFIG_AVFILTER = $ffmpeg_a
8914CONFIG_AVFORMAT = $ffmpeg_a
8915CONFIG_AVUTIL   = $ffmpeg_a
8916CONFIG_POSTPROC = $ffmpeg_a
8917CONFIG_SWSCALE  = $ffmpeg_a
8918CONFIG_SWRESAMPLE = $ffmpeg_a
8919
8920ASFLAGS    = \$(CFLAGS)
8921AS_DEPFLAGS= $DEPFLAGS
8922HOSTCC     = \$(HOST_CC)
8923HOSTCFLAGS = $HOSTCFLAGS
8924HOSTLIBS   = $libm
8925AS_O       = -o \$@
8926CC_O       = $CC_O
8927CC_LINK_O  = $CC_LINK_O
8928CXX_O      = -o \$@
8929AS_C       = -c
8930CC_C       = -c
8931CXX_C      = -c
8932LD         = cc
8933RANLIB     = $_ranlib
8934YASM       = $_yasm
8935X86ASM     = $_yasm
8936DEPYASM    = $_yasm
8937DEPX86ASM  = $_yasm
8938YASMFLAGS  = $YASMFLAGS
8939X86ASMFLAGS = $YASMFLAGS -o\$@
8940DEPX86ASMFLAGS=\$(X86ASMFLAGS)
8941STRIP      = $_strip
8942
8943CONFIG_FFPROBE       = no
8944CONFIG_LAVFI_INDEV   = no
8945CONFIG_AMOVIE_FILTER = no
8946CONFIG_MOVIE_FILTER  = no
8947CONFIG_SCALE_FILTER  = no
8948CONFIG_SELECT_FILTER = no
8949
8950CONFIG_STATIC = yes
8951SRC_PATH      = .
8952DST_PATH      = $(pwd)/ffmpeg
8953LIBPREF       = lib
8954LIBSUF        = .a
8955FULLNAME      = \$(NAME)\$(BUILDSUF)
8956LIBNAME       = \$(LIBPREF)\$(FULLNAME)\$(LIBSUF)
8957
8958# These are not necessary for building, since we do not use shared libraries,
8959# but without them target names clash, causing Make warnings by the boatload.
8960SLIBNAME            = \$(SLIBPREF)\$(FULLNAME)\$(SLIBSUF)
8961SLIBNAME_WITH_MAJOR = \$(SLIBNAME)-42
8962
8963# Some FFmpeg codecs depend on these. Enable them unconditionally for now.
8964CONFIG_AANDCTTABLES  = yes
8965CONFIG_ADTS_HEADER = yes
8966CONFIG_ATSC_A53 = yes
8967CONFIG_AUDIODSP = yes
8968CONFIG_AUDIO_FRAME_QUEUE = yes
8969CONFIG_BLOCKDSP= yes
8970CONFIG_BSWAPDSP= yes
8971CONFIG_CABAC   = yes
8972CONFIG_CBS     = yes
8973CONFIG_CHROMAPRINT = no
8974CONFIG_DCT     = yes
8975CONFIG_DWT     = yes
8976CONFIG_ERROR_RESILIENCE = yes
8977CONFIG_EXIF    = yes
8978CONFIG_FAANDCT = yes
8979CONFIG_FAANIDCT= yes
8980CONFIG_FDCTDSP = yes
8981CONFIG_FLACDSP = yes
8982CONFIG_FMTCONVERT = yes
8983CONFIG_FRAME_THREAD_ENCODER = yes
8984CONFIG_FFT     = yes
8985CONFIG_G722DSP = yes
8986CONFIG_GOLOMB  = yes
8987CONFIG_H263DSP = yes
8988CONFIG_H264CHROMA = yes
8989CONFIG_H264DSP = yes
8990CONFIG_H264PARSE = yes
8991CONFIG_H264PRED= yes
8992CONFIG_H264QPEL= yes
8993CONFIG_HEVCPARSE = yes
8994CONFIG_HPELDSP = yes
8995CONFIG_IIRFILTER = yes
8996CONFIG_ISO_MEDIA = yes
8997CONFIG_IVIDSP = yes
8998CONFIG_JPEGTABLES = yes
8999CONFIG_QPELDSP = yes
9000CONFIG_QSV     = no
9001CONFIG_HUFFYUVDSP = yes
9002CONFIG_HUFFYUVENCDSP = yes
9003CONFIG_IDCTDSP = yes
9004CONFIG_TPELDSP = yes
9005CONFIG_HUFFMAN = yes
9006CONFIG_MDCT15  = yes
9007CONFIG_INTRAX8 = yes
9008CONFIG_LLAUDDSP= yes
9009CONFIG_LLVIDDSP= yes
9010CONFIG_LLVIDENCDSP = yes
9011CONFIG_LPC     = yes
9012CONFIG_LSP     = yes
9013CONFIG_LZF = yes
9014CONFIG_LZO     = yes
9015CONFIG_MDCT    = yes
9016CONFIG_ME_CMP  = yes
9017CONFIG_MPEG_ER = yes
9018CONFIG_MPEGAUDIODSP = yes
9019CONFIG_MPEGAUDIOHEADER = yes
9020CONFIG_MPEGVIDEO    = yes
9021CONFIG_MPEGVIDEOENC = yes
9022CONFIG_MSS34DSP = yes
9023CONFIG_PIXBLOCKDSP  = yes
9024CONFIG_RANGECODER   = yes
9025CONFIG_RDFT    = yes
9026CONFIG_RIFFDEC = yes
9027CONFIG_RIFFENC = yes
9028CONFIG_RTPENC_CHAIN = yes
9029CONFIG_RV34DSP = yes
9030CONFIG_SINEWIN = yes
9031CONFIG_SNAPPY = yes
9032CONFIG_STARTCODE = yes
9033CONFIG_TEXTUREDSP = yes
9034CONFIG_VC1DSP = yes
9035CONFIG_VIDEODSP = yes
9036CONFIG_VP3DSP  = yes
9037CONFIG_VP56DSP = yes
9038CONFIG_VP8DSP = yes
9039CONFIG_WMA_FREQS = yes
9040CONFIG_WMV2DSP = yes
9041
9042$mak_hardcoded_tables
9043$mak_libavcodec_mpegaudio_hp
9044!CONFIG_LIBRTMP = $nolibrtmp
9045CONFIG_LIBRTMP  = $_librtmp
9046
9047CONFIG_AC3DSP   = yes
9048CONFIG_BZLIB    = $bzlib
9049CONFIG_CRYSTALHD= $crystalhd
9050CONFIG_ENCODERS = yes
9051CONFIG_GNUTLS   = $_gnutls
9052CONFIG_OPENSSL  = $_openssl
9053CONFIG_GPL      = yes
9054CONFIG_ICONV    = $_iconv
9055CONFIG_MLIB     = $_mlib
9056CONFIG_MPEGAUDIO=yes
9057CONFIG_MUXERS   = yes
9058CONFIG_NETWORK  = $networking
9059CONFIG_RTPDEC   = $networking
9060CONFIG_VF_LAVFI = $_vf_lavfi
9061CONFIG_VDA      = $_vda
9062CONFIG_VDPAU    = $_vdpau
9063CONFIG_XVMC     = $_xvmc
9064CONFIG_ZLIB     = $_zlib
9065
9066HAVE_GNU_AS     = $gnu_as
9067HAVE_OS2THREADS = $_os2threads
9068HAVE_PTHREADS   = $_pthreads
9069HAVE_SHM        = $_shm
9070HAVE_W32THREADS = $_w32threads
9071HAVE_THREADS    = $_threads
9072HAVE_YASM       = $have_yasm
9073HAVE_X86ASM     = $have_yasm
9074INTRINSICS      = $intrinsics
9075
9076CONFIG_LIBXVID = $_xvid_lavc
9077$(mak_enable "$libavdecoders_all"  "$libavdecoders"  CONFIG)
9078$(mak_enable "$libavencoders_all"  "$libavencoders"  CONFIG)
9079$(mak_enable "$libavparsers_all"   "$libavparsers"   CONFIG)
9080$(mak_enable "$libavdemuxers_all"  "$libavdemuxers"  CONFIG)
9081$(mak_enable "$libavmuxers_all"    "$libavmuxers"    CONFIG)
9082$(mak_enable "$libavprotocols_all" "$libavprotocols" CONFIG)
9083$(mak_enable "$libavbsfs_all"      "$libavbsfs"      CONFIG)
9084$(mak_enable "$libavcbs_all"       "$libavcbs"       CONFIG)
9085$(mak_enable "$libavhwaccels_all"  "$libavhwaccels"  CONFIG)
9086$(mak_enable "$libavfilters_all"   "$libavfilters"   CONFIG)
9087EOF
9088
9089#############################################################################
9090
9091ff_config_enable () {
9092list=$(echo $1 | toupper)
9093item=$(echo $2 | toupper)
9094_nprefix=$4;
9095_defineprefix=$3;
9096_postfix=$5;
9097test -z "$_nprefix" && _nprefix='CONFIG'
9098for part in $list; do
9099  if $(echo $item | grep -q -E "(^| )$part($| )"); then
9100    echo "${_defineprefix}define ${_nprefix}_${part}${_postfix} 1"
9101  else
9102    echo "${_defineprefix}define ${_nprefix}_${part}${_postfix} 0"
9103  fi
9104done
9105}
9106
9107echo "Creating config.h"
9108cat > $TMPH << EOF
9109/*----------------------------------------------------------------------------
9110** This file has been automatically generated by configure any changes in it
9111** will be lost when you run configure again.
9112** Instead of modifying definitions here, use the --enable/--disable options
9113** of the configure script! See ./configure --help for details.
9114*---------------------------------------------------------------------------*/
9115
9116#ifndef MPLAYER_CONFIG_H
9117#define MPLAYER_CONFIG_H
9118
9119/* Undefine this if you do not want to select mono audio (left or right)
9120   with a stereo MPEG layer 2/3 audio stream. The command line option
9121   -stereo has three possible values (0 for stereo, 1 for left-only, 2 for
9122   right-only), with 0 being the default.
9123   */
9124#define CONFIG_FAKE_MONO 1
9125
9126/* set up max. outburst. use 131072 for TrueHD SPDIF pass-through */
9127#define MAX_OUTBURST 131072
9128
9129/* set up audio OUTBURST. Do not change this! */
9130#define OUTBURST 512
9131
9132/* Enable fast OSD/SUB renderer (looks ugly, but uses less CPU power) */
9133#undef FAST_OSD
9134#undef FAST_OSD_TABLE
9135
9136/* Required for libdvdcss and some files below stream/. */
9137#ifndef O_BINARY
9138#define O_BINARY 0
9139#endif
9140
9141/* Define this to enable MPEG-1/2 image postprocessing in libmpeg2 */
9142#define MPEG12_POSTPROC 1
9143#define ATTRIBUTE_ALIGNED_MAX 16
9144
9145
9146
9147#define CONFIGURATION "$configuration"
9148
9149#define MPLAYER_DATADIR "$_datadir"
9150#define MPLAYER_CONFDIR "$_confdir"
9151#define MPLAYER_LIBDIR "$_libdir"
9152
9153/* definitions needed by included libraries */
9154/* libmpeg2 */
9155$def_fast_inttypes
9156/* libdvdcss */
9157#define HAVE_ERRNO_H 1
9158#define HAVE_INTTYPES_H 1
9159$def_unistd_h
9160$def_broken_mkdir
9161$def_cdio
9162$def_cdrom
9163$def_dvd
9164$def_dvd_bsd
9165$def_dvd_darwin
9166$def_dvd_linux
9167$def_dvd_openbsd
9168$def_dvdcss
9169$def_dvdio
9170$def_hpux_scsi_h
9171$def_sol_scsi_h
9172$def_sys_uio_h
9173
9174/* libdvdcss + libdvdread */
9175#define HAVE_LIMITS_H 1
9176/* libdvdread */
9177#define HAVE_DLFCN_H 1
9178#define HAVE_MEMCPY 1
9179#define STDC_HEADERS 1
9180/* libdvdnav */
9181#define READ_CACHE_TRACE 0
9182
9183
9184/* system headers */
9185$def_alloca_h
9186$def_altivec_h
9187$def_malloc_h
9188$def_mman_h
9189$def_mman_has_map_failed
9190$def_soundcard_h
9191$def_sys_soundcard_h
9192$def_sys_sysinfo_h
9193$def_sys_videoio_h
9194$def_termios_h
9195$def_termios_sys_h
9196$def_winsock2_h
9197$def_cdio_paranoia_h
9198$def_cdio_paranoia_paranoia_h
9199
9200
9201/* system functions */
9202$def_gethostbyname2
9203$def_gettimeofday
9204$def_clock_gettime
9205$def_glob
9206$def_gmtime_r
9207$def_langinfo
9208$def_localtime_r
9209$def_memalign
9210$def_nanosleep
9211$def_posix_select
9212$def_select
9213$def_setenv
9214$def_setmode
9215$def_shm
9216$def_strsep
9217$def_sysi86
9218$def_sysi86_iv
9219$def_termcap
9220$def_termios
9221$def_vsscanf
9222
9223
9224/* system-specific features */
9225$def_asmalign_pot
9226$def_builtin_expect
9227$def_dl
9228$def_dos_paths
9229$def_extern_asm
9230$def_extern_prefix
9231$def_iconv
9232$def_kstat
9233$def_macosx_bundle
9234$def_macosx_finder
9235$def_maemo
9236$def_path_max_check
9237$def_priority
9238$def_quicktime
9239$def_restrict_keyword
9240$def_rtc
9241$def_unrar_exec
9242
9243
9244/* configurable options */
9245$def_charset
9246$def_crash_debug
9247$def_debug
9248$def_dynamic_plugins
9249$def_fastmemcpy
9250$def_menu
9251$def_nls
9252$def_runtime_cpudetection
9253$def_sighandler
9254$def_sortsub
9255$def_stream_cache
9256$def_pthread_cache
9257
9258
9259/* CPU stuff */
9260#define __CPU__ $iproc
9261$def_armthumb
9262$def_bigendian
9263$def_ebx_available
9264$def_vfp_args
9265$(ff_config_enable "$arch_all" "$arch" "#" "ARCH")
9266$(ff_config_enable "$subarch_all" "$subarch" "#" "ARCH")
9267$(ff_config_enable "$cpuexts_all" "$cpuexts" "#" "HAVE")
9268$(ff_config_enable "$cpuexts_all" "$cpuexts_external" "#" "HAVE" "_EXTERNAL")
9269$(ff_config_enable "$cpuexts_all" "$cpuexts_inline" "#" "HAVE" "_INLINE")
9270
9271
9272/* Blu-ray/DVD/VCD/CD */
9273#define DEFAULT_CDROM_DEVICE "$default_cdrom_device"
9274#define DEFAULT_DVD_DEVICE   "$default_dvd_device"
9275$def_bluray
9276$def_cddb
9277$def_cdparanoia
9278$def_dvdnav
9279$def_dvdread
9280$def_libcdio
9281$def_vcd
9282
9283
9284/* codec libraries */
9285$def_faac
9286$def_faad
9287$def_liba52
9288$def_libdca
9289$def_libdv
9290$def_liblzo
9291$def_libmpeg2
9292$def_libmpeg2_internal
9293$def_libilbc
9294$def_libopus
9295$def_mad
9296$def_mp3lame
9297$def_mp3lame_preset
9298$def_mp3lame_preset_medium
9299$def_mpg123
9300$def_musepack
9301$def_speex
9302$def_theora
9303$def_toolame
9304$def_tremor
9305$def_twolame
9306$def_vorbis
9307$def_x264
9308$def_xvid
9309$def_zlib
9310
9311$def_libnut
9312
9313
9314/* binary codecs */
9315$def_qtx
9316$def_qtx_win32
9317$def_real
9318$def_win32_loader
9319$def_win32dll
9320$def_xanim
9321$def_xmms
9322#define BINARY_CODECS_PATH "$_codecsdir"
9323#define XMMS_INPUT_PLUGIN_DIR "$_xmmsplugindir"
9324
9325
9326/* GUI */
9327$def_gui
9328$def_xshape
9329
9330
9331/* Audio output drivers */
9332$def_alsa
9333$def_arts
9334$def_coreaudio
9335$def_dart
9336$def_esd
9337$def_esd_latency
9338$def_jack
9339$def_kai
9340$def_nas
9341$def_openal
9342$def_openal_h
9343$def_ossaudio
9344$def_ossaudio_devdsp
9345$def_ossaudio_devmixer
9346$def_pulse
9347$def_sgiaudio
9348$def_sndio
9349$def_sunaudio
9350$def_win32waveout
9351
9352$def_ladspa
9353$def_libbs2b
9354
9355
9356/* input */
9357$def_apple_ir
9358$def_apple_remote
9359$def_ioctl_bt848_h_name
9360$def_ioctl_meteor_h_name
9361$def_joystick
9362$def_lirc
9363$def_lircc
9364$def_pvr
9365$def_radio
9366$def_radio_bsdbt848
9367$def_radio_capture
9368$def_radio_v4l
9369$def_radio_v4l2
9370$def_tv
9371$def_tv_bsdbt848
9372$def_tv_dshow
9373$def_tv_v4l
9374$def_tv_v4l1
9375$def_tv_v4l2
9376
9377
9378/* font stuff */
9379$def_ass
9380$def_ass_internal
9381$def_bitmap_font
9382$def_enca
9383$def_fontconfig
9384$def_freetype
9385$def_fribidi
9386
9387
9388/* networking */
9389$def_closesocket
9390$def_ftp
9391$def_inet6
9392$def_inet_aton
9393$def_inet_pton
9394$def_live
9395$def_nemesi
9396$def_networking
9397$def_smb
9398$def_vstream
9399
9400
9401/* libvo options */
9402$def_3dfx
9403$def_aa
9404$def_bl
9405$def_caca
9406$def_corevideo
9407$def_dga
9408$def_dga1
9409$def_dga2
9410$def_direct3d
9411$def_directfb
9412$def_directx
9413$def_dvb
9414$def_dvbin
9415$def_dxr2
9416$def_dxr3
9417$def_fbdev
9418$def_ggi
9419$def_ggiwmh
9420$def_gif
9421$def_gif_4
9422$def_gif_tvt_hack
9423$def_gl
9424$def_gl_win32
9425$def_gl_x11
9426$def_gl_egl_android
9427$def_gl_egl_x11
9428$def_gl_sdl
9429$def_gl_osx
9430$def_matrixview
9431$def_jpeg
9432$def_kva
9433$def_md5sum
9434$def_mga
9435$def_mlib
9436$def_mng
9437$def_postproc
9438$def_png
9439$def_pnm
9440$def_quartz
9441$def_s3fb
9442$def_sdl
9443$def_sdl_sdl_h
9444$def_svga
9445$def_tdfxfb
9446$def_tdfxvid
9447$def_tga
9448$def_v4l2
9449$def_vdpau
9450$def_vesa
9451$def_vidix
9452$def_vidix_drv_cyberblade
9453$def_vidix_drv_ivtv
9454$def_vidix_drv_mach64
9455$def_vidix_drv_mga
9456$def_vidix_drv_mga_crtc2
9457$def_vidix_drv_nvidia
9458$def_vidix_drv_pm3
9459$def_vidix_drv_radeon
9460$def_vidix_drv_rage128
9461$def_vidix_drv_s3
9462$def_vidix_drv_sh_veu
9463$def_vidix_drv_sis
9464$def_vidix_drv_unichrome
9465$def_vidix_pfx
9466$def_vm
9467$def_wii
9468$def_x11
9469$def_xdpms
9470$def_xf86keysym
9471$def_xinerama
9472$def_xmga
9473$def_xss
9474$def_xv
9475$def_xvmc
9476$def_xvr100
9477$def_yuv4mpeg
9478$def_zr
9479
9480
9481/* FFmpeg */
9482#define av_restrict restrict
9483
9484$def_ffmpeg
9485$def_ffmpeg_a
9486$def_ffmpeg_so
9487
9488#define CONFIG_DECODERS 1
9489#define CONFIG_ENCODERS 1
9490#define CONFIG_DEMUXERS 1
9491#define CONFIG_MUXERS 1
9492$def_rtpdec
9493
9494/* selectable features */
9495$def_hardcoded_tables
9496$def_libavcodec_mpegaudio_hp
9497$def_network
9498$def_vf_lavfi
9499
9500/* headers */
9501$def_arpa_inet_h
9502$def_direct_h
9503$def_io_h
9504$def_poll_h
9505$def_windows_h
9506$def_emmintrin_h
9507#if ARCH_X86_32
9508#define ATTR_TARGET_SSE2 __attribute__((target("sse2")))
9509#else
9510#define ATTR_TARGET_SSE2
9511#endif
9512
9513/* external libraries */
9514$def_bzlib
9515$def_crystalhd
9516$def_libaom_lavc
9517$def_libdav1d_lavc
9518$def_libgsm
9519$def_libopencore_amrnb
9520$def_libopencore_amrwb
9521$def_libopenjpeg
9522$def_librtmp
9523$def_mp3lame_lavc
9524$def_x264_lavc
9525$def_xvid_lavc
9526
9527/* system features */
9528$def_fast_64bit
9529$def_fast_unaligned
9530$def_gnu_as
9531$def_ibm_asm
9532$def_local_aligned
9533$def_os2threads
9534$def_pic
9535$def_pthreads
9536$def_pthread_cancel
9537$def_socklen_t
9538$def_struct_addrinfo
9539$def_struct_ipv6_mreq
9540$def_struct_sockaddr_in6
9541$def_struct_sockaddr_sa_len
9542$def_struct_sockaddr_storage
9543$def_threads
9544$def_w32threads
9545$def_xform_asm
9546$def_xmm_clobbers
9547$def_yasm
9548
9549/* system functions */
9550$def_aligned_malloc
9551$def_bswap
9552$def_dcbzl
9553$def_vsx
9554$def_atanf
9555$def_atan2f
9556$def_cbrt
9557$def_cbrtf
9558$def_cosf
9559$def_expf
9560$def_exp2
9561$def_exp2f
9562$def_fminf
9563$def_getaddrinfo
9564$def_hypot
9565$def_isfinite
9566$def_isinf
9567$def_isnan
9568$def_ldexpf
9569$def_llrint
9570$def_llrintf
9571$def_log2
9572$def_log2f
9573$def_log10f
9574$def_lrint
9575$def_lrintf
9576$def_mkstemp
9577$def_mmap
9578$def_posix_memalign
9579$def_powf
9580$def_mprotect
9581$def_rint
9582$def_round
9583$def_roundf
9584$def_sinf
9585$def_trunc
9586$def_truncf
9587$def_erf
9588
9589#define HAVE_INCOMPATIBLE_LIBAV_ABI 0
9590#define HAVE_MSVCRT 0
9591#define HAVE_UWP 0
9592#define HAVE_WINRT 0
9593#define HAVE_PRAGMA_DEPRECATED 0
9594#define CONFIG_AUDIO_FLOAT 0
9595#define CONFIG_AVCODEC 1
9596#define CONFIG_AVSERVER 0
9597#define CONFIG_CHROMAPRINT 0
9598#define CONFIG_DXVA2 0
9599#define CONFIG_FASTDIV 0
9600#define CONFIG_FFSERVER 0
9601#define CONFIG_FTRAPV 0
9602$def_gnutls
9603$def_openssl
9604#define CONFIG_GPL 1
9605#define CONFIG_GRAY 0
9606#define CONFIG_LIBMODPLUG 0
9607#define CONFIG_LIBVORBIS 0
9608#define CONFIG_LINUX_PERF 0
9609#define CONFIG_MEMORY_POISONING 0
9610#define CONFIG_POWERPC_PERF 0
9611/* For now prefer speed over avoiding potential invalid reads */
9612#define CONFIG_SAFE_BITSTREAM_READER 0
9613#define CONFIG_SHARED 0
9614#define CONFIG_SMALL 0
9615#define CONFIG_SWSCALE_ALPHA 1
9616#define SWS_MAX_FILTER_SIZE 256
9617#define CONFIG_QSV 0
9618#define CONFIG_VAAPI 0
9619
9620#define HAVE_ALIGNED_STACK 1
9621#define HAVE_AS_ARCH_DIRECTIVE 1
9622#define HAVE_AS_DN_DIRECTIVE 1
9623#define HAVE_AS_FPU_DIRECTIVE 1
9624$def_as_func
9625#define HAVE_AS_OBJECT_ARCH 1
9626#define HAVE_ASM_MOD_Q 1
9627#define HAVE_ATOMICS_GCC 1
9628#define HAVE_COPYSIGN 1
9629#define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1
9630#define HAVE_ATOMICS_NATIVE 1
9631#define HAVE_ATTRIBUTE_PACKED 1
9632#define HAVE_GETHRTIME 0
9633$def_inline_asm
9634#define HAVE_INLINE_ASM_NONLOCAL_LABELS 1
9635#define HAVE_INLINE_ASM_DIRECT_SYMBOL_REFS 1
9636#define HAVE_ISATTY 0
9637#define HAVE_LDBRX 0
9638#define HAVE_LIBC_MSVCRT 0
9639#define HAVE_MACH_ABSOLUTE_TIME 0
9640#define HAVE_MACH_MACH_TIME_H 0
9641#define HAVE_MAPVIEWOFFILE 0
9642#define HAVE_MIPSDSP 0
9643#define HAVE_MIPSDSPR1 0
9644#define HAVE_MIPSFPU 0
9645#define HAVE_MM_EMPTY 0
9646#define HAVE_PPC4XX 0
9647#define HAVE_RDTSC 0
9648#define HAVE_SECTION_DATA_REL_RO 0
9649#define HAVE_SIMD_ALIGN_16 1
9650$def_simd_align_32
9651#define HAVE_SIMD_ALIGN_64 0
9652#define HAVE_STRERROR_R 0
9653#define HAVE_STRPTIME 0
9654$def_struct_pollfd
9655#define HAVE_SYMVER_ASM_LABEL 0
9656#define HAVE_SYMVER_GNU_ASM 0
9657#define HAVE_SYNC_SYNCHRONIZE 1
9658#define HAVE_SYS_SELECT_H 0
9659#define HAVE_VIRTUALALLOC 0
9660
9661/* Some FFmpeg codecs depend on these. Enable them unconditionally for now. */
9662#define CONFIG_AANDCTTABLES 1
9663#define CONFIG_ADTS_HEADER 1
9664#define CONFIG_ATSC_A53 1
9665#define CONFIG_AUDIODSP 1
9666#define CONFIG_AUDIO_FRAME_QUEUE 1
9667#define CONFIG_BLOCKDSP 1
9668#define CONFIG_BSWAPDSP 1
9669#define CONFIG_DCT 1
9670#define CONFIG_DVPROFILE 1
9671#define CONFIG_DWT 1
9672#define CONFIG_ERROR_RESILIENCE 1
9673#define CONFIG_EXIF 1
9674#define CONFIG_FAANDCT 1
9675#define CONFIG_FAANIDCT 1
9676#define CONFIG_FDCTDSP 1
9677#define CONFIG_FLACDSP 1
9678#define CONFIG_FMTCONVERT 1
9679#define CONFIG_FRAME_THREAD_ENCODER 1
9680#define CONFIG_FFT 1
9681#define CONFIG_G722DSP 1
9682#define CONFIG_GOLOMB 1
9683#define CONFIG_H263DSP 1
9684#define CONFIG_H264CHROMA 1
9685#define CONFIG_H264DSP 1
9686#define CONFIG_H264PRED 1
9687#define CONFIG_H264QPEL 1
9688#define CONFIG_HEVCPARSE 1
9689#define CONFIG_HUFFMAN 1
9690#define CONFIG_IDCTDSP 1
9691#define CONFIG_IVIDSP 1
9692#define CONFIG_LPC 1
9693#define CONFIG_LZF 1
9694#define CONFIG_LZO 1
9695#define CONFIG_MDCT 1
9696#define CONFIG_ME_CMP 1
9697#define CONFIG_MPEG_ER 1
9698#define CONFIG_MPEGVIDEO 1
9699#define CONFIG_MSS34DSP 1
9700#define CONFIG_PIXBLOCKDSP 1
9701#define CONFIG_RDFT 1
9702#define CONFIG_RIFFDEC 1
9703#define CONFIG_RIFFENC 1
9704#define CONFIG_RV34DSP 1
9705#define CONFIG_SNAPPY 1
9706#define CONFIG_STARTCODE 1
9707#define CONFIG_TEXTUREDSP 1
9708#define CONFIG_VC1DSP 1
9709#define CONFIG_VIDEODSP 1
9710#define CONFIG_VP56DSP 1
9711#define CONFIG_VP8DSP 1
9712#define CONFIG_WMA_FREQS 1
9713#define CONFIG_WMV2DSP 1
9714
9715/* Use these registers in FFmpeg x86 inline asm. No proper detection yet. */
9716#ifndef MP_DEBUG
9717#define HAVE_EBP_AVAILABLE 1
9718#else
9719#define HAVE_EBP_AVAILABLE 0
9720#endif
9721
9722#define FFMPEG_CONFIGURATION "--enable-gpl --enable-postproc"
9723#define FFMPEG_LICENSE "GPL version 2 or later"
9724
9725#define LIBAV_CONFIGURATION FFMPEG_CONFIGURATION
9726#define LIBAV_LICENSE FFMPEG_LICENSE
9727
9728$(ff_config_enable "$libavdecoders_all"  "$libavdecoders" "#")
9729$(ff_config_enable "$libavencoders_all"  "$libavencoders" "#")
9730$(ff_config_enable "$libavparsers_all"   "$libavparsers" "#")
9731$(ff_config_enable "$libavdemuxers_all"  "$libavdemuxers" "#")
9732$(ff_config_enable "$libavmuxers_all"    "$libavmuxers" "#")
9733$(ff_config_enable "$libavprotocols_all" "$libavprotocols" "#")
9734$(ff_config_enable "$libavbsfs_all"      "$libavbsfs" "#")
9735$(ff_config_enable "$libavcbs_all"       "$libavcbs" "#")
9736$(ff_config_enable "$libavhwaccels_all"  "$libavhwaccels" "#")
9737$(ff_config_enable "$libavfilters_all"   "$libavfilters" "#")
9738
9739#endif /* MPLAYER_CONFIG_H */
9740EOF
9741
9742# Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
9743cmp -s "$TMPH" config.h || mv -f "$TMPH" config.h
9744
9745############################################################################
9746
9747# Create FFmpeg config files only for internal ffmpeg
9748if test "$ffmpeg_a" = yes; then
9749
9750# Create avconfig.h for FFmpeg.
9751cat > "$TMPH" << EOF
9752/* Generated by mpconfigure */
9753#ifndef AVUTIL_AVCONFIG_H
9754#define AVUTIL_AVCONFIG_H
9755$def_av_bigendian
9756$def_av_fast_unaligned
9757#define AV_HAVE_INCOMPATIBLE_LIBAV_ABI 0
9758#endif /* AVUTIL_AVCONFIG_H */
9759EOF
9760
9761# Do not overwrite an unchanged avconfig.h to avoid superfluous rebuilds.
9762cmp -s "$TMPH" ffmpeg/libavutil/avconfig.h || mv -f "$TMPH" ffmpeg/libavutil/avconfig.h
9763
9764
9765if x86; then
9766# Create a skeleton config.asm with just the ARCH_ and *CODER definitions for FFmpeg.
9767> "$TMPS"
9768echo "%define CONFIG_GPL 1" >> "$TMPS"
9769echo "%define HAVE_ALIGNED_STACK 1" >> "$TMPS"
9770echo "$(ff_config_enable "$arch_all" "$arch" "%" "ARCH")" >> "$TMPS"
9771echo "$(ff_config_enable "$subarch_all" "$subarch" "%" "ARCH")" >> "$TMPS"
9772echo "$(ff_config_enable "$cpuexts_all" "$cpuexts_external" "%" "HAVE" "_EXTERNAL")" >> "$TMPS"
9773echo "$(ff_config_enable "$cpuexts_all" "$cpuexts_inline" "%" "HAVE" "_INLINE")" >> "$TMPS"
9774echo "$(ff_config_enable "$yasm_features_all" "$yasm_features" "%" "HAVE")" >> "$TMPS"
9775echo "$(ff_config_enable "$libavdecoders_all"  "$libavdecoders" "%" "CONFIG")" >> "$TMPS"
9776echo "$(ff_config_enable "$libavencoders_all"  "$libavencoders" "%" "CONFIG")" >> "$TMPS"
9777
9778cmp -s "$TMPS" ffmpeg/config.asm || mv -f "$TMPS" ffmpeg/config.asm
9779fi
9780
9781
9782# Create a config.mak for FFmpeg that includes MPlayer's config.mak.
9783cat > ffmpeg/ffbuild/config.mak << EOF
9784ifndef FFMPEG_CONFIG_MAK
9785FFMPEG_CONFIG_MAK = 1
9786include ../config.mak
9787endif # FFMPEG_CONFIG_MAK
9788EOF
9789
9790# TODO: temporary support for older ffmpeg
9791cp ffmpeg/ffbuild/config.mak ffmpeg/config.mak
9792
9793cat > ffmpeg/config.h << EOF
9794#include "../config.h"
9795EOF
9796touch ffmpeg/.config
9797
9798# generate the lists of enabled components for ffmpeg
9799print_enabled_components(){
9800    file=$1
9801    struct_name=$2
9802    name=$3
9803    shift 3
9804    list=$(echo $* | tolower)
9805    echo "static const $struct_name *$name[] = {" > $TMPH
9806    for c in $list; do
9807        printf "    &ff_%s,\n" $c >> $TMPH
9808    done
9809    echo "    NULL };" >> $TMPH
9810    cmp -s $TMPH ffmpeg/$file && return
9811    cp $TMPH ffmpeg/$file
9812}
9813
9814print_enabled_filters(){
9815    file=$1
9816    struct_name=$2
9817    name=$3
9818    shift 3
9819    list=$(echo $* | tolower)
9820    echo "static const $struct_name *$name[] = {" > $TMPH
9821    for c in $list; do
9822        printf "    &ff_%s,\n" $(echo $c | rev | cut -d _ -f 2- | rev) >> $TMPH
9823    done
9824    for c in asrc_abuffer vsrc_buffer asink_abuffer vsink_buffer; do
9825        printf "    &ff_%s,\n" $c >> $TMPH
9826    done
9827    echo "    NULL };" >> $TMPH
9828    cmp -s $TMPH ffmpeg/$file && return
9829    cp $TMPH ffmpeg/$file
9830}
9831
9832print_enabled_components libavcodec/codec_list.c AVCodec codec_list $libavdecoders $libavencoders
9833print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $libavparsers
9834print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $libavbsfs
9835print_enabled_components libavdevice/indev_list.c AVInputFormat indev_list ""
9836print_enabled_components libavdevice/outdev_list.c AVOutputFormat outdev_list ""
9837print_enabled_components libavformat/demuxer_list.c AVInputFormat demuxer_list $libavdemuxers
9838print_enabled_components libavformat/muxer_list.c AVOutputFormat muxer_list $libavmuxers
9839print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $libavprotocols
9840print_enabled_filters libavfilter/filter_list.c AVFilter filter_list $libavfilters
9841
9842fi
9843
9844#############################################################################
9845
9846cat << EOF
9847
9848Config files successfully generated by ./configure $configuration !
9849
9850  Install prefix: $_prefix
9851  Data directory: $_datadir
9852  Config direct.: $_confdir
9853
9854  Byte order: $_byte_order
9855  Optimizing for: $_optimizing
9856
9857  Languages:
9858    Messages/GUI: $language_msg
9859    Manual pages: $language_man
9860    Documentation: $language_doc
9861
9862  Enabled optional drivers:
9863    Input: $inputmodules
9864    Codecs: $codecmodules
9865    Audio output: $aomodules
9866    Video output: $vomodules
9867
9868  Disabled optional drivers:
9869    Input: $noinputmodules
9870    Codecs: $nocodecmodules
9871    Audio output: $noaomodules
9872    Video output: $novomodules
9873
9874'config.h' and 'config.mak' contain your configuration options.
9875Note: If you alter theses files (for instance CFLAGS) MPlayer may no longer
9876      compile *** DO NOT REPORT BUGS if you tweak these files ***
9877
9878'make' will now compile MPlayer and 'make install' will install it.
9879Note: On non-Linux systems you might need to use 'gmake' instead of 'make'.
9880
9881EOF
9882
9883
9884if test "$_mtrr" = yes ; then
9885  echo "Please check MTRR settings at /proc/mtrr (see DOCS/HTML/$language_doc/video.html#mtrr)"
9886  echo
9887fi
9888
9889if ! x86_32; then
9890  cat <<EOF
9891NOTE: Win32 codec DLLs are not supported on your CPU ($host_arch) or your
9892operating system ($system_name). You may encounter a few files that cannot
9893be played due to missing open source video/audio codec support.
9894
9895EOF
9896fi
9897
9898
9899cat <<EOF
9900Check $TMPLOG if you wonder why an autodetection failed (make sure
9901development headers/packages are installed).
9902
9903NOTE: The --enable-* parameters unconditionally force options on, completely
9904skipping autodetection. This behavior is unlike what you may be used to from
9905autoconf-based configure scripts that can decide to override you. This greater
9906level of control comes at a price. You may have to provide the correct compiler
9907and linker flags yourself.
9908If you used one of these options (except --enable-menu and similar ones that
9909turn on internal features) and experience a compilation or linking failure,
9910make sure you have passed the necessary compiler/linker flags to configure.
9911
9912If you suspect a bug, please read DOCS/HTML/$language_doc/bugreports.html.
9913
9914EOF
9915
9916if test "$_runtime_cpudetection" = yes && arm; then
9917  cat << EOF
9918WARNING: --enable-runtime-cpudetection is not fully supported on Arm,
9919it only compiles for your compilers default target instead of the host
9920CPU (-march=native).
9921EOF
9922fi
9923
9924if test "$warn_cflags" = yes; then
9925  cat <<EOF
9926
9927MPlayer compilation will use the CPPFLAGS/CFLAGS/LDFLAGS/YASMFLAGS set by you,
9928but:
9929
9930    *** ***  DO NOT REPORT BUGS IF IT DOES NOT COMPILE/WORK!  *** ***
9931
9932It is strongly recommended to let MPlayer choose the correct *FLAGS!
9933To do so, remove *FLAGS from the environment an re-run configure.
9934You can use --extra-*flags to add custom flags if necessary.
9935
9936EOF
9937fi
9938
9939# Last move:
9940cleanup
9941