Statistics
| Branch: | Revision:

ffmpeg / configure @ 445ad18d

History | View | Annotate | Download (22.1 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
cross_prefix=""
23
cc="gcc"
24
ar="ar"
25
ranlib="ranlib"
26
make="make"
27
strip="strip"
28
cpu=`uname -m`
29
mmx="default"
30
altivec="default"
31
mmi="default"
32
case "$cpu" in
33
  i386|i486|i586|i686|i86pc|BePC)
34
    cpu="x86"
35
  ;;
36
  armv4l)
37
    cpu="armv4l"
38
  ;;
39
  alpha)
40
    cpu="alpha"
41
  ;;
42
  "Power Macintosh"|ppc)
43
    cpu="powerpc"
44
  ;;
45
  mips)
46
    cpu="mips"
47
  ;;
48
  sun4u)
49
    cpu="sparc64"
50
  ;;
51
  *)
52
    cpu="unknown"
53
  ;;
54
esac
55
gprof="no"
56
v4l="yes"
57
audio_oss="yes"
58
audio_beos="no"
59
dv1394="yes"
60
network="yes"
61
zlib="yes"
62
mp3lame="no"
63
vorbis="no"
64
faad="no"
65
faadbin="no"
66
a52="yes"
67
a52bin="no"
68
pp="yes"
69
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
dlfcn="no"
80
dlopen="no"
81
mpegaudio_hp="yes"
82
SHFLAGS=-shared
83
netserver="no"
84
need_inet_aton="no"
85
ffserver="yes"
86
LDFLAGS=-Wl,--warn-common
87
FFSLDFLAGS=-Wl,-E
88
LIBPREF="lib"
89
LIBSUF=".a"
90
SLIBPREF="lib"
91
SLIBSUF=".so"
92
risky="yes"
93
small="no"
94

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

    
219
# From mplayer configure. We need TARGET_OS available
220
# to the Makefile, so it can distinguish between flavors
221
# of AltiVec on PowerPC
222
TARGET_OS=`( uname -s ) 2>&1`
223
  case "$TARGET_OS" in
224
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
225
    ;;
226
  IRIX*)
227
    TARGET_OS=IRIX
228
    ;;
229
  HP-UX*)
230
    TARGET_OS=HP-UX
231
    ;;
232
  [cC][yY][gG][wW][iI][nN]*)
233
    TARGET_OS=CYGWIN
234
    ;;
235
  *)
236
    TARGET_OS="$TARGET_OS-UNKNOWN"
237
    ;;
238
  esac
239

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

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

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

    
334
# Can only do AltiVec on PowerPC
335
if test $altivec = "default"; then
336
    if test $cpu = "powerpc"; then
337
        altivec="yes"
338
    else
339
        altivec="no"
340
    fi
341
fi
342

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

    
355
# Can only do mmi on mips
356
if test $mmi = "default"; then
357
    if test $cpu = "mips"; then
358
        mmi="yes"
359
    else
360
        mmi="no"
361
    fi
362
fi
363

    
364
# See does our compiler support mmi
365
if test $mmi = "yes"; then
366
cat > $TMPC << EOF
367
int main(void) {
368
    __asm__ ("lq \$2, 0(\$2)");
369
    return 0;
370
}
371
EOF
372
$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
373
fi
374

    
375
# Checking for CFLAGS
376
if test -z "$CFLAGS"; then
377
    CFLAGS="-O3"
378
fi
379

    
380
if test "$win32" = "yes" ; then
381
    cross_prefix="i386-mingw32msvc-"
382
    v4l="no"
383
    audio_oss="no"
384
    dv1394="no"
385
    network="no"
386
fi
387

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

    
396
cc="${cross_prefix}${cc}"
397
ar="${cross_prefix}${ar}"
398
ranlib="${cross_prefix}${ranlib}"
399
strip="${cross_prefix}${strip}"
400

    
401
if test -z "$cross_prefix" ; then
402

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

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

    
419
else
420

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

    
426
fi
427

    
428
# ---
429
# check availability of some header files
430

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

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

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

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

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

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

    
490
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
fi
495

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

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

    
517
builtin_vector=no
518
if $cc -o $TMPO $TMPC 2> /dev/null ; then
519
  builtin_vector=yes
520
fi
521

    
522
# dlopen/dlfcn.h probing
523

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

    
529
ldl=-ldl
530

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

    
536
if $cc -o $TMPE $TMPC 2> /dev/null  ; then
537
dlfcn=yes
538
dlopen=yes
539
ldl=""
540
fi
541

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

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

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

    
555
if test "$vhook" = "default" ; then
556
  vhook="$dlopen"
