configure 22.1 KB
Newer Older
F
Fabrice Bellard 已提交
1
#!/bin/sh
2
#
F
Fabrice Bellard 已提交
3
# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
4 5
#
# set temporary file name
Z
Zdenek Kabelac 已提交
6
if test ! -z "$TMPDIR" ; then
7
    TMPDIR1="${TMPDIR}"
Z
Zdenek Kabelac 已提交
8
elif test ! -z "$TEMPDIR" ; then
9
    TMPDIR1="${TEMPDIR}"
N
Nick Kurshev 已提交
10
else
11
    TMPDIR1="/tmp"
N
Nick Kurshev 已提交
12 13
fi

14 15
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
16
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
17 18 19
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"

F
Fabrice Bellard 已提交
20 21
# default parameters
prefix="/usr/local"
22
cross_prefix=""
F
Fabrice Bellard 已提交
23 24
cc="gcc"
ar="ar"
M
Michael Niedermayer 已提交
25
ranlib="ranlib"
26
make="make"
27
strip="strip"
F
Fabrice Bellard 已提交
28
cpu=`uname -m`
29
mmx="default"
30
altivec="default"
31
mmi="default"
F
Fabrice Bellard 已提交
32
case "$cpu" in
33
  i386|i486|i586|i686|i86pc|BePC)
F
Fabrice Bellard 已提交
34 35
    cpu="x86"
  ;;
36 37 38
  armv4l)
    cpu="armv4l"
  ;;
39 40 41
  alpha)
    cpu="alpha"
  ;;
42
  "Power Macintosh"|ppc)
43 44
    cpu="powerpc"
  ;;
45 46 47
  mips)
    cpu="mips"
  ;;
48 49 50
  sun4u)
    cpu="sparc64"
  ;;
F
Fabrice Bellard 已提交
51
  *)
52
    cpu="unknown"
F
Fabrice Bellard 已提交
53 54 55
  ;;
esac
gprof="no"
F
Fabrice Bellard 已提交
56 57
v4l="yes"
audio_oss="yes"
58
audio_beos="no"
59
dv1394="yes"
F
Fabrice Bellard 已提交
60
network="yes"
61
zlib="yes"
62
mp3lame="no"
63
vorbis="no"
64 65
faad="no"
faadbin="no"
F
Fabrice Bellard 已提交
66
a52="yes"
Z
Zdenek Kabelac 已提交
67
a52bin="no"
68 69
pp="yes"
shared_pp="no"
70
win32="no"
71
mingw32="no"
72
cygwin="no"
73
os2="no"
74
lshared="no"
75
extralibs="-lm"
76
simpleidct="yes"
77
bigendian="no"
78
vhook="default"
79 80
dlfcn="no"
dlopen="no"
81
mpegaudio_hp="yes"
82
SHFLAGS=-shared
83
netserver="no"
84
need_inet_aton="no"
85
ffserver="yes"
86 87
LDFLAGS=-Wl,--warn-common
FFSLDFLAGS=-Wl,-E
88 89 90 91
LIBPREF="lib"
LIBSUF=".a"
SLIBPREF="lib"
SLIBSUF=".so"
M
Michael Niedermayer 已提交
92
risky="yes"
93
small="no"
94 95 96 97 98 99 100

