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