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