557
fi
558

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

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

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

    
575
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
fi
583

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

    
589
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
590
cat << EOF
591

    
592
Usage: configure [options]
593
Options: [defaults in brackets after descriptions]
594

    
595
EOF
596
echo "Standard options:"
597
echo "  --help                   print this message"
598
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
599
echo "  --enable-mp3lame         enable mp3 encoding via libmp3lame [default=no]"
600
echo "  --enable-vorbis          enable vorbis support via libvorbisenc [default=no]"
601
echo "  --enable-faad            enable faad support via libfaad [default=no]"
602
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"
605
echo "  --disable-a52            disable GPL'ed A52 support [default=no]"
606
echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
607
echo "  --disable-pp             disable GPL'ed post processing support [default=no]"
608
echo "  --enable-shared-pp       use libpostproc.so [default=no]"
609
echo "  --enable-shared          build shared libraries [default=no]"
610
echo ""
611
echo "Advanced options (experts only):"
612
echo "  --source-path=PATH       path of source code [$source_path]"
613
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
614
echo "  --cc=CC                  use C compiler CC [$cc]"
615
echo "  --make=MAKE              use specified make [$make]"
616
echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
617
echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
618
echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
619
echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
620
echo "  --disable-mmx            disable mmx usage"
621
echo "  --disable-altivec        disable AltiVec usage"
622
echo "  --disable-audio-oss      disable OSS audio support [default=no]"
623
echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
624
echo "  --disable-v4l            disable video4linux grabbing [default=no]"
625
echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
626
echo "  --disable-network        disable network support [default=no]"
627
echo "  --disable-zlib           disable zlib [default=no]"
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
echo "  --disable-mpegaudio-hp   faster (but less accurate)"
632
echo "                           mpegaudio decoding [default=no]"
633
echo "  --disable-ffserver       disable ffserver build"
634
echo "  --disable-risky          disables patent encumbered codecs"
635
echo "  --enable-small           optimize for size instead of speed"
636
echo ""
637
echo "NOTE: The object files are build at the place where configure is launched"
638
exit 1
639
fi
640

    
641
echo "Install prefix   $prefix"
642
echo "Source path      $source_path"
643
echo "C compiler       $cc"
644
echo "make             $make"
645
echo "CPU              $cpu"
646
echo "Big Endian       $bigendian"
647
if test $cpu = "x86"; then
648
echo "MMX enabled      $mmx"
649
echo "Vector Builtins  $builtin_vector"
650
fi
651
if test $cpu = "mips"; then
652
echo "MMI enabled      $mmi"
653
fi
654
if test $cpu = "powerpc"; then
655
echo "AltiVec enabled  $altivec"
656
fi
657
echo "gprof enabled    $gprof"
658
echo "zlib enabled     $zlib"
659
echo "mp3lame enabled  $mp3lame"
660
echo "vorbis enabled   $vorbis"
661
echo "faad enabled     $faad"
662
echo "faadbin enabled  $faadbin"
663
echo "a52 support      $a52"
664
echo "a52 dlopened     $a52bin"
665
echo "pp support       $pp"
666
echo "shared pp        $shared_pp"
667
echo "Video hooking    $vhook"
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
675

    
676
echo "Creating config.mak and config.h"
677

    
678
echo "# Automatically generated by configure - do not modify" > config.mak
679
echo "/* Automatically generated by configure - do not modify */" > $TMPH
680

    
681
echo "prefix=$prefix" >> config.mak
682
echo "MAKE=$make" >> config.mak
683
echo "CC=$cc" >> config.mak
684
echo "AR=$ar" >> config.mak
685
echo "RANLIB=$ranlib" >> config.mak
686
echo "STRIP=$strip" >> config.mak
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
echo "LIBPREF=$LIBPREF" >> config.mak
692
echo "LIBSUF=$LIBSUF" >> config.mak
693
echo "SLIBPREF=$SLIBPREF" >> config.mak
694
echo "SLIBSUF=$SLIBSUF" >> config.mak
695
echo "TARGET_OS=$TARGET_OS" >> config.mak
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
elif test "$cpu" = "sparc64" ; then
706
  echo "TARGET_ARCH_SPARC64=yes" >> config.mak
707
  echo "#define ARCH_SPARC64 1" >> $TMPH
708
elif test "$cpu" = "powerpc" ; then
709
  echo "TARGET_ARCH_POWERPC=yes" >> config.mak
710
  echo "#define ARCH_POWERPC 1" >> $TMPH
