Statistics
| Branch: | Revision:

ffmpeg / configure @ 7a91333f

History | View | Annotate | Download (36.4 KB)

1
#!/bin/sh
2
#
3
# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
4
#
5

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

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

    
12
EOF
13
echo "Standard options:"
14
echo "  --help                   print this message"
15
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
16
echo "  --mandir=DIR             man documentation in DIR [PREFIX/man]"
17
echo "  --enable-mp3lame         enable mp3 encoding via libmp3lame [default=no]"
18
echo "  --enable-vorbis          enable vorbis support via libvorbisenc [default=no]"
19
echo "  --enable-faad            enable faad support via libfaad [default=no]"
20
echo "  --enable-faadbin         build faad support with runtime linking [default=no]"
21
echo "  --enable-faac            enable faac support via libfaac [default=no]"
22
echo "  --enable-xvid            enable xvid support via xvidcore [default=no]"
23
echo "  --enable-mingw32         enable mingw32 native/cross windows compile"
24
echo "  --enable-a52             enable GPL'ed A52 support [default=no]"
25
echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
26
echo "  --enable-dts             enable GPL'ed DTS support [default=no]"
27
echo "  --enable-pp              enable GPL'ed post processing support [default=no]"
28
echo "  --enable-shared-pp       use libpostproc.so [default=no]"
29
echo "  --enable-shared          build shared libraries [default=no]"
30
echo "  --enable-amr_nb          enable amr_nb float audio codec"
31
echo "  --enable-amr_nb-fixed    use fixed point for amr-nb codec"
32
echo "  --enable-amr_wb          enable amr_wb float audio codec"
33
echo "  --enable-sunmlib         use Sun medialib [default=no]"
34
echo "  --enable-pthreads        use pthreads [default=no]"
35
echo "  --enable-dc1394          enable IIDC-1394 grabbing using libdc1394 and libraw1394 [default=no]"
36
echo "  --enable-gpl             allow use of gpl code, the resulting libav* and ffmpeg will be under gpl [default=no]"
37
echo ""
38
echo "Advanced options (experts only):"
39
echo "  --source-path=PATH       path of source code [$source_path]"
40
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
41
echo "  --cc=CC                  use C compiler CC [$cc]"
42
echo "  --make=MAKE              use specified make [$make]"
43
echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
44
echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
45
echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
46
echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
47
echo "  --tune=PROCESSOR         tune code for a particular CPU (may fails or misperforms on other CPUs)"
48
echo "  --powerpc-perf-enable    enable performance report on PPC (requires enabling PMC)"
49
echo "  --disable-mmx            disable mmx usage"
50
echo "  --disable-altivec        disable AltiVec usage"
51
echo "  --disable-audio-oss      disable OSS audio support [default=no]"
52
echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
53
echo "  --disable-v4l            disable video4linux grabbing [default=no]"
54
echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
55
echo "  --disable-network        disable network support [default=no]"
56
echo "  --disable-zlib           disable zlib [default=no]"
57
echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
58
echo "  --disable-vhook          disable video hooking support"
59
echo "  --enable-gprof           enable profiling with gprof [$gprof]"
60
echo "  --disable-debug          disable debugging symbols"
61
echo "  --disable-opts           disable compiler optimizations"
62
echo "  --disable-mpegaudio-hp   faster (but less accurate)"
63
echo "                           mpegaudio decoding [default=no]"
64
echo "  --disable-ffserver       disable ffserver build"
65
echo "  --disable-ffplay         disable ffplay build"
66
echo "  --disable-risky          disables patent encumbered codecs"
67
echo "  --enable-small           optimize for size instead of speed"
68
echo "  --enable-memalign-hack   emulate memalign, interferes with memory debuggers"
69
echo "  --disable-strip          disable stripping of executables and shared libraries"
70
echo ""
71
echo "NOTE: The object files are build at the place where configure is launched"
72
exit 1
73
fi
74

    
75
# set temporary file name
76
if test ! -z "$TMPDIR" ; then
77
    TMPDIR1="${TMPDIR}"
78
elif test ! -z "$TEMPDIR" ; then
79
    TMPDIR1="${TEMPDIR}"
80
else
81
    TMPDIR1="/tmp"
82
fi
83

    
84
TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
85
TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
86
TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
87
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
88
TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
89

    
90
# default parameters
91
prefix="/usr/local"
92
mandir=""
93
bindir=""
94
cross_prefix=""
95
cc="gcc"
96
ar="ar"
97
ranlib="ranlib"
98
make="make"
99
strip="strip"
100
cpu=`uname -m`
101
tune="generic"
102
powerpc_perf="no"
103
mmx="default"
104
altivec="default"
105
mmi="default"
106
case "$cpu" in
107
  i386|i486|i586|i686|i86pc|BePC)
108
    cpu="x86"
109
  ;;
110
  x86_64)
111
    if [ "`$cc -dumpmachine | grep x86_64 | cut -d- -f1`" = "x86_64" -a \
112
         -z "`echo $CFLAGS | grep -- -m32`"  ]; then
113
      cpu="x86_64"
114
    else
115
      cpu="x86"
116
    fi
117
  ;;
118
  # armv4l is a subset of armv5tel
119
  armv4l|armv5tel)
120
    cpu="armv4l"
121
  ;;
122
  alpha)
123
    cpu="alpha"
124
  ;;
125
  "Power Macintosh"|ppc)
126
    cpu="powerpc"
127
  ;;
128
  mips)
129
    cpu="mips"
130
  ;;
131
  sun4u|sparc64)
132
    cpu="sparc64"
133
  ;;
134
  sparc)
135
    cpu="sparc"
136
  ;;
137
  sh4)
138
    cpu="sh4"
139
  ;;
140
  *)
141
    cpu="unknown"
142
  ;;
