Statistics
| Branch: | Revision:

ffmpeg / configure @ c54d0a1a

History | View | Annotate | Download (27.6 KB)

1
#!/bin/sh
2
#
3
# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
4
#
5
# set temporary file name
6
if test ! -z "$TMPDIR" ; then
7
    TMPDIR1="${TMPDIR}"
8
elif test ! -z "$TEMPDIR" ; then
9
    TMPDIR1="${TEMPDIR}"
10
else
11
    TMPDIR1="/tmp"
12
fi
13

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

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

    
105
# OS specific
106
targetos=`uname -s`
107
case $targetos in
108
BeOS)
109
prefix="/boot/home/config"
110
# helps building libavcodec
111
CFLAGS="-O3 -DPIC -fomit-frame-pointer"
112
# 3 gcc releases known for BeOS, each with ugly bugs
113
gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
114
case "$gcc_version" in
115
2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
116
mmx="no"
117
;;
118
*20010315*) echo "BeBits gcc"
119
CFLAGS="$CFLAGS -fno-expensive-optimizations"
120
;;
121
esac
122
SHFLAGS=-nostart
123
# disable linux things
124
audio_oss="no"
125
v4l="no"
126
dv1394="no"
127
# enable beos things
128
audio_beos="yes"
129
# no need for libm, but the inet stuff
130
# Check for BONE
131
if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
132
extralibs="-lbind -lsocket"
133
else
134
netserver="yes"
135
need_inet_aton="yes"
136
extralibs="-lnet"
137
fi ;;
138
SunOS)
139
v4l="no"
140
audio_oss="no"
141
dv1394="no"
142
make="gmake"
143
LDFLAGS=""
144
FFSLDFLAGS=""
145
need_inet_aton="yes"
146
extralibs="$extralibs -lsocket -lnsl"
147
;;
148
FreeBSD)
149
v4l="no"
150
audio_oss="yes"
151
dv1394="no"
152
make="gmake"
153
LDFLAGS="$LDFLAGS -export-dynamic"
154
;;
155
BSD/OS)
156
v4l="no"
157
audio_oss="yes"
158
dv1394="no"
159
extralibs="-lpoll -lgnugetopt -lm"
160
make="gmake"
161
;;
162
Darwin)
163
cc="cc"
164
v4l="no"
165
audio_oss="no"
166
dv1394="no"
167
ffserver="no"
168
SHFLAGS="-dynamiclib"
169
extralibs=""
170
darwin="yes"
171
strip="strip -x"
172
LDFLAGS="-d"
173
FFSLDFLAGS=-Wl,-bind_at_load
174
gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
175
case "$gcc_version" in
176
*2.95*) 
177
CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer"
178
;;
179
*3.3*) 
180
CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic -force_cpusubtype_ALL"
181
;;
182
*) 
183
CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic"
184
;;
185
esac
186
;;
187
MINGW32*)
188
v4l="no"
189
audio_oss="no"
190
dv1394="no"
191
ffserver="no"
192
network="no"
193
mingw32="yes"
194
LIBPREF=""
195
LIBSUF=".lib"
196
SLIBPREF=""
197
SLIBSUF=".dll"
198
;;
199
CYGWIN*)
200
v4l="no"
201
audio_oss="yes"
202
dv1394="no"
203
extralibs=""
204
cygwin="yes"
205
test -f /usr/include/inttypes.h || \
206
test -f /usr/local/include/inttypes.h || \
207
echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
208
     "/usr/include/inttypes.h !!!"
209
;;
210
Linux)
211
LDFLAGS="$LDFLAGS -rdynamic"
212
;;
213
OS/2)
214
TMPE=$TMPE".exe"
215
ar="emxomfar -p64"
216
ranlib="echo ignoring ranlib"
217
strip="echo ignoring strip"
218
CFLAGS="-Zomf -O3"
219
LDFLAGS="-Zomf -Zstack 16384 -s"
220
SHFLAGS=""
221
FFSLDFLAGS=""
222
LIBPREF=""
223
LIBSUF=".lib"
224
SLIBPREF=""
225
SLIBSUF=".dll"
226
extralibs=""
227
v4l="no"
228
audio_oss="no"
229
dv1394="no"
230
network="no"
231
ffserver="no"
232
os2="yes"
233
;;
234
*) ;;
235
esac
236

    
237
# From mplayer configure. We need TARGET_OS available
238
# to the Makefile, so it can distinguish between flavors
239
# of AltiVec on PowerPC
240
TARGET_OS=`( uname -s ) 2>&1`
241
  case "$TARGET_OS" in
