configure 45.1 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]"
17 18
echo "  --mandir=DIR             man documentation in DIR [PREFIX/man]"
echo "  --enable-mp3lame         enable mp3 encoding via libmp3lame [default=no]"
19
echo "  --enable-libogg          enable ogg support via libogg [default=no]"
Nilesh Bansal's avatar
Nilesh Bansal committed
20 21
echo "  --enable-vorbis          enable vorbis support via libvorbis [default=no]"
echo "  --enable-theora          enable theora support via libtheora [default=no]"
22 23 24
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]"
25
echo "  --enable-libgsm          enable gsm support via libgsm [default=no]"
26
echo "  --enable-xvid            enable xvid support via xvidcore [default=no]"
27
echo "  --enable-x264            enable H.264 encoding via x264 [default=no]"
28 29 30
echo "  --enable-mingw32         enable mingw32 native/cross windows compile"
echo "  --enable-a52             enable GPL'ed A52 support [default=no]"
echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
31
echo "  --enable-dts             enable GPL'ed DTS support [default=no]"
32 33 34 35 36
echo "  --enable-pp              enable GPL'ed post processing support [default=no]"
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"
38
echo "  --enable-sunmlib         use Sun medialib [default=no]"
39
echo "  --enable-pthreads        use pthreads [default=no]"
40
echo "  --enable-dc1394          enable IIDC-1394 grabbing using libdc1394 and libraw1394 [default=no]"
41
echo "  --enable-gpl             allow use of gpl code, the resulting libav* and ffmpeg will be under gpl [default=no]"
42 43 44 45 46 47 48 49 50
echo ""
echo "Advanced options (experts only):"
echo "  --source-path=PATH       path of source code [$source_path]"
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
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]"
51
echo "  --build-suffix=SUFFIX    suffix for application specific build []"
52 53 54 55
echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
echo "  --tune=PROCESSOR         tune code for a particular CPU (may fails or misperforms on other CPUs)"
echo "  --powerpc-perf-enable    enable performance report on PPC (requires enabling PMC)"
echo "  --disable-mmx            disable mmx usage"
56
echo "  --disable-iwmmxt         disable iwmmxt usage"
57 58 59 60
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]"
61
echo "  --disable-bktr           disable bktr video grabbing [default=no]"
62 63 64 65 66 67 68 69 70 71 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]"
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)"
echo "                           mpegaudio decoding [default=no]"
echo "  --disable-ffserver       disable ffserver build"
echo "  --disable-ffplay         disable ffplay build"
echo "  --enable-small           optimize for size instead of speed"
75
echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
76
echo "  --disable-strip          disable stripping of executables and shared libraries"
Michael Niedermayer's avatar
typo  
Michael Niedermayer committed
77 78
echo "  --enable-codec=codec     enables codec"
echo "  --disable-codec=codec    disables codec"
79
echo "  --disable-encoders       disables all encoders"
80
echo "  --disable-decoders       disables all decoders"
81 82 83 84 85
echo ""
echo "NOTE: The object files are build at the place where configure is launched"
exit 1
fi

86
# set temporary file name
Zdenek Kabelac's avatar
Zdenek Kabelac committed
87
if test ! -z "$TMPDIR" ; then
88
    TMPDIR1="${TMPDIR}"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
89
elif test ! -z "$TEMPDIR" ; then
90
    TMPDIR1="${TEMPDIR}"
Nick Kurshev's avatar
Nick Kurshev committed
91
else
92
    TMPDIR1="/tmp"
Nick Kurshev's avatar
Nick Kurshev committed
93 94
fi

95 96
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
97
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
98 99 100
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"

Fabrice Bellard's avatar
Fabrice Bellard committed
101 102
# default parameters
prefix="/usr/local"
103
libdir=""
104
mandir=""
Fabrice Bellard's avatar
Fabrice Bellard committed
105
bindir=""
106
cross_prefix=""
Fabrice Bellard's avatar
Fabrice Bellard committed
107 108
cc="gcc"
ar="ar"
Michael Niedermayer's avatar
Michael Niedermayer committed
109
ranlib="ranlib"
110
make="make"
111
strip="strip"
Fabrice Bellard's avatar
Fabrice Bellard committed
112
cpu=`uname -m`
113
tune="generic"
114
powerpc_perf="no"
115
mmx="default"
116
iwmmxt="default"
117
altivec="default"
118
mmi="default"
Fabrice Bellard's avatar
Fabrice Bellard committed
119
case "$cpu" in
120
  i386|i486|i586|i686|i86pc|BePC)