143
esac
144
gprof="no"
145
v4l="yes"
146
audio_oss="yes"
147
audio_beos="no"
148
dv1394="yes"
149
dc1394="no"
150
network="yes"
151
zlib="yes"
152
mp3lame="no"
153
vorbis="no"
154
faad="no"
155
faadbin="no"
156
faac="no"
157
xvid="no"
158
a52="no"
159
a52bin="no"
160
dts="no"
161
pp="no"
162
shared_pp="no"
163
mingw32="no"
164
cygwin="no"
165
os2="no"
166
lshared="no"
167
optimize="yes"
168
debug="yes"
169
dostrip="yes"
170
extralibs="-lm"
171
simpleidct="yes"
172
bigendian="no"
173
inttypes="yes"
174
emu_fast_int="no"
175
vhook="default"
176
dlfcn="no"
177
dlopen="no"
178
mpegaudio_hp="yes"
179
SHFLAGS=-shared
180
netserver="no"
181
need_inet_aton="no"
182
ffserver="yes"
183
ffplay="yes"
184
LDFLAGS=-Wl,--warn-common
185
FFSLDFLAGS=-Wl,-E
186
LIBPREF="lib"
187
LIBSUF=".a"
188
SLIBPREF="lib"
189
SLIBSUF=".so"
190
EXESUF=""
191
risky="yes"
192
amr_nb="no"
193
amr_wb="no"
194
amr_nb_fixed="no"
195
sunmlib="no"
196
pthreads="no"
197
gpl="no"
198
memalignhack="no"
199

    
200
# OS specific
201
targetos=`uname -s`
202
case $targetos in
203
BeOS)
204
prefix="/boot/home/config"
205
# helps building libavcodec
206
CFLAGS="-DPIC -fomit-frame-pointer"
207
# 3 gcc releases known for BeOS, each with ugly bugs
208
gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
209
case "$gcc_version" in
210
2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
211
mmx="no"
212
;;
213
*20010315*) echo "BeBits gcc"
214
CFLAGS="$CFLAGS -fno-expensive-optimizations"
215
;;
216
esac
217
SHFLAGS=-nostart
218
# disable linux things
219
audio_oss="no"
220
v4l="no"
221
dv1394="no"
222
# enable beos things
223
audio_beos="yes"
224
# no need for libm, but the inet stuff
225
# Check for BONE
226
if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
227
extralibs="-lbind -lsocket"
228
else
229
netserver="yes"
230
need_inet_aton="yes"
231
extralibs="-lnet"
232
fi ;;
233
SunOS)
234
v4l="no"
235
audio_oss="no"
236
dv1394="no"
237
make="gmake"
238
LDFLAGS=""
239
FFSLDFLAGS=""
240
need_inet_aton="yes"
241
extralibs="$extralibs -lsocket -lnsl"
242
;;
243
FreeBSD)
244
v4l="no"
245
audio_oss="yes"
246
dv1394="no"
247
make="gmake"
248
CFLAGS="-pthread"
249
LDFLAGS="$LDFLAGS -export-dynamic -pthread"
250
;;
251
BSD/OS)
252
v4l="no"
253
audio_oss="yes"
254
dv1394="no"
255
extralibs="-lpoll -lgnugetopt -lm"
256
make="gmake"
257
;;
258
Darwin)
259
cc="cc"
260
v4l="no"
261
audio_oss="no"
262
dv1394="no"
263
ffserver="no"
264
SHFLAGS="-dynamiclib"
265
extralibs=""
266
darwin="yes"
267
strip="strip -x"
268
LDFLAGS="-Wl,-d"
269
FFSLDFLAGS=-Wl,-bind_at_load
270
;;
271
MINGW32*)
272
# Note: the rest of the mingw32 config is done afterwards as mingw32
273
# can be forced on command line for linux cross compilation
274
mingw32="yes"
275
;;
276
CYGWIN*)
277
v4l="no"
278
audio_oss="yes"
279
dv1394="no"
280
extralibs=""
281
cygwin="yes"
282
test -f /usr/include/inttypes.h || \
283
test -f /usr/local/include/inttypes.h || \
284
echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
285
     "/usr/local/include/inttypes.h !!!"
286
;;
287
Linux)
288
LDFLAGS="$LDFLAGS -rdynamic"
289
;;
290
IRIX*)
291
ranlib="echo ignoring ranlib"
292
v4l="no"
293
audio_oss="no"
294
make="gmake"
295
;;
296
OS/2)
297
TMPE=$TMPE".exe"
298
ar="emxomfar -p64"
299
ranlib="echo ignoring ranlib"
300
strip="echo ignoring strip"
301
CFLAGS="-Zomf"
302
LDFLAGS="-Zomf -Zstack 16384 -s"
303
SHFLAGS=""
304
FFSLDFLAGS=""
305
LIBPREF=""
306
LIBSUF=".lib"
307
SLIBPREF=""
308
SLIBSUF=".dll"
309
EXESUF=".exe"
310
extralibs=""
311
v4l="no"
312
audio_oss="no"
313
dv1394="no"
314
network="no"
315
ffserver="no"
316
os2="yes"
317
;;
318
*) ;;
319
esac
320

    
321
# From mplayer configure. We need TARGET_OS available
322
# to the Makefile, so it can distinguish between flavors
323
# of AltiVec on PowerPC
324
TARGET_OS=`( uname -s ) 2>&1`
325
  case "$TARGET_OS" in
326
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
327
    ;;
328
  IRIX*)
329
    TARGET_OS=IRIX
330
    ;;
331
  HP-UX*)
332
    TARGET_OS=HP-UX
333
    ;;
334
  [cC][yY][gG][wW][iI][nN]*)
335
    TARGET_OS=CYGWIN
336
    ;;
337
  *)
338
    TARGET_OS="$TARGET_OS-UNKNOWN"
339
    ;;
340
  esac
341

    
342
# find source path
343
# XXX: we assume an absolute path is given when launching configure, 
344
# except in './configure' case.
345
source_path="`echo $0 | sed -e 's#/configure##'`"
346
source_path_used="yes"
347
if test -z "$source_path" -o "$source_path" = "." ; then
348
    source_path=`pwd`
349
    source_path_used="no"
350
fi
351

    
352
FFMPEG_CONFIGURATION=" "
353
for opt do
354
  FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
355
done
356

    
357
for opt do
358
  case "$opt" in
359
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
360
  ;;
361
  --mandir=*) mandir=`echo $opt | cut -d '=' -f 2`
362
  ;;
363
  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
364
  ;;
365
  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
366
  ;;
367
  --cc=*) cc=`echo $opt | cut -d '=' -f 2`
368
  ;;
369
  --make=*) make=`echo $opt | cut -d '=' -f 2`
370
  ;;
371
  --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
372
  ;;
373
  --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
374
  ;;
375
  --extra-libs=*) extralibs=${opt#--extra-libs=}
376
  ;;
377
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
378
  ;;
379
  --tune=*) tune=`echo $opt | cut -d '=' -f 2`
380
  ;;
381
  --powerpc-perf-enable) powerpc_perf="yes"
382
  ;;
383
  --disable-mmx) mmx="no"
384
  ;;
385
  --disable-altivec) altivec="no"
386
  ;;
387
  --enable-gprof) gprof="yes"
388
  ;;
389
  --disable-v4l) v4l="no"
390
  ;;
391
  --disable-audio-oss) audio_oss="no"
392
  ;;