242
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
243
    ;;
244
  IRIX*)
245
    TARGET_OS=IRIX
246
    ;;
247
  HP-UX*)
248
    TARGET_OS=HP-UX
249
    ;;
250
  [cC][yY][gG][wW][iI][nN]*)
251
    TARGET_OS=CYGWIN
252
    ;;
253
  *)
254
    TARGET_OS="$TARGET_OS-UNKNOWN"
255
    ;;
256
  esac
257

    
258
# find source path
259
# XXX: we assume an absolute path is given when launching configure, 
260
# except in './configure' case.
261
source_path="`echo $0 | sed -e 's#/configure##'`"
262
source_path_used="yes"
263
if test -z "$source_path" -o "$source_path" = "." ; then
264
    source_path=`pwd`
265
    source_path_used="no"
266
fi
267

    
268
for opt do
269
  case "$opt" in
270
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
271
  ;;
272
  --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
273
  ;;
274
  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
275
  ;;
276
  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
277
  ;;
278
  --cc=*) cc=`echo $opt | cut -d '=' -f 2`
279
  ;;
280
  --make=*) make=`echo $opt | cut -d '=' -f 2`
281
  ;;
282
  --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
283
  ;;
284
  --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
285
  ;;
286
  --extra-libs=*) extralibs=${opt#--extra-libs=}
287
  ;;
288
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
289
  ;;
290
  --tune=*) tune=`echo $opt | cut -d '=' -f 2`
291
  ;;
292
  --powerpc-perf-enable) powerpc_perf="yes"
293
  ;;
294
  --disable-mmx) mmx="no"
295
  ;;
296
  --disable-altivec) altivec="no"
297
  ;;
298
  --enable-gprof) gprof="yes"
299
  ;;
300
  --disable-v4l) v4l="no"
301
  ;;
302
  --disable-audio-oss) audio_oss="no"
303
  ;;
304
  --disable-audio-beos) audio_beos="no"
305
  ;;
306
  --disable-dv1394) dv1394="no"
307
  ;;
308
  --disable-network) network="no"
309
  ;;
310
  --disable-zlib) zlib="no"
311
  ;;
312
  --enable-a52) a52="yes"
313
  ;;
314
  --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
315
  ;;
316
  --enable-pp) pp="yes"
317
  ;;
318
  --enable-shared-pp) shared_pp="yes"
319
  ;;
320
  --enable-mp3lame) mp3lame="yes"
321
  ;;
322
  --enable-vorbis) vorbis="yes"
323
  ;;
324
  --enable-faad) faad="yes"
325
  ;;
326
  --enable-faadbin) faadbin="yes"
327
  ;;
328
  --disable-vhook) vhook="no"
329
  ;;
330
  --disable-simple_idct) simpleidct="no"
331
  ;;
332
  --enable-mingw32) mingw32="yes"
333
  ;;
334
  --enable-shared) lshared="yes"
335
  ;;
336
  --disable-mpegaudio-hp) mpegaudio_hp="no"
337
  ;;
338
  --disable-ffserver) ffserver="no"
339
  ;;
340
  --disable-ffplay) ffplay="no"
341
  ;;
342
  --disable-risky) risky="no"
343
  ;;
344
  --enable-small) small="yes"
345
  ;;
346
  --enable-amr_nb) amr_nb="yes"
347
  ;;
348
  --enable-amr_nb-fixed) amr_nb_fixed="yes"
349
  ;;
350
  --enable-sunmlib) sunmlib="yes"
351
  ;;
352
  esac
353
done
354

    
355
# compute mmx state
356
if test $mmx = "default"; then
357
    if test $cpu = "x86"; then
358
        mmx="yes"
359
    else
360
        mmx="no"
361
    fi
362
fi
363

    
364
# Can only do AltiVec on PowerPC
365
if test $altivec = "default"; then
366
    if test $cpu = "powerpc"; then
367
        altivec="yes"
368
    else
369
        altivec="no"
370
    fi
371
fi
372

    
373
# Add processor-specific flags
374
TUNECPU="generic"
375
if test $tune != "generic"; then
376
    case $tune in
377
	601|ppc601|PowerPC601)
378
	    CFLAGS="$CFLAGS -mcpu=601"
379
	    if test $altivec = "yes"; then
380
		echo "WARNING: tuning for PPC601 but altivec enabled !";
381
	    fi
382
	    TUNECPU=ppc601
383
	;;
384
	603*|ppc603*|PowerPC603*)
385
	    CFLAGS="$CFLAGS -mcpu=603"
