configure 50 KB
Newer Older
Fabrice Bellard's avatar
Fabrice Bellard committed
1
#!/bin/sh
2
#
Fabrice Bellard's avatar
Fabrice Bellard committed
3
# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
4
#
5 6 7 8 9 10 11 12 13 14 15

if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
cat << EOF

Usage: configure [options]
Options: [defaults in brackets after descriptions]

EOF
echo "Standard options:"
echo "  --help                   print this message"
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
16
echo "  --libdir=DIR             install libs in DIR [PREFIX/lib]"
Diego Biurrun's avatar
Diego Biurrun committed
17 18 19 20 21 22 23 24 25 26
echo "  --mandir=DIR             install man page in DIR [PREFIX/man]"
echo "  --enable-mp3lame         enable MP3 encoding via libmp3lame [default=no]"
echo "  --enable-libogg          enable Ogg support via libogg [default=no]"
echo "  --enable-vorbis          enable Vorbis support via libvorbis [default=no]"
echo "  --enable-theora          enable Theora support via libtheora [default=no]"
echo "  --enable-faad            enable FAAD support via libfaad [default=no]"
echo "  --enable-faadbin         build FAAD support with runtime linking [default=no]"
echo "  --enable-faac            enable FAAC support via libfaac [default=no]"
echo "  --enable-libgsm          enable GSM support via libgsm [default=no]"
echo "  --enable-xvid            enable XviD support via xvidcore [default=no]"
27
echo "  --enable-x264            enable H.264 encoding via x264 [default=no]"
Diego Biurrun's avatar
Diego Biurrun committed
28 29
echo "  --enable-mingw32         enable MinGW native/cross Windows compile"
echo "  --enable-a52             enable GPLed A52 support [default=no]"
30
echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
Diego Biurrun's avatar
Diego Biurrun committed
31 32
echo "  --enable-dts             enable GPLed DTS support [default=no]"
echo "  --enable-pp              enable GPLed postprocessing support [default=no]"
33 34 35 36
echo "  --enable-shared-pp       use libpostproc.so [default=no]"
echo "  --enable-shared          build shared libraries [default=no]"
echo "  --enable-amr_nb          enable amr_nb float audio codec"
echo "  --enable-amr_nb-fixed    use fixed point for amr-nb codec"
37
echo "  --enable-amr_wb          enable amr_wb float audio codec"
Diego Biurrun's avatar
Diego Biurrun committed
38
echo "  --enable-amr_if2         enable amr_wb IF2 audio codec"
39
echo "  --enable-sunmlib         use Sun medialib [default=no]"
40
echo "  --enable-pthreads        use pthreads [default=no]"
Diego Biurrun's avatar
Diego Biurrun committed
41 42 43 44
echo "  --enable-dc1394          enable IIDC-1394 grabbing using libdc1394"
echo "                           and libraw1394 [default=no]"
echo "  --enable-gpl             allow use of GPL code, the resulting libav*"
echo "                           and ffmpeg will be under GPL [default=no]"
45 46
echo ""
echo "Advanced options (experts only):"
Diego Biurrun's avatar
Diego Biurrun committed
47 48
echo "  --source-path=PATH       path to source code [$source_path]"
echo "  --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]"
49 50 51 52 53
echo "  --cc=CC                  use C compiler CC [$cc]"
echo "  --make=MAKE              use specified make [$make]"
echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
54
echo "  --build-suffix=SUFFIX    suffix for application specific build []"
55
echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
Diego Biurrun's avatar
Diego Biurrun committed
56 57 58 59 60
echo "  --tune=CPU               tune code for a particular CPU"
echo "                           (may fail or perform badly on other CPUs)"
echo "  --powerpc-perf-enable    enable performance report on PPC"
echo "                           (requires enabling PMC)"
echo "  --disable-mmx            disable MMX usage"
61
echo "  --disable-iwmmxt         disable iwmmxt usage"
62 63 64 65
echo "  --disable-altivec        disable AltiVec usage"
echo "  --disable-audio-oss      disable OSS audio support [default=no]"
echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
echo "  --disable-v4l            disable video4linux grabbing [default=no]"
66
echo "  --disable-bktr           disable bktr video grabbing [default=no]"
67 68 69
echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
echo "  --disable-network        disable network support [default=no]"
echo "  --disable-zlib           disable zlib [default=no]"
70
echo "  --disable-lzo            disable lzo [default=no]"
71 72 73 74 75 76
echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
echo "  --disable-vhook          disable video hooking support"
echo "  --enable-gprof           enable profiling with gprof [$gprof]"
echo "  --disable-debug          disable debugging symbols"
echo "  --disable-opts           disable compiler optimizations"
echo "  --disable-mpegaudio-hp   faster (but less accurate)"
Diego Biurrun's avatar
Diego Biurrun committed
77
echo "                           MPEG audio decoding [default=no]"
78 79 80
echo "  --disable-ffserver       disable ffserver build"
echo "  --disable-ffplay         disable ffplay build"
echo "  --enable-small           optimize for size instead of speed"
81
echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
82
echo "  --disable-strip          disable stripping of executables and shared libraries"
83 84 85 86
echo "  --disable-encoder=NAME   disables encoder NAME"
echo "  --enable-encoder=NAME    enables encoder NAME"
echo "  --disable-decoder=NAME   disables decoder NAME"
echo "  --enable-decoder=NAME    enables decoder NAME"
87
echo "  --disable-encoders       disables all encoders"
88
echo "  --disable-decoders       disables all decoders"
89 90
echo "  --disable-muxers         disables all muxers"
echo "  --disable-demuxers       disables all demuxers"
91
echo ""
Diego Biurrun's avatar
Diego Biurrun committed
92
echo "NOTE: Object files are built at the place where configure is launched."
93 94 95
exit 1
fi