393
  --disable-audio-beos) audio_beos="no"
394
  ;;
395
  --disable-dv1394) dv1394="no"
396
  ;;
397
  --disable-network) network="no"; ffserver="no"
398
  ;;
399
  --disable-zlib) zlib="no"
400
  ;;
401
  --enable-a52) a52="yes"
402
  ;;
403
  --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
404
  ;;
405
  --enable-dts) dts="yes" ; extralibs="$extralibs -ldts"
406
  ;;
407
  --enable-pp) pp="yes"
408
  ;;
409
  --enable-shared-pp) shared_pp="yes"
410
  ;;
411
  --enable-mp3lame) mp3lame="yes"
412
  ;;
413
  --enable-vorbis) vorbis="yes"
414
  ;;
415
  --enable-faad) faad="yes"
416
  ;;
417
  --enable-faadbin) faadbin="yes"
418
  ;;
419
  --enable-faac) faac="yes"
420
  ;;
421
  --enable-xvid) xvid="yes"
422
  ;;
423
  --enable-dc1394) dc1394="yes"
424
  ;;
425
  --disable-vhook) vhook="no"
426
  ;;
427
  --disable-simple_idct) simpleidct="no"
428
  ;;
429
  --enable-mingw32) mingw32="yes"
430
  ;;
431
  --enable-shared) lshared="yes"
432
  ;;
433
  --disable-debug) debug="no"
434
  ;;
435
  --disable-opts) optimize="no"
436
  ;;
437
  --disable-mpegaudio-hp) mpegaudio_hp="no"
438
  ;;
439
  --disable-ffserver) ffserver="no"
440
  ;;
441
  --disable-ffplay) ffplay="no"
442
  ;;
443
  --disable-risky) risky="no"
444
  ;;
445
  --enable-small) optimize="small"
446
  ;;
447
  --enable-amr_nb) amr_nb="yes"
448
  ;;
449
  --enable-amr_nb-fixed) amr_nb_fixed="yes"
450
  ;;
451
  --enable-amr_wb) amr_wb="yes"
452
  ;; 
453
  --enable-sunmlib) sunmlib="yes"
454
  ;;
455
  --enable-pthreads) pthreads="yes"
456
  ;;
457
  --enable-gpl) gpl="yes"
458
  ;;
459
  --enable-memalign-hack) memalignhack="yes"
460
  ;;
461
  --disable-strip) dostrip="no"
462
  ;;
463
  esac
464
done
465

    
466
if test "$gpl" != "yes"; then
467
    if test "$pp" != "no" -o "$shared_pp" != "no"; then
468
        echo "The Postprocessing code is under GPL and --enable-gpl is not specified"
469
        fail="yes"
470
    fi
471

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

    
477
    if test "$xvid" != "no"; then
478
        echo "libxvidcore is under GPL and --enable-gpl is not specified"
479
        fail="yes"
480
    fi
481

    
482
    if test "$dts" != "no"; then
483
        echo "libdts is under GPL and --enable-gpl is not specified"
484
        fail="yes"
485
    fi
486
    
487
    if test "$faad" != "no" -o "$faadbin" != "no"; then
488
        cat > $TMPC << EOF
489
            #include <faad.h>
490
            int main( void ) { return 0; }
491
EOF
492
    
493
        if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
494
            cat > $TMPC << EOF
495
                #include <faad.h>
496
                #ifndef FAAD2_VERSION
497
                ok faad1
498
                #endif
499
                int main( void ) { return 0; }
500
EOF
501
            if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
502
                echo "faad2 is under GPL and --enable-gpl is not specified"
503
                fail="yes"
504
            fi
505
        else
506
            faad="no"
507
            faadbin="no"
508
            echo "faad test failed"
509
        fi
510
    fi
511
   
512

    
513
    if test "$fail" = "yes"; then
514
        exit 1
515
    fi
516
fi
517

    
518
# compute mmx state
519
if test $mmx = "default"; then
520
    if test $cpu = "x86" -o $cpu = "x86_64"; then
521
        mmx="yes"
522
    else
523
        mmx="no"
524
    fi
525
fi
526

    
527
#Darwin CC versions
528
needmdynamicnopic="no"
529
if test $targetos = Darwin; then
530
    if test -n "`$cc -v 2>&1 | grep xlc`"; then
531
	CFLAGS="$CFLAGS -qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
532
    else
533
	gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
534
	case "$gcc_version" in
535
	    *2.95*) 
536
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
537
		;;
538
	    *3.*)
539
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare"
540
		if test "$lshared" = no; then
541
		   needmdynamicnopic="yes"
542
		fi
543
		;;
544
	    *)
545
		CFLAGS="$CFLAGS -no-cpp-precomp -pipe -fomit-frame-pointer"
546
		if test "$lshared" = no; then
547
		   needmdynamicnopic="yes"
548
		fi
549
		;;
550
	esac
551
    fi
552
fi
553

    
554
# Can only do AltiVec on PowerPC
555
if test $altivec = "default"; then
556
    if test $cpu = "powerpc"; then
557
        altivec="yes"
558
    else
559
        altivec="no"
560
    fi
561
fi
562

    
563
# Add processor-specific flags
564
TUNECPU="generic"
565
POWERPCMODE="32bits"
566
if test $tune != "generic"; then
567
    case $tune in
568
	601|ppc601|PowerPC601)
569
	    CFLAGS="$CFLAGS -mcpu=601"
570
	    if test $altivec = "yes"; then
571
		echo "WARNING: tuning for PPC601 but altivec enabled !";
572
	    fi
573
	    TUNECPU=ppc601
574
	;;
575
	603*|ppc603*|PowerPC603*)
576
	    CFLAGS="$CFLAGS -mcpu=603"
577
	    if test $altivec = "yes"; then
578
		echo "WARNING: tuning for PPC603 but altivec enabled !";
579
	    fi
580
	    TUNECPU=ppc603
581
	;;
582
	604*|ppc604*|PowerPC604*)
583
	    CFLAGS="$CFLAGS -mcpu=604"
584
	    if test $altivec = "yes"; then
585
		echo "WARNING: tuning for PPC604 but altivec enabled !";
586
	    fi
587
	    TUNECPU=ppc604
588
	;;
589
	G3|g3|75*|ppc75*|PowerPC75*)
590
	    CFLAGS="$CFLAGS -mcpu=750 -mtune=750 -mpowerpc-gfxopt"
591
	    if test $altivec = "yes"; then
592
		echo "WARNING: tuning for PPC75x but altivec enabled !";
593
	    fi
594
	    TUNECPU=ppc750
595
	;;
596
	G4|g4|745*|ppc745*|PowerPC745*)
