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