96
# set temporary file name
Zdenek Kabelac's avatar
Zdenek Kabelac committed
97
if test ! -z "$TMPDIR" ; then
98
    TMPDIR1="${TMPDIR}"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
99
elif test ! -z "$TEMPDIR" ; then
100
    TMPDIR1="${TEMPDIR}"
Nick Kurshev's avatar
Nick Kurshev committed
101
else
102
    TMPDIR1="/tmp"
Nick Kurshev's avatar
Nick Kurshev committed
103 104
fi

105 106
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
107
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
108 109 110
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"

Fabrice Bellard's avatar
Fabrice Bellard committed
111 112
# default parameters
prefix="/usr/local"
113
libdir=""
114
mandir=""
Fabrice Bellard's avatar
Fabrice Bellard committed
115
bindir=""
116
cross_prefix=""
Fabrice Bellard's avatar
Fabrice Bellard committed
117 118
cc="gcc"
ar="ar"
Michael Niedermayer's avatar
Michael Niedermayer committed
119
ranlib="ranlib"
120
make="make"
121
strip="strip"
Fabrice Bellard's avatar
Fabrice Bellard committed
122
cpu=`uname -m`
123
tune="generic"
124
powerpc_perf="no"
125
mmx="default"
126
iwmmxt="default"
127
altivec="default"
128
mmi="default"
Fabrice Bellard's avatar
Fabrice Bellard committed
129
case "$cpu" in
130
  i386|i486|i586|i686|i86pc|BePC)
Fabrice Bellard's avatar
Fabrice Bellard committed
131 132
    cpu="x86"
  ;;
133 134 135 136 137 138 139
  x86_64|amd64)
    cpu="x86"
    canon_arch="`cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
    if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
      if [ -z "`echo $CFLAGS | grep -- -m32`"  ]; then
        cpu="x86_64"
      fi
140 141
    fi
  ;;
142 143
  # armv4l is a subset of armv5tel
  armv4l|armv5tel)
144 145
    cpu="armv4l"
  ;;
146 147 148
  alpha)
    cpu="alpha"
  ;;
Alex Beregszaszi's avatar
Alex Beregszaszi committed
149
  "Power Macintosh"|ppc|powerpc)
150 151
    cpu="powerpc"
  ;;
152
  mips|mipsel)
153 154
    cpu="mips"
  ;;
155
  sun4u|sparc64)
156 157
    cpu="sparc64"
  ;;
158 159 160
  sparc)
    cpu="sparc"
  ;;
Alex Beregszaszi's avatar
Alex Beregszaszi committed
161 162 163
  sh4)
    cpu="sh4"
  ;;