597
	    CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450 -mpowerpc-gfxopt"
598
	    if test $altivec = "no"; then
599
		echo "WARNING: tuning for PPC745x but altivec disabled !";
600
	    fi
601
	    TUNECPU=ppc7450
602
	;;
603
	74*|ppc74*|PowerPC74*)
604
	    CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400 -mpowerpc-gfxopt"
605
	    if test $altivec = "no"; then
606
		echo "WARNING: tuning for PPC74xx but altivec disabled !";
607
	    fi
608
	    TUNECPU=ppc7400
609
	;;
610
	G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
611
	    CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc-gfxopt -mpowerpc64"
612
	    if test $altivec = "no"; then
613
		echo "WARNING: tuning for PPC970 but altivec disabled !";
614
	    fi
615
	    TUNECPU=ppc970
616
            POWERPCMODE="64bits"
617
	;;
618
	*)
619
	echo "WARNING: unknown CPU "$tune", ignored"
620
	;;
621
    esac
622
fi
623

    
624
# AltiVec flags: The FSF version of GCC differs from the Apple version 
625
if test $cpu = "powerpc"; then
626
    if test $altivec = "yes"; then
627
        if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
628
            CFLAGS="$CFLAGS -faltivec"
629
        else
630
            CFLAGS="$CFLAGS -maltivec -mabi=altivec"
631
        fi
632
    fi
633
fi
634

    
635
# See if we have <altivec.h>
636
cat > $TMPC << EOF
637
#include <altivec.h>
638
int main( void ) { return 0; }
639
EOF
640

    
641
_altivec_h="no"
642
if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
643
_altivec_h="yes"
644
fi
645

    
646
# See does our compiler support Motorola AltiVec C API
647
if test $altivec = "yes"; then
648
if test $_altivec_h = "yes"; then
649
cat > $TMPC << EOF
650
#include <altivec.h>
651
int main(void) {
652
    vector signed int v1, v2, v3;
653
    v1 = vec_add(v2,v3);
654
    return 0;
655
}
656
EOF
657
else
658
cat > $TMPC << EOF
659
int main(void) {
660
    vector signed int v1, v2, v3;
661
    v1 = vec_add(v2,v3);
662
    return 0;
663
}
664
EOF
665
fi
666
$cc $CFLAGS -o $TMPE $TMPC 2> /dev/null || altivec="no"
667
fi
668

    
669
# Can only do mmi on mips
670
if test $mmi = "default"; then
671
    if test $cpu = "mips"; then
672
        mmi="yes"
673
    else
674
        mmi="no"
675
    fi
676
fi
677

    
678
# See does our compiler support mmi
679
if test $mmi = "yes"; then
680
cat > $TMPC << EOF
681
int main(void) {
682
    __asm__ ("lq \$2, 0(\$2)");
683
    return 0;
684
}
685
EOF
686
$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
687
fi
688

    
689
if test "$mingw32" = "yes" ; then
690
    v4l="no"
691
    audio_oss="no"
692
    dv1394="no"
693
    dc1394="no"
694
    ffserver="no"
695
    network="no"
696
    LIBPREF=""
697
    LIBSUF=".lib"
698
    SLIBPREF=""
699
    SLIBSUF=".dll"
700
    EXESUF=".exe"
701
    prefix="/c/Program Files/FFmpeg"
702
    bindir="$prefix"
703
fi
704

    
705
cc="${cross_prefix}${cc}"
706
ar="${cross_prefix}${ar}"
707
ranlib="${cross_prefix}${ranlib}"
708
strip="${cross_prefix}${strip}"
709

    
710
if test -z "$cross_prefix" ; then
711

    
712
# ---
713
# big/little endian test
714
cat > $TMPC << EOF
715
#include <inttypes.h>
716
int main(int argc, char ** argv){
717
	volatile uint32_t i=0x01234567;
718
	return (*((uint8_t*)(&i))) == 0x67;
719
}
720
EOF
721

    
722
if $cc -o $TMPE $TMPC 2>/dev/null ; then
723
$TMPE && bigendian="yes"
724
else
725
echo big/little test failed
726
fi
727

    
728
else
729

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

    
735
fi
736

    
737
# ---
738
# *inttypes.h* test
739
cat > $TMPC << EOF
740
#include <inttypes.h>
741
int main(int argc, char ** argv){
742
    return 0;
743
}
744
EOF
745

    
746
$cc -o $TMPE $TMPC 2>/dev/null || inttypes="no"
747

    
748
# ---
749
# *int_fast* test
750
cat > $TMPC << EOF
751
#include <inttypes.h>
752
int main(int argc, char ** argv){
753
	volatile uint_fast64_t i=0x01234567;
754
	return 0;
755
}
756
EOF
757

    
758
$cc -o $TMPE $TMPC 2>/dev/null || emu_fast_int="yes"
759

    
760
# ---
761
# check availability of some header files
762

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

    
768
_memalign=no
769
_malloc_h=no
770
if $cc -o $TMPE $TMPC 2> /dev/null ; then
771
_malloc_h=yes
772
_memalign=yes
773
# check for memalign - atmos
774
cat > $TMPC << EOF
775
#include <malloc.h>
776
int main ( void ) {
777
char *string = NULL;
778
string = memalign(64, sizeof(char));
779
return 0;
780
}
781
EOF
782
$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
783
fi
784

    
785
if test "$_memalign" = "no" -a "$mmx" = "yes" -a "$memalignhack" != "yes"; then
786
    echo "error, no memalign() but sse enabled, either disable it or use --enable-memalign-hack"
787
    exit 1
788
fi
789

    
790
cat > $TMPC << EOF
791
#include <time.h>
792
int main( void ) { localtime_r(NULL, NULL); }
793
EOF
794

    
795
localtime_r=no
796
if $cc -o $TMPE $TMPC 2> /dev/null ; then
797
  localtime_r=yes
798
fi
799

    
800
if test "$zlib" = "yes"; then
801
# check for zlib - mmu_man
802
cat > $TMPC << EOF
803
#include <zlib.h>
804
int main ( void ) {
805
if (zlibVersion() != ZLIB_VERSION)
806
   puts("zlib version differs !!!");
807
   return 1;
808
return 0;
809
}
810
EOF
811
$cc $CFLAGS -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
812
# $TMPE 2> /dev/null > /dev/null || zlib="no"
813
# XXX: more tests needed - runtime test
814
fi
815
if test "$zlib" = "yes"; then
816
extralibs="$extralibs -lz"
817
fi
818

    
819
# test for lrintf in math.h
820
cat > $TMPC << EOF
821
#define _ISOC9X_SOURCE  1
822
#include <math.h>
823
int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
824
EOF
825

    
826
have_lrintf="no"
827
if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
828
  have_lrintf="yes"