# OS specific
targetos=`uname -s`
case $targetos in
BeOS)
prefix="/boot/home/config"
# helps building libavcodec
101
CFLAGS="-O3 -DPIC -fomit-frame-pointer"
102 103 104 105 106 107 108 109 110 111
# 3 gcc releases known for BeOS, each with ugly bugs
gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
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
112 113 114
SHFLAGS=-nostart
# disable linux things
audio_oss="no"
F
Fabrice Bellard 已提交
115
v4l="no"
116
dv1394="no"
117 118
# enable beos things
audio_beos="yes"
119 120 121 122 123
# 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
124
netserver="yes"
125
need_inet_aton="yes"
126
extralibs="-lnet"
127
fi ;;
128 129 130
SunOS)
v4l="no"
audio_oss="no"
131
dv1394="no"
132 133 134 135 136 137
make="gmake"
LDFLAGS=""
FFSLDFLAGS=""
need_inet_aton="yes"
extralibs="$extralibs -lsocket -lnsl"
;;
138 139 140
FreeBSD)
v4l="no"
audio_oss="yes"
141
dv1394="no"
142
make="gmake"
143
LDFLAGS="$LDFLAGS -export-dynamic"
144
;;
145
BSD/OS)
F
Fabrice Bellard 已提交
146
v4l="no"
F
Fabrice Bellard 已提交
147
audio_oss="yes"
148
dv1394="no"
149 150 151
extralibs="-lpoll -lgnugetopt -lm"
make="gmake"
;;
152
Darwin)
153
cc="cc"
154 155
v4l="no"
audio_oss="no"
156
dv1394="no"
157
SHFLAGS="-dynamiclib"
158
extralibs=""
159
darwin="yes"
160
strip="strip -x"
161
LDFLAGS="-d"
162 163 164 165 166 167 168 169 170 171
FFSLDFLAGS=-Wl,-bind_at_load
gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f4-)"
case "$gcc_version" in
*2.95*) 
CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer"
;;
*) 
CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic"
;;
esac
172
;;
173 174 175
MINGW32*)
v4l="no"
audio_oss="no"
176
dv1394="no"
177 178 179 180
ffserver="no"
network="no"
mingw32="yes"
;;
181 182 183
CYGWIN*)
v4l="no"
audio_oss="yes"
184
dv1394="no"
185 186 187 188 189 190 191
extralibs=""
cygwin="yes"
test -f /usr/include/inttypes.h || \
test -f /usr/local/include/inttypes.h || \
echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
     "/usr/include/inttypes.h !!!"
;;
192
Linux)
193
LDFLAGS="$LDFLAGS -rdynamic"
194
;;
195 196
OS/2)
TMPE=$TMPE".exe"
197 198 199 200 201
ar="emxomfar -p64"
ranlib="echo ignoring ranlib"
strip="echo ignoring strip"
CFLAGS="-Zomf -O3"
LDFLAGS="-Zomf -Zstack 16384 -s"
202 203 204 205 206 207 208 209 210
SHFLAGS=""
FFSLDFLAGS=""
LIBPREF=""
LIBSUF=".lib"
SLIBPREF=""
SLIBSUF=".dll"
extralibs=""
v4l="no"
audio_oss="no"
211
dv1394="no"
212 213 214 215
network="no"
ffserver="no"
os2="yes"
;;
216 217
*) ;;
esac
F
Fabrice Bellard 已提交
218

219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
# 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
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
    ;;
  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

240 241 242
# find source path
# XXX: we assume an absolute path is given when launching configure, 
# except in './configure' case.
243
source_path="`echo $0 | sed -e 's#/configure##'`"
244 245 246 247
source_path_used="yes"
if test -z "$source_path" -o "$source_path" = "." ; then
    source_path=`pwd`
    source_path_used="no"
F
Fabrice Bellard 已提交
248 249 250 251 252 253
fi

for opt do
  case "$opt" in
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
  ;;
254 255 256 257
  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
  ;;
  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
  ;;
F
Fabrice Bellard 已提交
258 259
  --cc=*) cc=`echo $opt | cut -d '=' -f 2`
  ;;
260 261
  --make=*) make=`echo $opt | cut -d '=' -f 2`
  ;;
262 263 264 265 266 267
  --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
  ;;
  --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
  ;;
  --extra-libs=*) extralibs=${opt#--extra-libs=}
  ;;
F
Fabrice Bellard 已提交
268 269 270 271
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
  ;;
  --disable-mmx) mmx="no"
  ;;
272 273
  --disable-altivec) altivec="no"
  ;;
F
Fabrice Bellard 已提交
274 275
  --enable-gprof) gprof="yes"
  ;;
F
Fabrice Bellard 已提交
276 277 278 279
  --disable-v4l) v4l="no"
  ;;
  --disable-audio-oss) audio_oss="no"
  ;;
280 281
  --disable-audio-beos) audio_beos="no"
  ;;
282 283
  --disable-dv1394) dv1394="no"
  ;;
F
Fabrice Bellard 已提交
284 285
  --disable-network) network="no"
  ;;
286 287
  --disable-zlib) zlib="no"
  ;;
F
Fabrice Bellard 已提交
288
  --disable-a52) a52="no"
289
  ;;
290
  --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
Z
Zdenek Kabelac 已提交
291
  ;;