386
	    if test $altivec = "yes"; then
387
		echo "WARNING: tuning for PPC603 but altivec enabled !";
388
	    fi
389
	    TUNECPU=ppc603
390
	;;
391
	604*|ppc604*|PowerPC604*)
392
	    CFLAGS="$CFLAGS -mcpu=604"
393
	    if test $altivec = "yes"; then
394
		echo "WARNING: tuning for PPC604 but altivec enabled !";
395
	    fi
396
	    TUNECPU=ppc604
397
	;;
398
	G3|g3|75*|ppc75*|PowerPC75*)
399
	    CFLAGS="$CFLAGS -mcpu=750 -mtune=750"
400
	    if test $altivec = "yes"; then
401
		echo "WARNING: tuning for PPC75x but altivec enabled !";
402
	    fi
403
	    TUNECPU=ppc750
404
	;;
405
	G4|g4|745*|ppc745*|PowerPC745*)
406
	    CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450"
407
	    if test $altivec = "no"; then
408
		echo "WARNING: tuning for PPC745x but altivec disabled !";
409
	    fi
410
	    TUNECPU=ppc7450
411
	;;
412
	74*|ppc74*|PowerPC74*)
413
	    CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400"
414
	    if test $altivec = "no"; then
415
		echo "WARNING: tuning for PPC74xx but altivec disabled !";
416
	    fi
417
	    TUNECPU=ppc7400
418
	;;
419
	G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
420
	    CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc64 -force_cpusubtype_ALL "
421
	    if test $altivec = "no"; then
422
		echo "WARNING: tuning for PPC970 but altivec disabled !";
423
	    fi
424
	    TUNECPU=ppc970
425
	;;
426
	*)
427
	echo "WARNING: unknown CPU "$tune", ignored"
428
	;;
429
    esac
430
fi
431

    
432
# AltiVec flags: The FSF version of GCC differs from the Darwin version 
433
if test $cpu = "powerpc"; then
434
    if test $altivec = "yes"; then
435
        if test "$darwin" = "yes"; then
436
            CFLAGS="$CFLAGS -faltivec"
437
        else
438
            CFLAGS="$CFLAGS -maltivec -mabi=altivec"
439
        fi
440
    fi
441
fi
442

    
443
# See if we have <altivec.h>
444
cat > $TMPC << EOF
445
#include <altivec.h>
446
int main( void ) { return 0; }
447
EOF
448

    
449
_altivec_h="no"
450
if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
451
_altivec_h="yes"
452
fi
453

    
454
# See does our compiler support Motorola AltiVec C API
455
if test $altivec = "yes"; then
456
if test $_altivec_h = "yes"; then
457
cat > $TMPC << EOF
458
#include <altivec.h>
459
int main(void) {
460
    vector signed int v1, v2, v3;
461
    v1 = vec_add(v2,v3);
462
    return 0;
463
}
464
EOF
465
else
466
cat > $TMPC << EOF
467
int main(void) {
468
    vector signed int v1, v2, v3;
469
    v1 = vec_add(v2,v3);
470
    return 0;
471
}
472
EOF
473
fi
474
$cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
475
fi
476

    
477
# Can only do mmi on mips
478
if test $mmi = "default"; then
479
    if test $cpu = "mips"; then
480
        mmi="yes"
481
    else
482
        mmi="no"
483
    fi
484
fi
485

    
486
# See does our compiler support mmi
487
if test $mmi = "yes"; then
488
cat > $TMPC << EOF
489
int main(void) {
490
    __asm__ ("lq \$2, 0(\$2)");
491
    return 0;
492
}
493
EOF
494
$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
495
fi
496

    
497
# Checking for CFLAGS
498
if test -z "$CFLAGS"; then
499
    CFLAGS="-O3"
500
fi
501

    
502
if test "$mingw32" = "yes" ; then
503
    v4l="no"
504
    audio_oss="no"
505
    dv1394="no"
506
    network="no"
