configure 53.8 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
echo "  --incdir=DIR             install includes in DIR [PREFIX/include/ffmpeg]"
Diego Biurrun's avatar
Diego Biurrun committed
18 19 20 21 22 23 24 25 26 27
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]"
28
echo "  --enable-x264            enable H.264 encoding via x264 [default=no]"
Diego Biurrun's avatar
Diego Biurrun committed
29
echo "  --enable-mingw32         enable MinGW native/cross Windows compile"
Gildas Bazin's avatar
Gildas Bazin committed
30
echo "  --enable-mingwce         enable MinGW native/cross WinCE compile"
Diego Biurrun's avatar
Diego Biurrun committed
31
echo "  --enable-a52             enable GPLed A52 support [default=no]"
32
echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
Diego Biurrun's avatar
Diego Biurrun committed
33 34
echo "  --enable-dts             enable GPLed DTS support [default=no]"
echo "  --enable-pp              enable GPLed postprocessing support [default=no]"
35 36
echo "  --enable-static          build static libraries [default=yes]"
echo "  --disable-static         do not build static libraries [default=no]"
37
echo "  --enable-shared          build shared libraries [default=no]"
38
echo "  --disable-shared         do not build shared libraries [default=yes]"
39 40
echo "  --enable-amr_nb          enable amr_nb float audio codec"
echo "  --enable-amr_nb-fixed    use fixed point for amr-nb codec"
41
echo "  --enable-amr_wb          enable amr_wb float audio codec"
Diego Biurrun's avatar
Diego Biurrun committed
42
echo "  --enable-amr_if2         enable amr_wb IF2 audio codec"
43
echo "  --enable-sunmlib         use Sun medialib [default=no]"
44
echo "  --enable-pthreads        use pthreads [default=no]"
Diego Biurrun's avatar
Diego Biurrun committed
45 46 47 48
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]"
49 50
echo ""
echo "Advanced options (experts only):"
Diego Biurrun's avatar
Diego Biurrun committed
51 52
echo "  --source-path=PATH       path to source code [$source_path]"
echo "  --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]"
53 54 55 56 57
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]"
58
echo "  --build-suffix=SUFFIX    suffix for application specific build []"
59
echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
Diego Biurrun's avatar
Diego Biurrun committed
60 61 62 63 64
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"
65
echo "  --disable-iwmmxt         disable iwmmxt usage"
66 67 68 69
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]"
Luca Abeni's avatar
Luca Abeni committed
70
echo "  --disable-v4l2           disable video4linux2 grabbing [default=no]"
71
echo "  --disable-bktr           disable bktr video grabbing [default=no]"
72 73 74
echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
echo "  --disable-network        disable network support [default=no]"
echo "  --disable-zlib           disable zlib [default=no]"
75
echo "  --disable-lzo            disable lzo [default=no]"
76 77 78 79 80 81
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
82
echo "                           MPEG audio decoding [default=no]"
83
echo "  --disable-protocols      disable I/O protocols support [default=no]"
84 85 86
echo "  --disable-ffserver       disable ffserver build"
echo "  --disable-ffplay         disable ffplay build"
echo "  --enable-small           optimize for size instead of speed"
87
echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
88
echo "  --disable-strip          disable stripping of executables and shared libraries"
89 90 91 92
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"
93
echo "  --disable-encoders       disables all encoders"
94
echo "  --disable-decoders       disables all decoders"
95 96
echo "  --disable-muxers         disables all muxers"
echo "  --disable-demuxers       disables all demuxers"
97
echo ""
Diego Biurrun's avatar
Diego Biurrun committed
98
echo "NOTE: Object files are built at the place where configure is launched."
99 100 101
exit 1
fi

102
# set temporary file name
Zdenek Kabelac's avatar
Zdenek Kabelac committed
103
if test ! -z "$TMPDIR" ; then
104
    TMPDIR1="${TMPDIR}"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