292 293 294 295
  --disable-pp) pp="no"
  ;;
  --enable-shared-pp) shared_pp="yes"
  ;;
296 297
  --enable-mp3lame) mp3lame="yes"
  ;;
298 299
  --enable-vorbis) vorbis="yes"
  ;;
Z
Zdenek Kabelac 已提交
300 301 302 303
  --enable-faad) faad="yes"
  ;;
  --enable-faadbin) faadbin="yes"
  ;;
304 305
  --disable-vhook) vhook="no"
  ;;
306
  --disable-simple_idct) simpleidct="no"
307
  ;;
308 309
  --enable-win32) win32="yes"
  ;;
310 311
  --enable-mingw32) mingw32="yes"
  ;;
312
  --enable-shared) lshared="yes"
N
Nick Kurshev 已提交
313
  ;;
314 315
  --disable-mpegaudio-hp) mpegaudio_hp="no"
  ;;
316 317
  --disable-ffserver) ffserver="no"
  ;;
M
Michael Niedermayer 已提交
318 319
  --disable-risky) risky="no"
  ;;
320 321
  --enable-small) small="yes"
  ;;
F
Fabrice Bellard 已提交
322 323 324
  esac
done

325 326 327 328 329 330 331 332 333
# compute mmx state
if test $mmx = "default"; then
    if test $cpu = "x86"; then
        mmx="yes"
    else
        mmx="no"
    fi
fi

334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
# Can only do AltiVec on PowerPC
if test $altivec = "default"; then
    if test $cpu = "powerpc"; then
        altivec="yes"
    else
        altivec="no"
    fi
fi

# See does our compiler support Motorola AltiVec C API
if test $altivec = "yes"; then
cat > $TMPC << EOF
int main(void) {
    vector signed int v1, v2, v3;
    v1 = vec_add(v2,v3);
    return 0;
}
EOF
352
$cc -o $TMPE $TMPC -faltivec 2> /dev/null || altivec="no"
353 354
fi

355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371
# 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
372
$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
373 374
fi

375 376
# Checking for CFLAGS
if test -z "$CFLAGS"; then
M
-O3  
Michael Niedermayer 已提交
377
    CFLAGS="-O3"
378 379
fi

Z
Zdenek Kabelac 已提交
380
if test "$win32" = "yes" ; then
381
    cross_prefix="i386-mingw32msvc-"
F
Fabrice Bellard 已提交
382 383
    v4l="no"
    audio_oss="no"
384
    dv1394="no"
F
Fabrice Bellard 已提交
385
    network="no"
386 387
fi

388 389 390 391
if test "$mingw32" = "yes" ; then
    cross_prefix=""
    v4l="no"
    audio_oss="no"
392
    dv1394="no"
393 394 395
    network="no"
fi

396 397
cc="${cross_prefix}${cc}"
ar="${cross_prefix}${ar}"
M
Michael Niedermayer 已提交
398
ranlib="${cross_prefix}${ranlib}"
399 400
strip="${cross_prefix}${strip}"

F
Fabrice Bellard 已提交
401 402
if test -z "$cross_prefix" ; then

403 404 405 406 407 408 409 410 411 412
# ---
# big/little endian test
cat > $TMPC << EOF
#include <inttypes.h>
int main(int argc, char ** argv){
	volatile uint32_t i=0x01234567;
	return (*((uint8_t*)(&i))) == 0x67;
}
EOF

413 414
if $cc -o $TMPE $TMPC 2>/dev/null ; then
$TMPE && bigendian="yes"
415 416 417 418
else
echo big/little test failed
fi

F
Fabrice Bellard 已提交
419 420 421 422 423 424 425 426 427
else

# if cross compiling, cannot launch a program, so make a static guess
if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
    bigendian="yes"
fi

fi

N
Nick Kurshev 已提交
428 429 430 431 432 433 434 435 436 437
# ---
# check availability of some header files

cat > $TMPC << EOF
#include <malloc.h>
int main( void ) { return 0; }
EOF

_memalign=no
_malloc_h=no
438
if $cc -o $TMPE $TMPC 2> /dev/null ; then
N
Nick Kurshev 已提交
439 440 441 442 443 444 445 446 447 448 449
_malloc_h=yes
_memalign=yes
# check for memalign - atmos
cat > $TMPC << EOF
#include <malloc.h>
int main ( void ) {
char *string = NULL;
string = memalign(64, sizeof(char));
return 0;
}
EOF
450
$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
N
Nick Kurshev 已提交
451 452
fi