Fabrice Bellard's avatar
Fabrice Bellard committed
121 122
    cpu="x86"
  ;;
123 124 125 126 127 128 129
  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
130 131
    fi
  ;;
132 133
  # armv4l is a subset of armv5tel
  armv4l|armv5tel)
134 135
    cpu="armv4l"
  ;;
136 137 138
  alpha)
    cpu="alpha"
  ;;
139
  "Power Macintosh"|ppc)
140 141
    cpu="powerpc"
  ;;
142 143 144
  mips)
    cpu="mips"
  ;;
145
  sun4u|sparc64)
146 147
    cpu="sparc64"
  ;;
148 149 150
  sparc)
    cpu="sparc"
  ;;
Alex Beregszaszi's avatar
Alex Beregszaszi committed
151 152 153
  sh4)
    cpu="sh4"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
154
  *)
155
    cpu="unknown"
Fabrice Bellard's avatar
Fabrice Bellard committed
156 157 158
  ;;
esac
gprof="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
159
v4l="yes"
160
bktr="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
161
audio_oss="yes"
162
audio_beos="no"
163
dv1394="yes"
164
dc1394="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
165
network="yes"
166
zlib="yes"
167
libgsm="no"
168
mp3lame="no"
169
libogg="no"
170
vorbis="no"
Nilesh Bansal's avatar
Nilesh Bansal committed
171
theora="no"
172 173
faad="no"
faadbin="no"
174
faac="no"
175
xvid="no"
176
x264="no"
177
a52="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
178
a52bin="no"
179
dts="no"
180
pp="no"
181
shared_pp="no"
182
mingw32="no"
183
cygwin="no"
184
os2="no"
185
lshared="no"
186 187
optimize="yes"
debug="yes"
188
dostrip="yes"
189
extralibs="-lm"
190
simpleidct="yes"
191
bigendian="no"
192
inttypes="yes"
193
emu_fast_int="no"
194
vhook="default"
195 196
dlfcn="no"
dlopen="no"
197
mpegaudio_hp="yes"
198
SHFLAGS=-shared
199
netserver="no"
200
need_inet_aton="no"
201
ffserver="yes"
202
ffplay="yes"
203
LIBOBJFLAGS=""
204 205
LDFLAGS=-Wl,--warn-common
FFSLDFLAGS=-Wl,-E
206
LDCONFIG="ldconfig"
207 208 209 210
LIBPREF="lib"
LIBSUF=".a"
SLIBPREF="lib"
SLIBSUF=".so"
Fabrice Bellard's avatar
Fabrice Bellard committed
211
EXESUF=""
212
BUILDSUF=""
213
amr_nb="no"
214
amr_wb="no"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
215
amr_nb_fixed="no"
216
amr_if2="no"
217
sunmlib="no"
218
pthreads="no"
219
gpl="no"
220
memalignhack="no"
221 222 223 224 225 226 227