829
  # allanc@chickenandporn.com: cannot execute cross-compiled
830
  # code on the host.  Only execute if not cross-compiling.
831
  if test -z "$cross_prefix" ; then
832
    $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
833
  fi
834
fi
835

    
836
_restrict=
837
for restrict_keyword in restrict __restrict__ __restrict; do
838
  echo "void foo(char * $restrict_keyword p);" > $TMPC
839
  if $cc -c -o $TMPO $TMPC 2> /dev/null; then
840
    _restrict=$restrict_keyword
841
    break;
842
  fi
843
done
844

    
845
# test gcc version to see if vector builtins can be used
846
# currently only used on i386 for MMX builtins
847
cat > $TMPC << EOF
848
#include <xmmintrin.h>
849
int main(void) { 
850
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
851
return 0;
852
#else
853
#error no vector builtins
854
#endif
855
}
856
EOF
857

    
858
builtin_vector=no
859
if $cc -o $TMPO $TMPC 2> /dev/null ; then
860
  builtin_vector=yes
861
fi
862

    
863
# dlopen/dlfcn.h probing
864

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

    
870
ldl=-ldl
871

    
872
if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1 ; then
873
dlfcn=yes
874
dlopen=yes
875
fi
876

    
877
if $cc -o $TMPE $TMPC > /dev/null 2>&1 ; then
878
dlfcn=yes
879
dlopen=yes
880
ldl=""
881
fi
882

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

    
887
if $cc -o $TMPE $TMPC -ldl > /dev/null 2>&1  ; then
888
dlopen=yes
889
fi
890

    
891
if $cc -o $TMPE $TMPC > /dev/null 2>&1  ; then
892
dlopen=yes
893
ldl=""
894
fi
895

    
896
if test "$vhook" = "default" ; then
897
  vhook="$dlopen"
898
fi
899

    
900
##########################################
901
# imlib probe
902

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

    
909
imlib2=no
910
if $cc -o $TMPE $TMPC -lImlib2 -lm > /dev/null 2>&1  ; then
911
imlib2=yes
912
fi
913

    
914
##########################################
915
# freetype probe
916

    
917
cat > $TMPC << EOF
918
#include <ft2build.h>
919
int main( void ) { return (int) FT_Init_FreeType(0); }
920
EOF
921

    
922
freetype2=no
923
if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
924
  if (freetype-config --version) >/dev/null 2>&1 ; then
925
    if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs`  > /dev/null 2>&1 ; then
926
      freetype2=yes
927
    fi
928
  fi
929
fi
930

    
931
##########################################
932
# SDL probe
933

    
934
cat > $TMPC << EOF
935
#include <SDL.h>
936
#undef main /* We don't want SDL to override our main() */
937
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
938
EOF
939

    
940
sdl_too_old=no
941
sdl=no
942
if (sdl-config --version) >/dev/null 2>&1 ; then
943
if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs`  > /dev/null 2>&1  ; then
944
_sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
945
if test "$_sdlversion" -lt 121 ; then
946
sdl_too_old=yes
947
else
948
sdl=yes
949
fi
950
fi
951
fi
952

    
953
##########################################
954
# texi2html probe
955

    
956
texi2html=no
957
if (texi2html -version) >/dev/null 2>&1; then
958
texi2html=yes
959
fi
960

    
961
if test "$network" = "yes" ; then
962
##########################################
963
# IPv6 probe
964

    
965
cat > $TMPC << EOF
966
#include <sys/types.h>
967
#include <sys/socket.h>
968
#include <netinet/in.h>
969
#include <netdb.h>
970
int main( void ) {
971
  struct sockaddr_storage saddr;
972
  struct ipv6_mreq mreq6;
973
  getaddrinfo(0,0,0,0);
974
  getnameinfo(0,0,0,0,0,0,0);
975
  IN6_IS_ADDR_MULTICAST(0);
976
}
977
EOF
978

    
979
ipv6=no
980
if $cc -o $TMPE $TMPC > /dev/null 2>&1  ; then
981
ipv6=yes
982
fi
983
fi
984

    
985
case "`$cc -v 2>&1 | grep version`" in
986
    *gcc*)
987
	CFLAGS="-Wall $CFLAGS"
988
	;;
989
    *)
990
	;;
991
esac
992

    
993
if test "$sdl" = "no" ; then
994
   ffplay=no
995
fi
996

    
997
if test "$debug" = "yes"; then
998
	CFLAGS="-g $CFLAGS"
999
fi
1000

    
1001
if test "$optimize" = "small"; then
1002
#  CFLAGS=${CFLAGS//-O3/-Os}
1003
  CFLAGS="$CFLAGS -Os"
1004
fi
1005

    
1006
if test "$optimize" = "yes"; then
1007
    if test -n "`$cc -v 2>&1 | grep xlc`"; then
1008
	CFLAGS="$CFLAGS -O5"
1009
	LDFLAGS="$LDFLAGS -O5"
1010
    else
1011
	CFLAGS="-O3 $CFLAGS"
1012
    fi