164 165 166 167 168 169 170 171 172 173 174 175
  parisc|parisc64)
    cpu="parisc"
  ;;
  s390|s390x)
    cpu="s390"
  ;;
  m68k)
    cpu="m68k"
  ;;
  ia64)
    cpu="ia64"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
176
  *)
177
    cpu="unknown"
Fabrice Bellard's avatar
Fabrice Bellard committed
178 179 180
  ;;
esac
gprof="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
181
v4l="yes"
182
bktr="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
183
audio_oss="yes"
184
audio_beos="no"
185
dv1394="yes"
186
dc1394="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
187
network="yes"
188
zlib="yes"
189
lzo="yes"
190
libgsm="no"
191
mp3lame="no"
192
libogg="no"
193
vorbis="no"
Nilesh Bansal's avatar
Nilesh Bansal committed
194
theora="no"
195 196
faad="no"
faadbin="no"
197
faac="no"
198
xvid="no"
199
x264="no"
200
a52="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
201
a52bin="no"
202
dts="no"
203
pp="no"
204
shared_pp="no"
205
mingw32="no"
206
cygwin="no"
207
os2="no"
208
lshared="no"
209 210
optimize="yes"
debug="yes"
211
dostrip="yes"
212
installstrip="-s"
213
extralibs="-lm"
214
simpleidct="yes"
215
bigendian="no"
216
inttypes="yes"
217
emu_fast_int="no"
218
vhook="default"
219 220
dlfcn="no"
dlopen="no"
221
mpegaudio_hp="yes"
222
SHFLAGS='-shared -Wl,-soname,$@.$(LIBMAJOR)'
223
netserver="no"
224
need_inet_aton="no"
225
ffserver="yes"
226
ffplay="yes"
227
LIBOBJFLAGS=""
228 229
LDFLAGS=-Wl,--warn-common
FFSLDFLAGS=-Wl,-E
230
LDCONFIG="ldconfig"
231 232
LIBPREF="lib"
LIBSUF=".a"
233
LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
234 235
SLIBPREF="lib"
SLIBSUF=".so"
236
SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
237 238
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)$(SLIBSUF).$(LIBVERSION)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)$(SLIBSUF).$(LIBMAJOR)'
Fabrice Bellard's avatar
Fabrice Bellard committed
239
EXESUF=""
240
BUILDSUF=""
241
amr_nb="no"
242
amr_wb="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
243
amr_nb_fixed="no"
244
amr_if2="no"
245
sunmlib="no"
246
pthreads="no"
247
gpl="no"
248
memalignhack="no"
249 250
muxers="yes"
demuxers="yes"
251 252 253 254 255 256 257