507
fi
508

    
509
cc="${cross_prefix}${cc}"
510
ar="${cross_prefix}${ar}"
511
ranlib="${cross_prefix}${ranlib}"
512
strip="${cross_prefix}${strip}"
513

    
514
if test -z "$cross_prefix" ; then
515

    
516
# ---
517
# big/little endian test
518
cat > $TMPC << EOF
519
#include <inttypes.h>
520
int main(int argc, char ** argv){
521
	volatile uint32_t i=0x01234567;
522
	return (*((uint8_t*)(&i))) == 0x67;
523
}
524
EOF
525

    
526
if $cc -o $TMPE $TMPC 2>/dev/null ; then
527
$TMPE && bigendian="yes"
528
else
529
echo big/little test failed
530
fi
531

    
532
else
533

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

    
539
fi
540

    
541
# ---
542
# check availability of some header files
543

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

    
549
_memalign=no
550
_malloc_h=no
551
if $cc -o $TMPE $TMPC 2> /dev/null ; then
552
_malloc_h=yes
553
_memalign=yes
554
# check for memalign - atmos
555
cat > $TMPC << EOF
556
#include <malloc.h>
557
int main ( void ) {
558
char *string = NULL;
559
string = memalign(64, sizeof(char));
560
return 0;
561
}
562
EOF
563
$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
564
fi
565

    
566
cat > $TMPC << EOF
567
#include <time.h>
568
int main( void ) { localtime_r(NULL, NULL); }
569
EOF
570

    
571
localtime_r=no
572
if $cc -o $TMPE $TMPC 2> /dev/null ; then
573
  localtime_r=yes
574
fi
575

    
576
if test "$zlib" = "yes"; then
577
# check for zlib - mmu_man
578
cat > $TMPC << EOF
579
#include <zlib.h>
580
int main ( void ) {
581
if (zlibVersion() != ZLIB_VERSION)
582
   puts("zlib version differs !!!");
583
   return 1;
584
return 0;
585
}
586
EOF
587
$cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
588
# $TMPE 2> /dev/null > /dev/null || zlib="no"
589
# XXX: more tests needed - runtime test
590
fi
591
if test "$zlib" = "yes"; then
592
extralibs="$extralibs -lz"
593
fi
594

    
595
# test for lrintf in math.h
596
cat > $TMPC << EOF
597
#define _ISOC9X_SOURCE  1
598
#include <math.h>
599
int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
600
EOF
601

    
602
have_lrintf="no"
603
if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
604
  have_lrintf="yes"
605
  $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
606
fi
607

    
608
_restrict=
609
for restrict_keyword in restrict __restrict__ __restrict; do
610
  echo "void foo(char * $restrict_keyword p);" > $TMPC
611
  if $cc -c -o $TMPO $TMPC 2> /dev/null; then
612
    _restrict=$restrict_keyword
613
    break;
614
  fi
615
done
616

    
617
# test gcc version to see if vector builtins can be used
618
# currently only used on i386 for MMX builtins
619
cat > $TMPC << EOF
620
int main(void) { 
621
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
622
return 0;
623
#else
624
#error no vector builtins
625
#endif
626
}
627
EOF
628

    
629
builtin_vector=no
630
if $cc -o $TMPO $TMPC 2> /dev/null ; then
631
  builtin_vector=yes
632
fi
633

    
634
# dlopen/dlfcn.h probing
635

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

    
641
ldl=-ldl
642

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

    
648
if $cc -o $TMPE $TMPC 2> /dev/null  ; then
649
dlfcn=yes
650
dlopen=yes
651
ldl=""
652
fi
653

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

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

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

    
667
if test "$vhook" = "default" ; then
668
  vhook="$dlopen"
669
fi
670

    
671
##########################################
672
# imlib probe
673

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

    
680
imlib2=no
681
if $cc -o $TMPE $TMPC -lImlib2 2> /dev/null  ; then
682
imlib2=yes
683
fi
684

    
685
##########################################
686
# freetype probe
687

    
688
cat > $TMPC << EOF
689
#include <ft2build.h>
690
int main( void ) { return (int) FT_Init_FreeType(0); }
691
EOF
692

    
693
freetype2=no
694
if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
695
  if test "`which freetype-config`" != ""; then
696
    if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs`  2> /dev/null ; then
697
      freetype2=yes
698
    fi
699
  fi
700
fi
701

    
702
##########################################
703
# SDL probe
704

    
705
cat > $TMPC << EOF
706
#include <SDL.h>
707
#undef main /* We don't want SDL to override our main() */
708
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
709
EOF
710

    
711
sdl_too_old=no
712
sdl=no
713
if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs`  2> /dev/null  ; then
714
_sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
715
if test "$_sdlversion" -lt 121 ; then
716
sdl_too_old=yes
717
else
718
sdl=yes
719
fi
720
fi
721

    
722
if test "$sdl" = "no" ; then
723
   ffplay=no
724
fi
725

    
726
if test "$small" = "yes"; then
727
#  CFLAGS=${CFLAGS//-O3/-Os}
728
  CFLAGS="$CFLAGS -Os"