711
  echo "// Enable the next line to get PowerPC performance report" >> $TMPH
712
  echo "// #define POWERPC_TBL_PERFORMANCE_REPORT 1" >> $TMPH
713
  echo "// Enable the next line to use PMC registers instead of TBL" >> $TMPH
714
  echo "// #define POWERPC_PERF_USE_PMC 1" >> $TMPH
715
elif test "$cpu" = "mips" ; then
716
  echo "TARGET_ARCH_MIPS=yes" >> config.mak
717
  echo "#define ARCH_MIPS 1" >> $TMPH
718
fi
719
if test "$bigendian" = "yes" ; then
720
  echo "WORDS_BIGENDIAN=yes" >> config.mak
721
  echo "#define WORDS_BIGENDIAN 1" >> $TMPH
722
fi
723
if test "$mmx" = "yes" ; then
724
  echo "TARGET_MMX=yes" >> config.mak
725
  echo "#define HAVE_MMX 1" >> $TMPH
726
fi
727
if test "$builtin_vector" = "yes" ; then
728
  echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
729
  echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
730
fi
731
if test "$mmi" = "yes" ; then
732
  echo "TARGET_MMI=yes" >> config.mak
733
  echo "#define HAVE_MMI 1" >> $TMPH
734
fi
735
if test "$altivec" = "yes" ; then
736
  echo "TARGET_ALTIVEC=yes" >> config.mak
737
  echo "#define HAVE_ALTIVEC 1" >> $TMPH
738
  echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
739
  echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
740
fi
741
if test "$gprof" = "yes" ; then
742
  echo "TARGET_GPROF=yes" >> config.mak
743
  echo "#define HAVE_GPROF 1" >> $TMPH
744
fi
745
if test "$strptime" = "yes" ; then
746
  echo "#define HAVE_STRPTIME 1" >> $TMPH
747
else
748
  echo "BUILD_STRPTIME=yes" >> config.mak
749
fi
750
if test "$imlib2" = "yes" ; then
751
  echo "HAVE_IMLIB2=yes" >> config.mak
752
fi
753
if test "$freetype2" = "yes" ; then
754
  echo "HAVE_FREETYPE2=yes" >> config.mak
755
fi
756
if test "$have_lrintf" = "yes" ; then
757
  echo "#define HAVE_LRINTF 1" >> $TMPH
758
fi
759
if test "$vhook" = "yes" ; then
760
  echo "BUILD_VHOOK=yes" >> config.mak
761
  echo "#define HAVE_VHOOK 1" >> $TMPH
762
  extralibs="$extralibs $ldl"
763
fi
764
if test "$lshared" = "yes" ; then
765
  echo "BUILD_SHARED=yes" >> config.mak
766
  echo "PIC=-fPIC" >> config.mak
767
fi
768
echo "EXTRALIBS=$extralibs" >> config.mak
769
echo "VERSION=`head $source_path/VERSION`" >>config.mak
770
echo "" >>config.mak
771
# if you do not want to use encoders, disable that.
772
echo "#define CONFIG_ENCODERS 1" >> $TMPH
773
echo "CONFIG_ENCODERS=yes" >> config.mak
774

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

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

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

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

    
795
  if test "$shared_pp" = "yes" ; then
796
    echo "#define SHARED_PP 1" >> $TMPH
797
    echo "SHARED_PP=yes" >> config.mak
798
  fi
799
fi
800

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

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

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

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

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

    
824
if test "$audio_oss" = "yes" ; then
825
  echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
826
  echo "CONFIG_AUDIO_OSS=yes" >> config.mak
827
fi
828

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

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

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

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

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

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

    
859
if test "$faadbin" = "yes" ; then
860
  echo "#define CONFIG_FAADBIN 1" >> $TMPH
861
  echo "CONFIG_FAADBIN=yes" >> config.mak
862
fi
863

    
864
if test "$win32" = "yes" ; then
865
  echo "#define CONFIG_WIN32 1" >> $TMPH
866
  echo "CONFIG_WIN32=yes" >> config.mak
867
fi
868

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

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

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

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

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

    
895
if test "$_malloc_h" = "yes" ; then
896
  echo "#define HAVE_MALLOC_H 1" >> $TMPH
897
else
898
  echo "#undef  HAVE_MALLOC_H" >> $TMPH
899
fi
900

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

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

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

    
916
if test "$simpleidct" = "yes" ; then
917
  echo "#define SIMPLE_IDCT 1" >> $TMPH
918
fi
919

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

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

    
930
echo "#define restrict $_restrict" >> $TMPH
931

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

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

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