Statistics
| Branch: | Revision:

ffmpeg / configure @ a8721c09

History | View | Annotate | Download (19.9 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
  *)
49
    cpu="unknown"
50
  ;;
51
esac
52
gprof="no"
53
v4l="yes"
54
audio_oss="yes"
55
audio_beos="no"
56
dv1394="yes"
57
network="yes"
58
zlib="yes"
59
mp3lame="no"
60
vorbis="no"
61
a52="yes"
62
a52bin="no"
63
win32="no"
64
mingw32="no"
65
cygwin="no"
66
os2="no"
67
lshared="no"
68
extralibs="-lm"
69
simpleidct="yes"
70
bigendian="no"
71
vhook="default"
72
dlfcn="no"
73
dlopen="no"
74
mpegaudio_hp="yes"
75
SHFLAGS=-shared
76
netserver="no"
77
need_inet_aton="no"
78
ffserver="yes"
79
LDFLAGS=-Wl,--warn-common
80
FFSLDFLAGS=-Wl,-E
81
LIBPREF="lib"
82
LIBSUF=".a"
83
SLIBPREF="lib"
84
SLIBSUF=".so"
85

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

    
209
# From mplayer configure. We need TARGET_OS available
210
# to the Makefile, so it can distinguish between flavors
211
# of AltiVec on PowerPC
212
TARGET_OS=`( uname -s ) 2>&1`
213
  case "$TARGET_OS" in
214
  Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
215
    ;;
216
  IRIX*)
217
    TARGET_OS=IRIX
218
    ;;
219
  HP-UX*)
220
    TARGET_OS=HP-UX
221
    ;;
222
  [cC][yY][gG][wW][iI][nN]*)
223
    TARGET_OS=CYGWIN
224
    ;;
225
  *)
226
    TARGET_OS="$TARGET_OS-UNKNOWN"
227
    ;;
228
  esac
229

    
230
# find source path
231
# XXX: we assume an absolute path is given when launching configure, 
232
# except in './configure' case.
233
source_path=${0%configure}
234
source_path=${source_path%/}
235
source_path_used="yes"
236
if test -z "$source_path" -o "$source_path" = "." ; then
237
    source_path=`pwd`
238
    source_path_used="no"
239
fi
240

    
241
for opt do
242
  case "$opt" in
243
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
244
  ;;
245
  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
246
  ;;
247
  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
248
  ;;
249
  --cc=*) cc=`echo $opt | cut -d '=' -f 2`
250
  ;;
251
  --make=*) make=`echo $opt | cut -d '=' -f 2`
252
  ;;
253
  --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
254
  ;;
255
  --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
256
  ;;
257
  --extra-libs=*) extralibs=${opt#--extra-libs=}
258
  ;;
259
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
260
  ;;
261
  --disable-mmx) mmx="no"
262
  ;;
263
  --disable-altivec) altivec="no"
264
  ;;
265
  --enable-gprof) gprof="yes"
266
  ;;
267
  --disable-v4l) v4l="no"
268
  ;;
269
  --disable-audio-oss) audio_oss="no"
270
  ;;
271
  --disable-audio-beos) audio_beos="no"
272
  ;;
273
  --disable-dv1394) dv1394="no"
274
  ;;
275
  --disable-network) network="no"
276
  ;;
277
  --disable-zlib) zlib="no"
278
  ;;
279
  --disable-a52) a52="no"
280
  ;;
281
  --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
282
  ;;
283
  --enable-mp3lame) mp3lame="yes"
284
  ;;
285
  --enable-vorbis) vorbis="yes"
286
  ;;
287
  --disable-vhook) vhook="no"
288
  ;;
289
  --disable-simple_idct) simpleidct="no"
290
  ;;
291
  --enable-win32) win32="yes"
292
  ;;
293
  --enable-mingw32) mingw32="yes"
294
  ;;
295
  --enable-shared) lshared="yes"
296
  ;;
297
  --disable-mpegaudio-hp) mpegaudio_hp="no"