# OS specific
targetos=`uname -s`
case $targetos in
BeOS)
prefix="/boot/home/config"
# helps building libavcodec
228
CFLAGS="-DPIC -fomit-frame-pointer"
229
# 3 gcc releases known for BeOS, each with ugly bugs
230
gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
231 232 233 234 235 236 237 238
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
239 240 241
SHFLAGS=-nostart
# disable linux things
audio_oss="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
242
v4l="no"
243
dv1394="no"
244 245
# enable beos things
audio_beos="yes"
246 247 248 249 250
# 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
251
netserver="yes"
252
need_inet_aton="yes"
253
extralibs="-lnet"
254
fi ;;
255 256 257
SunOS)
v4l="no"
audio_oss="no"
258
dv1394="no"
259 260 261 262 263 264
make="gmake"
LDFLAGS=""
FFSLDFLAGS=""
need_inet_aton="yes"
extralibs="$extralibs -lsocket -lnsl"
;;
265 266
NetBSD)
v4l="no"
267
bktr="yes"
268 269 270 271 272 273 274 275 276
audio_oss="yes"
dv1394="no"
make="gmake"
LDFLAGS="$LDFLAGS -export-dynamic"
case `uname -r` in
2.*) extralibs="-lossaudio"
;;
esac
;;
277 278
OpenBSD)
v4l="no"
279
bktr="yes"
280 281 282
audio_oss="yes"
dv1394="no"
make="gmake"
283
LIBOBJFLAGS="\$(PIC)"
284
LDFLAGS="$LDFLAGS -export-dynamic -pthread"
285
LDCONFIG="ldconfig -m \$(libdir)"
286 287
extralibs="$extralibs -lossaudio"
;;
288 289
FreeBSD)
v4l="no"
290
bktr="yes"
291
audio_oss="yes"
292
dv1394="no"
293
make="gmake"
294 295
CFLAGS="-pthread"
LDFLAGS="$LDFLAGS -export-dynamic -pthread"
296
;;
297
BSD/OS)
Fabrice Bellard's avatar
Fabrice Bellard committed
298
v4l="no"
299
bktr="yes"
Fabrice Bellard's avatar
Fabrice Bellard committed
300
audio_oss="yes"
301
dv1394="no"
302 303 304
extralibs="-lpoll -lgnugetopt -lm"
make="gmake"
;;
305
Darwin)
306
cc="cc"
307 308
v4l="no"
audio_oss="no"
309
dv1394="no"
310
ffserver="no"
311
SHFLAGS="-dynamiclib"
312
extralibs=""
313
darwin="yes"
314
strip="strip -x"
315
LDFLAGS="-Wl,-search_paths_first"
316
FFSLDFLAGS=-Wl,-bind_at_load
317
;;
318
MINGW32*)
Fabrice Bellard's avatar
Fabrice Bellard committed
319 320
# Note: the rest of the mingw32 config is done afterwards as mingw32
# can be forced on command line for linux cross compilation
321 322
mingw32="yes"
;;
323 324 325
CYGWIN*)
v4l="no"
audio_oss="yes"
326
dv1394="no"
327
ffserver="no"
328 329
extralibs=""
cygwin="yes"
330
EXESUF=".exe"
331
;;
332
Linux)
333
LDFLAGS="$LDFLAGS -rdynamic"
334
;;
335 336 337 338 339 340
IRIX*)
ranlib="echo ignoring ranlib"
v4l="no"
audio_oss="no"
make="gmake"
;;
341 342
OS/2)
TMPE=$TMPE".exe"
343
ar="emxomfar -p128"
344 345
ranlib="echo ignoring ranlib"
strip="echo ignoring strip"
346
CFLAGS="-Zomf"
347
LDFLAGS="-Zomf -Zstack 16384 -s"
348
SHFLAGS="-Zdll -Zomf"
349 350 351 352 353
FFSLDFLAGS=""
LIBPREF=""
LIBSUF=".lib"
SLIBPREF=""
SLIBSUF=".dll"
Fabrice Bellard's avatar
Fabrice Bellard committed
354
EXESUF=".exe"
355 356 357
extralibs=""
v4l="no"
audio_oss="no"
358
dv1394="no"
359 360
network="no"
ffserver="no"
361
vhook="no"
362
os2="yes"
363

364
;;
365 366
*) ;;
esac
Fabrice Bellard's avatar
Fabrice Bellard committed
367

368 369 370 371 372
# From mplayer configure. We need TARGET_OS available
# to the Makefile, so it can distinguish between flavors
# of AltiVec on PowerPC
TARGET_OS=`( uname -s ) 2>&1`
  case "$TARGET_OS" in
373
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU|BeOS)
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388
    ;;
  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

389
# find source path
390
source_path="`echo $0 | sed -e 's#/configure##'`"
391 392 393 394
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
    source_path=`pwd`
    source_path_used="no"
395 396
else
    source_path="`cd \"$source_path\"; pwd`"
Fabrice Bellard's avatar
Fabrice Bellard committed
397 398
fi

399 400 401 402 403
FFMPEG_CONFIGURATION=" "
for opt do
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
done

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

Fabrice Bellard's avatar
Fabrice Bellard committed
406 407
for opt do
  case "$opt" in