729
fi
730

    
731
if test x"$mandir" = x""; then
732
mandir="${prefix}/man"
733
fi
734

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

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

    
741
EOF
742
echo "Standard options:"
743
echo "  --help                   print this message"
744
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
745
echo "  --mandir=DIR             man documentation in DIR [PREFIX/man]"
746
echo "  --enable-mp3lame         enable mp3 encoding via libmp3lame [default=no]"
747
echo "  --enable-vorbis          enable vorbis support via libvorbisenc [default=no]"
748
echo "  --enable-faad            enable faad support via libfaad [default=no]"
749
echo "  --enable-faadbin         build faad support with runtime linking [default=no]"
750
echo "  --enable-mingw32         enable mingw32 native/cross windows compile"
751
echo "  --enable-a52             enable GPL'ed A52 support [default=no]"
752
echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
753
echo "  --enable-pp              enable GPL'ed post processing support [default=no]"
754
echo "  --enable-shared-pp       use libpostproc.so [default=no]"
755
echo "  --enable-shared          build shared libraries [default=no]"
756
echo "  --enable-amr_nb          enable amr_nb float audio codec"
757
echo "  --enable-amr_nb-fixed    use fixed point for amr-nb codec"
758
echo "  --enable-sunmlib         use Sun medialib [default=no]"
759
echo ""
760
echo "Advanced options (experts only):"
761
echo "  --source-path=PATH       path of source code [$source_path]"
762
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
763
echo "  --cc=CC                  use C compiler CC [$cc]"
764
echo "  --make=MAKE              use specified make [$make]"
765
echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
766
echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
767
echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
768
echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
769
echo "  --tune=PROCESSOR         tune code for a particular CPU (may fails or misperforms on other CPUs)"
770
echo "  --powerpc-perf-enable    enable performance report on PPC (requires enabling PMC)"
771
echo "  --disable-mmx            disable mmx usage"
772
echo "  --disable-altivec        disable AltiVec usage"
773
echo "  --disable-audio-oss      disable OSS audio support [default=no]"
774
echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
775
echo "  --disable-v4l            disable video4linux grabbing [default=no]"
776
echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
777
echo "  --disable-network        disable network support [default=no]"
778
echo "  --disable-zlib           disable zlib [default=no]"
779
echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
780
echo "  --disable-vhook          disable video hooking support"
781
echo "  --enable-gprof           enable profiling with gprof [$gprof]"
782
echo "  --disable-mpegaudio-hp   faster (but less accurate)"
783
echo "                           mpegaudio decoding [default=no]"
784
echo "  --disable-ffserver       disable ffserver build"
785
echo "  --disable-ffplay         disable ffplay build"
786
echo "  --disable-risky          disables patent encumbered codecs"
787
echo "  --enable-small           optimize for size instead of speed"
788
echo ""
789
echo "NOTE: The object files are build at the place where configure is launched"
790
exit 1
791
fi
792

    
793
echo "Install prefix   $prefix"
794
echo "Source path      $source_path"
795
echo "C compiler       $cc"
796
echo "make             $make"
797
echo "CPU              $cpu ($tune)"
798
echo "Big Endian       $bigendian"
799
if test $cpu = "x86"; then
800
echo "MMX enabled      $mmx"
801
echo "Vector Builtins  $builtin_vector"
802
fi
803
if test $cpu = "mips"; then
804
echo "MMI enabled      $mmi"
805
fi
806
if test $cpu = "powerpc"; then
807
echo "AltiVec enabled  $altivec"
808
fi
809
echo "gprof enabled    $gprof"
810
echo "zlib enabled     $zlib"
811
echo "mp3lame enabled  $mp3lame"
812
echo "vorbis enabled   $vorbis"
813
echo "faad enabled     $faad"
814
echo "faadbin enabled  $faadbin"
815
echo "a52 support      $a52"
816
echo "a52 dlopened     $a52bin"
817
echo "pp support       $pp"
818
echo "shared pp        $shared_pp"
819
echo "Video hooking    $vhook"
820
echo "SDL support      $sdl"
821
if test $sdl_too_old = "yes"; then
822
echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
823
fi
824
echo "risky / patent encumbered codecs $risky"
825
echo "optimize for size $small"
826

    
827
if test "$vhook" = "yes" ; then
828
echo "Imlib2 support   $imlib2"
829
echo "freetype support $freetype2"
830
fi
831
echo "Sun medialib support"  $sunmlib
832
echo "AMR-NB float support"  $amr_nb
833
echo "AMR-NB fixed support"  $amr_nb_fixed
834

    
835
echo "Creating config.mak and config.h"
836

    
837
echo "# Automatically generated by configure - do not modify" > config.mak
838
echo "/* Automatically generated by configure - do not modify */" > $TMPH
839

    
840
echo "prefix=$prefix" >> config.mak
841
echo "mandir=$mandir" >> config.mak
842
echo "MAKE=$make" >> config.mak
843
echo "CC=$cc" >> config.mak
844
echo "AR=$ar" >> config.mak
845
echo "RANLIB=$ranlib" >> config.mak
846
echo "STRIP=$strip" >> config.mak
847
echo "OPTFLAGS=$CFLAGS" >> config.mak
848
echo "LDFLAGS=$LDFLAGS" >> config.mak
849
echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
850
echo "SHFLAGS=$SHFLAGS" >> config.mak
851
echo "LIBPREF=$LIBPREF" >> config.mak
852
echo "LIBSUF=$LIBSUF" >> config.mak
853
echo "SLIBPREF=$SLIBPREF" >> config.mak
854
echo "SLIBSUF=$SLIBSUF" >> config.mak
855
echo "TARGET_OS=$TARGET_OS" >> config.mak
856
if test "$cpu" = "x86" ; then
857
  echo "TARGET_ARCH_X86=yes" >> config.mak