298
  ;;
299
  --disable-ffserver) ffserver="no"
300
  ;;
301
  esac
302
done
303

    
304
# compute mmx state
305
if test $mmx = "default"; then
306
    if test $cpu = "x86"; then
307
        mmx="yes"
308
    else
309
        mmx="no"
310
    fi
311
fi
312

    
313
# Can only do AltiVec on PowerPC
314
if test $altivec = "default"; then
315
    if test $cpu = "powerpc"; then
316
        altivec="yes"
317
    else
318
        altivec="no"
319
    fi
320
fi
321

    
322
# See does our compiler support Motorola AltiVec C API
323
if test $altivec = "yes"; then
324
cat > $TMPC << EOF
325
int main(void) {
326
    vector signed int v1, v2, v3;
327
    v1 = vec_add(v2,v3);
328
    return 0;
329
}
330
EOF
331
$cc -o $TMPE $TMPC -faltivec 2> /dev/null || altivec="no"
332
fi
333

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

    
343
# See does our compiler support mmi
344
if test $mmi = "yes"; then
345
cat > $TMPC << EOF
346
int main(void) {
347
    __asm__ ("lq \$2, 0(\$2)");
348
    return 0;
349
}
350
EOF
351
$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
352
fi
353

    
354
# Checking for CFLAGS
355
if test -z "$CFLAGS"; then
356
    CFLAGS="-O3"
357
fi
358

    
359
if test "$win32" = "yes" ; then
360
    cross_prefix="i386-mingw32msvc-"
361
    v4l="no"
362
    audio_oss="no"
363
    dv1394="no"
364
    network="no"
365
fi
366

    
367
if test "$mingw32" = "yes" ; then
368
    cross_prefix=""
369
    v4l="no"
370
    audio_oss="no"
371
    dv1394="no"
372
    network="no"
373
fi
374

    
375
cc="${cross_prefix}${cc}"
376
ar="${cross_prefix}${ar}"
377
ranlib="${cross_prefix}${ranlib}"
378
strip="${cross_prefix}${strip}"
379

    
380
if test -z "$cross_prefix" ; then
381

    
382
# ---
383
# big/little endian test
384
cat > $TMPC << EOF
385
#include <inttypes.h>
386
int main(int argc, char ** argv){
387
	volatile uint32_t i=0x01234567;
388
	return (*((uint8_t*)(&i))) == 0x67;
389
}
390
EOF
391

    
392
if $cc -o $TMPE $TMPC 2>/dev/null ; then
393
$TMPE && bigendian="yes"
394
else
395
echo big/little test failed
396
fi
397

    
398
else
399

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

    
405
fi
406

    
407
# ---
408
# check availability of some header files
409

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

    
415
_memalign=no
416
_malloc_h=no
417
if $cc -o $TMPE $TMPC 2> /dev/null ; then
418
_malloc_h=yes
419
_memalign=yes
420
# check for memalign - atmos
421
cat > $TMPC << EOF
422
#include <malloc.h>
423
int main ( void ) {
424
char *string = NULL;
425
string = memalign(64, sizeof(char));
426
return 0;
427
}
428
EOF
429
$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
430
fi
431

    
432
cat > $TMPC << EOF
433
#define _GNU_SOURCE
434
#include <time.h>
435
int main( void ) { return *strptime("", "", 0); }
436
EOF
437

    
438
strptime=no
439
if $cc -o $TMPE $TMPC 2> /dev/null ; then
440
  strptime=yes
441
fi
442

    
443
if test "$zlib" = "yes"; then
444
# check for zlib - mmu_man
445
cat > $TMPC << EOF
446
#include <zlib.h>
447
int main ( void ) {
448
if (zlibVersion() != ZLIB_VERSION)
449
   puts("zlib version differs !!!");
450
   return 1;
451
return 0;
452
}
453
EOF
454
$cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
455
# $TMPE 2> /dev/null > /dev/null || zlib="no"
456
# XXX: more tests needed - runtime test
457
fi
458
if test "$zlib" = "yes"; then
459
extralibs="$extralibs -lz"
460
fi
461

    
462
# test for lrintf in math.h
463
cat > $TMPC << EOF
464
#define _ISOC9X_SOURCE  1
465
#include <math.h>
466
int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
467
EOF
468

    
469
have_lrintf="no"
470
if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
471
  have_lrintf="yes"