408
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`; force_prefix=yes
Fabrice Bellard's avatar
Fabrice Bellard committed
409
  ;;
410
  --libdir=*) libdir=`echo $opt | cut -d '=' -f 2`; force_libdir=yes
411
  ;;
412 413
  --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
  ;;
414 415 416 417
  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
  ;;
  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
  ;;
418
  --cc=*) cc=`echo $opt | cut -d '=' -f 2-`
Fabrice Bellard's avatar
Fabrice Bellard committed
419
  ;;
420 421
  --make=*) make=`echo $opt | cut -d '=' -f 2`
  ;;
422
  --extra-cflags=*) CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
423
  ;;
424
  --extra-ldflags=*) LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
425 426 427
  ;;
  --extra-libs=*) extralibs=${opt#--extra-libs=}
  ;;
428 429
  --build-suffix=*) BUILDSUF=${opt#--build-suffix=}
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
430 431
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
  ;;
432 433
  --tune=*) tune=`echo $opt | cut -d '=' -f 2`
  ;;
434 435
  --powerpc-perf-enable) powerpc_perf="yes"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
436 437
  --disable-mmx) mmx="no"
  ;;
438 439
  --disable-iwmmxt) iwmmxt="no"
  ;;
440 441
  --disable-altivec) altivec="no"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
442 443
  --enable-gprof) gprof="yes"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
444 445
  --disable-v4l) v4l="no"
  ;;
446 447
  --disable-bktr) bktr="no"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
448 449
  --disable-audio-oss) audio_oss="no"
  ;;
450 451
  --disable-audio-beos) audio_beos="no"
  ;;
452 453
  --disable-dv1394) dv1394="no"
  ;;
454
  --disable-network) network="no"; ffserver="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
455
  ;;
456 457
  --disable-zlib) zlib="no"
  ;;
458
  --enable-a52) a52="yes"
459
  ;;
Michael Niedermayer's avatar
Michael Niedermayer committed
460
  --enable-a52bin) a52bin="yes"
Zdenek Kabelac's avatar
Zdenek Kabelac committed
461
  ;;
462 463
  --enable-dts) dts="yes" ; extralibs="$extralibs -ldts"
  ;;
464
  --enable-pp) pp="yes"
465 466 467
  ;;
  --enable-shared-pp) shared_pp="yes"
  ;;
468 469
  --enable-libgsm) libgsm="yes"
  ;;
470 471
  --enable-mp3lame) mp3lame="yes"
  ;;
472
  --enable-libogg) libogg="yes"
Nilesh Bansal's avatar
Nilesh Bansal committed
473
  ;;
474 475
  --enable-vorbis) vorbis="yes"
  ;;
Nilesh Bansal's avatar
Nilesh Bansal committed
476 477
  --enable-theora) theora="yes"
  ;;
Zdenek Kabelac's avatar
Zdenek Kabelac committed
478 479 480 481
  --enable-faad) faad="yes"
  ;;
  --enable-faadbin) faadbin="yes"
  ;;
482 483
  --enable-faac) faac="yes"
  ;;
484 485
  --enable-xvid) xvid="yes"
  ;;
486 487
  --enable-x264) x264="yes"; extralibs="$extralibs -lx264"
  ;;
488 489
  --enable-dc1394) dc1394="yes"
  ;;
490 491
  --disable-vhook) vhook="no"
  ;;
492
  --disable-simple_idct) simpleidct="no"
493
  ;;
494 495
  --enable-mingw32) mingw32="yes"
  ;;
496
  --enable-shared) lshared="yes"
Nick Kurshev's avatar
Nick Kurshev committed
497
  ;;
498 499 500 501
  --disable-debug) debug="no"
  ;;
  --disable-opts) optimize="no"
  ;;
502 503
  --disable-mpegaudio-hp) mpegaudio_hp="no"
  ;;
504 505
  --disable-ffserver) ffserver="no"
  ;;
506 507
  --disable-ffplay) ffplay="no"
  ;;
508
  --enable-small) optimize="small"
509
  ;;
510 511
  --enable-amr_nb) amr_nb="yes"
  ;;
Zdenek Kabelac's avatar
Zdenek Kabelac committed
512 513
  --enable-amr_nb-fixed) amr_nb_fixed="yes"
  ;;
514 515
  --enable-amr_wb) amr_wb="yes"
  ;; 
516 517
  --enable-amr_if2) amr_if2="yes"
  ;;
518 519
  --enable-sunmlib) sunmlib="yes"
  ;;
520 521
  --enable-pthreads) pthreads="yes"
  ;;
522 523
  --enable-gpl) gpl="yes"
  ;;
524 525
  --enable-memalign-hack) memalignhack="yes"
  ;;
526 527
  --disable-strip) dostrip="no"
  ;;
528 529 530 531 532 533
  --enable-codec=*) CODEC_LIST="$CODEC_LIST ${opt#--enable-codec=}"
  ;;
  --disable-codec=*) CODEC_LIST="`echo $CODEC_LIST | sed -e \"s#${opt#--disable-codec=}##\"`"
  ;;
  --disable-encoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*encoder//g'`"
  ;;