858
  echo "#define ARCH_X86 1" >> $TMPH
859
elif test "$cpu" = "armv4l" ; then
860
  echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
861
  echo "#define ARCH_ARMV4L 1" >> $TMPH
862
elif test "$cpu" = "alpha" ; then
863
  echo "TARGET_ARCH_ALPHA=yes" >> config.mak
864
  echo "#define ARCH_ALPHA 1" >> $TMPH
865
elif test "$cpu" = "sparc64" ; then
866
  echo "TARGET_ARCH_SPARC64=yes" >> config.mak
867
  echo "#define ARCH_SPARC64 1" >> $TMPH
868
elif test "$cpu" = "powerpc" ; then
869
  echo "TARGET_ARCH_POWERPC=yes" >> config.mak
870
  echo "#define ARCH_POWERPC 1" >> $TMPH
871
  if test "$powerpc_perf" = "yes"; then
872
    echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
873
  fi
874
elif test "$cpu" = "mips" ; then
875
  echo "TARGET_ARCH_MIPS=yes" >> config.mak
876
  echo "#define ARCH_MIPS 1" >> $TMPH
877
elif test "$cpu" = "sh4" ; then
878
  echo "TARGET_ARCH_SH4=yes" >> config.mak
879
  echo "#define ARCH_SH4 1" >> $TMPH
880
fi
881
echo "#define TUNECPU $TUNECPU" >> $TMPH
882
if test "$bigendian" = "yes" ; then
883
  echo "WORDS_BIGENDIAN=yes" >> config.mak
884
  echo "#define WORDS_BIGENDIAN 1" >> $TMPH
885
fi
886
if test "$mmx" = "yes" ; then
887
  echo "TARGET_MMX=yes" >> config.mak
888
  echo "#define HAVE_MMX 1" >> $TMPH
889
  echo "#define __CPU__ 586" >> $TMPH
890
fi
891
if test "$mingw32" = "yes" ; then
892
  echo "TARGET_MINGW32=yes" >> config.mak
893
fi
894
if test "$builtin_vector" = "yes" ; then
895
  echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
896
  echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
897
fi
898
if test "$mmi" = "yes" ; then
899
  echo "TARGET_MMI=yes" >> config.mak
900
  echo "#define HAVE_MMI 1" >> $TMPH
901
fi
902
if test "$altivec" = "yes" ; then
903
  echo "TARGET_ALTIVEC=yes" >> config.mak
904
  echo "#define HAVE_ALTIVEC 1" >> $TMPH
905
  echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
906
  echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
907
  if test "$_altivec_h" = "yes" ; then
908
    echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
909
  else
910
    echo "#undef HAVE_ALTIVEC_H" >> $TMPH
911
  fi
912
fi
913
if test "$gprof" = "yes" ; then
914
  echo "TARGET_GPROF=yes" >> config.mak
915
  echo "#define HAVE_GPROF 1" >> $TMPH
916
fi
917
if test "$localtime_r" = "yes" ; then
918
  echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
919
fi
920
if test "$imlib2" = "yes" ; then
921
  echo "HAVE_IMLIB2=yes" >> config.mak
922
fi
923
if test "$freetype2" = "yes" ; then
924
  echo "HAVE_FREETYPE2=yes" >> config.mak
925
fi
926
if test "$sunmlib" = "yes" ; then
927
  echo "HAVE_MLIB=yes" >> config.mak