472
  $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
473
fi
474

    
475
_restrict=
476
for restrict_keyword in restrict __restrict__ __restrict; do
477
  echo "void foo(char * $restrict_keyword p);" > $TMPC
478
  if $cc -c -o $TMPO $TMPC 2> /dev/null; then
479
    _restrict=$restrict_keyword
480
    break;
481
  fi
482
done
483

    
484
# test gcc version to see if vector builtins can be used
485
# currently only used on i386 for MMX builtins
486
cat > $TMPC << EOF
487
int main(void) { 
488
#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
489
return 0;
490
#else
491
#error no vector builtins
492
#endif
493
}
494
EOF
495

    
496
builtin_vector=no
497
if $cc -o $TMPO $TMPC 2> /dev/null ; then
498
  builtin_vector=yes
499
fi
500

    
501
# dlopen/dlfcn.h probing
502

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

    
508
ldl=-ldl
509

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

    
515
if $cc -o $TMPE $TMPC 2> /dev/null  ; then
516
dlfcn=yes
517
dlopen=yes
518
ldl=""
519
fi
520

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

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

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

    
534
if test "$vhook" = "default" ; then
535
  vhook="$dlopen"
536
fi
537

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

    
544
imlib2=no
545
if $cc -o $TMPE $TMPC -lImlib2 2> /dev/null  ; then
546
imlib2=yes
547
fi
548

    
549
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
550
cat << EOF
551

    
552
Usage: configure [options]
553
Options: [defaults in brackets after descriptions]
554

    
555
EOF
556
echo "Standard options:"
557
echo "  --help                   print this message"
558
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
559
echo "  --enable-mp3lame         enable mp3 encoding via libmp3lame [default=no]"
560
echo "  --enable-vorbis          enable vorbis support via libvorbisenc [default=no]"
561
echo "  --enable-win32           enable win32 cross compile"
562
echo "  --enable-mingw32         enable mingw32 native windows compile"
563
echo "  --disable-a52            disable GPL'ed A52 support [default=no]"
564
echo "  --enable-a52bin          open liba52.so.0 at runtime [default=no]"
565
echo "  --enable-shared          build shared libraries [default=no]"
566
echo ""
567
echo "Advanced options (experts only):"
568
echo "  --source-path=PATH       path of source code [$source_path]"
569
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
570
echo "  --cc=CC                  use C compiler CC [$cc]"
571
echo "  --make=MAKE              use specified make [$make]"
572
echo "  --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]"
573
echo "  --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
574
echo "  --extra-libs=ELIBS       add ELIBS [$ELIBS]"
575
echo "  --cpu=CPU                force cpu to CPU  [$cpu]"
576
echo "  --disable-mmx            disable mmx usage"
577
echo "  --disable-altivec        disable AltiVec usage"
578
echo "  --disable-audio-oss      disable OSS audio support [default=no]"
579
echo "  --disable-audio-beos     disable BeOS audio support [default=no]"
580
echo "  --disable-v4l            disable video4linux grabbing [default=no]"
581
echo "  --disable-dv1394         disable DV1394 grabbing [default=no]"
582
echo "  --disable-network        disable network support [default=no]"
583
echo "  --disable-zlib           disable zlib [default=no]"
584
echo "  --disable-simple_idct    disable simple IDCT routines [default=no]"
585
echo "  --disable-vhook          disable video hooking support"
586
echo "  --enable-gprof           enable profiling with gprof [$gprof]"
587
echo "  --disable-mpegaudio-hp   faster (but less accurate)"
588
echo "                           mpegaudio decoding [default=no]"
589
echo "  --disable-ffserver       disable ffserver build"
590
echo ""
591
echo "NOTE: The object files are build at the place where configure is launched"
592
exit 1
593
fi
594

    
595
echo "Install prefix   $prefix"
596
echo "Source path      $source_path"
597
echo "C compiler       $cc"
598
echo "make             $make"
599
echo "CPU              $cpu"
600
echo "Big Endian       $bigendian"
601
if test $cpu = "x86"; then
602
echo "MMX enabled      $mmx"
603
echo "Vector Builtins  $builtin_vector"
604
fi
605
if test $cpu = "mips"; then
606
echo "MMI enabled      $mmi"
607
fi
608
if test $cpu = "powerpc"; then
609
echo "AltiVec enabled  $altivec"
610
fi
611
echo "gprof enabled    $gprof"
612
echo "zlib enabled     $zlib"
613
echo "mp3lame enabled  $mp3lame"
614
echo "vorbis enabled   $vorbis"
615
echo "a52 support      $a52"
616
echo "a52 dlopened     $a52bin"
617
echo "Video hooking    $vhook"
618

    
619
if test "$vhook" = "yes" ; then
620
echo "Imlib2 support   $imlib2"
621
fi
622

    
623
echo "Creating config.mak and config.h"
624

    
625
echo "# Automatically generated by configure - do not modify" > config.mak
626
echo "/* Automatically generated by configure - do not modify */" > $TMPH
627

    
628
echo "prefix=$prefix" >> config.mak
629
echo "MAKE=$make" >> config.mak
630
echo "CC=$cc" >> config.mak
631
echo "AR=$ar" >> config.mak
632
echo "RANLIB=$ranlib" >> config.mak
633
echo "STRIP=$strip" >> config.mak
634
echo "OPTFLAGS=$CFLAGS" >> config.mak
635
echo "LDFLAGS=$LDFLAGS" >> config.mak
636
echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
637
echo "SHFLAGS=$SHFLAGS" >> config.mak
638
echo "LIBPREF=$LIBPREF" >> config.mak
639
echo "LIBSUF=$LIBSUF" >> config.mak
640
echo "SLIBPREF=$SLIBPREF" >> config.mak
641
echo "SLIBSUF=$SLIBSUF" >> config.mak
642
echo "TARGET_OS=$TARGET_OS" >> config.mak
643
if test "$cpu" = "x86" ; then
644
  echo "TARGET_ARCH_X86=yes" >> config.mak