# OS specific
targetos=`uname -s`
case $targetos in
BeOS)
prefix="/boot/home/config"
# helps building libavcodec
258
CFLAGS="-DPIC -fomit-frame-pointer"
259
# 3 gcc releases known for BeOS, each with ugly bugs
260
gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
261 262 263 264 265 266 267 268
case "$gcc_version" in
2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
mmx="no"
;;
*20010315*) echo "BeBits gcc"
CFLAGS="$CFLAGS -fno-expensive-optimizations"
;;
esac
269
SHFLAGS=-nostart
Diego Biurrun's avatar
Diego Biurrun committed
270
# disable Linux things
271
audio_oss="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
272
v4l="no"
273
dv1394="no"
Diego Biurrun's avatar
Diego Biurrun committed
274
# enable BeOS things
275
audio_beos="yes"
276 277 278 279 280
# no need for libm, but the inet stuff
# Check for BONE
if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
extralibs="-lbind -lsocket"
else
281
netserver="yes"
282
need_inet_aton="yes"
283
extralibs="-lnet"
284
fi ;;
285 286 287
SunOS)
v4l="no"
audio_oss="no"
288
dv1394="no"
289 290 291 292 293 294
make="gmake"
LDFLAGS=""
FFSLDFLAGS=""
need_inet_aton="yes"
extralibs="$extralibs -lsocket -lnsl"
;;
295 296
NetBSD)
v4l="no"
297
bktr="yes"
298 299 300 301 302
audio_oss="yes"
dv1394="no"
make="gmake"
LDFLAGS="$LDFLAGS -export-dynamic"
case `uname -r` in
303
2.*) extralibs="$extralibs -lossaudio"
304 305 306
;;
esac
;;
307 308
OpenBSD)
v4l="no"
309
bktr="yes"
310 311 312
audio_oss="yes"
dv1394="no"
make="gmake"
313
LIBOBJFLAGS="\$(PIC)"
314
LDFLAGS="$LDFLAGS -export-dynamic -pthread"
315
LDCONFIG="ldconfig -m \$(libdir)"
316 317
extralibs="$extralibs -lossaudio"
;;
318 319
FreeBSD)
v4l="no"
320
bktr="yes"
321
audio_oss="yes"
322
dv1394="no"
323
make="gmake"
324 325
CFLAGS="-pthread"
LDFLAGS="$LDFLAGS -export-dynamic -pthread"
326
;;
327
BSD/OS)
Fabrice Bellard's avatar
Fabrice Bellard committed
328
v4l="no"
329
bktr="yes"
Fabrice Bellard's avatar
Fabrice Bellard committed
330
audio_oss="yes"
331
dv1394="no"
332 333
extralibs="-lpoll -lgnugetopt -lm"
make="gmake"
334 335
strip="strip -d"
installstrip=""
336
;;
337
Darwin)
338
cc="cc"
339 340
v4l="no"
audio_oss="no"
341
dv1394="no"
342
ffserver="no"
343
SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(libdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION)"
344
extralibs=""
345
darwin="yes"
346
strip="strip -x"
347
installstrip=""
348 349
LDFLAGS="-Wl,-dynamic,-search_paths_first"
SLIBSUF=".dylib"
350 351
SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
352
FFSLDFLAGS=-Wl,-bind_at_load
353
;;
354
MINGW32*)
Fabrice Bellard's avatar
Fabrice Bellard committed
355
# Note: the rest of the mingw32 config is done afterwards as mingw32
Diego Biurrun's avatar
Diego Biurrun committed
356
# can be forced on the command line for Linux cross compilation.
357 358
mingw32="yes"
;;
359 360 361
CYGWIN*)
v4l="no"
audio_oss="yes"
362
dv1394="no"
363
vhook="no"
364 365
extralibs=""
cygwin="yes"
366
EXESUF=".exe"
367
;;
368
Linux)
369
LDFLAGS="$LDFLAGS -rdynamic"
370
;;
371 372 373 374 375 376
IRIX*)
ranlib="echo ignoring ranlib"
v4l="no"
audio_oss="no"
make="gmake"
;;
377 378
OS/2)
TMPE=$TMPE".exe"
379
ar="emxomfar -p128"
380 381
ranlib="echo ignoring ranlib"
strip="echo ignoring strip"
382
CFLAGS="-Zomf"
383
LDFLAGS="-Zomf -Zstack 16384 -s"
384
SHFLAGS="-Zdll -Zomf"
385 386 387 388 389
FFSLDFLAGS=""
LIBPREF=""
LIBSUF=".lib"
SLIBPREF=""
SLIBSUF=".dll"
Fabrice Bellard's avatar
Fabrice Bellard committed
390
EXESUF=".exe"
391
extralibs=""
392
pkg_requires=""
393 394
v4l="no"
audio_oss="no"
395
dv1394="no"
396 397
network="no"
ffserver="no"
398
vhook="no"
399
os2="yes"
400

401
;;
402 403
*) ;;
esac
Fabrice Bellard's avatar
Fabrice Bellard committed
404

Diego Biurrun's avatar
Diego Biurrun committed
405
# From MPlayer configure. We need TARGET_OS available
406
# to the Makefile, so it can distinguish between flavors
Diego Biurrun's avatar
Diego Biurrun committed
407
# of AltiVec on PowerPC.
408 409
TARGET_OS=`( uname -s ) 2>&1`
  case "$TARGET_OS" in
Alex Beregszaszi's avatar
Alex Beregszaszi committed
410
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS)
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425
    ;;
  IRIX*)
    TARGET_OS=IRIX
    ;;
  HP-UX*)
    TARGET_OS=HP-UX
    ;;
  [cC][yY][gG][wW][iI][nN]*)
    TARGET_OS=CYGWIN
    ;;
  *)
    TARGET_OS="$TARGET_OS-UNKNOWN"
    ;;
  esac

