* quiet missing EOF \n warning
[libav.git] / configure
CommitLineData
de6d9b64 1#!/bin/sh
0f3cb305 2#
5cbcf02c 3# ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
0f3cb305
FB
4#
5# set temporary file name
57514323 6if test ! -z "$TMPDIR" ; then
0f3cb305 7 TMPDIR1="${TMPDIR}"
57514323 8elif test ! -z "$TEMPDIR" ; then
0f3cb305 9 TMPDIR1="${TEMPDIR}"
3d204385 10else
0f3cb305 11 TMPDIR1="/tmp"
3d204385
NK
12fi
13
0f3cb305
FB
14TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
15TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
f3ec2d46 16TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
0f3cb305
FB
17TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
18TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
19
de6d9b64
FB
20# default parameters
21prefix="/usr/local"
0f3cb305 22cross_prefix=""
de6d9b64
FB
23cc="gcc"
24ar="ar"
be7109c1 25ranlib="ranlib"
4a908fbc 26make="make"
0f3cb305 27strip="strip"
de6d9b64 28cpu=`uname -m`
0f3cb305 29mmx="default"
ab6c65f6 30altivec="default"
d46aba26 31mmi="default"
de6d9b64 32case "$cpu" in
ef0bc4c9 33 i386|i486|i586|i686|i86pc|BePC)
de6d9b64 34 cpu="x86"
de6d9b64 35 ;;
6ed7422a
FB
36 armv4l)
37 cpu="armv4l"
6ed7422a 38 ;;
91d1f1a4
NK
39 alpha)
40 cpu="alpha"
91d1f1a4 41 ;;
a43bd1d7 42 "Power Macintosh"|ppc)
90cee0c3
MN
43 cpu="powerpc"
44 ;;
d46aba26
LS
45 mips)
46 cpu="mips"
47 ;;
a7beab73
RS
48 sun4u)
49 cpu="sparc64"
50 ;;
de6d9b64 51 *)
0f3cb305 52 cpu="unknown"
de6d9b64
FB
53 ;;
54esac
55gprof="no"
5cbcf02c
FB
56v4l="yes"
57audio_oss="yes"
dfdfa47c 58audio_beos="no"
8aa3ee32 59dv1394="yes"
5cbcf02c 60network="yes"
0147f198 61zlib="yes"
a6741398 62mp3lame="no"
81e0d0b4 63vorbis="no"
0fc50e58
ZK
64faad="no"
65faadbin="no"
5cbcf02c 66a52="yes"
57514323 67a52bin="no"
bba9b16c
MN
68pp="yes"
69shared_pp="no"
daf8e955 70win32="no"
732d9245 71mingw32="no"
3f027ca7 72cygwin="no"
f3ec2d46 73os2="no"
83286d2a 74lshared="no"
ef0bc4c9 75extralibs="-lm"
c02dbee1 76simpleidct="yes"
0f3cb305 77bigendian="no"
a8721c09 78vhook="default"
adbc0510
PG
79dlfcn="no"
80dlopen="no"
1eb2212e 81mpegaudio_hp="yes"
e1707f52 82SHFLAGS=-shared
26b35efb 83netserver="no"
4baca069 84need_inet_aton="no"
8154d2e0 85ffserver="yes"
4baca069
PG
86LDFLAGS=-Wl,--warn-common
87FFSLDFLAGS=-Wl,-E
f3ec2d46
SG
88LIBPREF="lib"
89LIBSUF=".a"
90SLIBPREF="lib"
91SLIBSUF=".so"
1d0d55da 92risky="yes"
553a6284 93small="no"
ef0bc4c9
FR
94
95# OS specific
96targetos=`uname -s`
97case $targetos in
98BeOS)
99prefix="/boot/home/config"
100# helps building libavcodec
e1707f52 101CFLAGS="-O3 -DPIC -fomit-frame-pointer"
31ba0b4d
FR
102# 3 gcc releases known for BeOS, each with ugly bugs
103gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
104case "$gcc_version" in
1052.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
106mmx="no"
107;;
108*20010315*) echo "BeBits gcc"
109CFLAGS="$CFLAGS -fno-expensive-optimizations"
110;;
111esac
e1707f52
MN
112SHFLAGS=-nostart
113# disable linux things
114audio_oss="no"
5cbcf02c 115v4l="no"
8aa3ee32 116dv1394="no"
dfdfa47c
FR
117# enable beos things
118audio_beos="yes"
ef0bc4c9
FR
119# no need for libm, but the inet stuff
120# Check for BONE
121if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
122extralibs="-lbind -lsocket"
123else
26b35efb 124netserver="yes"
4baca069 125need_inet_aton="yes"
26b35efb 126extralibs="-lnet"
ef0bc4c9 127fi ;;
4baca069
PG
128SunOS)
129v4l="no"
130audio_oss="no"
8aa3ee32 131dv1394="no"
4baca069
PG
132make="gmake"
133LDFLAGS=""
134FFSLDFLAGS=""
135need_inet_aton="yes"
136extralibs="$extralibs -lsocket -lnsl"
137;;
9c938e77
PG
138FreeBSD)
139v4l="no"
140audio_oss="yes"
8aa3ee32 141dv1394="no"
9c938e77 142make="gmake"
4baca069 143LDFLAGS="$LDFLAGS -export-dynamic"
9c938e77 144;;
4a908fbc 145BSD/OS)
5cbcf02c 146v4l="no"
6063bce7 147audio_oss="yes"
8aa3ee32 148dv1394="no"
4a908fbc
AB
149extralibs="-lpoll -lgnugetopt -lm"
150make="gmake"
151;;
90cee0c3 152Darwin)
a43bd1d7 153cc="cc"
90cee0c3
MN
154v4l="no"
155audio_oss="no"
8aa3ee32 156dv1394="no"
a43bd1d7 157SHFLAGS="-dynamiclib"
90cee0c3 158extralibs=""
a43bd1d7 159darwin="yes"
47930f09 160strip="strip -x"
6207ba95 161LDFLAGS="-d"
4baca069
PG
162FFSLDFLAGS=-Wl,-bind_at_load
163gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f4-)"
164case "$gcc_version" in
165*2.95*)
166CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer"
167;;
168*)
169CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic"
170;;
171esac
90cee0c3 172;;
732d9245
BE
173MINGW32*)
174v4l="no"
175audio_oss="no"
8aa3ee32 176dv1394="no"
732d9245
BE
177ffserver="no"
178network="no"
179mingw32="yes"
180;;
3f027ca7
FB
181CYGWIN*)
182v4l="no"
183audio_oss="yes"
8aa3ee32 184dv1394="no"
3f027ca7
FB
185extralibs=""
186cygwin="yes"
187test -f /usr/include/inttypes.h || \
188test -f /usr/local/include/inttypes.h || \
189echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
190 "/usr/include/inttypes.h !!!"
191;;
b55e4ef4 192Linux)
4baca069 193LDFLAGS="$LDFLAGS -rdynamic"
b55e4ef4 194;;
f3ec2d46
SG
195OS/2)
196TMPE=$TMPE".exe"
69db4e10
SG
197ar="emxomfar -p64"
198ranlib="echo ignoring ranlib"
199strip="echo ignoring strip"
200CFLAGS="-Zomf -O3"
201LDFLAGS="-Zomf -Zstack 16384 -s"
f3ec2d46
SG
202SHFLAGS=""
203FFSLDFLAGS=""
204LIBPREF=""
205LIBSUF=".lib"
206SLIBPREF=""
207SLIBSUF=".dll"
208extralibs=""
209v4l="no"
210audio_oss="no"
8aa3ee32 211dv1394="no"
f3ec2d46
SG
212network="no"
213ffserver="no"
214os2="yes"
215;;
ef0bc4c9
FR
216*) ;;
217esac
de6d9b64 218
6852ac95
RD
219# From mplayer configure. We need TARGET_OS available
220# to the Makefile, so it can distinguish between flavors
221# of AltiVec on PowerPC
222TARGET_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
0f3cb305
FB
240# find source path
241# XXX: we assume an absolute path is given when launching configure,
242# except in './configure' case.
586bc755 243source_path="`echo $0 | sed -e 's#/configure##'`"
0f3cb305
FB
244source_path_used="yes"
245if test -z "$source_path" -o "$source_path" = "." ; then
246 source_path=`pwd`
247 source_path_used="no"
de6d9b64
FB
248fi
249
250for opt do
251 case "$opt" in
252 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
253 ;;
0f3cb305
FB
254 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
255 ;;
256 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
257 ;;
de6d9b64
FB
258 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
259 ;;
4a908fbc
AB
260 --make=*) make=`echo $opt | cut -d '=' -f 2`
261 ;;
0f3cb305
FB
262 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
263 ;;
264 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
265 ;;
266 --extra-libs=*) extralibs=${opt#--extra-libs=}
267 ;;
de6d9b64
FB
268 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
269 ;;
270 --disable-mmx) mmx="no"
271 ;;
ab6c65f6
BF
272 --disable-altivec) altivec="no"
273 ;;
de6d9b64
FB
274 --enable-gprof) gprof="yes"
275 ;;
5cbcf02c
FB
276 --disable-v4l) v4l="no"
277 ;;
278 --disable-audio-oss) audio_oss="no"
279 ;;
dfdfa47c
FR
280 --disable-audio-beos) audio_beos="no"
281 ;;
8aa3ee32
MK
282 --disable-dv1394) dv1394="no"
283 ;;
5cbcf02c
FB
284 --disable-network) network="no"
285 ;;
0147f198
FR
286 --disable-zlib) zlib="no"
287 ;;
5cbcf02c 288 --disable-a52) a52="no"
6ed7422a 289 ;;
9c938e77 290 --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
57514323 291 ;;
bba9b16c
MN
292 --disable-pp) pp="no"
293 ;;
294 --enable-shared-pp) shared_pp="yes"
295 ;;
a6741398
J
296 --enable-mp3lame) mp3lame="yes"
297 ;;
81e0d0b4
MH
298 --enable-vorbis) vorbis="yes"
299 ;;
68892110
PG
300 --disable-vhook) vhook="no"
301 ;;
c02dbee1 302 --disable-simple_idct) simpleidct="no"
045ed63f 303 ;;
daf8e955
FB
304 --enable-win32) win32="yes"
305 ;;
732d9245
BE
306 --enable-mingw32) mingw32="yes"
307 ;;
83286d2a 308 --enable-shared) lshared="yes"
0319c531 309 ;;
1eb2212e
FB
310 --disable-mpegaudio-hp) mpegaudio_hp="no"
311 ;;
8154d2e0
FB
312 --disable-ffserver) ffserver="no"
313 ;;
1d0d55da
MN
314 --disable-risky) risky="no"
315 ;;
553a6284
MN
316 --enable-small) small="yes"
317 ;;
de6d9b64
FB
318 esac
319done
320
0f3cb305
FB
321# compute mmx state
322if test $mmx = "default"; then
323 if test $cpu = "x86"; then
324 mmx="yes"
325 else
326 mmx="no"
327 fi
328fi
329
ab6c65f6
BF
330# Can only do AltiVec on PowerPC
331if test $altivec = "default"; then
332 if test $cpu = "powerpc"; then
333 altivec="yes"
334 else
335 altivec="no"
336 fi
337fi
338
339# See does our compiler support Motorola AltiVec C API
340if test $altivec = "yes"; then
341cat > $TMPC << EOF
342int main(void) {
343 vector signed int v1, v2, v3;
344 v1 = vec_add(v2,v3);
345 return 0;
346}
347EOF
f3ec2d46 348$cc -o $TMPE $TMPC -faltivec 2> /dev/null || altivec="no"
ab6c65f6
BF
349fi
350
d46aba26
LS
351# Can only do mmi on mips
352if test $mmi = "default"; then
353 if test $cpu = "mips"; then
354 mmi="yes"
355 else
356 mmi="no"
357 fi
358fi
359
360# See does our compiler support mmi
361if test $mmi = "yes"; then
362cat > $TMPC << EOF
363int main(void) {
364 __asm__ ("lq \$2, 0(\$2)");
365 return 0;
366}
367EOF
f3ec2d46 368$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
d46aba26
LS
369fi
370
daf8e955
FB
371# Checking for CFLAGS
372if test -z "$CFLAGS"; then
29482cb4 373 CFLAGS="-O3"
daf8e955
FB
374fi
375
57514323 376if test "$win32" = "yes" ; then
daf8e955 377 cross_prefix="i386-mingw32msvc-"
5cbcf02c
FB
378 v4l="no"
379 audio_oss="no"
8aa3ee32 380 dv1394="no"
5cbcf02c 381 network="no"
daf8e955
FB
382fi
383
732d9245
BE
384if test "$mingw32" = "yes" ; then
385 cross_prefix=""
386 v4l="no"
387 audio_oss="no"
8aa3ee32 388 dv1394="no"
732d9245
BE
389 network="no"
390fi
391
0f3cb305
FB
392cc="${cross_prefix}${cc}"
393ar="${cross_prefix}${ar}"
be7109c1 394ranlib="${cross_prefix}${ranlib}"
0f3cb305
FB
395strip="${cross_prefix}${strip}"
396
487a54d7
FB
397if test -z "$cross_prefix" ; then
398
3d204385 399# ---
a3999908
MN
400# big/little endian test
401cat > $TMPC << EOF
402#include <inttypes.h>
403int main(int argc, char ** argv){
404 volatile uint32_t i=0x01234567;
405 return (*((uint8_t*)(&i))) == 0x67;
406}
407EOF
408
f3ec2d46
SG
409if $cc -o $TMPE $TMPC 2>/dev/null ; then
410$TMPE && bigendian="yes"
a3999908
MN
411else
412echo big/little test failed
413fi
414
487a54d7
FB
415else
416
417# if cross compiling, cannot launch a program, so make a static guess
418if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
419 bigendian="yes"
420fi
421
422fi
423
a3999908 424# ---
3d204385
NK
425# check availability of some header files
426
427cat > $TMPC << EOF
428#include <malloc.h>
429int main( void ) { return 0; }
430EOF
431
432_memalign=no
433_malloc_h=no
f3ec2d46 434if $cc -o $TMPE $TMPC 2> /dev/null ; then
3d204385
NK
435_malloc_h=yes
436_memalign=yes
437# check for memalign - atmos
438cat > $TMPC << EOF
439#include <malloc.h>
440int main ( void ) {
441char *string = NULL;
442string = memalign(64, sizeof(char));
443return 0;
444}
445EOF
f3ec2d46 446$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
3d204385
NK
447fi
448
68892110
PG
449cat > $TMPC << EOF
450#define _GNU_SOURCE
451#include <time.h>
452int main( void ) { return *strptime("", "", 0); }
453EOF
454
455strptime=no
f3ec2d46 456if $cc -o $TMPE $TMPC 2> /dev/null ; then
68892110
PG
457 strptime=yes
458fi
459
0147f198
FR
460if test "$zlib" = "yes"; then
461# check for zlib - mmu_man
462cat > $TMPC << EOF
463#include <zlib.h>
464int main ( void ) {
465if (zlibVersion() != ZLIB_VERSION)
466 puts("zlib version differs !!!");
467 return 1;
468return 0;
469}
470EOF
f3ec2d46
SG
471$cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
472# $TMPE 2> /dev/null > /dev/null || zlib="no"
0147f198
FR
473# XXX: more tests needed - runtime test
474fi
475if test "$zlib" = "yes"; then
476extralibs="$extralibs -lz"
477fi
478
95e2ce4a
MN
479# test for lrintf in math.h
480cat > $TMPC << EOF
481#define _ISOC9X_SOURCE 1
482#include <math.h>
483int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
484EOF
485
486have_lrintf="no"
f3ec2d46 487if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
95e2ce4a 488 have_lrintf="yes"
f3ec2d46 489 $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
95e2ce4a
MN
490fi
491
c13e1abd
FH
492_restrict=
493for restrict_keyword in restrict __restrict__ __restrict; do
494 echo "void foo(char * $restrict_keyword p);" > $TMPC
495 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
496 _restrict=$restrict_keyword
497 break;
498 fi
499done
500
52b41d7f
FB
501# test gcc version to see if vector builtins can be used
502# currently only used on i386 for MMX builtins
503cat > $TMPC << EOF
504int main(void) {
505#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
506return 0;
507#else
508#error no vector builtins
509#endif
510}
511EOF
512
513builtin_vector=no
514if $cc -o $TMPO $TMPC 2> /dev/null ; then
515 builtin_vector=yes
a8721c09
FB
516fi
517
518# dlopen/dlfcn.h probing
519
520cat > $TMPC << EOF
521#include <dlfcn.h>
522int main( void ) { return (int) dlopen("foo", 0); }
523EOF
524
525ldl=-ldl
526
527if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
528dlfcn=yes
529dlopen=yes
530fi
531
532if $cc -o $TMPE $TMPC 2> /dev/null ; then
533dlfcn=yes
534dlopen=yes
535ldl=""
536fi
537
538cat > $TMPC << EOF
539int main( void ) { return (int) dlopen("foo", 0); }
540EOF
541
542if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
543dlopen=yes
544fi
545
546if $cc -o $TMPE $TMPC 2> /dev/null ; then
547dlopen=yes
548ldl=""
549fi
550
551if test "$vhook" = "default" ; then
552 vhook="$dlopen"
553fi
554
555cat > $TMPC << EOF
556#include <X11/Xlib.h>
557#include <Imlib2.h>
558int main( void ) { return (int) imlib_load_font("foo"); }
559EOF
560
561imlib2=no
562if $cc -o $TMPE $TMPC -lImlib2 2> /dev/null ; then
563imlib2=yes
52b41d7f
FB
564fi
565
04511d53
PG
566cat > $TMPC << EOF
567#include <ft2build.h>
568int main( void ) { return (int) FT_Init_FreeType(0); }
569EOF
570
571freetype2=no
69db4e10 572if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
6e023978 573 if test "`which freetype-config`" != ""; then
04511d53 574 if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` 2> /dev/null ; then
dee076fc 575 freetype2=yes
04511d53 576 fi
dee076fc 577 fi
04511d53
PG
578fi
579
c9f97d82 580if test "$small" = "yes"; then
98ca7790 581# CFLAGS=${CFLAGS//-O3/-Os}
553a6284
MN
582 CFLAGS="$CFLAGS -Os"
583fi
584
6063bce7 585if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
0f3cb305
FB
586cat << EOF
587
588Usage: configure [options]
589Options: [defaults in brackets after descriptions]
590
591EOF
592echo "Standard options:"
593echo " --help print this message"
594echo " --prefix=PREFIX install in PREFIX [$prefix]"
0f3cb305 595echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
81e0d0b4 596echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
0fc50e58
ZK
597echo " --enable-faad enable faad support via libfaad [default=no]"
598echo " --enable-faadbin build faad support with runtime linking [default=no]"
0f3cb305 599echo " --enable-win32 enable win32 cross compile"
732d9245 600echo " --enable-mingw32 enable mingw32 native windows compile"
5cbcf02c 601echo " --disable-a52 disable GPL'ed A52 support [default=no]"
0f3cb305 602echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
bba9b16c
MN
603echo " --disable-pp disable GPL'ed post processing support [default=no]"
604echo " --enable-shared-pp use libpostproc.so [default=no]"
0f3cb305
FB
605echo " --enable-shared build shared libraries [default=no]"
606echo ""
607echo "Advanced options (experts only):"
608echo " --source-path=PATH path of source code [$source_path]"
609echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
610echo " --cc=CC use C compiler CC [$cc]"
4a908fbc 611echo " --make=MAKE use specified make [$make]"
0f3cb305
FB
612echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
613echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
614echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
615echo " --cpu=CPU force cpu to CPU [$cpu]"
616echo " --disable-mmx disable mmx usage"
ab6c65f6 617echo " --disable-altivec disable AltiVec usage"
5cbcf02c 618echo " --disable-audio-oss disable OSS audio support [default=no]"
dfdfa47c 619echo " --disable-audio-beos disable BeOS audio support [default=no]"
6063bce7 620echo " --disable-v4l disable video4linux grabbing [default=no]"
8aa3ee32 621echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
5cbcf02c 622echo " --disable-network disable network support [default=no]"
0147f198 623echo " --disable-zlib disable zlib [default=no]"
5cbcf02c 624echo " --disable-simple_idct disable simple IDCT routines [default=no]"
47930f09 625echo " --disable-vhook disable video hooking support"
0f3cb305 626echo " --enable-gprof enable profiling with gprof [$gprof]"
1eb2212e
FB
627echo " --disable-mpegaudio-hp faster (but less accurate)"
628echo " mpegaudio decoding [default=no]"
8154d2e0 629echo " --disable-ffserver disable ffserver build"
1d0d55da 630echo " --disable-risky disables patent encumbered codecs"
553a6284 631echo " --enable-small optimize for size instead of speed"
0f3cb305
FB
632echo ""
633echo "NOTE: The object files are build at the place where configure is launched"
634exit 1
635fi
636
de6d9b64 637echo "Install prefix $prefix"
0f3cb305 638echo "Source path $source_path"
de6d9b64 639echo "C compiler $cc"
4a908fbc 640echo "make $make"
de6d9b64 641echo "CPU $cpu"
0f3cb305 642echo "Big Endian $bigendian"
e41e8342 643if test $cpu = "x86"; then
de6d9b64 644echo "MMX enabled $mmx"
52b41d7f 645echo "Vector Builtins $builtin_vector"
e41e8342
FB
646fi
647if test $cpu = "mips"; then
d46aba26 648echo "MMI enabled $mmi"
e41e8342
FB
649fi
650if test $cpu = "powerpc"; then
ab6c65f6 651echo "AltiVec enabled $altivec"
e41e8342 652fi
de6d9b64 653echo "gprof enabled $gprof"
0147f198 654echo "zlib enabled $zlib"
a6741398 655echo "mp3lame enabled $mp3lame"
81e0d0b4 656echo "vorbis enabled $vorbis"
5cbcf02c 657echo "a52 support $a52"
57514323 658echo "a52 dlopened $a52bin"
bba9b16c
MN
659echo "pp support $pp"
660echo "shared pp $shared_pp"
47930f09 661echo "Video hooking $vhook"
1d0d55da 662echo "risky / patent encumbered codecs $risky"
553a6284 663echo "optimize for size $small"
68892110
PG
664
665if test "$vhook" = "yes" ; then
47930f09 666echo "Imlib2 support $imlib2"
04511d53 667echo "freetype support $freetype2"
68892110 668fi
de6d9b64 669
980fc7b8 670echo "Creating config.mak and config.h"
de6d9b64 671
980fc7b8 672echo "# Automatically generated by configure - do not modify" > config.mak
045ed63f 673echo "/* Automatically generated by configure - do not modify */" > $TMPH
de6d9b64 674
980fc7b8 675echo "prefix=$prefix" >> config.mak
4a908fbc 676echo "MAKE=$make" >> config.mak
980fc7b8
FB
677echo "CC=$cc" >> config.mak
678echo "AR=$ar" >> config.mak
be7109c1 679echo "RANLIB=$ranlib" >> config.mak
0f3cb305 680echo "STRIP=$strip" >> config.mak
a9b3f630 681echo "OPTFLAGS=$CFLAGS" >> config.mak
0f3cb305 682echo "LDFLAGS=$LDFLAGS" >> config.mak
4baca069 683echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
e1707f52 684echo "SHFLAGS=$SHFLAGS" >> config.mak
f3ec2d46
SG
685echo "LIBPREF=$LIBPREF" >> config.mak
686echo "LIBSUF=$LIBSUF" >> config.mak
687echo "SLIBPREF=$SLIBPREF" >> config.mak
688echo "SLIBSUF=$SLIBSUF" >> config.mak
6852ac95 689echo "TARGET_OS=$TARGET_OS" >> config.mak
57514323 690if test "$cpu" = "x86" ; then
980fc7b8 691 echo "TARGET_ARCH_X86=yes" >> config.mak
045ed63f 692 echo "#define ARCH_X86 1" >> $TMPH
0f3cb305 693elif test "$cpu" = "armv4l" ; then
6ed7422a 694 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
045ed63f 695 echo "#define ARCH_ARMV4L 1" >> $TMPH
0f3cb305 696elif test "$cpu" = "alpha" ; then
91d1f1a4 697 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
045ed63f 698 echo "#define ARCH_ALPHA 1" >> $TMPH
35fedfc3
PG
699elif test "$cpu" = "sparc64" ; then
700 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
701 echo "#define ARCH_SPARC64 1" >> $TMPH
0f3cb305
FB
702elif test "$cpu" = "powerpc" ; then
703 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
704 echo "#define ARCH_POWERPC 1" >> $TMPH
35e5fb06
RD
705 echo "// Enable the next line to get PowerPC performance report" >> $TMPH
706 echo "// #define POWERPC_TBL_PERFORMANCE_REPORT 1" >> $TMPH
707 echo "// Enable the next line to use PMC registers instead of TBL" >> $TMPH
708 echo "// #define POWERPC_PERF_USE_PMC 1" >> $TMPH
d46aba26
LS
709elif test "$cpu" = "mips" ; then
710 echo "TARGET_ARCH_MIPS=yes" >> config.mak
711 echo "#define ARCH_MIPS 1" >> $TMPH
0f3cb305
FB
712fi
713if test "$bigendian" = "yes" ; then
714 echo "WORDS_BIGENDIAN=yes" >> config.mak
715 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
91d1f1a4 716fi
57514323 717if test "$mmx" = "yes" ; then
980fc7b8 718 echo "TARGET_MMX=yes" >> config.mak
045ed63f 719 echo "#define HAVE_MMX 1" >> $TMPH
de6d9b64 720fi
52b41d7f
FB
721if test "$builtin_vector" = "yes" ; then
722 echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
723 echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
724fi
d46aba26
LS
725if test "$mmi" = "yes" ; then
726 echo "TARGET_MMI=yes" >> config.mak
727 echo "#define HAVE_MMI 1" >> $TMPH
728fi
ab6c65f6
BF
729if test "$altivec" = "yes" ; then
730 echo "TARGET_ALTIVEC=yes" >> config.mak
731 echo "#define HAVE_ALTIVEC 1" >> $TMPH
db40a39a
MN
732 echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
733 echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
ab6c65f6 734fi
57514323 735if test "$gprof" = "yes" ; then
980fc7b8 736 echo "TARGET_GPROF=yes" >> config.mak
045ed63f 737 echo "#define HAVE_GPROF 1" >> $TMPH
de6d9b64 738fi
68892110
PG
739if test "$strptime" = "yes" ; then
740 echo "#define HAVE_STRPTIME 1" >> $TMPH
741else
742 echo "BUILD_STRPTIME=yes" >> config.mak
743fi
744if test "$imlib2" = "yes" ; then
745 echo "HAVE_IMLIB2=yes" >> config.mak
746fi
04511d53
PG
747if test "$freetype2" = "yes" ; then
748 echo "HAVE_FREETYPE2=yes" >> config.mak
749fi
95e2ce4a
MN
750if test "$have_lrintf" = "yes" ; then
751 echo "#define HAVE_LRINTF 1" >> $TMPH
752fi
68892110
PG
753if test "$vhook" = "yes" ; then
754 echo "BUILD_VHOOK=yes" >> config.mak
755 echo "#define HAVE_VHOOK 1" >> $TMPH
9c938e77 756 extralibs="$extralibs $ldl"
68892110 757fi
57514323 758if test "$lshared" = "yes" ; then
0319c531 759 echo "BUILD_SHARED=yes" >> config.mak
5cbcf02c 760 echo "PIC=-fPIC" >> config.mak
0319c531 761fi
ef0bc4c9 762echo "EXTRALIBS=$extralibs" >> config.mak
586bc755 763echo "VERSION=`head $source_path/VERSION`" >>config.mak
0319c531 764echo "" >>config.mak
d771bcae 765# if you do not want to use encoders, disable that.
045ed63f 766echo "#define CONFIG_ENCODERS 1" >> $TMPH
d771bcae
FB
767echo "CONFIG_ENCODERS=yes" >> config.mak
768
769# if you do not want to use decoders, disable that.
045ed63f 770echo "#define CONFIG_DECODERS 1" >> $TMPH
d771bcae
FB
771echo "CONFIG_DECODERS=yes" >> config.mak
772
5cbcf02c
FB
773# AC3
774if test "$a52" = "yes" ; then
775 echo "#define CONFIG_AC3 1" >> $TMPH
776 echo "CONFIG_AC3=yes" >> config.mak
d771bcae 777
5cbcf02c
FB
778 if test "$a52bin" = "yes" ; then
779 echo "#define CONFIG_A52BIN 1" >> $TMPH
780 echo "CONFIG_A52BIN=yes" >> config.mak
781 fi
782fi
783
bba9b16c
MN
784# PP
785if test "$pp" = "yes" ; then
786 echo "#define CONFIG_PP 1" >> $TMPH
787 echo "CONFIG_PP=yes" >> config.mak
788
789 if test "$shared_pp" = "yes" ; then
790 echo "#define SHARED_PP 1" >> $TMPH
791 echo "SHARED_PP=yes" >> config.mak
792 fi
793fi
794
1eb2212e
FB
795# mpeg audio high precision mode
796if test "$mpegaudio_hp" = "yes" ; then
797 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
798fi
799
5cbcf02c
FB
800if test "$v4l" = "yes" ; then
801 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
802 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
803fi
804
8aa3ee32
MK
805if test "$dv1394" = "yes" ; then
806 echo "#define CONFIG_DV1394 1" >> $TMPH
807 echo "CONFIG_DV1394=yes" >> config.mak
808fi
809
adbc0510
PG
810if test "$dlopen" = "yes" ; then
811 echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
812fi
813
814if test "$dlfcn" = "yes" ; then
815 echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
816fi
817
5cbcf02c
FB
818if test "$audio_oss" = "yes" ; then
819 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
820 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
57514323
ZK
821fi
822
dfdfa47c
FR
823if test "$audio_beos" = "yes" ; then
824 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
825 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
826fi
827
5cbcf02c
FB
828if test "$network" = "yes" ; then
829 echo "#define CONFIG_NETWORK 1" >> $TMPH
830 echo "CONFIG_NETWORK=yes" >> config.mak
6ed7422a 831fi
daf8e955 832
0147f198
FR
833if test "$zlib" = "yes" ; then
834 echo "#define CONFIG_ZLIB 1" >> $TMPH
835 echo "CONFIG_ZLIB=yes" >> config.mak
836fi
837
57514323 838if test "$mp3lame" = "yes" ; then
045ed63f 839 echo "#define CONFIG_MP3LAME 1" >> $TMPH
a6741398
J
840 echo "CONFIG_MP3LAME=yes" >> config.mak
841fi
842
81e0d0b4
MH
843if test "$vorbis" = "yes" ; then
844 echo "#define CONFIG_VORBIS 1" >> $TMPH
845 echo "CONFIG_VORBIS=yes" >> config.mak
846fi
847
0fc50e58
ZK
848if test "$faad" = "yes" ; then
849 echo "#define CONFIG_FAAD 1" >> $TMPH
850 echo "CONFIG_FAAD=yes" >> config.mak
851fi
852
853if test "$faadbin" = "yes" ; then
854 echo "#define CONFIG_FAADBIN 1" >> $TMPH
855fi
856
57514323 857if test "$win32" = "yes" ; then
045ed63f 858 echo "#define CONFIG_WIN32 1" >> $TMPH
daf8e955
FB
859 echo "CONFIG_WIN32=yes" >> config.mak
860fi
3d204385 861
732d9245
BE
862if test "$mingw32" = "yes" ; then
863 echo "#define CONFIG_WIN32 1" >> $TMPH
864 echo "CONFIG_WIN32=yes" >> config.mak
865 echo "#define __MINGW32__ 1" >> $TMPH
866 echo "__MINGW32__=1" >> config.mak
867fi
868
3f027ca7
FB
869if test "$cygwin" = "yes" ; then
870 # setup correct exesuffix
871 echo "CONFIG_WIN32=yes" >> config.mak
872fi
873
f3ec2d46
SG
874if test "$os2" = "yes" ; then
875 echo "#define CONFIG_OS2 1" >> $TMPH
876 echo "CONFIG_OS2=yes" >> config.mak
877fi
878
6e023978
RS
879if test "$TARGET_OS" = "SunOS" ; then
880 echo "#define CONFIG_SUNOS 1" >> $TMPH
881fi
882
90cee0c3
MN
883if test "$darwin" = "yes"; then
884 echo "#define CONFIG_DARWIN 1" >> $TMPH
885 echo "CONFIG_DARWIN=yes" >> config.mak
886fi
887
57514323 888if test "$_malloc_h" = "yes" ; then
045ed63f 889 echo "#define HAVE_MALLOC_H 1" >> $TMPH
3d204385 890else
045ed63f 891 echo "#undef HAVE_MALLOC_H" >> $TMPH
3d204385
NK
892fi
893
57514323 894if test "$_memalign" = "yes" ; then
045ed63f
ZK
895 echo "#define HAVE_MEMALIGN 1" >> $TMPH
896else
897 echo "#undef HAVE_MEMALIGN" >> $TMPH
898fi
899
26b35efb
FR
900if test "$netserver" = "yes" ; then
901 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
902 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
903fi
904
4baca069
PG
905if test "$need_inet_aton" = "yes" ; then
906 echo "NEED_INET_ATON=yes" >> config.mak
907fi
908
57514323 909if test "$simpleidct" = "yes" ; then
045ed63f
ZK
910 echo "#define SIMPLE_IDCT 1" >> $TMPH
911fi
912
8154d2e0
FB
913if test "$ffserver" = "yes" ; then
914 echo "#define CONFIG_FFSERVER 1" >> $TMPH
915 echo "CONFIG_FFSERVER=yes" >> config.mak
916fi
917
1d0d55da
MN
918if test "$risky" = "yes" ; then
919 echo "#define CONFIG_RISKY 1" >> $TMPH
920 echo "CONFIG_RISKY=yes" >> config.mak
921fi
922
c13e1abd
FH
923echo "#define restrict $_restrict" >> $TMPH
924
0f3cb305
FB
925# build tree in object directory if source path is different from current one
926if test "$source_path_used" = "yes" ; then
a382b927 927 DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
5f6b58de
MR
928 libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
929 FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
0f3cb305
FB
930 for dir in $DIRS ; do
931 mkdir -p $dir
932 done
933 for f in $FILES ; do
934 ln -sf $source_path/$f $f
935 done
936fi
937echo "SRC_PATH=$source_path" >> config.mak
938
a7c02e25 939diff $TMPH config.h >/dev/null 2>&1
045ed63f
ZK
940if test $? -ne 0 ; then
941 mv -f $TMPH config.h
3d204385 942else
045ed63f 943 echo "config.h is unchanged"
3d204385
NK
944fi
945
f3ec2d46 946rm -f $TMPO $TMPC $TMPE $TMPS $TMPH