645
  echo "#define ARCH_X86 1" >> $TMPH
646
elif test "$cpu" = "armv4l" ; then
647
  echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
648
  echo "#define ARCH_ARMV4L 1" >> $TMPH
649
elif test "$cpu" = "alpha" ; then
650
  echo "TARGET_ARCH_ALPHA=yes" >> config.mak
651
  echo "#define ARCH_ALPHA 1" >> $TMPH
652
elif test "$cpu" = "sparc64" ; then
653
  echo "TARGET_ARCH_SPARC64=yes" >> config.mak
654
  echo "#define ARCH_SPARC64 1" >> $TMPH
655
elif test "$cpu" = "powerpc" ; then
656
  echo "TARGET_ARCH_POWERPC=yes" >> config.mak
657
  echo "#define ARCH_POWERPC 1" >> $TMPH
658
  echo "// Enable the next line to get PowerPC performance report" >> $TMPH
659
  echo "// #define POWERPC_TBL_PERFORMANCE_REPORT 1" >> $TMPH
660
  echo "// Enable the next line to use PMC registers instead of TBL" >> $TMPH
661
  echo "// #define POWERPC_PERF_USE_PMC 1" >> $TMPH
662
elif test "$cpu" = "mips" ; then
663
  echo "TARGET_ARCH_MIPS=yes" >> config.mak
664
  echo "#define ARCH_MIPS 1" >> $TMPH
