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