534 535
  --disable-decoders) CODEC_LIST="`echo $CODEC_LIST | sed 's/[-_a-zA-Z0-9]*decoder//g'`"
  ;;
Fabrice Bellard's avatar
Fabrice Bellard committed
536 537 538
  esac
done

Nilesh Bansal's avatar
Nilesh Bansal committed
539
if test "$theora" = "yes" ; then
540 541
    if test "$libogg" = "no"; then
        echo "libogg must be enabled to enable Theora"     
Nilesh Bansal's avatar
Nilesh Bansal committed
542 543 544 545 546 547
        fail="yes"
        theora="no"
    fi
fi

if test "$vorbis" = "yes" ; then
548 549
    if test "$libogg" = "no"; then
        echo "libogg must be enabled to enable Vorbis"
Nilesh Bansal's avatar
Nilesh Bansal committed
550 551 552 553 554
        fail="yes"
        vorbis="no"
    fi
fi

555 556 557 558 559 560 561 562 563 564
if test "$gpl" != "yes"; then
    if test "$pp" != "no" -o "$shared_pp" != "no"; then
        echo "The Postprocessing code is under GPL and --enable-gpl is not specified"
        fail="yes"
    fi

    if test "$a52" != "no" -o "$a52bin" != "no"; then
        echo "liba52 is under GPL and --enable-gpl is not specified"
        fail="yes"
    fi
565

566 567 568 569 570
    if test "$xvid" != "no"; then
        echo "libxvidcore is under GPL and --enable-gpl is not specified"
        fail="yes"
    fi

571 572 573 574 575
    if test "$x264" != "no"; then
        echo "x264 is under GPL and --enable-gpl is not specified"
        fail="yes"
    fi

576 577 578 579
    if test "$dts" != "no"; then
        echo "libdts is under GPL and --enable-gpl is not specified"
        fail="yes"
    fi
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606
    
    if test "$faad" != "no" -o "$faadbin" != "no"; then
        cat > $TMPC << EOF
            #include <faad.h>
            int main( void ) { return 0; }
EOF
    
        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
                echo "faad2 is under GPL and --enable-gpl is not specified"
                fail="yes"
            fi
        else
            faad="no"
            faadbin="no"
            echo "faad test failed"
        fi
    fi
   

Michael Niedermayer's avatar
10l  
Michael Niedermayer committed
607
    if test "$fail" = "yes"; then
608 609 610 611
        exit 1
    fi
fi

612 613
# compute mmx state
if test $mmx = "default"; then
614
    if test $cpu = "x86" -o $cpu = "x86_64"; then
615 616 617 618 619 620
        mmx="yes"
    else
        mmx="no"
    fi
fi

621 622 623 624 625 626 627 628 629 630 631 632 633 634
# check iwmmxt support
if test $iwmmxt = "default" -a $cpu = "armv4l"; then
    cat > $TMPC << EOF
        int main(void) { 
        __asm__ __volatile__ ("wunpckelub wr6, wr4");
        }
EOF

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

635
#Darwin CC versions
636
needmdynamicnopic="no"
637
if test $targetos = Darwin; then
638
    if test -n "`$cc -v 2>&1 | grep xlc`"; then
639
	CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
640
    else
641
	gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
642 643
	case "$gcc_version" in
	    *2.95*) 
644
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
645
		;;
646
	    *[34].*)
647
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
648 649 650
		if test "$lshared" = no; then
		   needmdynamicnopic="yes"
		fi
651 652
		;;
	    *)
653
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
654 655 656
		if test "$lshared" = no; then
		   needmdynamicnopic="yes"
		fi
657 658 659 660 661
		;;
	esac
    fi
fi

662 663 664 665 666 667 668 669 670
# Can only do AltiVec on PowerPC
if test $altivec = "default"; then
    if test $cpu = "powerpc"; then
        altivec="yes"
    else
        altivec="no"
    fi
fi