665
fi
666
if test "$bigendian" = "yes" ; then
667
  echo "WORDS_BIGENDIAN=yes" >> config.mak
668
  echo "#define WORDS_BIGENDIAN 1" >> $TMPH
669
fi
670
if test "$mmx" = "yes" ; then
671
  echo "TARGET_MMX=yes" >> config.mak
672
  echo "#define HAVE_MMX 1" >> $TMPH
673
fi
674
if test "$builtin_vector" = "yes" ; then
675
  echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
676
  echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
677
fi
678
if test "$mmi" = "yes" ; then
679
  echo "TARGET_MMI=yes" >> config.mak
680
  echo "#define HAVE_MMI 1" >> $TMPH
681
fi
682
if test "$altivec" = "yes" ; then
683
  echo "TARGET_ALTIVEC=yes" >> config.mak
684
  echo "#define HAVE_ALTIVEC 1" >> $TMPH
685
  echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
686
  echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
687
fi
688
if test "$gprof" = "yes" ; then
689
  echo "TARGET_GPROF=yes" >> config.mak
690
  echo "#define HAVE_GPROF 1" >> $TMPH
691
fi
692
if test "$strptime" = "yes" ; then
693
  echo "#define HAVE_STRPTIME 1" >> $TMPH
694
else
695
  echo "BUILD_STRPTIME=yes" >> config.mak
696
fi
697
if test "$imlib2" = "yes" ; then
698
  echo "HAVE_IMLIB2=yes" >> config.mak
699
fi
700
if test "$have_lrintf" = "yes" ; then
701
  echo "#define HAVE_LRINTF 1" >> $TMPH
702
fi
703
if test "$vhook" = "yes" ; then
704
  echo "BUILD_VHOOK=yes" >> config.mak
705
  echo "#define HAVE_VHOOK 1" >> $TMPH
706
  extralibs="$extralibs $ldl"
707
fi
708
if test "$lshared" = "yes" ; then
709
  echo "BUILD_SHARED=yes" >> config.mak
710
  echo "PIC=-fPIC" >> config.mak
711
fi
712
echo "EXTRALIBS=$extralibs" >> config.mak
713
echo -n "VERSION=" >>config.mak
714
head $source_path/VERSION >>config.mak
715
echo "" >>config.mak
716
# if you do not want to use encoders, disable that.
717
echo "#define CONFIG_ENCODERS 1" >> $TMPH
718
echo "CONFIG_ENCODERS=yes" >> config.mak
719

    
720
# if you do not want to use decoders, disable that.
721
echo "#define CONFIG_DECODERS 1" >> $TMPH
722
echo "CONFIG_DECODERS=yes" >> config.mak
723

    
724
# AC3
725
if test "$a52" = "yes" ; then
726
  echo "#define CONFIG_AC3 1" >> $TMPH
727
  echo "CONFIG_AC3=yes" >> config.mak
728

    
729
  if test "$a52bin" = "yes" ; then
730
    echo "#define CONFIG_A52BIN 1" >> $TMPH
731
    echo "CONFIG_A52BIN=yes" >> config.mak
732
  fi
733
fi
734

    
735
# mpeg audio high precision mode
736
if test "$mpegaudio_hp" = "yes" ; then
737
  echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
738
fi
739

    
740
if test "$v4l" = "yes" ; then
741
  echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
742
  echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
743
fi
744

    
745
if test "$dv1394" = "yes" ; then
746
  echo "#define CONFIG_DV1394 1" >> $TMPH
747
  echo "CONFIG_DV1394=yes" >> config.mak
748
fi
749

    
750
if test "$dlopen" = "yes" ; then
751
  echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
752
fi
753

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

    
758
if test "$audio_oss" = "yes" ; then
759
  echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
760
  echo "CONFIG_AUDIO_OSS=yes" >> config.mak
761
fi
762

    
763
if test "$audio_beos" = "yes" ; then
764
  echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
765
  echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