928
  echo "#define HAVE_MLIB 1" >> $TMPH
929
  extralibs="$extralibs -lmlib"
930
fi
931
if test "$sdl" = "yes" ; then
932
  echo "CONFIG_SDL=yes" >> config.mak
933
  echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
934
  echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
935
fi
936
if test "$have_lrintf" = "yes" ; then
937
  echo "#define HAVE_LRINTF 1" >> $TMPH
938
fi
939
if test "$vhook" = "yes" ; then
940
  echo "BUILD_VHOOK=yes" >> config.mak
941
  echo "#define HAVE_VHOOK 1" >> $TMPH
942
  extralibs="$extralibs $ldl"
943
fi
944
if test "$lshared" = "yes" ; then
945
  echo "BUILD_SHARED=yes" >> config.mak
946
  echo "PIC=-fPIC" >> config.mak
947
fi
948
echo "EXTRALIBS=$extralibs" >> config.mak
949
echo "VERSION=`head $source_path/VERSION`" >>config.mak
950
echo "" >>config.mak
951
# if you do not want to use encoders, disable that.
952
echo "#define CONFIG_ENCODERS 1" >> $TMPH
953
echo "CONFIG_ENCODERS=yes" >> config.mak
954

    
955
# if you do not want to use decoders, disable that.
956
echo "#define CONFIG_DECODERS 1" >> $TMPH
957
echo "CONFIG_DECODERS=yes" >> config.mak
958

    
959
# AC3
960
if test "$a52" = "yes" ; then
961
  echo "#define CONFIG_AC3 1" >> $TMPH
962
  echo "CONFIG_AC3=yes" >> config.mak
963

    
964
  if test "$a52bin" = "yes" ; then
965
    echo "#define CONFIG_A52BIN 1" >> $TMPH
966
    echo "CONFIG_A52BIN=yes" >> config.mak
967
  fi
968
fi
969

    
970
# PP
971
if test "$pp" = "yes" ; then
972
  echo "#define CONFIG_PP 1" >> $TMPH
973
  echo "CONFIG_PP=yes" >> config.mak
974

    
975
  if test "$shared_pp" = "yes" ; then
976
    echo "#define SHARED_PP 1" >> $TMPH
977
    echo "SHARED_PP=yes" >> config.mak
978
  fi
979
fi
980

    
981
# mpeg audio high precision mode
982
if test "$mpegaudio_hp" = "yes" ; then
983
  echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
984
fi
985

    
986
if test "$v4l" = "yes" ; then
987
  echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
988
  echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
989
fi
990

    
991
if test "$dv1394" = "yes" ; then
992
  echo "#define CONFIG_DV1394 1" >> $TMPH
993
  echo "CONFIG_DV1394=yes" >> config.mak
994
fi
995

    
996
if test "$dlopen" = "yes" ; then
997
  echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
998
fi
999

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

    
1004
if test "$audio_oss" = "yes" ; then
1005
  echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1006
  echo "CONFIG_AUDIO_OSS=yes" >> config.mak
1007
fi
1008

    
1009
if test "$audio_beos" = "yes" ; then
1010
  echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1011
  echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
1012
fi
1013

    
1014
if test "$network" = "yes" ; then
1015
  echo "#define CONFIG_NETWORK 1" >> $TMPH
1016
  echo "CONFIG_NETWORK=yes" >> config.mak
1017
fi
1018

    
1019
if test "$zlib" = "yes" ; then
1020
  echo "#define CONFIG_ZLIB 1" >> $TMPH
1021
  echo "CONFIG_ZLIB=yes" >> config.mak
1022
fi
1023

    
1024
if test "$mp3lame" = "yes" ; then
1025
  echo "#define CONFIG_MP3LAME 1" >> $TMPH
1026
  echo "CONFIG_MP3LAME=yes" >> config.mak
1027
fi
1028

    
1029
if test "$vorbis" = "yes" ; then
1030
  echo "#define CONFIG_VORBIS 1" >> $TMPH
1031
  echo "CONFIG_VORBIS=yes" >> config.mak
1032
fi
1033

    
1034
if test "$faad" = "yes" ; then
1035
  echo "#define CONFIG_FAAD 1" >> $TMPH
1036
  echo "CONFIG_FAAD=yes" >> config.mak
1037
fi
1038

    
1039
if test "$faadbin" = "yes" ; then
1040
  echo "#define CONFIG_FAADBIN 1" >> $TMPH
1041
  echo "CONFIG_FAADBIN=yes" >> config.mak