671 672
# Add processor-specific flags
TUNECPU="generic"
673
POWERPCMODE="32bits"
674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696
if test $tune != "generic"; then
    case $tune in
	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
	;;
697
	G3|g3|75*|ppc75*|PowerPC75*)
698
	    CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
699 700 701 702 703
	    if test $altivec = "yes"; then
		echo "WARNING: tuning for PPC75x but altivec enabled !";
	    fi
	    TUNECPU=ppc750
	;;
704
	G4|g4|745*|ppc745*|PowerPC745*)
705
	    CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
706 707 708 709 710 711
	    if test $altivec = "no"; then
		echo "WARNING: tuning for PPC745x but altivec disabled !";
	    fi
	    TUNECPU=ppc7450
	;;
	74*|ppc74*|PowerPC74*)
712
	    CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
713 714 715
	    if test $altivec = "no"; then
		echo "WARNING: tuning for PPC74xx but altivec disabled !";
	    fi
716
	    TUNECPU=ppc7400
717
	;;
718
	G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
719
	    CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
720 721 722 723
	    if test $altivec = "no"; then
		echo "WARNING: tuning for PPC970 but altivec disabled !";
	    fi
	    TUNECPU=ppc970
724
            POWERPCMODE="64bits"
725
	;;
726 727 728
	i[3456]86|pentium|pentiumpro|pentium-mmx|pentium[234]|prescott|k6|k6-[23]|athlon|athlon-tbird|athlon-4|athlon-[mx]p|winchip-c6|winchip2|c3|nocona)
	    CFLAGS="$CFLAGS -march=$tune"
	;;
729
	*)
730
	echo "WARNING: unknown CPU \"$tune\", ignored"
731 732 733 734
	;;
    esac
fi

735
# AltiVec flags: The FSF version of GCC differs from the Apple version 
736 737
if test $cpu = "powerpc"; then
    if test $altivec = "yes"; then
738
        if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
739
            CFLAGS="$CFLAGS -faltivec -maltivec"
740 741 742 743 744 745
        else
            CFLAGS="$CFLAGS -maltivec -mabi=altivec"
        fi
    fi
fi

746 747 748 749 750 751 752
# See if we have <altivec.h>
cat > $TMPC << EOF
#include <altivec.h>
int main( void ) { return 0; }
EOF

_altivec_h="no"
753
if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
754 755 756
_altivec_h="yes"
fi

757 758
# See does our compiler support Motorola AltiVec C API
if test $altivec = "yes"; then
759
if test $_altivec_h = "yes"; then
760
cat > $TMPC << EOF
761
#include <altivec.h>
762 763 764 765 766 767
int main(void) {
    vector signed int v1, v2, v3;
    v1 = vec_add(v2,v3);
    return 0;
}
EOF
768 769 770 771 772 773 774 775 776
else
cat > $TMPC << EOF
int main(void) {
    vector signed int v1, v2, v3;
    v1 = vec_add(v2,v3);
    return 0;
}
EOF
fi
777
$cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
778 779
fi

780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796
# Can only do mmi on mips
if test $mmi = "default"; then
    if test $cpu = "mips"; then
        mmi="yes"
    else
        mmi="no"
    fi
fi

# See does our compiler support mmi
if test $mmi = "yes"; then
cat > $TMPC << EOF
int main(void) {
    __asm__ ("lq \$2, 0(\$2)");
    return 0;
}
EOF
797
$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
798 799
fi

800 801
if test "$mingw32" = "yes" ; then
    v4l="no"
802
    bktr="no"
803
    audio_oss="no"
804
    dv1394="no"
805
    dc1394="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
806
    ffserver="no"
807
    network="no"
Fabrice Bellard's avatar
Fabrice Bellard committed
808 809 810
    SLIBPREF=""
    SLIBSUF=".dll"
    EXESUF=".exe"
811 812
    if test "$force_prefix" != yes; then prefix="/c/Program Files/FFmpeg"; fi
    if test "$force_libdir" != yes; then bindir="$prefix"; fi
813 814
fi

815 816
cc="${cross_prefix}${cc}"
ar="${cross_prefix}${ar}"
Michael Niedermayer's avatar
Michael Niedermayer committed
817
ranlib="${cross_prefix}${ranlib}"
818 819
strip="${cross_prefix}${strip}"

Fabrice Bellard's avatar
Fabrice Bellard committed
820 821
if test -z "$cross_prefix" ; then

822 823 824 825 826 827