766
fi
767

    
768
if test "$network" = "yes" ; then
769
  echo "#define CONFIG_NETWORK 1" >> $TMPH
770
  echo "CONFIG_NETWORK=yes" >> config.mak
771
fi
772

    
773
if test "$zlib" = "yes" ; then
774
  echo "#define CONFIG_ZLIB 1" >> $TMPH
775
  echo "CONFIG_ZLIB=yes" >> config.mak
776
fi
777

    
778
if test "$mp3lame" = "yes" ; then
779
  echo "#define CONFIG_MP3LAME 1" >> $TMPH
780
  echo "CONFIG_MP3LAME=yes" >> config.mak
781
fi
782

    
783
if test "$vorbis" = "yes" ; then
784
  echo "#define CONFIG_VORBIS 1" >> $TMPH
785
  echo "CONFIG_VORBIS=yes" >> config.mak
786
fi
787

    
788
if test "$win32" = "yes" ; then
789
  echo "#define CONFIG_WIN32 1" >> $TMPH
790
  echo "CONFIG_WIN32=yes" >> config.mak
791
fi
792

    
793
if test "$mingw32" = "yes" ; then
794
  echo "#define CONFIG_WIN32 1" >> $TMPH
795
  echo "CONFIG_WIN32=yes" >> config.mak
796
  echo "#define __MINGW32__ 1" >> $TMPH
797
  echo "__MINGW32__=1" >> config.mak
798
fi
799

    
800
if test "$cygwin" = "yes" ; then
801
  # setup correct exesuffix
802
  echo "CONFIG_WIN32=yes" >> config.mak
803
fi
804

    
805
if test "$os2" = "yes" ; then
806
  echo "#define CONFIG_OS2 1" >> $TMPH
807
  echo "CONFIG_OS2=yes" >> config.mak
808
fi
809

    
810
if test "$darwin" = "yes"; then
811
  echo "#define CONFIG_DARWIN 1"  >> $TMPH
812
  echo "CONFIG_DARWIN=yes" >> config.mak
813
fi
814

    
815
if test "$_malloc_h" = "yes" ; then
816
  echo "#define HAVE_MALLOC_H 1" >> $TMPH
817
else
818
  echo "#undef  HAVE_MALLOC_H" >> $TMPH
819
fi
820

    
821
if test "$_memalign" = "yes" ; then
822
  echo "#define HAVE_MEMALIGN 1" >> $TMPH
823
else
824
  echo "#undef  HAVE_MEMALIGN" >> $TMPH
825
fi
826

    
827
if test "$netserver" = "yes" ; then
828
  echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
829
  echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
830
fi
831

    
832
if test "$need_inet_aton" = "yes" ; then
833
  echo "NEED_INET_ATON=yes" >> config.mak
834
fi
835

    
836
if test "$simpleidct" = "yes" ; then
837
  echo "#define SIMPLE_IDCT 1" >> $TMPH
838
fi
839

    
840
if test "$ffserver" = "yes" ; then
841
  echo "#define CONFIG_FFSERVER 1" >> $TMPH
842
  echo "CONFIG_FFSERVER=yes" >> config.mak
843
fi
844

    
845
echo "#define restrict $_restrict" >> $TMPH
846

    
847
# build tree in object directory if source path is different from current one
848
if test "$source_path_used" = "yes" ; then
849
    DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
850
          libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests vhook"
851
    FILES="Makefile libavformat/Makefile libavcodec/Makefile tests/Makefile vhook/Makefile"
852
    for dir in $DIRS ; do
853
            mkdir -p $dir
854
    done
855
    for f in $FILES ; do
856
        ln -sf $source_path/$f $f
857
    done
858
fi
859
echo "SRC_PATH=$source_path" >> config.mak
860

    
861
diff $TMPH config.h >/dev/null 2>&1
862
if test $? -ne 0 ; then
863
	mv -f $TMPH config.h
864
else
865
	echo "config.h is unchanged"
866
fi
867

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