1042
fi
1043

    
1044
if test "$mingw32" = "yes" ; then
1045
  echo "#define CONFIG_WIN32 1" >> $TMPH
1046
  echo "CONFIG_WIN32=yes" >> config.mak
1047
  echo "#ifndef __MINGW32__" >> $TMPH
1048
  echo "#define __MINGW32__ 1" >> $TMPH
1049
  echo "#endif" >> $TMPH
1050
  echo "__MINGW32__=1" >> config.mak
1051
fi
1052

    
1053
if test "$cygwin" = "yes" ; then
1054
  # setup correct exesuffix
1055
  echo "CONFIG_WIN32=yes" >> config.mak
1056
fi
1057

    
1058
if test "$os2" = "yes" ; then
1059
  echo "#define CONFIG_OS2 1" >> $TMPH
1060
  echo "CONFIG_OS2=yes" >> config.mak
1061
fi
1062

    
1063
if test "$TARGET_OS" = "SunOS" ; then
1064
  echo "#define CONFIG_SUNOS 1" >> $TMPH
1065
fi
1066

    
1067
if test "$darwin" = "yes"; then
1068
  echo "#define CONFIG_DARWIN 1"  >> $TMPH
1069
  echo "CONFIG_DARWIN=yes" >> config.mak
1070
fi
1071

    
1072
if test "$_malloc_h" = "yes" ; then
1073
  echo "#define HAVE_MALLOC_H 1" >> $TMPH
1074
else
1075
  echo "#undef  HAVE_MALLOC_H" >> $TMPH
1076
fi
1077

    
1078
if test "$_memalign" = "yes" ; then
1079
  echo "#define HAVE_MEMALIGN 1" >> $TMPH
1080
else
1081
  echo "#undef  HAVE_MEMALIGN" >> $TMPH
1082
fi
1083

    
1084
if test "$netserver" = "yes" ; then
1085
  echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
1086
  echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
1087
fi
1088

    
1089
if test "$need_inet_aton" = "yes" ; then
1090
  echo "NEED_INET_ATON=yes" >> config.mak
1091
fi
1092

    
1093
if test "$simpleidct" = "yes" ; then
1094
  echo "#define SIMPLE_IDCT 1" >> $TMPH
1095
fi
1096

    
1097
if test "$ffserver" = "yes" ; then
1098
  echo "#define CONFIG_FFSERVER 1" >> $TMPH
1099
  echo "CONFIG_FFSERVER=yes" >> config.mak
1100
fi
1101

    
1102
if test "$ffplay" = "yes" ; then
1103
  echo "CONFIG_FFPLAY=yes" >> config.mak
1104
fi
1105

    
1106
if test "$risky" = "yes" ; then
1107
  echo "#define CONFIG_RISKY 1" >> $TMPH
1108
  echo "CONFIG_RISKY=yes" >> config.mak
1109
fi
1110

    
1111
echo "#define restrict $_restrict" >> $TMPH
1112

    
1113
# build tree in object directory if source path is different from current one
1114
if test "$source_path_used" = "yes" ; then
1115
    DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
1116
          libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
1117
    FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
1118
    for dir in $DIRS ; do
1119
            mkdir -p $dir
1120
    done
1121
    for f in $FILES ; do
1122
        ln -sf $source_path/$f $f
1123
    done
1124
fi
1125
echo "SRC_PATH=$source_path" >> config.mak
1126

    
1127
if test "$amr_nb" = "yes" ; then
1128
  echo "#define AMR_NB 1" >> $TMPH
1129
  echo "AMR_NB=yes" >> config.mak
1130
  echo
1131
if test "$amr_nb_fixed" = "yes" ; then
1132
  echo "AMR_NB_FIXED=yes" >> config.mak
1133
  echo "#define AMR_NB_FIXED 1" >> $TMPH
1134
  echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
1135
  echo "REL-5 version 5.1.0 from "
1136
  echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-510.zip"
1137
  echo "and extracted src to libavcodec/amr"
1138
  echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
1139
  echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
1140
  echo
1141
else
1142
  echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
1143
  echo "REL-5 V5.1.0 from "
1144
  echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-510.zip"
1145
  echo "and extracted the source to libavcodec/amr_float"
1146
  echo
1147
fi
1148

    
1149
fi
1150

    
1151
diff $TMPH config.h >/dev/null 2>&1
1152
if test $? -ne 0 ; then
1153
	mv -f $TMPH config.h
1154
else
1155
	echo "config.h is unchanged"
1156
fi
1157

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