do not call (av_)abort()
[libav.git] / configure
CommitLineData
de6d9b64 1#!/bin/sh
0f3cb305 2#
5cbcf02c 3# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
0f3cb305 4#
cf9d24ad
DC
5
6if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
7cat << EOF
8
9Usage: configure [options]
10Options: [defaults in brackets after descriptions]
11
12EOF
13echo "Standard options:"
14echo " --help print this message"
15echo " --prefix=PREFIX install in PREFIX [$prefix]"
16echo " --mandir=DIR man documentation in DIR [PREFIX/man]"
17echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
18echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
19echo " --enable-faad enable faad support via libfaad [default=no]"
20echo " --enable-faadbin build faad support with runtime linking [default=no]"
21echo " --enable-faac enable faac support via libfaac [default=no]"
1ddadfa9 22echo " --enable-xvid enable xvid support via xvidcore [default=no]"
cf9d24ad
DC
23echo " --enable-mingw32 enable mingw32 native/cross windows compile"
24echo " --enable-a52 enable GPL'ed A52 support [default=no]"
25echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
23c99253 26echo " --enable-dts enable GPL'ed DTS support [default=no]"
cf9d24ad
DC
27echo " --enable-pp enable GPL'ed post processing support [default=no]"
28echo " --enable-shared-pp use libpostproc.so [default=no]"
29echo " --enable-shared build shared libraries [default=no]"
30echo " --enable-amr_nb enable amr_nb float audio codec"
31echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
64cba748 32echo " --enable-amr_wb enable amr_wb float audio codec"
cf9d24ad 33echo " --enable-sunmlib use Sun medialib [default=no]"
9c3d33d6 34echo " --enable-pthreads use pthreads [default=no]"
b2e3c528 35echo " --enable-gpl allow use of gpl code, the resulting libav* and ffmpeg will be under gpl [default=no]"
cf9d24ad
DC
36echo ""
37echo "Advanced options (experts only):"
38echo " --source-path=PATH path of source code [$source_path]"
39echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
40echo " --cc=CC use C compiler CC [$cc]"
41echo " --make=MAKE use specified make [$make]"
42echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
43echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
44echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
45echo " --cpu=CPU force cpu to CPU [$cpu]"
46echo " --tune=PROCESSOR tune code for a particular CPU (may fails or misperforms on other CPUs)"
47echo " --powerpc-perf-enable enable performance report on PPC (requires enabling PMC)"
48echo " --disable-mmx disable mmx usage"
49echo " --disable-altivec disable AltiVec usage"
50echo " --disable-audio-oss disable OSS audio support [default=no]"
51echo " --disable-audio-beos disable BeOS audio support [default=no]"
52echo " --disable-v4l disable video4linux grabbing [default=no]"
53echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
54echo " --disable-network disable network support [default=no]"
55echo " --disable-zlib disable zlib [default=no]"
56echo " --disable-simple_idct disable simple IDCT routines [default=no]"
57echo " --disable-vhook disable video hooking support"
58echo " --enable-gprof enable profiling with gprof [$gprof]"
59echo " --disable-debug disable debugging symbols"
60echo " --disable-opts disable compiler optimizations"
61echo " --disable-mpegaudio-hp faster (but less accurate)"
62echo " mpegaudio decoding [default=no]"
63echo " --disable-ffserver disable ffserver build"
64echo " --disable-ffplay disable ffplay build"
65echo " --disable-risky disables patent encumbered codecs"
66echo " --enable-small optimize for size instead of speed"
da9b170c 67echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers"
cf9d24ad
DC
68echo ""
69echo "NOTE: The object files are build at the place where configure is launched"
70exit 1
71fi
72
0f3cb305 73# set temporary file name
57514323 74if test ! -z "$TMPDIR" ; then
0f3cb305 75 TMPDIR1="${TMPDIR}"
57514323 76elif test ! -z "$TEMPDIR" ; then
0f3cb305 77 TMPDIR1="${TEMPDIR}"
3d204385 78else
0f3cb305 79 TMPDIR1="/tmp"
3d204385
NK
80fi
81
0f3cb305
FB
82TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
83TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
f3ec2d46 84TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
0f3cb305
FB
85TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
86TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
87
de6d9b64
FB
88# default parameters
89prefix="/usr/local"
23a65308 90mandir=""
951bf3e6 91bindir=""
0f3cb305 92cross_prefix=""
de6d9b64
FB
93cc="gcc"
94ar="ar"
be7109c1 95ranlib="ranlib"
4a908fbc 96make="make"
0f3cb305 97strip="strip"
de6d9b64 98cpu=`uname -m`
a4adb608 99tune="generic"
e45a2872 100powerpc_perf="no"
0f3cb305 101mmx="default"
ab6c65f6 102altivec="default"
d46aba26 103mmi="default"
de6d9b64 104case "$cpu" in
ef0bc4c9 105 i386|i486|i586|i686|i86pc|BePC)
de6d9b64 106 cpu="x86"
de6d9b64 107 ;;
93caefc7
AB
108 # armv4l is a subset of armv5tel
109 armv4l|armv5tel)
6ed7422a 110 cpu="armv4l"
6ed7422a 111 ;;
91d1f1a4
NK
112 alpha)
113 cpu="alpha"
91d1f1a4 114 ;;
a43bd1d7 115 "Power Macintosh"|ppc)
90cee0c3
MN
116 cpu="powerpc"
117 ;;
d46aba26
LS
118 mips)
119 cpu="mips"
120 ;;
bb476ff3 121 sun4u|sparc64)
a7beab73
RS
122 cpu="sparc64"
123 ;;
bb476ff3
JM
124 sparc)
125 cpu="sparc"
126 ;;
bdb2e37c
AB
127 sh4)
128 cpu="sh4"
129 ;;
de6d9b64 130 *)
0f3cb305 131 cpu="unknown"
de6d9b64
FB
132 ;;
133esac
134gprof="no"
5cbcf02c
FB
135v4l="yes"
136audio_oss="yes"
dfdfa47c 137audio_beos="no"
8aa3ee32 138dv1394="yes"
5cbcf02c 139network="yes"
0147f198 140zlib="yes"
a6741398 141mp3lame="no"
81e0d0b4 142vorbis="no"
0fc50e58
ZK
143faad="no"
144faadbin="no"
29d48296 145faac="no"
1ddadfa9 146xvid="no"
ba9261e5 147a52="no"
57514323 148a52bin="no"
23c99253 149dts="no"
ba9261e5 150pp="no"
bba9b16c 151shared_pp="no"
732d9245 152mingw32="no"
3f027ca7 153cygwin="no"
f3ec2d46 154os2="no"
83286d2a 155lshared="no"
cddf3f45
GM
156optimize="yes"
157debug="yes"
ef0bc4c9 158extralibs="-lm"
c02dbee1 159simpleidct="yes"
0f3cb305 160bigendian="no"
7f965c1c 161inttypes="yes"
b5c950c4 162emu_fast_int="no"
a8721c09 163vhook="default"
adbc0510
PG
164dlfcn="no"
165dlopen="no"
1eb2212e 166mpegaudio_hp="yes"
e1707f52 167SHFLAGS=-shared
26b35efb 168netserver="no"
4baca069 169need_inet_aton="no"
8154d2e0 170ffserver="yes"
a86b921c 171ffplay="yes"
4baca069
PG
172LDFLAGS=-Wl,--warn-common
173FFSLDFLAGS=-Wl,-E
f3ec2d46
SG
174LIBPREF="lib"
175LIBSUF=".a"
176SLIBPREF="lib"
177SLIBSUF=".so"
951bf3e6 178EXESUF=""
1d0d55da 179risky="yes"
891f64b3 180amr_nb="no"
d663a1fd 181amr_wb="no"
bc634f6f 182amr_nb_fixed="no"
f80f7964 183sunmlib="no"
9c3d33d6 184pthreads="no"
b2e3c528 185gpl="no"
da9b170c 186memalignhack="no"
ef0bc4c9
FR
187
188# OS specific
189targetos=`uname -s`
190case $targetos in
191BeOS)
192prefix="/boot/home/config"
193# helps building libavcodec
cddf3f45 194CFLAGS="-DPIC -fomit-frame-pointer"
31ba0b4d 195# 3 gcc releases known for BeOS, each with ugly bugs
b2924696 196gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
31ba0b4d
FR
197case "$gcc_version" in
1982.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
199mmx="no"
200;;
201*20010315*) echo "BeBits gcc"
202CFLAGS="$CFLAGS -fno-expensive-optimizations"
203;;
204esac
e1707f52
MN
205SHFLAGS=-nostart
206# disable linux things
207audio_oss="no"
5cbcf02c 208v4l="no"
8aa3ee32 209dv1394="no"
dfdfa47c
FR
210# enable beos things
211audio_beos="yes"
ef0bc4c9
FR
212# no need for libm, but the inet stuff
213# Check for BONE
214if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
215extralibs="-lbind -lsocket"
216else
26b35efb 217netserver="yes"
4baca069 218need_inet_aton="yes"
26b35efb 219extralibs="-lnet"
ef0bc4c9 220fi ;;
4baca069
PG
221SunOS)
222v4l="no"
223audio_oss="no"
8aa3ee32 224dv1394="no"
4baca069
PG
225make="gmake"
226LDFLAGS=""
227FFSLDFLAGS=""
228need_inet_aton="yes"
229extralibs="$extralibs -lsocket -lnsl"
230;;
9c938e77
PG
231FreeBSD)
232v4l="no"
233audio_oss="yes"
8aa3ee32 234dv1394="no"
9c938e77 235make="gmake"
12043e1d
SS
236CFLAGS="-pthread"
237LDFLAGS="$LDFLAGS -export-dynamic -pthread"
9c938e77 238;;
4a908fbc 239BSD/OS)
5cbcf02c 240v4l="no"
6063bce7 241audio_oss="yes"
8aa3ee32 242dv1394="no"
4a908fbc
AB
243extralibs="-lpoll -lgnugetopt -lm"
244make="gmake"
245;;
90cee0c3 246Darwin)
a43bd1d7 247cc="cc"
90cee0c3
MN
248v4l="no"
249audio_oss="no"
8aa3ee32 250dv1394="no"
d3b15036 251ffserver="no"
a43bd1d7 252SHFLAGS="-dynamiclib"
90cee0c3 253extralibs=""
a43bd1d7 254darwin="yes"
47930f09 255strip="strip -x"
4850b2d2 256LDFLAGS="-Wl,-d"
4baca069 257FFSLDFLAGS=-Wl,-bind_at_load
90cee0c3 258;;
732d9245 259MINGW32*)
951bf3e6
FB
260# Note: the rest of the mingw32 config is done afterwards as mingw32
261# can be forced on command line for linux cross compilation
732d9245
BE
262mingw32="yes"
263;;
3f027ca7
FB
264CYGWIN*)
265v4l="no"
266audio_oss="yes"
8aa3ee32 267dv1394="no"
3f027ca7
FB
268extralibs=""
269cygwin="yes"
270test -f /usr/include/inttypes.h || \
271test -f /usr/local/include/inttypes.h || \
272echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
24689bce 273 "/usr/local/include/inttypes.h !!!"
3f027ca7 274;;
b55e4ef4 275Linux)
4baca069 276LDFLAGS="$LDFLAGS -rdynamic"
b55e4ef4 277;;
99614dd4
MB
278IRIX*)
279ranlib="echo ignoring ranlib"
280v4l="no"
281audio_oss="no"
282make="gmake"
283;;
f3ec2d46
SG
284OS/2)
285TMPE=$TMPE".exe"
69db4e10
SG
286ar="emxomfar -p64"
287ranlib="echo ignoring ranlib"
288strip="echo ignoring strip"
cddf3f45 289CFLAGS="-Zomf"
69db4e10 290LDFLAGS="-Zomf -Zstack 16384 -s"
f3ec2d46
SG
291SHFLAGS=""
292FFSLDFLAGS=""
293LIBPREF=""
294LIBSUF=".lib"
295SLIBPREF=""
296SLIBSUF=".dll"
951bf3e6 297EXESUF=".exe"
f3ec2d46
SG
298extralibs=""
299v4l="no"
300audio_oss="no"
8aa3ee32 301dv1394="no"
f3ec2d46
SG
302network="no"
303ffserver="no"
304os2="yes"
305;;
ef0bc4c9
FR
306*) ;;
307esac
de6d9b64 308
6852ac95
RD
309# From mplayer configure. We need TARGET_OS available
310# to the Makefile, so it can distinguish between flavors
311# of AltiVec on PowerPC
312TARGET_OS=`( uname -s ) 2>&1`
313 case "$TARGET_OS" in
314 Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
315 ;;
316 IRIX*)
317 TARGET_OS=IRIX
318 ;;
319 HP-UX*)
320 TARGET_OS=HP-UX
321 ;;
322 [cC][yY][gG][wW][iI][nN]*)
323 TARGET_OS=CYGWIN
324 ;;
325 *)
326 TARGET_OS="$TARGET_OS-UNKNOWN"
327 ;;
328 esac
329
0f3cb305
FB
330# find source path
331# XXX: we assume an absolute path is given when launching configure,
332# except in './configure' case.
586bc755 333source_path="`echo $0 | sed -e 's#/configure##'`"
0f3cb305
FB
334source_path_used="yes"
335if test -z "$source_path" -o "$source_path" = "." ; then
336 source_path=`pwd`
337 source_path_used="no"
de6d9b64
FB
338fi
339
340for opt do
341 case "$opt" in
342 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
343 ;;
23a65308
FB
344 --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
345 ;;
0f3cb305
FB
346 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
347 ;;
348 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
349 ;;
de6d9b64
FB
350 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
351 ;;
4a908fbc
AB
352 --make=*) make=`echo $opt | cut -d '=' -f 2`
353 ;;
0f3cb305
FB
354 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
355 ;;
356 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
357 ;;
358 --extra-libs=*) extralibs=${opt#--extra-libs=}
359 ;;
de6d9b64
FB
360 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
361 ;;
a4adb608
MN
362 --tune=*) tune=`echo $opt | cut -d '=' -f 2`
363 ;;
e45a2872
RD
364 --powerpc-perf-enable) powerpc_perf="yes"
365 ;;
de6d9b64
FB
366 --disable-mmx) mmx="no"
367 ;;
ab6c65f6
BF
368 --disable-altivec) altivec="no"
369 ;;
de6d9b64
FB
370 --enable-gprof) gprof="yes"
371 ;;
5cbcf02c
FB
372 --disable-v4l) v4l="no"
373 ;;
374 --disable-audio-oss) audio_oss="no"
375 ;;
dfdfa47c
FR
376 --disable-audio-beos) audio_beos="no"
377 ;;
8aa3ee32
MK
378 --disable-dv1394) dv1394="no"
379 ;;
ffc0ef96 380 --disable-network) network="no"; ffserver="no"
5cbcf02c 381 ;;
0147f198
FR
382 --disable-zlib) zlib="no"
383 ;;
ba9261e5 384 --enable-a52) a52="yes"
6ed7422a 385 ;;
9c938e77 386 --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
57514323 387 ;;
23c99253
MN
388 --enable-dts) dts="yes" ; extralibs="$extralibs -ldts"
389 ;;
ba9261e5 390 --enable-pp) pp="yes"
bba9b16c
MN
391 ;;
392 --enable-shared-pp) shared_pp="yes"
393 ;;
a6741398
J
394 --enable-mp3lame) mp3lame="yes"
395 ;;
81e0d0b4
MH
396 --enable-vorbis) vorbis="yes"
397 ;;
445ad18d
ZK
398 --enable-faad) faad="yes"
399 ;;
400 --enable-faadbin) faadbin="yes"
401 ;;
29d48296
MN
402 --enable-faac) faac="yes"
403 ;;
1ddadfa9
AT
404 --enable-xvid) xvid="yes"
405 ;;
68892110
PG
406 --disable-vhook) vhook="no"
407 ;;
c02dbee1 408 --disable-simple_idct) simpleidct="no"
045ed63f 409 ;;
732d9245
BE
410 --enable-mingw32) mingw32="yes"
411 ;;
83286d2a 412 --enable-shared) lshared="yes"
0319c531 413 ;;
cddf3f45
GM
414 --disable-debug) debug="no"
415 ;;
416 --disable-opts) optimize="no"
417 ;;
1eb2212e
FB
418 --disable-mpegaudio-hp) mpegaudio_hp="no"
419 ;;
8154d2e0
FB
420 --disable-ffserver) ffserver="no"
421 ;;
a86b921c
FB
422 --disable-ffplay) ffplay="no"
423 ;;
1d0d55da
MN
424 --disable-risky) risky="no"
425 ;;
cddf3f45 426 --enable-small) optimize="small"
553a6284 427 ;;
891f64b3 428 --enable-amr_nb) amr_nb="yes"
429 ;;
bc634f6f
ZK
430 --enable-amr_nb-fixed) amr_nb_fixed="yes"
431 ;;
64cba748
MN
432 --enable-amr_wb) amr_wb="yes"
433 ;;
f80f7964
RS
434 --enable-sunmlib) sunmlib="yes"
435 ;;
9c3d33d6
MN
436 --enable-pthreads) pthreads="yes"
437 ;;
b2e3c528
MN
438 --enable-gpl) gpl="yes"
439 ;;
da9b170c
MN
440 --enable-memalign-hack) memalignhack="yes"
441 ;;
de6d9b64
FB
442 esac
443done
444
b2e3c528
MN
445if test "$gpl" != "yes"; then
446 if test "$pp" != "no" -o "$shared_pp" != "no"; then
447 echo "The Postprocessing code is under GPL and --enable-gpl is not specified"
448 fail="yes"
449 fi
450
451 if test "$a52" != "no" -o "$a52bin" != "no"; then
452 echo "liba52 is under GPL and --enable-gpl is not specified"
453 fail="yes"
454 fi
23c99253 455
1ddadfa9
AT
456 if test "$xvid" != "no"; then
457 echo "libxvidcore is under GPL and --enable-gpl is not specified"
458 fail="yes"
459 fi
460
23c99253
MN
461 if test "$dts" != "no"; then
462 echo "libdts is under GPL and --enable-gpl is not specified"
463 fail="yes"
464 fi
b2e3c528
MN
465
466 if test "$faad" != "no" -o "$faadbin" != "no"; then
467 cat > $TMPC << EOF
468 #include <faad.h>
469 int main( void ) { return 0; }
470EOF
471
472 if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
473 cat > $TMPC << EOF
474 #include <faad.h>
475 #ifndef FAAD2_VERSION
476 ok faad1
477 #endif
478 int main( void ) { return 0; }
479EOF
480 if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
481 echo "faad2 is under GPL and --enable-gpl is not specified"
482 fail="yes"
483 fi
484 else
485 faad="no"
486 faadbin="no"
487 echo "faad test failed"
488 fi
489 fi
490
491
a18b5183 492 if test "$fail" = "yes"; then
b2e3c528
MN
493 exit 1
494 fi
495fi
496
0f3cb305
FB
497# compute mmx state
498if test $mmx = "default"; then
499 if test $cpu = "x86"; then
500 mmx="yes"
501 else
502 mmx="no"
503 fi
504fi
505
cf9d24ad 506#Darwin CC versions
75388c74 507needmdynamicnopic="no"
cf9d24ad 508if test $targetos = Darwin; then
b2924696 509 if test -n "`$cc -v 2>&1 | grep xlc`"; then
747a0554 510 CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
cf9d24ad 511 else
b2924696 512 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
cf9d24ad
DC
513 case "$gcc_version" in
514 *2.95*)
747a0554 515 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
cf9d24ad 516 ;;
75388c74 517 *3.*)
747a0554 518 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
75388c74
MN
519 if test "$lshared" = no; then
520 needmdynamicnopic="yes"
521 fi
cf9d24ad
DC
522 ;;
523 *)
747a0554 524 CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
75388c74
MN
525 if test "$lshared" = no; then
526 needmdynamicnopic="yes"
527 fi
cf9d24ad
DC
528 ;;
529 esac
530 fi
531fi
532
ab6c65f6
BF
533# Can only do AltiVec on PowerPC
534if test $altivec = "default"; then
535 if test $cpu = "powerpc"; then
536 altivec="yes"
537 else
538 altivec="no"
539 fi
540fi
541
a4adb608
MN
542# Add processor-specific flags
543TUNECPU="generic"
9007f514 544POWERPCMODE="32bits"
a4adb608
MN
545if test $tune != "generic"; then
546 case $tune in
547 601|ppc601|PowerPC601)
548 CFLAGS="$CFLAGS -mcpu=601"
549 if test $altivec = "yes"; then
550 echo "WARNING: tuning for PPC601 but altivec enabled !";
551 fi
552 TUNECPU=ppc601
553 ;;
554 603*|ppc603*|PowerPC603*)
555 CFLAGS="$CFLAGS -mcpu=603"
556 if test $altivec = "yes"; then
557 echo "WARNING: tuning for PPC603 but altivec enabled !";
558 fi
559 TUNECPU=ppc603
560 ;;
561 604*|ppc604*|PowerPC604*)
562 CFLAGS="$CFLAGS -mcpu=604"
563 if test $altivec = "yes"; then
564 echo "WARNING: tuning for PPC604 but altivec enabled !";
565 fi
566 TUNECPU=ppc604
567 ;;
8d6625b6 568 G3|g3|75*|ppc75*|PowerPC75*)
fe0f2a97 569 CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
a4adb608
MN
570 if test $altivec = "yes"; then
571 echo "WARNING: tuning for PPC75x but altivec enabled !";
572 fi
573 TUNECPU=ppc750
574 ;;
8d6625b6 575 G4|g4|745*|ppc745*|PowerPC745*)
fe0f2a97 576 CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
3efd4952
RD
577 if test $altivec = "no"; then
578 echo "WARNING: tuning for PPC745x but altivec disabled !";
579 fi
580 TUNECPU=ppc7450
581 ;;
582 74*|ppc74*|PowerPC74*)
fe0f2a97 583 CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
a4adb608
MN
584 if test $altivec = "no"; then
585 echo "WARNING: tuning for PPC74xx but altivec disabled !";
586 fi
e45a2872 587 TUNECPU=ppc7400
a4adb608 588 ;;
8d6625b6 589 G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
9007f514 590 CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
a4adb608
MN
591 if test $altivec = "no"; then
592 echo "WARNING: tuning for PPC970 but altivec disabled !";
593 fi
594 TUNECPU=ppc970
9007f514 595 POWERPCMODE="64bits"
a4adb608
MN
596 ;;
597 *)
598 echo "WARNING: unknown CPU "$tune", ignored"
599 ;;
600 esac
601fi
602
cf9d24ad 603# AltiVec flags: The FSF version of GCC differs from the Apple version
b6e52719
MD
604if test $cpu = "powerpc"; then
605 if test $altivec = "yes"; then
b2924696 606 if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
b6e52719
MD
607 CFLAGS="$CFLAGS -faltivec"
608 else
609 CFLAGS="$CFLAGS -maltivec -mabi=altivec"
610 fi
611 fi
612fi
613
a9a07762
MN
614# See if we have <altivec.h>
615cat > $TMPC << EOF
616#include <altivec.h>
617int main( void ) { return 0; }
618EOF
619
620_altivec_h="no"
b6e52719 621if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
a9a07762
MN
622_altivec_h="yes"
623fi
624
ab6c65f6
BF
625# See does our compiler support Motorola AltiVec C API
626if test $altivec = "yes"; then
a9a07762 627if test $_altivec_h = "yes"; then
ab6c65f6 628cat > $TMPC << EOF
a9a07762 629#include <altivec.h>
ab6c65f6
BF
630int main(void) {
631 vector signed int v1, v2, v3;
632 v1 = vec_add(v2,v3);
633 return 0;
634}
635EOF
a9a07762
MN
636else
637cat > $TMPC << EOF
638int main(void) {
639 vector signed int v1, v2, v3;
640 v1 = vec_add(v2,v3);
641 return 0;
642}
643EOF
644fi
b6e52719 645$cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
ab6c65f6
BF
646fi
647
d46aba26
LS
648# Can only do mmi on mips
649if test $mmi = "default"; then
650 if test $cpu = "mips"; then
651 mmi="yes"
652 else
653 mmi="no"
654 fi
655fi
656
657# See does our compiler support mmi
658if test $mmi = "yes"; then
659cat > $TMPC << EOF
660int main(void) {
661 __asm__ ("lq \$2, 0(\$2)");
662 return 0;
663}
664EOF
f3ec2d46 665$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
d46aba26
LS
666fi
667
732d9245 668if test "$mingw32" = "yes" ; then
732d9245
BE
669 v4l="no"
670 audio_oss="no"
8aa3ee32 671 dv1394="no"
951bf3e6 672 ffserver="no"
732d9245 673 network="no"
951bf3e6
FB
674 LIBPREF=""
675 LIBSUF=".lib"
676 SLIBPREF=""
677 SLIBSUF=".dll"
678 EXESUF=".exe"
679 prefix="/c/Program Files/FFmpeg"
680 bindir="$prefix"
732d9245
BE
681fi
682
0f3cb305
FB
683cc="${cross_prefix}${cc}"
684ar="${cross_prefix}${ar}"
be7109c1 685ranlib="${cross_prefix}${ranlib}"
0f3cb305
FB
686strip="${cross_prefix}${strip}"
687
487a54d7
FB
688if test -z "$cross_prefix" ; then
689
3d204385 690# ---
a3999908
MN
691# big/little endian test
692cat > $TMPC << EOF
693#include <inttypes.h>
694int main(int argc, char ** argv){
695 volatile uint32_t i=0x01234567;
696 return (*((uint8_t*)(&i))) == 0x67;
697}
698EOF
699
f3ec2d46
SG
700if $cc -o $TMPE $TMPC 2>/dev/null ; then
701$TMPE && bigendian="yes"
a3999908
MN
702else
703echo big/little test failed
704fi
705
487a54d7
FB
706else
707
708# if cross compiling, cannot launch a program, so make a static guess
709if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
710 bigendian="yes"
711fi
712
713fi
714
a3999908 715# ---
7f965c1c
CF
716# *inttypes.h* test
717cat > $TMPC << EOF
718#include <inttypes.h>
719int main(int argc, char ** argv){
720 return 0;
721}
722EOF
723
724$cc -o $TMPE $TMPC 2>/dev/null || inttypes="no"
725
726# ---
b5c950c4
MN
727# *int_fast* test
728cat > $TMPC << EOF
729#include <inttypes.h>
730int main(int argc, char ** argv){
731 volatile uint_fast64_t i=0x01234567;
732 return 0;
733}
734EOF
735
736$cc -o $TMPE $TMPC 2>/dev/null || emu_fast_int="yes"
737
738# ---
3d204385
NK
739# check availability of some header files
740
741cat > $TMPC << EOF
742#include <malloc.h>
743int main( void ) { return 0; }
744EOF
745
746_memalign=no
747_malloc_h=no
f3ec2d46 748if $cc -o $TMPE $TMPC 2> /dev/null ; then
3d204385
NK
749_malloc_h=yes
750_memalign=yes
751# check for memalign - atmos
752cat > $TMPC << EOF
753#include <malloc.h>
754int main ( void ) {
755char *string = NULL;
756string = memalign(64, sizeof(char));
757return 0;
758}
759EOF
f3ec2d46 760$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
3d204385
NK
761fi
762
8bf5d58f
MN
763if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
764 echo "error, no memalign() but sse enabled, either disable it or use --enable-memalign-hack"
765 exit 1
766fi
767
68892110 768cat > $TMPC << EOF
5e4639e2
GM
769#include <time.h>
770int main( void ) { localtime_r(NULL, NULL); }
771EOF
772
773localtime_r=no
774if $cc -o $TMPE $TMPC 2> /dev/null ; then
775 localtime_r=yes
776fi
777
0147f198
FR
778if test "$zlib" = "yes"; then
779# check for zlib - mmu_man
780cat > $TMPC << EOF
781#include <zlib.h>
782int main ( void ) {
783if (zlibVersion() != ZLIB_VERSION)
784 puts("zlib version differs !!!");
785 return 1;
786return 0;
787}
788EOF
16806499 789$cc $CFLAGS -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
f3ec2d46 790# $TMPE 2> /dev/null > /dev/null || zlib="no"
0147f198
FR
791# XXX: more tests needed - runtime test
792fi
793if test "$zlib" = "yes"; then
794extralibs="$extralibs -lz"
795fi
796
95e2ce4a
MN
797# test for lrintf in math.h
798cat > $TMPC << EOF
799#define _ISOC9X_SOURCE 1
800#include <math.h>
801int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
802EOF
803
804have_lrintf="no"
f3ec2d46 805if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
95e2ce4a 806 have_lrintf="yes"
c2b9685e
MN
807 # allanc@chickenandporn.com: cannot execute cross-compiled
808 # code on the host. Only execute if not cross-compiling.
809 if test -z "$cross_prefix" ; then
810 $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
811 fi
95e2ce4a
MN
812fi
813
c13e1abd
FH
814_restrict=
815for restrict_keyword in restrict __restrict__ __restrict; do
816 echo "void foo(char * $restrict_keyword p);" > $TMPC
817 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
818 _restrict=$restrict_keyword
819 break;
820 fi
821done
822
52b41d7f
FB
823# test gcc version to see if vector builtins can be used
824# currently only used on i386 for MMX builtins
825cat > $TMPC << EOF
826int main(void) {
827#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
828return 0;
829#else
830#error no vector builtins
831#endif
832}
833EOF
834
835builtin_vector=no
836if $cc -o $TMPO $TMPC 2> /dev/null ; then
837 builtin_vector=yes
a8721c09
FB
838fi
839
840# dlopen/dlfcn.h probing
841
842cat > $TMPC << EOF
843#include <dlfcn.h>
844int main( void ) { return (int) dlopen("foo", 0); }
845EOF
846
847ldl=-ldl
848
cf9d24ad 849if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
a8721c09
FB
850dlfcn=yes
851dlopen=yes
852fi
853
cf9d24ad 854if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
a8721c09
FB
855dlfcn=yes
856dlopen=yes
857ldl=""
858fi
859
860cat > $TMPC << EOF
861int main( void ) { return (int) dlopen("foo", 0); }
862EOF
863
cf9d24ad 864if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
a8721c09
FB
865dlopen=yes
866fi
867
cf9d24ad 868if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
a8721c09
FB
869dlopen=yes
870ldl=""
871fi
872
873if test "$vhook" = "default" ; then
874 vhook="$dlopen"
875fi
876
a86b921c
FB
877##########################################
878# imlib probe
879
a8721c09
FB
880cat > $TMPC << EOF
881#include <X11/Xlib.h>
882#include <Imlib2.h>
883int main( void ) { return (int) imlib_load_font("foo"); }
884EOF
885
886imlib2=no
7802d373 887if $cc -o $TMPE $TMPC -lImlib2 -lm > /dev/null 2>&1 ; then
a8721c09 888imlib2=yes
52b41d7f
FB
889fi
890
a86b921c
FB
891##########################################
892# freetype probe
893
04511d53
PG
894cat > $TMPC << EOF
895#include <ft2build.h>
896int main( void ) { return (int) FT_Init_FreeType(0); }
897EOF
898
899freetype2=no
69db4e10 900if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
e2a3cd59 901 if (freetype-config --version) >/dev/null 2>&1 ; then
cf9d24ad 902 if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` > /dev/null 2>&1 ; then
dee076fc 903 freetype2=yes
04511d53 904 fi
dee076fc 905 fi
04511d53
PG
906fi
907
a86b921c
FB
908##########################################
909# SDL probe
910
911cat > $TMPC << EOF
912#include <SDL.h>
31319a8c 913#undef main /* We don't want SDL to override our main() */
a86b921c
FB
914int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
915EOF
916
917sdl_too_old=no
918sdl=no
e2a3cd59 919if (sdl-config --version) >/dev/null 2>&1 ; then
cf9d24ad 920if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` > /dev/null 2>&1 ; then
a86b921c
FB
921_sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
922if test "$_sdlversion" -lt 121 ; then
923sdl_too_old=yes
924else
925sdl=yes
926fi
927fi
c3f6b472 928fi
a86b921c 929
146ea952
NB
930##########################################
931# texi2html probe
932
933texi2html=no
e2a3cd59 934if (texi2html -version) >/dev/null 2>&1; then
146ea952
NB
935texi2html=yes
936fi
937
b2924696 938case "`$cc -v 2>&1 | grep version`" in
cf9d24ad
DC
939 *gcc*)
940 CFLAGS="-Wall $CFLAGS"
941 ;;
942 *)
943 ;;
944esac
945
94a3401e
FB
946if test "$sdl" = "no" ; then
947 ffplay=no
948fi
949
cddf3f45 950if test "$debug" = "yes"; then
7906085f 951 CFLAGS="-g $CFLAGS"
cddf3f45
GM
952fi
953
954if test "$optimize" = "small"; then
98ca7790 955# CFLAGS=${CFLAGS//-O3/-Os}
553a6284
MN
956 CFLAGS="$CFLAGS -Os"
957fi
958
cddf3f45 959if test "$optimize" = "yes"; then
b2924696 960 if test -n "`$cc -v 2>&1 | grep xlc`"; then
cf9d24ad
DC
961 CFLAGS="$CFLAGS -O5"
962 LDFLAGS="$LDFLAGS -O5"
963 else
7906085f 964 CFLAGS="-O3 $CFLAGS"
cf9d24ad 965 fi
cddf3f45
GM
966fi
967
951bf3e6
FB
968if test x"$bindir" = x""; then
969bindir="${prefix}/bin"
970fi
971
23a65308
FB
972if test x"$mandir" = x""; then
973mandir="${prefix}/man"
974fi
975
de6d9b64 976echo "Install prefix $prefix"
0f3cb305 977echo "Source path $source_path"
de6d9b64 978echo "C compiler $cc"
4a908fbc 979echo "make $make"
a4adb608 980echo "CPU $cpu ($tune)"
0f3cb305 981echo "Big Endian $bigendian"
7f965c1c 982echo "inttypes.h $inttypes"
b5c950c4 983echo "broken inttypes.h $emu_fast_int"
e41e8342 984if test $cpu = "x86"; then
de6d9b64 985echo "MMX enabled $mmx"
52b41d7f 986echo "Vector Builtins $builtin_vector"
e41e8342
FB
987fi
988if test $cpu = "mips"; then
d46aba26 989echo "MMI enabled $mmi"
e41e8342
FB
990fi
991if test $cpu = "powerpc"; then
ab6c65f6 992echo "AltiVec enabled $altivec"
e41e8342 993fi
de6d9b64 994echo "gprof enabled $gprof"
0147f198 995echo "zlib enabled $zlib"
a6741398 996echo "mp3lame enabled $mp3lame"
81e0d0b4 997echo "vorbis enabled $vorbis"
445ad18d
ZK
998echo "faad enabled $faad"
999echo "faadbin enabled $faadbin"
29d48296 1000echo "faac enabled $faac"
1ddadfa9 1001echo "xvid enabled $xvid"
5cbcf02c 1002echo "a52 support $a52"
57514323 1003echo "a52 dlopened $a52bin"
23c99253 1004echo "dts support $dts"
bba9b16c 1005echo "pp support $pp"
cddf3f45
GM
1006echo "debug symbols $debug"
1007echo "optimize $optimize"
bba9b16c 1008echo "shared pp $shared_pp"
47930f09 1009echo "Video hooking $vhook"
a86b921c
FB
1010echo "SDL support $sdl"
1011if test $sdl_too_old = "yes"; then
1012echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
1013fi
1d0d55da 1014echo "risky / patent encumbered codecs $risky"
68892110
PG
1015
1016if test "$vhook" = "yes" ; then
47930f09 1017echo "Imlib2 support $imlib2"
04511d53 1018echo "freetype support $freetype2"
68892110 1019fi
f80f7964 1020echo "Sun medialib support" $sunmlib
9c3d33d6 1021echo "pthreads support" $pthreads
bc634f6f
ZK
1022echo "AMR-NB float support" $amr_nb
1023echo "AMR-NB fixed support" $amr_nb_fixed
d663a1fd 1024echo "AMR-WB float support" $amr_wb
b2e3c528
MN
1025if test "$gpl" = "no" ; then
1026echo "License: LGPL"
1027else
1028echo "License: GPL"
1029fi
de6d9b64 1030
980fc7b8 1031echo "Creating config.mak and config.h"
de6d9b64 1032
980fc7b8 1033echo "# Automatically generated by configure - do not modify" > config.mak
045ed63f 1034echo "/* Automatically generated by configure - do not modify */" > $TMPH
de6d9b64 1035
980fc7b8 1036echo "prefix=$prefix" >> config.mak
951bf3e6 1037echo "bindir=$bindir" >> config.mak
23a65308 1038echo "mandir=$mandir" >> config.mak
4a908fbc 1039echo "MAKE=$make" >> config.mak
980fc7b8
FB
1040echo "CC=$cc" >> config.mak
1041echo "AR=$ar" >> config.mak
be7109c1 1042echo "RANLIB=$ranlib" >> config.mak
0f3cb305 1043echo "STRIP=$strip" >> config.mak
75388c74
MN
1044
1045# SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic. Used when building
1046# shared modules on OS/X (vhook/Makefile).
1047SHCFLAGS=$CFLAGS
1048if test "$needmdynamicnopic" = yes; then
1049 CFLAGS="$CFLAGS -mdynamic-no-pic"
1050fi
1051
a9b3f630 1052echo "OPTFLAGS=$CFLAGS" >> config.mak
75388c74 1053echo "SHCFLAGS=$SHCFLAGS">>config.mak
0f3cb305 1054echo "LDFLAGS=$LDFLAGS" >> config.mak
4baca069 1055echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
e1707f52 1056echo "SHFLAGS=$SHFLAGS" >> config.mak
f3ec2d46
SG
1057echo "LIBPREF=$LIBPREF" >> config.mak
1058echo "LIBSUF=$LIBSUF" >> config.mak
1059echo "SLIBPREF=$SLIBPREF" >> config.mak
1060echo "SLIBSUF=$SLIBSUF" >> config.mak
951bf3e6 1061echo "EXESUF=$EXESUF" >> config.mak
6852ac95 1062echo "TARGET_OS=$TARGET_OS" >> config.mak
57514323 1063if test "$cpu" = "x86" ; then
980fc7b8 1064 echo "TARGET_ARCH_X86=yes" >> config.mak
045ed63f 1065 echo "#define ARCH_X86 1" >> $TMPH
0f3cb305 1066elif test "$cpu" = "armv4l" ; then
6ed7422a 1067 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
045ed63f 1068 echo "#define ARCH_ARMV4L 1" >> $TMPH
0f3cb305 1069elif test "$cpu" = "alpha" ; then
91d1f1a4 1070 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
045ed63f 1071 echo "#define ARCH_ALPHA 1" >> $TMPH
35fedfc3
PG
1072elif test "$cpu" = "sparc64" ; then
1073 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
1074 echo "#define ARCH_SPARC64 1" >> $TMPH
bb476ff3
JM
1075 echo "TARGET_ARCH_SPARC=yes" >> config.mak
1076 echo "#define ARCH_SPARC 1" >> $TMPH
1077elif test "$cpu" = "sparc" ; then
1078 echo "TARGET_ARCH_SPARC=yes" >> config.mak
1079 echo "#define ARCH_SPARC 1" >> $TMPH
0f3cb305
FB
1080elif test "$cpu" = "powerpc" ; then
1081 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
1082 echo "#define ARCH_POWERPC 1" >> $TMPH
9007f514
RD
1083 if test $POWERPCMODE = "32bits"; then
1084 echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
1085 else
1086 echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1087 fi
e45a2872
RD
1088 if test "$powerpc_perf" = "yes"; then
1089 echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1090 fi
d46aba26
LS
1091elif test "$cpu" = "mips" ; then
1092 echo "TARGET_ARCH_MIPS=yes" >> config.mak
1093 echo "#define ARCH_MIPS 1" >> $TMPH
bdb2e37c
AB
1094elif test "$cpu" = "sh4" ; then
1095 echo "TARGET_ARCH_SH4=yes" >> config.mak
1096 echo "#define ARCH_SH4 1" >> $TMPH
1097fi
a4adb608 1098echo "#define TUNECPU $TUNECPU" >> $TMPH
0f3cb305
FB
1099if test "$bigendian" = "yes" ; then
1100 echo "WORDS_BIGENDIAN=yes" >> config.mak
1101 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
91d1f1a4 1102fi
d2a9bddd
MN
1103if test "$inttypes" != "yes" ; then
1104 echo "#define EMULATE_INTTYPES 1" >> $TMPH
7f965c1c 1105fi
b5c950c4 1106if test "$emu_fast_int" = "yes" ; then
19d053c5 1107 echo "#define EMULATE_FAST_INT 1" >> $TMPH
b5c950c4 1108fi
57514323 1109if test "$mmx" = "yes" ; then
980fc7b8 1110 echo "TARGET_MMX=yes" >> config.mak
045ed63f 1111 echo "#define HAVE_MMX 1" >> $TMPH
e82c5a8c 1112 echo "#define __CPU__ 586" >> $TMPH
de6d9b64 1113fi
52b41d7f
FB
1114if test "$builtin_vector" = "yes" ; then
1115 echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
1116 echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
1117fi
d46aba26
LS
1118if test "$mmi" = "yes" ; then
1119 echo "TARGET_MMI=yes" >> config.mak
1120 echo "#define HAVE_MMI 1" >> $TMPH
1121fi
ab6c65f6
BF
1122if test "$altivec" = "yes" ; then
1123 echo "TARGET_ALTIVEC=yes" >> config.mak
1124 echo "#define HAVE_ALTIVEC 1" >> $TMPH
db40a39a
MN
1125 echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
1126 echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
a9a07762
MN
1127 if test "$_altivec_h" = "yes" ; then
1128 echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
1129 else
e67e14d5 1130 echo "#undef HAVE_ALTIVEC_H" >> $TMPH
a9a07762 1131 fi
ab6c65f6 1132fi
57514323 1133if test "$gprof" = "yes" ; then
980fc7b8 1134 echo "TARGET_GPROF=yes" >> config.mak
045ed63f 1135 echo "#define HAVE_GPROF 1" >> $TMPH
de6d9b64 1136fi
5e4639e2
GM
1137if test "$localtime_r" = "yes" ; then
1138 echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
5e4639e2 1139fi
68892110
PG
1140if test "$imlib2" = "yes" ; then
1141 echo "HAVE_IMLIB2=yes" >> config.mak
1142fi
04511d53
PG
1143if test "$freetype2" = "yes" ; then
1144 echo "HAVE_FREETYPE2=yes" >> config.mak
1145fi
f80f7964
RS
1146if test "$sunmlib" = "yes" ; then
1147 echo "HAVE_MLIB=yes" >> config.mak
1148 echo "#define HAVE_MLIB 1" >> $TMPH
1149 extralibs="$extralibs -lmlib"
1150fi
9c3d33d6
MN
1151if test "$pthreads" = "yes" ; then
1152 echo "HAVE_PTHREADS=yes" >> config.mak
1153 echo "#define HAVE_PTHREADS 1" >> $TMPH
0abd6916 1154 if test $targetos != FreeBSD; then
12043e1d
SS
1155 extralibs="$extralibs -lpthread"
1156 fi
9c3d33d6 1157fi
a86b921c
FB
1158if test "$sdl" = "yes" ; then
1159 echo "CONFIG_SDL=yes" >> config.mak
1160 echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
1161 echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
1162fi
146ea952
NB
1163if test "$texi2html" = "yes"; then
1164 echo "BUILD_DOC=yes" >> config.mak
1165fi
95e2ce4a
MN
1166if test "$have_lrintf" = "yes" ; then
1167 echo "#define HAVE_LRINTF 1" >> $TMPH
1168fi
68892110
PG
1169if test "$vhook" = "yes" ; then
1170 echo "BUILD_VHOOK=yes" >> config.mak
1171 echo "#define HAVE_VHOOK 1" >> $TMPH
9c938e77 1172 extralibs="$extralibs $ldl"
68892110 1173fi
57514323 1174if test "$lshared" = "yes" ; then
0319c531 1175 echo "BUILD_SHARED=yes" >> config.mak
5cbcf02c 1176 echo "PIC=-fPIC" >> config.mak
0319c531 1177fi
ef0bc4c9 1178echo "EXTRALIBS=$extralibs" >> config.mak
258207b7
FB
1179version=`grep '#define FFMPEG_VERSION ' $source_path/libavcodec/avcodec.h |
1180 cut -d '"' -f 2`
1181echo "VERSION=$version" >>config.mak
d771bcae 1182# if you do not want to use encoders, disable that.
045ed63f 1183echo "#define CONFIG_ENCODERS 1" >> $TMPH
d771bcae
FB
1184echo "CONFIG_ENCODERS=yes" >> config.mak
1185
1186# if you do not want to use decoders, disable that.
045ed63f 1187echo "#define CONFIG_DECODERS 1" >> $TMPH
d771bcae
FB
1188echo "CONFIG_DECODERS=yes" >> config.mak
1189
5cbcf02c
FB
1190# AC3
1191if test "$a52" = "yes" ; then
1192 echo "#define CONFIG_AC3 1" >> $TMPH
1193 echo "CONFIG_AC3=yes" >> config.mak
d771bcae 1194
5cbcf02c
FB
1195 if test "$a52bin" = "yes" ; then
1196 echo "#define CONFIG_A52BIN 1" >> $TMPH
1197 echo "CONFIG_A52BIN=yes" >> config.mak
1198 fi
1199fi
1200
23c99253
MN
1201# DTS
1202if test "$dts" = "yes" ; then
1203 echo "#define CONFIG_DTS 1" >> $TMPH
1204 echo "CONFIG_DTS=yes" >> config.mak
1205fi
1206
bba9b16c
MN
1207# PP
1208if test "$pp" = "yes" ; then
1209 echo "#define CONFIG_PP 1" >> $TMPH
1210 echo "CONFIG_PP=yes" >> config.mak
1211
1212 if test "$shared_pp" = "yes" ; then
1213 echo "#define SHARED_PP 1" >> $TMPH
1214 echo "SHARED_PP=yes" >> config.mak
1215 fi
1216fi
1217
1eb2212e
FB
1218# mpeg audio high precision mode
1219if test "$mpegaudio_hp" = "yes" ; then
1220 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
1221fi
1222
5cbcf02c
FB
1223if test "$v4l" = "yes" ; then
1224 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
1225 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
1226fi
1227
8aa3ee32
MK
1228if test "$dv1394" = "yes" ; then
1229 echo "#define CONFIG_DV1394 1" >> $TMPH
1230 echo "CONFIG_DV1394=yes" >> config.mak
1231fi
1232
adbc0510
PG
1233if test "$dlopen" = "yes" ; then
1234 echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
1235fi
1236
1237if test "$dlfcn" = "yes" ; then
1238 echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
1239fi
1240
5cbcf02c
FB
1241if test "$audio_oss" = "yes" ; then
1242 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1243 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
57514323
ZK
1244fi
1245
dfdfa47c
FR
1246if test "$audio_beos" = "yes" ; then
1247 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1248 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
1249fi
1250
5cbcf02c
FB
1251if test "$network" = "yes" ; then
1252 echo "#define CONFIG_NETWORK 1" >> $TMPH
1253 echo "CONFIG_NETWORK=yes" >> config.mak
6ed7422a 1254fi
daf8e955 1255
0147f198
FR
1256if test "$zlib" = "yes" ; then
1257 echo "#define CONFIG_ZLIB 1" >> $TMPH
1258 echo "CONFIG_ZLIB=yes" >> config.mak
1259fi
1260
57514323 1261if test "$mp3lame" = "yes" ; then
045ed63f 1262 echo "#define CONFIG_MP3LAME 1" >> $TMPH
a6741398
J
1263 echo "CONFIG_MP3LAME=yes" >> config.mak
1264fi
1265
81e0d0b4
MH
1266if test "$vorbis" = "yes" ; then
1267 echo "#define CONFIG_VORBIS 1" >> $TMPH
1268 echo "CONFIG_VORBIS=yes" >> config.mak
1269fi
1270
0fc50e58
ZK
1271if test "$faad" = "yes" ; then
1272 echo "#define CONFIG_FAAD 1" >> $TMPH
1273 echo "CONFIG_FAAD=yes" >> config.mak
1274fi
1275
1276if test "$faadbin" = "yes" ; then
1277 echo "#define CONFIG_FAADBIN 1" >> $TMPH
445ad18d 1278 echo "CONFIG_FAADBIN=yes" >> config.mak
0fc50e58
ZK
1279fi
1280
29d48296
MN
1281if test "$faac" = "yes" ; then
1282 echo "#define CONFIG_FAAC 1" >> $TMPH
1283 echo "CONFIG_FAAC=yes" >> config.mak
1284fi
1285
1ddadfa9
AT
1286if test "$xvid" = "yes" ; then
1287 echo "#define CONFIG_XVID 1" >> $TMPH
1288 echo "CONFIG_XVID=yes" >> config.mak
1289fi
1290
732d9245
BE
1291if test "$mingw32" = "yes" ; then
1292 echo "#define CONFIG_WIN32 1" >> $TMPH
1293 echo "CONFIG_WIN32=yes" >> config.mak
16806499
MN
1294 echo "HAVE_W32THREADS=yes" >> config.mak
1295 echo "#define HAVE_W32THREADS 1" >> $TMPH
7eea5766 1296 echo "#ifndef __MINGW32__" >> $TMPH
732d9245 1297 echo "#define __MINGW32__ 1" >> $TMPH
7eea5766 1298 echo "#endif" >> $TMPH
3f027ca7
FB
1299fi
1300
f3ec2d46
SG
1301if test "$os2" = "yes" ; then
1302 echo "#define CONFIG_OS2 1" >> $TMPH
1303 echo "CONFIG_OS2=yes" >> config.mak
1304fi
1305
6e023978
RS
1306if test "$TARGET_OS" = "SunOS" ; then
1307 echo "#define CONFIG_SUNOS 1" >> $TMPH
1308fi
1309
90cee0c3
MN
1310if test "$darwin" = "yes"; then
1311 echo "#define CONFIG_DARWIN 1" >> $TMPH
1312 echo "CONFIG_DARWIN=yes" >> config.mak
1313fi
1314
57514323 1315if test "$_malloc_h" = "yes" ; then
045ed63f 1316 echo "#define HAVE_MALLOC_H 1" >> $TMPH
3d204385 1317else
045ed63f 1318 echo "#undef HAVE_MALLOC_H" >> $TMPH
3d204385
NK
1319fi
1320
57514323 1321if test "$_memalign" = "yes" ; then
045ed63f
ZK
1322 echo "#define HAVE_MEMALIGN 1" >> $TMPH
1323else
1324 echo "#undef HAVE_MEMALIGN" >> $TMPH
1325fi
1326
da9b170c
MN
1327if test "$memalignhack" = "yes" ; then
1328 echo "#define MEMALIGN_HACK 1" >> $TMPH
1329fi
1330
1331
26b35efb
FR
1332if test "$netserver" = "yes" ; then
1333 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
1334 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
1335fi
1336
4baca069
PG
1337if test "$need_inet_aton" = "yes" ; then
1338 echo "NEED_INET_ATON=yes" >> config.mak
1339fi
1340
57514323 1341if test "$simpleidct" = "yes" ; then
045ed63f
ZK
1342 echo "#define SIMPLE_IDCT 1" >> $TMPH
1343fi
1344
8154d2e0
FB
1345if test "$ffserver" = "yes" ; then
1346 echo "#define CONFIG_FFSERVER 1" >> $TMPH
1347 echo "CONFIG_FFSERVER=yes" >> config.mak
1348fi
1349
a86b921c
FB
1350if test "$ffplay" = "yes" ; then
1351 echo "CONFIG_FFPLAY=yes" >> config.mak
1352fi
1353
1d0d55da
MN
1354if test "$risky" = "yes" ; then
1355 echo "#define CONFIG_RISKY 1" >> $TMPH
1356 echo "CONFIG_RISKY=yes" >> config.mak
1357fi
1358
b2e3c528
MN
1359if test "$gpl" = "yes" ; then
1360 echo "#define CONFIG_GPL 1" >> $TMPH
1361 echo "CONFIG_GPL=yes" >> config.mak
1362fi
1363
c13e1abd
FH
1364echo "#define restrict $_restrict" >> $TMPH
1365
bb801c97
MN
1366if test "$optimize" = "small"; then
1367 echo "#define always_inline" >> $TMPH
1368fi
1369
0f3cb305
FB
1370# build tree in object directory if source path is different from current one
1371if test "$source_path_used" = "yes" ; then
a382b927 1372 DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
5f6b58de
MR
1373 libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
1374 FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
0f3cb305
FB
1375 for dir in $DIRS ; do
1376 mkdir -p $dir
1377 done
1378 for f in $FILES ; do
1379 ln -sf $source_path/$f $f
1380 done
1381fi
1382echo "SRC_PATH=$source_path" >> config.mak
1383
d663a1fd
MN
1384if test "$amr_wb" = "yes" ; then
1385 echo "#define AMR_WB 1" >> $TMPH
1386 echo "AMR_WB=yes" >> config.mak
1387 echo
1388 echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
1389 echo "V5.1.0 from "
1390 echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
1391 echo "and extracted the source to libavcodec/amrwb_float"
1392 echo
1393fi
1394
891f64b3 1395if test "$amr_nb" = "yes" ; then
1396 echo "#define AMR_NB 1" >> $TMPH
1397 echo "AMR_NB=yes" >> config.mak
1398 echo
bc634f6f
ZK
1399if test "$amr_nb_fixed" = "yes" ; then
1400 echo "AMR_NB_FIXED=yes" >> config.mak
1401 echo "#define AMR_NB_FIXED 1" >> $TMPH
1402 echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
1403 echo "REL-5 version 5.1.0 from "
891f64b3 1404 echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-510.zip"
1405 echo "and extracted src to libavcodec/amr"
bc634f6f
ZK
1406 echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
1407 echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
1408 echo
1409else
1410 echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
1411 echo "REL-5 V5.1.0 from "
1412 echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-510.zip"
1413 echo "and extracted the source to libavcodec/amr_float"
821e46f4 1414 echo "and if u try this on an alpha, u may need to change Word32 to int in amr/typedef.h"
891f64b3 1415 echo
1416fi
1417
bc634f6f
ZK
1418fi
1419
a7c02e25 1420diff $TMPH config.h >/dev/null 2>&1
045ed63f
ZK
1421if test $? -ne 0 ; then
1422 mv -f $TMPH config.h
3d204385 1423else
045ed63f 1424 echo "config.h is unchanged"
3d204385
NK
1425fi
1426
f3ec2d46 1427rm -f $TMPO $TMPC $TMPE $TMPS $TMPH