1013
fi
1014

    
1015
if test x"$bindir" = x""; then
1016
bindir="${prefix}/bin"
1017
fi
1018

    
1019
if test x"$mandir" = x""; then
1020
mandir="${prefix}/man"
1021
fi
1022

    
1023
echo "Install prefix   $prefix"
1024
echo "Source path      $source_path"
1025
echo "C compiler       $cc"
1026
echo "make             $make"
1027
echo "CPU              $cpu ($tune)"
1028
echo "Big Endian       $bigendian"
1029
echo "inttypes.h       $inttypes"
1030
echo "broken inttypes.h $emu_fast_int"
1031
if test $cpu = "x86" -o $cpu = "x86_64"; then
1032
echo "MMX enabled      $mmx"
1033
echo "Vector Builtins  $builtin_vector"
1034
fi
1035
if test $cpu = "mips"; then
1036
echo "MMI enabled      $mmi"
1037
fi
1038
if test $cpu = "powerpc"; then
1039
echo "AltiVec enabled  $altivec"
1040
fi
1041
echo "gprof enabled    $gprof"
1042
echo "zlib enabled     $zlib"
1043
echo "mp3lame enabled  $mp3lame"
1044
echo "vorbis enabled   $vorbis"
1045
echo "faad enabled     $faad"
1046
echo "faadbin enabled  $faadbin"
1047
echo "faac enabled     $faac"
1048
echo "xvid enabled     $xvid"
1049
echo "a52 support      $a52"
1050
echo "a52 dlopened     $a52bin"
1051
echo "dts support      $dts"
1052
echo "pp support       $pp"
1053
echo "debug symbols    $debug"
1054
echo "strip symbols    $dostrip"
1055
echo "optimize         $optimize"
1056
echo "shared pp        $shared_pp"
1057
echo "Video hooking    $vhook"
1058
echo "SDL support      $sdl"
1059
if test $sdl_too_old = "yes"; then
1060
echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
1061
fi
1062
echo "risky / patent encumbered codecs $risky"
1063

    
1064
if test "$vhook" = "yes" ; then
1065
echo "Imlib2 support   $imlib2"
1066
echo "freetype support $freetype2"
1067
fi
1068
echo "Sun medialib support"  $sunmlib
1069
echo "pthreads support"      $pthreads
1070
echo "AMR-NB float support"  $amr_nb
1071
echo "AMR-NB fixed support"  $amr_nb_fixed
1072
echo "AMR-WB float support"  $amr_wb
1073
echo "network support      $network"
1074
if test "$network" = "yes" ; then
1075
echo "IPv6 support         $ipv6"
1076
fi
1077
if test "$gpl" = "no" ; then
1078
echo "License: LGPL"
1079
else
1080
echo "License: GPL"
1081
fi
1082

    
1083
echo "Creating config.mak and config.h"
1084

    
1085
date >> config.log
1086
echo "   $0 $FFMPEG_CONFIGURATION" >> config.log
1087
echo "# Automatically generated by configure - do not modify" > config.mak
1088
echo "/* Automatically generated by configure - do not modify */" > $TMPH
1089
echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
1090

    
1091
echo "prefix=$prefix" >> config.mak
1092
echo "bindir=$bindir" >> config.mak
1093
echo "mandir=$mandir" >> config.mak
1094
echo "MAKE=$make" >> config.mak
1095
echo "CC=$cc" >> config.mak
1096
echo "AR=$ar" >> config.mak
1097
echo "RANLIB=$ranlib" >> config.mak
1098
if test "$dostrip" = "yes" ; then
1099
echo "STRIP=$strip" >> config.mak
1100
echo "INSTALLSTRIP=-s" >> config.mak
1101
else
1102
echo "STRIP=echo ignoring strip" >> config.mak
1103
echo "INSTALLSTRIP=" >> config.mak
1104
fi
1105

    
1106
# SHCFLAGS is a copy of CFLAGS without -mdynamic-no-pic.  Used when building 
1107
# shared modules on OS/X (vhook/Makefile).
1108
SHCFLAGS=$CFLAGS
1109
if test "$needmdynamicnopic" = yes; then
1110
   CFLAGS="$CFLAGS -mdynamic-no-pic"
1111
fi
1112

    
1113
echo "OPTFLAGS=$CFLAGS" >> config.mak
1114
echo "SHCFLAGS=$SHCFLAGS">>config.mak
1115
echo "LDFLAGS=$LDFLAGS" >> config.mak
1116
echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
1117
echo "SHFLAGS=$SHFLAGS" >> config.mak
1118
echo "LIBPREF=$LIBPREF" >> config.mak
1119
echo "LIBSUF=$LIBSUF" >> config.mak
1120
echo "SLIBPREF=$SLIBPREF" >> config.mak
1121
echo "SLIBSUF=$SLIBSUF" >> config.mak
1122
echo "EXESUF=$EXESUF" >> config.mak
1123
echo "TARGET_OS=$TARGET_OS" >> config.mak
1124
if test "$cpu" = "x86" ; then
1125
  echo "TARGET_ARCH_X86=yes" >> config.mak
1126
  echo "#define ARCH_X86 1" >> $TMPH
1127
elif test "$cpu" = "x86_64" ; then
1128
  echo "TARGET_ARCH_X86_64=yes" >> config.mak
1129
  echo "#define ARCH_X86_64 1" >> $TMPH
1130
elif test "$cpu" = "armv4l" ; then
1131
  echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
1132
  echo "#define ARCH_ARMV4L 1" >> $TMPH
1133
elif test "$cpu" = "alpha" ; then
1134
  echo "TARGET_ARCH_ALPHA=yes" >> config.mak
1135
  echo "#define ARCH_ALPHA 1" >> $TMPH
1136
elif test "$cpu" = "sparc64" ; then
1137
  echo "TARGET_ARCH_SPARC64=yes" >> config.mak
1138
  echo "#define ARCH_SPARC64 1" >> $TMPH
1139
  echo "TARGET_ARCH_SPARC=yes" >> config.mak
1140
  echo "#define ARCH_SPARC 1" >> $TMPH
1141
elif test "$cpu" = "sparc" ; then
1142
  echo "TARGET_ARCH_SPARC=yes" >> config.mak
1143
  echo "#define ARCH_SPARC 1" >> $TMPH
1144
elif test "$cpu" = "powerpc" ; then
1145
  echo "TARGET_ARCH_POWERPC=yes" >> config.mak
1146
  echo "#define ARCH_POWERPC 1" >> $TMPH
1147
  if test $POWERPCMODE = "32bits"; then
1148
    echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
1149
  else
1150
    echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1151
  fi
1152
  if test "$powerpc_perf" = "yes"; then
1153
    echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1154
  fi
1155
elif test "$cpu" = "mips" ; then
1156
  echo "TARGET_ARCH_MIPS=yes" >> config.mak
1157
  echo "#define ARCH_MIPS 1" >> $TMPH
1158
elif test "$cpu" = "sh4" ; then
1159
  echo "TARGET_ARCH_SH4=yes" >> config.mak
1160
  echo "#define ARCH_SH4 1" >> $TMPH
1161
fi
1162
echo "#define TUNECPU $TUNECPU" >> $TMPH
1163
if test "$bigendian" = "yes" ; then
1164
  echo "WORDS_BIGENDIAN=yes" >> config.mak
1165
  echo "#define WORDS_BIGENDIAN 1" >> $TMPH
1166
fi
1167
if test "$inttypes" != "yes" ; then
1168
  echo "#define EMULATE_INTTYPES 1" >> $TMPH
1169
fi
1170
if test "$emu_fast_int" = "yes" ; then
1171
  echo "#define EMULATE_FAST_INT 1" >> $TMPH
1172
fi
1173
if test "$mmx" = "yes" ; then
1174
  echo "TARGET_MMX=yes" >> config.mak
1175
  echo "#define HAVE_MMX 1" >> $TMPH
1176
  echo "#define __CPU__ 586" >> $TMPH
1177
fi
1178
if test "$builtin_vector" = "yes" ; then
1179
  echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