453 454 455 456 457 458 459
cat > $TMPC << EOF
#define _GNU_SOURCE
#include <time.h>
int main( void ) { return *strptime("", "", 0); }
EOF

strptime=no
460
if $cc -o $TMPE $TMPC 2> /dev/null ; then
461 462 463
  strptime=yes
fi

464 465 466 467 468 469 470 471 472 473 474
if test "$zlib" = "yes"; then
# check for zlib - mmu_man
cat > $TMPC << EOF
#include <zlib.h>
int main ( void ) {
if (zlibVersion() != ZLIB_VERSION)
   puts("zlib version differs !!!");
   return 1;
return 0;
}
EOF
475 476
$cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
# $TMPE 2> /dev/null > /dev/null || zlib="no"
477 478 479 480 481 482
# XXX: more tests needed - runtime test
fi
if test "$zlib" = "yes"; then
extralibs="$extralibs -lz"
fi

483 484 485 486 487 488 489 490
# test for lrintf in math.h
cat > $TMPC << EOF
#define _ISOC9X_SOURCE  1
#include <math.h>
int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
EOF

have_lrintf="no"
491
if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
492
  have_lrintf="yes"
493
  $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
494 495
fi

F
Falk Hüffner 已提交
496 497 498 499 500 501 502 503 504
_restrict=
for restrict_keyword in restrict __restrict__ __restrict; do
  echo "void foo(char * $restrict_keyword p);" > $TMPC
  if $cc -c -o $TMPO $TMPC 2> /dev/null; then
    _restrict=$restrict_keyword
    break;
  fi
done

505 506 507 508 509 510 511 512 513 514 515 516 517 518 519
# test gcc version to see if vector builtins can be used
# currently only used on i386 for MMX builtins
cat > $TMPC << EOF
int main(void) { 
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
return 0;
#else
#error no vector builtins
#endif
}
EOF

builtin_vector=no
if $cc -o $TMPO $TMPC 2> /dev/null ; then
  builtin_vector=yes
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
fi

# dlopen/dlfcn.h probing

cat > $TMPC << EOF
#include <dlfcn.h>
int main( void ) { return (int) dlopen("foo", 0); }
EOF

ldl=-ldl

if $cc -o $TMPE $TMPC -ldl 2> /dev/null  ; then
dlfcn=yes
dlopen=yes
fi

if $cc -o $TMPE $TMPC 2> /dev/null  ; then
dlfcn=yes
dlopen=yes
ldl=""
fi

cat > $TMPC << EOF
int main( void ) { return (int) dlopen("foo", 0); }
EOF

if $cc -o $TMPE $TMPC -ldl 2> /dev/null  ; then
dlopen=yes
fi

if $cc -o $TMPE $TMPC 2> /dev/null  ; then
dlopen=yes
ldl=""
fi

if test "$vhook" = "default" ; then
  vhook="$dlopen"
fi

cat > $TMPC << EOF
#include <X11/Xlib.h>
#include <Imlib2.h>
int main( void ) { return (int) imlib_load_font("foo"); }
EOF

imlib2=no
if $cc -o $TMPE $TMPC -lImlib2 2> /dev/null  ; then
imlib2=yes
568 569
fi

570 571 572 573 574 575
cat > $TMPC << EOF
#include <ft2build.h>
int main( void ) { return (int) FT_Init_FreeType(0); }
EOF

freetype2=no
576
if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
577
  if test "`which freetype-config`" != ""; then