105
elif test ! -z "$TEMPDIR" ; then
106
    TMPDIR1="${TEMPDIR}"
Nick Kurshev's avatar
Nick Kurshev committed
107
else
108
    TMPDIR1="/tmp"
Nick Kurshev's avatar
Nick Kurshev committed
109 110
fi

111 112
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
113
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
114 115 116
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"

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

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

416
;;
417 418
*) ;;
esac
Fabrice Bellard's avatar
Fabrice Bellard committed
419

Diego Biurrun's avatar
Diego Biurrun committed
420
# From MPlayer configure. We need TARGET_OS available
421
# to the Makefile, so it can distinguish between flavors
Diego Biurrun's avatar
Diego Biurrun committed
422
# of AltiVec on PowerPC.
423 424
TARGET_OS=`( uname -s ) 2>&1`
  case "$TARGET_OS" in
Alex Beregszaszi's avatar
Alex Beregszaszi committed
425
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS|MorphOS)
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
    ;;
  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

441
# find source path
442
source_path="`dirname $0`"
443 444 445 446
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
    source_path=`pwd`
    source_path_used="no"
447 448
else
    source_path="`cd \"$source_path\"; pwd`"
Fabrice Bellard's avatar
Fabrice Bellard committed
449 450
fi

451 452 453 454 455
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

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

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

633 634 635 636

# Combine FFLDFLAGS and the LDFLAGS environment variable
LDFLAGS="$FFLDFLAGS $LDFLAGS"

637 638 639 640 641 642 643 644 645 646 647
# we need to build at least one lib type
if test "$lstatic" = "no" && test "$lshared" = "no" ; then
    cat <<EOF
At least one library type must be built.
Specify --enable-static to build the static libraries or --enable-shared to
build the shared libraries as well. To only build the shared libraries specify
--disable-static in addition to --enable-shared.
EOF
    exit 1;
fi

Nilesh Bansal's avatar
Nilesh Bansal committed
648
if test "$theora" = "yes" ; then
649
    if test "$libogg" = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
650
        echo "libogg must be enabled to enable Theora."
Nilesh Bansal's avatar
Nilesh Bansal committed
651 652 653 654 655 656
        fail="yes"
        theora="no"
    fi
fi

if test "$vorbis" = "yes" ; then
657
    if test "$libogg" = "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
658
        echo "libogg must be enabled to enable Vorbis."
Nilesh Bansal's avatar
Nilesh Bansal committed
659 660 661 662 663
        fail="yes"
        vorbis="no"
    fi
fi

664
if test "$gpl" != "yes"; then
665
    if test "$pp" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
666
        echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
667 668 669 670
        fail="yes"
    fi

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

675
    if test "$xvid" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
676
        echo "libxvidcore is under GPL and --enable-gpl is not specified."
677 678 679
        fail="yes"
    fi

680
    if test "$x264" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
681
        echo "x264 is under GPL and --enable-gpl is not specified."
682 683 684
        fail="yes"
    fi

685
    if test "$dts" != "no"; then
Diego Biurrun's avatar
Diego Biurrun committed
686
        echo "libdts is under GPL and --enable-gpl is not specified."
687 688
        fail="yes"
    fi
689

690 691 692 693 694
    if test "$faad" != "no" -o "$faadbin" != "no"; then
        cat > $TMPC << EOF
            #include <faad.h>
            int main( void ) { return 0; }
EOF
695

696 697 698 699 700 701 702 703 704
        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
705
                echo "FAAD2 is under GPL and --enable-gpl is not specified."
706 707 708 709 710
                fail="yes"
            fi
        else
            faad="no"
            faadbin="no"
Diego Biurrun's avatar
Diego Biurrun committed
711
            echo "FAAD test failed."
712 713
        fi
    fi
714

715

Michael Niedermayer's avatar
10l  
Michael Niedermayer committed
716
    if test "$fail" = "yes"; then
717 718 719 720
        exit 1
    fi
fi