1180
  echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
1181
fi
1182
if test "$mmi" = "yes" ; then
1183
  echo "TARGET_MMI=yes" >> config.mak
1184
  echo "#define HAVE_MMI 1" >> $TMPH
1185
fi
1186
if test "$altivec" = "yes" ; then
1187
  echo "TARGET_ALTIVEC=yes" >> config.mak
1188
  echo "#define HAVE_ALTIVEC 1" >> $TMPH
1189
  echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
1190
  echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
1191
  if test "$_altivec_h" = "yes" ; then
1192
    echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
1193
  else
1194
    echo "#undef HAVE_ALTIVEC_H" >> $TMPH
1195
  fi
1196
fi
1197
if test "$gprof" = "yes" ; then
1198
  echo "TARGET_GPROF=yes" >> config.mak
1199
  echo "#define HAVE_GPROF 1" >> $TMPH
1200
fi
1201
if test "$localtime_r" = "yes" ; then
1202
  echo "#define HAVE_LOCALTIME_R 1" >> $TMPH
1203
fi
1204
if test "$imlib2" = "yes" ; then
1205
  echo "HAVE_IMLIB2=yes" >> config.mak
1206
fi
1207
if test "$freetype2" = "yes" ; then
1208
  echo "HAVE_FREETYPE2=yes" >> config.mak
1209
fi
1210
if test "$sunmlib" = "yes" ; then
1211
  echo "HAVE_MLIB=yes" >> config.mak
1212
  echo "#define HAVE_MLIB 1" >> $TMPH
1213
  extralibs="$extralibs -lmlib"
1214
fi
1215
if test "$pthreads" = "yes" ; then
1216
  echo "HAVE_PTHREADS=yes" >> config.mak
1217
  echo "#define HAVE_PTHREADS 1" >> $TMPH
1218
  if test $targetos != FreeBSD; then
1219
     extralibs="$extralibs -lpthread"
1220
  fi
1221
fi
1222
if test "$sdl" = "yes" ; then
1223
  echo "CONFIG_SDL=yes" >> config.mak
1224
  echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
1225
  echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
1226
fi
1227
if test "$texi2html" = "yes"; then
1228
  echo "BUILD_DOC=yes" >> config.mak
1229
fi
1230
if test "$have_lrintf" = "yes" ; then
1231
  echo "#define HAVE_LRINTF 1" >> $TMPH
1232
fi
1233
if test "$vhook" = "yes" ; then
1234
  echo "BUILD_VHOOK=yes" >> config.mak
1235
  echo "#define HAVE_VHOOK 1" >> $TMPH
1236
  extralibs="$extralibs $ldl"
1237
fi
1238
if test "$lshared" = "yes" ; then
1239
  echo "BUILD_SHARED=yes" >> config.mak
1240
  echo "PIC=-fPIC" >> config.mak
1241
fi
1242
echo "EXTRALIBS=$extralibs" >> config.mak
1243
version=`grep '#define FFMPEG_VERSION ' $source_path/libavcodec/avcodec.h |
1244
 cut -d '"' -f 2`
1245
echo "VERSION=$version" >>config.mak
1246
# if you do not want to use encoders, disable that.
1247
echo "#define CONFIG_ENCODERS 1" >> $TMPH
1248
echo "CONFIG_ENCODERS=yes" >> config.mak
1249

    
1250
# if you do not want to use decoders, disable that.
1251
echo "#define CONFIG_DECODERS 1" >> $TMPH
1252
echo "CONFIG_DECODERS=yes" >> config.mak
1253

    
1254
# AC3
1255
if test "$a52" = "yes" ; then
1256
  echo "#define CONFIG_AC3 1" >> $TMPH
1257
  echo "CONFIG_AC3=yes" >> config.mak
1258

    
1259
  if test "$a52bin" = "yes" ; then
1260
    echo "#define CONFIG_A52BIN 1" >> $TMPH
1261
    echo "CONFIG_A52BIN=yes" >> config.mak
1262
  fi
1263
fi
1264

    
1265
# DTS
1266
if test "$dts" = "yes" ; then
1267
  echo "#define CONFIG_DTS 1" >> $TMPH
1268
  echo "CONFIG_DTS=yes" >> config.mak
1269
fi
1270

    
1271
# PP
1272
if test "$pp" = "yes" ; then
1273
  echo "#define CONFIG_PP 1" >> $TMPH
1274
  echo "CONFIG_PP=yes" >> config.mak
1275

    
1276
  if test "$shared_pp" = "yes" ; then
1277
    echo "#define SHARED_PP 1" >> $TMPH
1278
    echo "SHARED_PP=yes" >> config.mak
1279
  fi
1280
fi
1281

    
1282
# mpeg audio high precision mode
1283
if test "$mpegaudio_hp" = "yes" ; then
1284
  echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
1285
fi
1286

    
1287
if test "$v4l" = "yes" ; then
1288
  echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
1289
  echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
1290
fi
1291

    
1292
if test "$dv1394" = "yes" ; then
1293
  echo "#define CONFIG_DV1394 1" >> $TMPH
1294
  echo "CONFIG_DV1394=yes" >> config.mak
1295
fi
1296

    
1297
if test "$dc1394" = "yes" ; then
1298
  echo "#define CONFIG_DC1394 1" >> $TMPH
1299
  echo "CONFIG_DC1394=yes" >> config.mak
1300
fi
1301

    
1302
if test "$dlopen" = "yes" ; then
1303
  echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
1304
fi
1305

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

    
1310
if test "$audio_oss" = "yes" ; then
1311
  echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
1312
  echo "CONFIG_AUDIO_OSS=yes" >> config.mak
1313
fi
1314

    
1315
if test "$audio_beos" = "yes" ; then
1316
  echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
1317
  echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
1318
fi
1319

    
1320
if test "$network" = "yes" ; then
1321
  echo "#define CONFIG_NETWORK 1" >> $TMPH
1322
  echo "CONFIG_NETWORK=yes" >> config.mak
1323
fi
1324

    
1325
if test "$ipv6" = "yes" ; then
1326
  echo "#define CONFIG_IPV6 1" >> $TMPH
1327
fi
1328

    
1329
if test "$zlib" = "yes" ; then
1330
  echo "#define CONFIG_ZLIB 1" >> $TMPH
1331
  echo "CONFIG_ZLIB=yes" >> config.mak
1332
fi
1333

    
1334
if test "$mp3lame" = "yes" ; then
1335
  echo "#define CONFIG_MP3LAME 1" >> $TMPH
1336
  echo "CONFIG_MP3LAME=yes" >> config.mak