578
    if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs`  2> /dev/null ; then
579
      freetype2=yes
580
    fi
581
  fi
582 583
fi

584
if test "$small" = "yes"; then
585
#  CFLAGS=${CFLAGS//-O3/-Os}
586 587 588
  CFLAGS="$CFLAGS -Os"
fi

F
Fabrice Bellard 已提交
589
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
590 591 592 593 594 595 596 597 598 599
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]"
echo "  --enable-mp3lame         enable mp3 encoding via libmp3lame [default=no]"
600
echo "  --enable-vorbis          enable vorbis support via libvorbisenc [default=no]"
601 602
echo "  --enable-faad            enable faad support via libfaad [default=no]"
echo "  --enable-faadbin         build faad support with runtime linking [default=no]"
603
echo "  --enable-win32           enable win32 cross compile"
604
echo "  --enable-mingw32         enable mingw32 native windows compile"
F
Fabrice Bellard 已提交
605
echo "  --disable-a52            disable GPL'ed A52 support [default=no]"
606
echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
607 608
echo "  --disable-pp             disable GPL'ed post processing support [default=no]"
echo "  --enable-shared-pp       use libpostproc.so [default=no]"
609 610 611 612 613 614
echo "  --enable-shared          build shared libraries [default=no]"
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]"
615
echo "  --make=MAKE              use specified make [$make]"
616 617 618 619 620
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]"
echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
echo "  --disable-mmx            disable mmx usage"
621
echo "  --disable-altivec        disable AltiVec usage"
F
Fabrice Bellard 已提交
622
echo "  --disable-audio-oss      disable OSS audio support [default=no]"
623
echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
F
Fabrice Bellard 已提交
624
echo "  --disable-v4l            disable video4linux grabbing [default=no]"
625
echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
F
Fabrice Bellard 已提交
626
echo "  --disable-network        disable network support [default=no]"
627
echo "  --disable-zlib           disable zlib [default=no]"
F
Fabrice Bellard 已提交
628
echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
629
echo "  --disable-vhook          disable video hooking support"
630
echo "  --enable-gprof           enable profiling with gprof [$gprof]"
631 632
echo "  --disable-mpegaudio-hp   faster (but less accurate)"
echo "                           mpegaudio decoding [default=no]"
633
echo "  --disable-ffserver       disable ffserver build"
M
Michael Niedermayer 已提交
634
echo "  --disable-risky          disables patent encumbered codecs"
635
echo "  --enable-small           optimize for size instead of speed"
636 637 638 639 640
echo ""
echo "NOTE: The object files are build at the place where configure is launched"
exit 1
fi

F
Fabrice Bellard 已提交
641
echo "Install prefix   $prefix"
642
echo "Source path      $source_path"
F
Fabrice Bellard 已提交
643
echo "C compiler       $cc"
644
echo "make             $make"
F
Fabrice Bellard 已提交
645
echo "CPU              $cpu"
646
echo "Big Endian       $bigendian"
F
Fabrice Bellard 已提交
647
if test $cpu = "x86"; then
F
Fabrice Bellard 已提交
648
echo "MMX enabled      $mmx"
649
echo "Vector Builtins  $builtin_vector"
F
Fabrice Bellard 已提交
650 651
fi
if test $cpu = "mips"; then
652
echo "MMI enabled      $mmi"
F
Fabrice Bellard 已提交
653 654
fi
if test $cpu = "powerpc"; then
655
echo "AltiVec enabled  $altivec"
F
Fabrice Bellard 已提交
656
fi
F
Fabrice Bellard 已提交
657
echo "gprof enabled    $gprof"
658
echo "zlib enabled     $zlib"
659
echo "mp3lame enabled  $mp3lame"
660
echo "vorbis enabled   $vorbis"
Z
Zdenek Kabelac 已提交
661 662
echo "faad enabled     $faad"
echo "faadbin enabled  $faadbin"
F
Fabrice Bellard 已提交
663
echo "a52 support      $a52"
Z
Zdenek Kabelac 已提交
664
echo "a52 dlopened     $a52bin"
665 666
echo "pp support       $pp"
echo "shared pp        $shared_pp"
667
echo "Video hooking    $vhook"
M
Michael Niedermayer 已提交
668
echo "risky / patent encumbered codecs $risky"
669
echo "optimize for size $small"
670 671

if test "$vhook" = "yes" ; then
672
echo "Imlib2 support   $imlib2"
673
echo "freetype support $freetype2"
674
fi
F
Fabrice Bellard 已提交
675

676
echo "Creating config.mak and config.h"
F
Fabrice Bellard 已提交
677

678
echo "# Automatically generated by configure - do not modify" > config.mak
679
echo "/* Automatically generated by configure - do not modify */" > $TMPH
F
Fabrice Bellard 已提交
680

681
echo "prefix=$prefix" >> config.mak
682
echo "MAKE=$make" >> config.mak
683 684
echo "CC=$cc" >> config.mak
echo "AR=$ar" >> config.mak
M
Michael Niedermayer 已提交
685
echo "RANLIB=$ranlib" >> config.mak
686
echo "STRIP=$strip" >> config.mak
N
Nick Kurshev 已提交
687
echo "OPTFLAGS=$CFLAGS" >> config.mak
688
echo "LDFLAGS=$LDFLAGS" >> config.mak
689
echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
690
echo "SHFLAGS=$SHFLAGS" >> config.mak
691 692 693 694
echo "LIBPREF=$LIBPREF" >> config.mak
echo "LIBSUF=$LIBSUF" >> config.mak
echo "SLIBPREF=$SLIBPREF" >> config.mak
echo "SLIBSUF=$SLIBSUF" >> config.mak
695
echo "TARGET_OS=$TARGET_OS" >> config.mak
Z
Zdenek Kabelac 已提交
696
if test "$cpu" = "x86" ; then
697
  echo "TARGET_ARCH_X86=yes" >> config.mak
698
  echo "#define ARCH_X86 1" >> $TMPH
699
elif test "$cpu" = "armv4l" ; then
700
  echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
701
  echo "#define ARCH_ARMV4L 1" >> $TMPH
702
elif test "$cpu" = "alpha" ; then
703
  echo "TARGET_ARCH_ALPHA=yes" >> config.mak
704
  echo "#define ARCH_ALPHA 1" >> $TMPH
705 706 707
elif test "$cpu" = "sparc64" ; then
  echo "TARGET_ARCH_SPARC64=yes" >> config.mak
  echo "#define ARCH_SPARC64 1" >> $TMPH
708 709 710
elif test "$cpu" = "powerpc" ; then
  echo "TARGET_ARCH_POWERPC=yes" >> config.mak
  echo "#define ARCH_POWERPC 1" >> $TMPH
711 712 713 714
  echo "// Enable the next line to get PowerPC performance report" >> $TMPH
  echo "// #define POWERPC_TBL_PERFORMANCE_REPORT 1" >> $TMPH
  echo "// Enable the next line to use PMC registers instead of TBL" >> $TMPH
  echo "// #define POWERPC_PERF_USE_PMC 1" >> $TMPH
715 716 717
elif test "$cpu" = "mips" ; then
  echo "TARGET_ARCH_MIPS=yes" >> config.mak
  echo "#define ARCH_MIPS 1" >> $TMPH
718 719 720 721
fi
if test "$bigendian" = "yes" ; then
  echo "WORDS_BIGENDIAN=yes" >> config.mak
  echo "#define WORDS_BIGENDIAN 1" >> $TMPH
722
fi
Z
Zdenek Kabelac 已提交
723
if test "$mmx" = "yes" ; then
724
  echo "TARGET_MMX=yes" >> config.mak
725
  echo "#define HAVE_MMX 1" >> $TMPH
F
Fabrice Bellard 已提交
726
fi
727 728 729 730
if test "$builtin_vector" = "yes" ; then
  echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
  echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
fi
731 732 733 734
if test "$mmi" = "yes" ; then
  echo "TARGET_MMI=yes" >> config.mak
  echo "#define HAVE_MMI 1" >> $TMPH
fi
735 736 737
if test "$altivec" = "yes" ; then
  echo "TARGET_ALTIVEC=yes" >> config.mak
  echo "#define HAVE_ALTIVEC 1" >> $TMPH
738 739
  echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
  echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
740
fi
Z
Zdenek Kabelac 已提交
741
if test "$gprof" = "yes" ; then
742
  echo "TARGET_GPROF=yes" >> config.mak
743
  echo "#define HAVE_GPROF 1" >> $TMPH
F
Fabrice Bellard 已提交
744
fi
745 746 747 748 749 750 751 752
if test "$strptime" = "yes" ; then
  echo "#define HAVE_STRPTIME 1" >> $TMPH
else
  echo "BUILD_STRPTIME=yes" >> config.mak
fi
if test "$imlib2" = "yes" ; then
  echo "HAVE_IMLIB2=yes" >> config.mak
fi
753 754 755
if test "$freetype2" = "yes" ; then
  echo "HAVE_FREETYPE2=yes" >> config.mak
fi
756 757 758
if test "$have_lrintf" = "yes" ; then
  echo "#define HAVE_LRINTF 1" >> $TMPH
fi
759 760 761
if test "$vhook" = "yes" ; then
  echo "BUILD_VHOOK=yes" >> config.mak
  echo "#define HAVE_VHOOK 1" >> $TMPH
762
  extralibs="$extralibs $ldl"
763
fi
Z
Zdenek Kabelac 已提交
764
if test "$lshared" = "yes" ; then
N
Nick Kurshev 已提交
765
  echo "BUILD_SHARED=yes" >> config.mak
F
Fabrice Bellard 已提交
766
  echo "PIC=-fPIC" >> config.mak
N
Nick Kurshev 已提交
767
fi
768
echo "EXTRALIBS=$extralibs" >> config.mak
769
echo "VERSION=`head $source_path/VERSION`" >>config.mak
N
Nick Kurshev 已提交
770
echo "" >>config.mak
771
# if you do not want to use encoders, disable that.
772
echo "#define CONFIG_ENCODERS 1" >> $TMPH
773 774 775
echo "CONFIG_ENCODERS=yes" >> config.mak

# if you do not want to use decoders, disable that.
776
echo "#define CONFIG_DECODERS 1" >> $TMPH
777 778
echo "CONFIG_DECODERS=yes" >> config.mak

F
Fabrice Bellard 已提交
779 780 781 782
# AC3
if test "$a52" = "yes" ; then
  echo "#define CONFIG_AC3 1" >> $TMPH
  echo "CONFIG_AC3=yes" >> config.mak
783

F
Fabrice Bellard 已提交
784 785 786 787 788 789
  if test "$a52bin" = "yes" ; then
    echo "#define CONFIG_A52BIN 1" >> $TMPH
    echo "CONFIG_A52BIN=yes" >> config.mak
  fi
fi

790 791 792 793 794 795 796 797 798 799 800
# PP
if test "$pp" = "yes" ; then
  echo "#define CONFIG_PP 1" >> $TMPH
  echo "CONFIG_PP=yes" >> config.mak

  if test "$shared_pp" = "yes" ; then
    echo "#define SHARED_PP 1" >> $TMPH
    echo "SHARED_PP=yes" >> config.mak
  fi
fi

801 802 803 804 805
# mpeg audio high precision mode
if test "$mpegaudio_hp" = "yes" ; then
  echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
fi

F
Fabrice Bellard 已提交
806 807 808 809 810
if test "$v4l" = "yes" ; then
  echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
  echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
fi

811 812 813 814 815
if test "$dv1394" = "yes" ; then
  echo "#define CONFIG_DV1394 1" >> $TMPH
  echo "CONFIG_DV1394=yes" >> config.mak
fi

816 817 818 819 820 821 822 823
if test "$dlopen" = "yes" ; then
  echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
fi

if test "$dlfcn" = "yes" ; then
  echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
fi

F
Fabrice Bellard 已提交
824 825 826
if test "$audio_oss" = "yes" ; then
  echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
  echo "CONFIG_AUDIO_OSS=yes" >> config.mak
Z
Zdenek Kabelac 已提交
827 828
fi

829 830 831 832 833
if test "$audio_beos" = "yes" ; then
  echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
  echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
fi

F
Fabrice Bellard 已提交
834 835 836
if test "$network" = "yes" ; then
  echo "#define CONFIG_NETWORK 1" >> $TMPH
  echo "CONFIG_NETWORK=yes" >> config.mak
837
fi
838

839 840 841 842 843
if test "$zlib" = "yes" ; then
  echo "#define CONFIG_ZLIB 1" >> $TMPH
  echo "CONFIG_ZLIB=yes" >> config.mak
fi

Z
Zdenek Kabelac 已提交
844
if test "$mp3lame" = "yes" ; then
845
  echo "#define CONFIG_MP3LAME 1" >> $TMPH
846 847 848
  echo "CONFIG_MP3LAME=yes" >> config.mak
fi

849 850 851 852 853
if test "$vorbis" = "yes" ; then
  echo "#define CONFIG_VORBIS 1" >> $TMPH
  echo "CONFIG_VORBIS=yes" >> config.mak
fi

854 855 856 857 858 859 860
if test "$faad" = "yes" ; then
  echo "#define CONFIG_FAAD 1" >> $TMPH
  echo "CONFIG_FAAD=yes" >> config.mak
fi

if test "$faadbin" = "yes" ; then
  echo "#define CONFIG_FAADBIN 1" >> $TMPH
Z
Zdenek Kabelac 已提交
861
  echo "CONFIG_FAADBIN=yes" >> config.mak
862 863
fi

Z
Zdenek Kabelac 已提交
864
if test "$win32" = "yes" ; then
865
  echo "#define CONFIG_WIN32 1" >> $TMPH
866 867
  echo "CONFIG_WIN32=yes" >> config.mak
fi
N
Nick Kurshev 已提交
868

869 870 871 872 873 874 875
if test "$mingw32" = "yes" ; then
  echo "#define CONFIG_WIN32 1" >> $TMPH
  echo "CONFIG_WIN32=yes" >> config.mak
  echo "#define __MINGW32__ 1" >> $TMPH
  echo "__MINGW32__=1" >> config.mak
fi

876 877 878 879 880
if test "$cygwin" = "yes" ; then
  # setup correct exesuffix
  echo "CONFIG_WIN32=yes" >> config.mak
fi

881 882 883 884 885
if test "$os2" = "yes" ; then
  echo "#define CONFIG_OS2 1" >> $TMPH
  echo "CONFIG_OS2=yes" >> config.mak
fi

886 887 888 889
if test "$TARGET_OS" = "SunOS" ; then
  echo "#define CONFIG_SUNOS 1" >> $TMPH
fi

890 891 892 893 894
if test "$darwin" = "yes"; then
  echo "#define CONFIG_DARWIN 1"  >> $TMPH
  echo "CONFIG_DARWIN=yes" >> config.mak
fi

Z
Zdenek Kabelac 已提交
895
if test "$_malloc_h" = "yes" ; then
896
  echo "#define HAVE_MALLOC_H 1" >> $TMPH
N
Nick Kurshev 已提交
897
else
898
  echo "#undef  HAVE_MALLOC_H" >> $TMPH
N
Nick Kurshev 已提交
899 900
fi

Z
Zdenek Kabelac 已提交
901
if test "$_memalign" = "yes" ; then
902 903 904 905 906
  echo "#define HAVE_MEMALIGN 1" >> $TMPH
else
  echo "#undef  HAVE_MEMALIGN" >> $TMPH
fi

907 908 909 910 911
if test "$netserver" = "yes" ; then
  echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
  echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
fi

912 913 914 915
if test "$need_inet_aton" = "yes" ; then
  echo "NEED_INET_ATON=yes" >> config.mak
fi

Z
Zdenek Kabelac 已提交
916
if test "$simpleidct" = "yes" ; then
917 918 919
  echo "#define SIMPLE_IDCT 1" >> $TMPH
fi

920 921 922 923 924
if test "$ffserver" = "yes" ; then
  echo "#define CONFIG_FFSERVER 1" >> $TMPH
  echo "CONFIG_FFSERVER=yes" >> config.mak
fi

M
Michael Niedermayer 已提交
925 926 927 928 929
if test "$risky" = "yes" ; then
  echo "#define CONFIG_RISKY 1" >> $TMPH
  echo "CONFIG_RISKY=yes" >> config.mak
fi

F
Falk Hüffner 已提交
930 931
echo "#define restrict $_restrict" >> $TMPH

932 933
# build tree in object directory if source path is different from current one
if test "$source_path_used" = "yes" ; then
F
Fabrice Bellard 已提交
934
    DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
935 936
          libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
    FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
937 938 939 940 941 942 943 944 945
    for dir in $DIRS ; do
            mkdir -p $dir
    done
    for f in $FILES ; do
        ln -sf $source_path/$f $f
    done
fi
echo "SRC_PATH=$source_path" >> config.mak

Z
Zdenek Kabelac 已提交
946
diff $TMPH config.h >/dev/null 2>&1
947 948
if test $? -ne 0 ; then
	mv -f $TMPH config.h
N
Nick Kurshev 已提交
949
else
950
	echo "config.h is unchanged"
N
Nick Kurshev 已提交
951 952
fi

953
rm -f $TMPO $TMPC $TMPE $TMPS $TMPH