426
# find source path
427
source_path="`dirname $0`"
428 429 430 431
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
    source_path=`pwd`
    source_path_used="no"
432 433
else
    source_path="`cd \"$source_path\"; pwd`"
Fabrice Bellard's avatar
Fabrice Bellard committed
434 435
fi

436 437 438 439 440
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

441
CODEC_LIST=`grep 'register_avcodec(&[a-z]' $source_path/libavcodec/allcodecs.c  | sed 's/.*&\(.*\)).*/\1/'`
442

Fabrice Bellard's avatar
Fabrice Bellard committed
443 444
for opt do
  case "$opt" in
445
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`; force_prefix=yes
Fabrice Bellard's avatar
Fabrice Bellard committed
446
  ;;
447
  --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`; force_libdir=yes
448
  ;;
449 450
  --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
  ;;
451 452 453 454
  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
  ;;
  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
  ;;
455
  --cc=*) cc=`echo $opt | cut -d '=' -f 2-`
Fabrice Bellard's avatar
Fabrice Bellard committed
456
  ;;
457 458
  --make=*) make=`echo $opt | cut -d '=' -f 2`
  ;;
459
  --extra-cflags=*) CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
460
  ;;
461
  --extra-ldflags=*) LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
462 463 464
  ;;
  --extra-libs=*) extralibs=${opt#--extra-libs=}
  ;;
465 466
  --build-suffix=*) BUILDSUF=${opt#--build-suffix=}
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
467 468
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
  ;;
469 470
  --tune=*) tune=`echo $opt | cut -d '=' -f 2`
  ;;
471 472
  --powerpc-perf-enable) powerpc_perf="yes"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
473 474
  --disable-mmx) mmx="no"
  ;;
475 476
  --disable-iwmmxt) iwmmxt="no"
  ;;
477 478
  --disable-altivec) altivec="no"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
479 480
  --enable-gprof) gprof="yes"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
481 482
  --disable-v4l) v4l="no"
  ;;
483 484
  --disable-bktr) bktr="no"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
485 486
  --disable-audio-oss) audio_oss="no"
  ;;
487
  --disable-audio-beos) audio_beos="no"
488
    extralibs="$extralibs -lbe -lmedia"
489
  ;;
490 491
  --disable-dv1394) dv1394="no"
  ;;
492
  --disable-network) network="no"; ffserver="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
493
  ;;
494 495
  --disable-zlib) zlib="no"
  ;;
496 497
  --disable-lzo) lzo="no"
  ;;
498
  --enable-a52) a52="yes"
499
  ;;
Michael Niedermayer's avatar
Michael Niedermayer committed
500
  --enable-a52bin) a52bin="yes"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
501
  ;;
502 503
  --enable-dts) dts="yes"
    extralibs="$extralibs -ldts"
504
  ;;
505
  --enable-pp) pp="yes"
506
  ;;
507
  --enable-shared-pp) pp="yes"; shared_pp="yes"
508
  ;;
509
  --enable-libgsm) libgsm="yes"
510
    extralibs="$extralibs -lgsm"
511
  ;;
512 513
  --enable-mp3lame) mp3lame="yes"
    extralibs="$extralibs -lmp3lame"
514
  ;;
515
  --enable-libogg) libogg="yes"
516 517
    extralibs="$extralibs -logg"
    pkg_requires="$pkg_requires ogg >= 1.1"
Nilesh Bansal's avatar
Nilesh Bansal committed
518
  ;;
519
  --enable-vorbis) vorbis="yes"
520 521
    extralibs="$extralibs -lvorbis -lvorbisenc"
    pkg_requires="$pkg_requires vorbis vorbisenc"
522
  ;;
Nilesh Bansal's avatar
Nilesh Bansal committed
523
  --enable-theora) theora="yes"
524 525
    extralibs="$extralibs -ltheora"
    pkg_requires="$pkg_requires theora"
Nilesh Bansal's avatar
Nilesh Bansal committed
526
  ;;
Zdenek Kabelac's avatar
Zdenek Kabelac committed
527
  --enable-faad) faad="yes"
528
    extralibs="$extralibs -lfaad"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
529 530 531
  ;;
  --enable-faadbin) faadbin="yes"
  ;;