1337
fi
1338

    
1339
if test "$vorbis" = "yes" ; then
1340
  echo "#define CONFIG_VORBIS 1" >> $TMPH
1341
  echo "CONFIG_VORBIS=yes" >> config.mak
1342
fi
1343

    
1344
if test "$faad" = "yes" ; then
1345
  echo "#define CONFIG_FAAD 1" >> $TMPH
1346
  echo "CONFIG_FAAD=yes" >> config.mak
1347
fi
1348

    
1349
if test "$faadbin" = "yes" ; then
1350
  echo "#define CONFIG_FAADBIN 1" >> $TMPH
1351
  echo "CONFIG_FAADBIN=yes" >> config.mak
1352
fi
1353

    
1354
if test "$faac" = "yes" ; then
1355
  echo "#define CONFIG_FAAC 1" >> $TMPH
1356
  echo "CONFIG_FAAC=yes" >> config.mak
1357
fi
1358

    
1359
if test "$xvid" = "yes" ; then
1360
  echo "#define CONFIG_XVID 1" >> $TMPH
1361
  echo "CONFIG_XVID=yes" >> config.mak
1362
fi
1363

    
1364
if test "$mingw32" = "yes" ; then
1365
  echo "#define CONFIG_WIN32 1" >> $TMPH
1366
  echo "CONFIG_WIN32=yes" >> config.mak
1367
  echo "HAVE_W32THREADS=yes" >> config.mak
1368
  echo "#define HAVE_W32THREADS 1" >> $TMPH
1369
  echo "#ifndef __MINGW32__" >> $TMPH
1370
  echo "#define __MINGW32__ 1" >> $TMPH
1371
  echo "#endif" >> $TMPH
1372
fi
1373

    
1374
if test "$os2" = "yes" ; then
1375
  echo "#define CONFIG_OS2 1" >> $TMPH
1376
  echo "CONFIG_OS2=yes" >> config.mak
1377
fi
1378

    
1379
if test "$TARGET_OS" = "SunOS" ; then
1380
  echo "#define CONFIG_SUNOS 1" >> $TMPH
1381
fi
1382

    
1383
if test "$darwin" = "yes"; then
1384
  echo "#define CONFIG_DARWIN 1"  >> $TMPH
1385
  echo "CONFIG_DARWIN=yes" >> config.mak
1386
fi
1387

    
1388
if test "$_malloc_h" = "yes" ; then
1389
  echo "#define HAVE_MALLOC_H 1" >> $TMPH
1390
else
1391
  echo "#undef  HAVE_MALLOC_H" >> $TMPH
1392
fi
1393

    
1394
if test "$_memalign" = "yes" ; then
1395
  echo "#define HAVE_MEMALIGN 1" >> $TMPH
1396
else
1397
  echo "#undef  HAVE_MEMALIGN" >> $TMPH
1398
fi
1399

    
1400
if test "$memalignhack" = "yes" ; then
1401
  echo "#define MEMALIGN_HACK 1" >> $TMPH
1402
fi
1403

    
1404

    
1405
if test "$netserver" = "yes" ; then
1406
  echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
1407
  echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
1408
fi
1409

    
1410
if test "$need_inet_aton" = "yes" ; then
1411
  echo "NEED_INET_ATON=yes" >> config.mak
1412
fi
1413

    
1414
if test "$simpleidct" = "yes" ; then
1415
  echo "#define SIMPLE_IDCT 1" >> $TMPH
1416
fi
1417

    
1418
if test "$ffserver" = "yes" ; then
1419
  echo "#define CONFIG_FFSERVER 1" >> $TMPH
1420
  echo "CONFIG_FFSERVER=yes" >> config.mak
1421
fi
1422

    
1423
if test "$ffplay" = "yes" ; then
1424
  echo "CONFIG_FFPLAY=yes" >> config.mak
1425
fi
1426

    
1427
if test "$risky" = "yes" ; then
1428
  echo "#define CONFIG_RISKY 1" >> $TMPH
1429
  echo "CONFIG_RISKY=yes" >> config.mak
1430
fi
1431

    
1432
if test "$gpl" = "yes" ; then
1433
  echo "#define CONFIG_GPL 1" >> $TMPH
1434
  echo "CONFIG_GPL=yes" >> config.mak
1435
fi
1436

    
1437
echo "#define restrict $_restrict" >> $TMPH
1438

    
1439
if test "$optimize" = "small"; then
1440
  echo "#define always_inline"  >> $TMPH
1441
fi
1442

    
1443
# build tree in object directory if source path is different from current one
1444
if test "$source_path_used" = "yes" ; then
1445
    DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
1446
          libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
1447
    FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
1448
    for dir in $DIRS ; do
1449
            mkdir -p $dir
1450
    done
1451
    for f in $FILES ; do
1452
        ln -sf $source_path/$f $f
1453
    done
1454
fi
1455
echo "SRC_PATH=$source_path" >> config.mak
1456

    
1457
if test "$amr_wb" = "yes" ; then
1458
  echo "#define AMR_WB 1" >> $TMPH
1459
  echo "AMR_WB=yes" >> config.mak
1460
  echo
1461
  echo "AMR WB FLOAT NOTICE ! Make sure you have downloaded TS26.204"
1462
  echo "V5.1.0 from "
1463
  echo "http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-510.zip"
1464
  echo "and extracted the source to libavcodec/amrwb_float"
1465
  echo
1466
fi
1467

    
1468
if test "$amr_nb" = "yes" ; then
1469
  echo "#define AMR_NB 1" >> $TMPH
1470
  echo "AMR_NB=yes" >> config.mak
1471
  echo
1472
if test "$amr_nb_fixed" = "yes" ; then
1473
  echo "AMR_NB_FIXED=yes" >> config.mak
1474
  echo "#define AMR_NB_FIXED 1" >> $TMPH
1475
  echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
1476
  echo "REL-5 version 5.1.0 from "
1477
  echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-5??.zip"
1478
  echo "and extracted src to libavcodec/amr"
1479
  echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
1480
  echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
1481
  echo
1482
else
1483
  echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
1484
  echo "REL-5 V5.1.0 from "
1485
  echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-5??.zip"
1486
  echo "and extracted the source to libavcodec/amr_float"
1487
  echo "and if u try this on an alpha, u may need to change Word32 to int in amr/typedef.h"
1488
  echo
1489
fi
1490

    
1491
fi
1492

    
1493
diff $TMPH config.h >/dev/null 2>&1
1494
if test $? -ne 0 ; then
1495
	mv -f $TMPH config.h
1496
else
1497
	echo "config.h is unchanged"
1498
fi
1499

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