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