532 533
  --enable-faac) faac="yes"
    extralibs="$extralibs -lfaac"
534
  ;;
535
  --enable-xvid) xvid="yes"
536
    extralibs="$extralibs -lxvidcore"
537
  ;;
538 539
  --enable-x264) x264="yes"
    extralibs="$extralibs -lx264"
540
  ;;
541
  --enable-dc1394) dc1394="yes"
542 543
    extralibs="$extralibs -ldc1394_control -lraw1394"
    pkg_requires="$pkg_requires libraw1394"
544
  ;;
545 546
  --disable-vhook) vhook="no"
  ;;
547
  --disable-simple_idct) simpleidct="no"
548
  ;;
549 550
  --enable-mingw32) mingw32="yes"
  ;;
551
  --enable-shared) lshared="yes"
Nick Kurshev's avatar
Nick Kurshev committed
552
  ;;
553 554 555 556
  --disable-debug) debug="no"
  ;;
  --disable-opts) optimize="no"
  ;;
557 558
  --disable-mpegaudio-hp) mpegaudio_hp="no"
  ;;
559 560
  --disable-ffserver) ffserver="no"
  ;;
561 562
  --disable-ffplay) ffplay="no"
  ;;
563
  --enable-small) optimize="small"
564
  ;;
565 566
  --enable-amr_nb) amr_nb="yes"
  ;;
Zdenek Kabelac's avatar
Zdenek Kabelac committed
567 568
  --enable-amr_nb-fixed) amr_nb_fixed="yes"
  ;;
569
  --enable-amr_wb) amr_wb="yes"
570
  ;;
571 572
  --enable-amr_if2) amr_if2="yes"
  ;;
573 574
  --enable-sunmlib) sunmlib="yes"
  ;;
575 576
  --enable-pthreads) pthreads="yes"
  ;;
577 578
  --enable-gpl) gpl="yes"
  ;;
579 580
  --enable-memalign-hack) memalignhack="yes"
  ;;
581 582
  --disable-strip) dostrip="no"
  ;;
583
  --enable-encoder=*) CODEC_LIST="$CODEC_LIST ${opt#--enable-encoder=}_encoder"
584
  ;;
585 586 587 588 589
  --enable-decoder=*) CODEC_LIST="$CODEC_LIST ${opt#--enable-decoder=}_decoder"
  ;;
  --disable-encoder=*) CODEC_LIST="`echo $CODEC_LIST | sed -e \"s#${opt#--disable-encoder=}_encoder##\"`"
  ;;
  --disable-decoder=*) CODEC_LIST="`echo $CODEC_LIST | sed -e \"s#${opt#--disable-decoder=}_decoder##\"`"
590 591 592
  ;;
  --disable-encoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*encoder//g'`"
  ;;
593 594
  --disable-decoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*decoder//g'`"
  ;;
595 596 597 598
  --disable-muxers) muxers="no"
  ;;
  --disable-demuxers) demuxers="no"
  ;;
599 600 601 602 603
  *)
  echo "Unknown option \"$opt\"."
  echo "See $0 --help for available options."
  exit 1
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
604 605 606
  esac
done

Nilesh Bansal's avatar
Nilesh Bansal committed
607
if test "$theora" = "yes" ; then
608
    if test "$libogg" = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
609
        echo "libogg must be enabled to enable Theora."
Nilesh Bansal's avatar
Nilesh Bansal committed
610 611 612 613 614 615
        fail="yes"
        theora="no"
    fi
fi

if test "$vorbis" = "yes" ; then
616
    if test "$libogg" = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
617
        echo "libogg must be enabled to enable Vorbis."
Nilesh Bansal's avatar
Nilesh Bansal committed
618 619 620 621 622
        fail="yes"
        vorbis="no"
    fi
fi

623 624
if test "$gpl" != "yes"; then
    if test "$pp" != "no" -o "$shared_pp" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
625
        echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
626 627 628 629
        fail="yes"
    fi

    if test "$a52" != "no" -o "$a52bin" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
630
        echo "liba52 is under GPL and --enable-gpl is not specified."
631 632
        fail="yes"
    fi
633

634
    if test "$xvid" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
635
        echo "libxvidcore is under GPL and --enable-gpl is not specified."
636 637 638
        fail="yes"
    fi

639
    if test "$x264" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
640
        echo "x264 is under GPL and --enable-gpl is not specified."
641 642 643
        fail="yes"
    fi

644
    if test "$dts" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
645
        echo "libdts is under GPL and --enable-gpl is not specified."
646 647
        fail="yes"
    fi
648

649 650 651 652 653
    if test "$faad" != "no" -o "$faadbin" != "no"; then
        cat > $TMPC << EOF
            #include <faad.h>
            int main( void ) { return 0; }
EOF
654

655 656 657 658 659 660 661 662 663
        if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
            cat > $TMPC << EOF
                #include <faad.h>
                #ifndef FAAD2_VERSION
                ok faad1
                #endif
                int main( void ) { return 0; }
EOF
            if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
Diego Biurrun's avatar
Diego Biurrun committed
664
                echo "FAAD2 is under GPL and --enable-gpl is not specified."
665 666 667 668 669
                fail="yes"
            fi
        else
            faad="no"
            faadbin="no"
Diego Biurrun's avatar
Diego Biurrun committed
670
            echo "FAAD test failed."
671 672
        fi
    fi
673

674

Michael Niedermayer's avatar
10l  
Michael Niedermayer committed
675
    if test "$fail" = "yes"; then
676 677 678 679
        exit 1
    fi
fi

Diego Biurrun's avatar
Diego Biurrun committed
680
# compute MMX state
681
if test $mmx = "default"; then
682
    if test $cpu = "x86" -o $cpu = "x86_64"; then
683 684 685 686 687 688
        mmx="yes"
    else
        mmx="no"
    fi
fi

689 690 691
# check iwmmxt support
if test $iwmmxt = "default" -a $cpu = "armv4l"; then
    cat > $TMPC << EOF
692
        int main(void) {
693 694 695 696 697 698 699 700 701 702
        __asm__ __volatile__ ("wunpckelub wr6, wr4");
        }
EOF

    iwmmxt=no
    if ${cross_prefix}${cc} -o $TMPO $TMPC 2> /dev/null ; then
        iwmmxt=yes
    fi
fi

703
#Darwin CC versions
704
needmdynamicnopic="no"
705
if test $targetos = Darwin; then
706
    if test -n "`$cc -v 2>&1 | grep xlc`"; then
707
        CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
708
    else
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726
        gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
        case "$gcc_version" in
            *2.95*)
                CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
                ;;
            *[34].*)
                CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
                if test "$lshared" = no; then
                   needmdynamicnopic="yes"
                fi
                ;;
            *)
                CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
                if test "$lshared" = no; then
                   needmdynamicnopic="yes"
                fi
                ;;
        esac
727 728 729
    fi
fi

730 731 732 733 734 735 736 737 738
# Can only do AltiVec on PowerPC
if test $altivec = "default"; then
    if test $cpu = "powerpc"; then
        altivec="yes"
    else
        altivec="no"
    fi
fi

739 740
# Add processor-specific flags
TUNECPU="generic"
741
POWERPCMODE="32bits"
742 743
if test $tune != "generic"; then
    case $tune in
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791
        601|ppc601|PowerPC601)
            CFLAGS="$CFLAGS -mcpu=601"
            if test $altivec = "yes"; then
                echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
            fi
            TUNECPU=ppc601
        ;;
        603*|ppc603*|PowerPC603*)
            CFLAGS="$CFLAGS -mcpu=603"
            if test $altivec = "yes"; then
                echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
            fi
            TUNECPU=ppc603
        ;;
        604*|ppc604*|PowerPC604*)
            CFLAGS="$CFLAGS -mcpu=604"
            if test $altivec = "yes"; then
                echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
            fi
            TUNECPU=ppc604
        ;;
        G3|g3|75*|ppc75*|PowerPC75*)
            CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
            if test $altivec = "yes"; then
                echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
            fi
            TUNECPU=ppc750
        ;;
        G4|g4|745*|ppc745*|PowerPC745*)
            CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
            if test $altivec = "no"; then
                echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
            fi
            TUNECPU=ppc7450
        ;;
        74*|ppc74*|PowerPC74*)
            CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
            if test $altivec = "no"; then
                echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
            fi
            TUNECPU=ppc7400
        ;;
        G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
            CFLAGS=