support for older real audio files (<= version 3)
[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`
a4adb608 29tune="generic"
e45a2872 30powerpc_perf="no"
0f3cb305 31mmx="default"
ab6c65f6 32altivec="default"
d46aba26 33mmi="default"
de6d9b64 34case "$cpu" in
ef0bc4c9 35 i386|i486|i586|i686|i86pc|BePC)
de6d9b64 36 cpu="x86"
de6d9b64 37 ;;
93caefc7
AB
38 # armv4l is a subset of armv5tel
39 armv4l|armv5tel)
6ed7422a 40 cpu="armv4l"
6ed7422a 41 ;;
91d1f1a4
NK
42 alpha)
43 cpu="alpha"
91d1f1a4 44 ;;
a43bd1d7 45 "Power Macintosh"|ppc)
90cee0c3
MN
46 cpu="powerpc"
47 ;;
d46aba26
LS
48 mips)
49 cpu="mips"
50 ;;
a7beab73
RS
51 sun4u)
52 cpu="sparc64"
53 ;;
de6d9b64 54 *)
0f3cb305 55 cpu="unknown"
de6d9b64
FB
56 ;;
57esac
58gprof="no"
5cbcf02c
FB
59v4l="yes"
60audio_oss="yes"
dfdfa47c 61audio_beos="no"
8aa3ee32 62dv1394="yes"
5cbcf02c 63network="yes"
0147f198 64zlib="yes"
a6741398 65mp3lame="no"
81e0d0b4 66vorbis="no"
0fc50e58
ZK
67faad="no"
68faadbin="no"
5cbcf02c 69a52="yes"
57514323 70a52bin="no"
bba9b16c
MN
71pp="yes"
72shared_pp="no"
daf8e955 73win32="no"
732d9245 74mingw32="no"
3f027ca7 75cygwin="no"
f3ec2d46 76os2="no"
83286d2a 77lshared="no"
ef0bc4c9 78extralibs="-lm"
c02dbee1 79simpleidct="yes"
0f3cb305 80bigendian="no"
a8721c09 81vhook="default"
adbc0510
PG
82dlfcn="no"
83dlopen="no"
1eb2212e 84mpegaudio_hp="yes"
e1707f52 85SHFLAGS=-shared
26b35efb 86netserver="no"
4baca069 87need_inet_aton="no"
8154d2e0 88ffserver="yes"
a86b921c 89ffplay="yes"
4baca069
PG
90LDFLAGS=-Wl,--warn-common
91FFSLDFLAGS=-Wl,-E
f3ec2d46
SG
92LIBPREF="lib"
93LIBSUF=".a"
94SLIBPREF="lib"
95SLIBSUF=".so"
1d0d55da 96risky="yes"
553a6284 97small="no"
891f64b3 98amr_nb="no"
bc634f6f 99amr_nb_fixed="no"
ef0bc4c9
FR
100
101# OS specific
102targetos=`uname -s`
103case $targetos in
104BeOS)
105prefix="/boot/home/config"
106# helps building libavcodec
e1707f52 107CFLAGS="-O3 -DPIC -fomit-frame-pointer"
31ba0b4d
FR
108# 3 gcc releases known for BeOS, each with ugly bugs
109gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
110case "$gcc_version" in
1112.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
112mmx="no"
113;;
114*20010315*) echo "BeBits gcc"
115CFLAGS="$CFLAGS -fno-expensive-optimizations"
116;;
117esac
e1707f52
MN
118SHFLAGS=-nostart
119# disable linux things
120audio_oss="no"
5cbcf02c 121v4l="no"
8aa3ee32 122dv1394="no"
dfdfa47c
FR
123# enable beos things
124audio_beos="yes"
ef0bc4c9
FR
125# no need for libm, but the inet stuff
126# Check for BONE
127if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
128extralibs="-lbind -lsocket"
129else
26b35efb 130netserver="yes"
4baca069 131need_inet_aton="yes"
26b35efb 132extralibs="-lnet"
ef0bc4c9 133fi ;;
4baca069
PG
134SunOS)
135v4l="no"
136audio_oss="no"
8aa3ee32 137dv1394="no"
4baca069
PG
138make="gmake"
139LDFLAGS=""
140FFSLDFLAGS=""
141need_inet_aton="yes"
142extralibs="$extralibs -lsocket -lnsl"
143;;
9c938e77
PG
144FreeBSD)
145v4l="no"
146audio_oss="yes"
8aa3ee32 147dv1394="no"
9c938e77 148make="gmake"
4baca069 149LDFLAGS="$LDFLAGS -export-dynamic"
9c938e77 150;;
4a908fbc 151BSD/OS)
5cbcf02c 152v4l="no"
6063bce7 153audio_oss="yes"
8aa3ee32 154dv1394="no"
4a908fbc
AB
155extralibs="-lpoll -lgnugetopt -lm"
156make="gmake"
157;;
90cee0c3 158Darwin)
a43bd1d7 159cc="cc"
90cee0c3
MN
160v4l="no"
161audio_oss="no"
8aa3ee32 162dv1394="no"
d3b15036 163ffserver="no"
a43bd1d7 164SHFLAGS="-dynamiclib"
90cee0c3 165extralibs=""
a43bd1d7 166darwin="yes"
47930f09 167strip="strip -x"
6207ba95 168LDFLAGS="-d"
4baca069 169FFSLDFLAGS=-Wl,-bind_at_load
8d6625b6 170gcc_version="$($cc -v 2>&1 | grep version | cut -d ' ' -f3-)"
4baca069
PG
171case "$gcc_version" in
172*2.95*)
173CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer"
174;;
8d6625b6
DC
175*3.3*)
176CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic -force_cpusubtype_ALL"
177;;
4baca069
PG
178*)
179CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer -mdynamic-no-pic"
180;;
181esac
90cee0c3 182;;
732d9245
BE
183MINGW32*)
184v4l="no"
185audio_oss="no"
8aa3ee32 186dv1394="no"
732d9245
BE
187ffserver="no"
188network="no"
189mingw32="yes"
190;;
3f027ca7
FB
191CYGWIN*)
192v4l="no"
193audio_oss="yes"
8aa3ee32 194dv1394="no"
3f027ca7
FB
195extralibs=""
196cygwin="yes"
197test -f /usr/include/inttypes.h || \
198test -f /usr/local/include/inttypes.h || \
199echo "Missing inttypes.h, please copy cygwin_inttypes.h to" \
200 "/usr/include/inttypes.h !!!"
201;;
b55e4ef4 202Linux)
4baca069 203LDFLAGS="$LDFLAGS -rdynamic"
b55e4ef4 204;;
f3ec2d46
SG
205OS/2)
206TMPE=$TMPE".exe"
69db4e10
SG
207ar="emxomfar -p64"
208ranlib="echo ignoring ranlib"
209strip="echo ignoring strip"
210CFLAGS="-Zomf -O3"
211LDFLAGS="-Zomf -Zstack 16384 -s"
f3ec2d46
SG
212SHFLAGS=""
213FFSLDFLAGS=""
214LIBPREF=""
215LIBSUF=".lib"
216SLIBPREF=""
217SLIBSUF=".dll"
218extralibs=""
219v4l="no"
220audio_oss="no"
8aa3ee32 221dv1394="no"
f3ec2d46
SG
222network="no"
223ffserver="no"
224os2="yes"
225;;
ef0bc4c9
FR
226*) ;;
227esac
de6d9b64 228
6852ac95
RD
229# From mplayer configure. We need TARGET_OS available
230# to the Makefile, so it can distinguish between flavors
231# of AltiVec on PowerPC
232TARGET_OS=`( uname -s ) 2>&1`
233 case "$TARGET_OS" in
234 Linux|FreeBSD|NetBSD|BSD/OS|OpenBSD|SunOS|QNX|Darwin|GNU)
235 ;;
236 IRIX*)
237 TARGET_OS=IRIX
238 ;;
239 HP-UX*)
240 TARGET_OS=HP-UX
241 ;;
242 [cC][yY][gG][wW][iI][nN]*)
243 TARGET_OS=CYGWIN
244 ;;
245 *)
246 TARGET_OS="$TARGET_OS-UNKNOWN"
247 ;;
248 esac
249
0f3cb305
FB
250# find source path
251# XXX: we assume an absolute path is given when launching configure,
252# except in './configure' case.
586bc755 253source_path="`echo $0 | sed -e 's#/configure##'`"
0f3cb305
FB
254source_path_used="yes"
255if test -z "$source_path" -o "$source_path" = "." ; then
256 source_path=`pwd`
257 source_path_used="no"
de6d9b64
FB
258fi
259
260for opt do
261 case "$opt" in
262 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
263 ;;
0f3cb305
FB
264 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
265 ;;
266 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
267 ;;
de6d9b64
FB
268 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
269 ;;
4a908fbc
AB
270 --make=*) make=`echo $opt | cut -d '=' -f 2`
271 ;;
0f3cb305
FB
272 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
273 ;;
274 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
275 ;;
276 --extra-libs=*) extralibs=${opt#--extra-libs=}
277 ;;
de6d9b64
FB
278 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
279 ;;
a4adb608
MN
280 --tune=*) tune=`echo $opt | cut -d '=' -f 2`
281 ;;
e45a2872
RD
282 --powerpc-perf-enable) powerpc_perf="yes"
283 ;;
de6d9b64
FB
284 --disable-mmx) mmx="no"
285 ;;
ab6c65f6
BF
286 --disable-altivec) altivec="no"
287 ;;
de6d9b64
FB
288 --enable-gprof) gprof="yes"
289 ;;
5cbcf02c
FB
290 --disable-v4l) v4l="no"
291 ;;
292 --disable-audio-oss) audio_oss="no"
293 ;;
dfdfa47c
FR
294 --disable-audio-beos) audio_beos="no"
295 ;;
8aa3ee32
MK
296 --disable-dv1394) dv1394="no"
297 ;;
5cbcf02c
FB
298 --disable-network) network="no"
299 ;;
0147f198
FR
300 --disable-zlib) zlib="no"
301 ;;
5cbcf02c 302 --disable-a52) a52="no"
6ed7422a 303 ;;
9c938e77 304 --enable-a52bin) a52bin="yes" ; extralibs="$ldl $extralibs"
57514323 305 ;;
bba9b16c
MN
306 --disable-pp) pp="no"
307 ;;
308 --enable-shared-pp) shared_pp="yes"
309 ;;
a6741398
J
310 --enable-mp3lame) mp3lame="yes"
311 ;;
81e0d0b4
MH
312 --enable-vorbis) vorbis="yes"
313 ;;
445ad18d
ZK
314 --enable-faad) faad="yes"
315 ;;
316 --enable-faadbin) faadbin="yes"
317 ;;
68892110
PG
318 --disable-vhook) vhook="no"
319 ;;
c02dbee1 320 --disable-simple_idct) simpleidct="no"
045ed63f 321 ;;
daf8e955
FB
322 --enable-win32) win32="yes"
323 ;;
732d9245
BE
324 --enable-mingw32) mingw32="yes"
325 ;;
83286d2a 326 --enable-shared) lshared="yes"
0319c531 327 ;;
1eb2212e
FB
328 --disable-mpegaudio-hp) mpegaudio_hp="no"
329 ;;
8154d2e0
FB
330 --disable-ffserver) ffserver="no"
331 ;;
a86b921c
FB
332 --disable-ffplay) ffplay="no"
333 ;;
1d0d55da
MN
334 --disable-risky) risky="no"
335 ;;
553a6284
MN
336 --enable-small) small="yes"
337 ;;
891f64b3 338 --enable-amr_nb) amr_nb="yes"
339 ;;
bc634f6f
ZK
340 --enable-amr_nb-fixed) amr_nb_fixed="yes"
341 ;;
de6d9b64
FB
342 esac
343done
344
0f3cb305
FB
345# compute mmx state
346if test $mmx = "default"; then
347 if test $cpu = "x86"; then
348 mmx="yes"
349 else
350 mmx="no"
351 fi
352fi
353
ab6c65f6
BF
354# Can only do AltiVec on PowerPC
355if test $altivec = "default"; then
356 if test $cpu = "powerpc"; then
357 altivec="yes"
358 else
359 altivec="no"
360 fi
361fi
362
a4adb608
MN
363# Add processor-specific flags
364TUNECPU="generic"
365if test $tune != "generic"; then
366 case $tune in
367 601|ppc601|PowerPC601)
368 CFLAGS="$CFLAGS -mcpu=601"
369 if test $altivec = "yes"; then
370 echo "WARNING: tuning for PPC601 but altivec enabled !";
371 fi
372 TUNECPU=ppc601
373 ;;
374 603*|ppc603*|PowerPC603*)
375 CFLAGS="$CFLAGS -mcpu=603"
376 if test $altivec = "yes"; then
377 echo "WARNING: tuning for PPC603 but altivec enabled !";
378 fi
379 TUNECPU=ppc603
380 ;;
381 604*|ppc604*|PowerPC604*)
382 CFLAGS="$CFLAGS -mcpu=604"
383 if test $altivec = "yes"; then
384 echo "WARNING: tuning for PPC604 but altivec enabled !";
385 fi
386 TUNECPU=ppc604
387 ;;
8d6625b6 388 G3|g3|75*|ppc75*|PowerPC75*)
3efd4952 389 CFLAGS="$CFLAGS -mcpu=750 -mtune=750"
a4adb608
MN
390 if test $altivec = "yes"; then
391 echo "WARNING: tuning for PPC75x but altivec enabled !";
392 fi
393 TUNECPU=ppc750
394 ;;
8d6625b6 395 G4|g4|745*|ppc745*|PowerPC745*)
3efd4952
RD
396 CFLAGS="$CFLAGS -mcpu=7450 -mtune=7450"
397 if test $altivec = "no"; then
398 echo "WARNING: tuning for PPC745x but altivec disabled !";
399 fi
400 TUNECPU=ppc7450
401 ;;
402 74*|ppc74*|PowerPC74*)
403 CFLAGS="$CFLAGS -mcpu=7400 -mtune=7400"
a4adb608
MN
404 if test $altivec = "no"; then
405 echo "WARNING: tuning for PPC74xx but altivec disabled !";
406 fi
e45a2872 407 TUNECPU=ppc7400
a4adb608 408 ;;
8d6625b6 409 G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
a4adb608
MN
410 CFLAGS="$CFLAGS -mcpu=970 -mtune=970 -mpowerpc64 -force_cpusubtype_ALL "
411 if test $altivec = "no"; then
412 echo "WARNING: tuning for PPC970 but altivec disabled !";
413 fi
414 TUNECPU=ppc970
415 ;;
416 *)
417 echo "WARNING: unknown CPU "$tune", ignored"
418 ;;
419 esac
420fi
421
a9a07762
MN
422# See if we have <altivec.h>
423cat > $TMPC << EOF
424#include <altivec.h>
425int main( void ) { return 0; }
426EOF
427
428_altivec_h="no"
429if $cc -o $TMPE $TMPC 2> /dev/null ; then
430_altivec_h="yes"
431fi
432
ab6c65f6
BF
433# See does our compiler support Motorola AltiVec C API
434if test $altivec = "yes"; then
a9a07762 435if test $_altivec_h = "yes"; then
ab6c65f6 436cat > $TMPC << EOF
a9a07762 437#include <altivec.h>
ab6c65f6
BF
438int main(void) {
439 vector signed int v1, v2, v3;
440 v1 = vec_add(v2,v3);
441 return 0;
442}
443EOF
a9a07762
MN
444else
445cat > $TMPC << EOF
446int main(void) {
447 vector signed int v1, v2, v3;
448 v1 = vec_add(v2,v3);
449 return 0;
450}
451EOF
452fi
453if test "$darwin" = "yes"; then
f3ec2d46 454$cc -o $TMPE $TMPC -faltivec 2> /dev/null || altivec="no"
a9a07762
MN
455else
456$cc -o $TMPE $TMPC -maltivec -mabi=altivec 2> /dev/null || altivec="no"
457fi
ab6c65f6
BF
458fi
459
d46aba26
LS
460# Can only do mmi on mips
461if test $mmi = "default"; then
462 if test $cpu = "mips"; then
463 mmi="yes"
464 else
465 mmi="no"
466 fi
467fi
468
469# See does our compiler support mmi
470if test $mmi = "yes"; then
471cat > $TMPC << EOF
472int main(void) {
473 __asm__ ("lq \$2, 0(\$2)");
474 return 0;
475}
476EOF
f3ec2d46 477$cc -o $TMPE $TMPC 2> /dev/null || mmi="no"
d46aba26
LS
478fi
479
daf8e955
FB
480# Checking for CFLAGS
481if test -z "$CFLAGS"; then
29482cb4 482 CFLAGS="-O3"
daf8e955
FB
483fi
484
57514323 485if test "$win32" = "yes" ; then
daf8e955 486 cross_prefix="i386-mingw32msvc-"
5cbcf02c
FB
487 v4l="no"
488 audio_oss="no"
8aa3ee32 489 dv1394="no"
5cbcf02c 490 network="no"
daf8e955
FB
491fi
492
732d9245
BE
493if test "$mingw32" = "yes" ; then
494 cross_prefix=""
495 v4l="no"
496 audio_oss="no"
8aa3ee32 497 dv1394="no"
732d9245
BE
498 network="no"
499fi
500
0f3cb305
FB
501cc="${cross_prefix}${cc}"
502ar="${cross_prefix}${ar}"
be7109c1 503ranlib="${cross_prefix}${ranlib}"
0f3cb305
FB
504strip="${cross_prefix}${strip}"
505
487a54d7
FB
506if test -z "$cross_prefix" ; then
507
3d204385 508# ---
a3999908
MN
509# big/little endian test
510cat > $TMPC << EOF
511#include <inttypes.h>
512int main(int argc, char ** argv){
513 volatile uint32_t i=0x01234567;
514 return (*((uint8_t*)(&i))) == 0x67;
515}
516EOF
517
f3ec2d46
SG
518if $cc -o $TMPE $TMPC 2>/dev/null ; then
519$TMPE && bigendian="yes"
a3999908
MN
520else
521echo big/little test failed
522fi
523
487a54d7
FB
524else
525
526# if cross compiling, cannot launch a program, so make a static guess
527if test "$cpu" = "powerpc" -o "$cpu" = "mips" ; then
528 bigendian="yes"
529fi
530
531fi
532
a3999908 533# ---
3d204385
NK
534# check availability of some header files
535
536cat > $TMPC << EOF
537#include <malloc.h>
538int main( void ) { return 0; }
539EOF
540
541_memalign=no
542_malloc_h=no
f3ec2d46 543if $cc -o $TMPE $TMPC 2> /dev/null ; then
3d204385
NK
544_malloc_h=yes
545_memalign=yes
546# check for memalign - atmos
547cat > $TMPC << EOF
548#include <malloc.h>
549int main ( void ) {
550char *string = NULL;
551string = memalign(64, sizeof(char));
552return 0;
553}
554EOF
f3ec2d46 555$cc -o $TMPE $TMPC 2> /dev/null || _memalign=no
3d204385
NK
556fi
557
68892110
PG
558cat > $TMPC << EOF
559#define _GNU_SOURCE
560#include <time.h>
561int main( void ) { return *strptime("", "", 0); }
562EOF
563
564strptime=no
f3ec2d46 565if $cc -o $TMPE $TMPC 2> /dev/null ; then
68892110
PG
566 strptime=yes
567fi
568
0147f198
FR
569if test "$zlib" = "yes"; then
570# check for zlib - mmu_man
571cat > $TMPC << EOF
572#include <zlib.h>
573int main ( void ) {
574if (zlibVersion() != ZLIB_VERSION)
575 puts("zlib version differs !!!");
576 return 1;
577return 0;
578}
579EOF
f3ec2d46
SG
580$cc -o $TMPE $TMPC -lz 2> /dev/null || zlib="no"
581# $TMPE 2> /dev/null > /dev/null || zlib="no"
0147f198
FR
582# XXX: more tests needed - runtime test
583fi
584if test "$zlib" = "yes"; then
585extralibs="$extralibs -lz"
586fi
587
95e2ce4a
MN
588# test for lrintf in math.h
589cat > $TMPC << EOF
590#define _ISOC9X_SOURCE 1
591#include <math.h>
592int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
593EOF
594
595have_lrintf="no"
f3ec2d46 596if $cc $extralibs -o $TMPE $TMPC 2> /dev/null ; then
95e2ce4a 597 have_lrintf="yes"
f3ec2d46 598 $TMPE 2> /dev/null > /dev/null || have_lrintf="no"
95e2ce4a
MN
599fi
600
c13e1abd
FH
601_restrict=
602for restrict_keyword in restrict __restrict__ __restrict; do
603 echo "void foo(char * $restrict_keyword p);" > $TMPC
604 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
605 _restrict=$restrict_keyword
606 break;
607 fi
608done
609
52b41d7f
FB
610# test gcc version to see if vector builtins can be used
611# currently only used on i386 for MMX builtins
612cat > $TMPC << EOF
613int main(void) {
614#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)
615return 0;
616#else
617#error no vector builtins
618#endif
619}
620EOF
621
622builtin_vector=no
623if $cc -o $TMPO $TMPC 2> /dev/null ; then
624 builtin_vector=yes
a8721c09
FB
625fi
626
627# dlopen/dlfcn.h probing
628
629cat > $TMPC << EOF
630#include <dlfcn.h>
631int main( void ) { return (int) dlopen("foo", 0); }
632EOF
633
634ldl=-ldl
635
636if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
637dlfcn=yes
638dlopen=yes
639fi
640
641if $cc -o $TMPE $TMPC 2> /dev/null ; then
642dlfcn=yes
643dlopen=yes
644ldl=""
645fi
646
647cat > $TMPC << EOF
648int main( void ) { return (int) dlopen("foo", 0); }
649EOF
650
651if $cc -o $TMPE $TMPC -ldl 2> /dev/null ; then
652dlopen=yes
653fi
654
655if $cc -o $TMPE $TMPC 2> /dev/null ; then
656dlopen=yes
657ldl=""
658fi
659
660if test "$vhook" = "default" ; then
661 vhook="$dlopen"
662fi
663
a86b921c
FB
664##########################################
665# imlib probe
666
a8721c09
FB
667cat > $TMPC << EOF
668#include <X11/Xlib.h>
669#include <Imlib2.h>
670int main( void ) { return (int) imlib_load_font("foo"); }
671EOF
672
673imlib2=no
674if $cc -o $TMPE $TMPC -lImlib2 2> /dev/null ; then
675imlib2=yes
52b41d7f
FB
676fi
677
a86b921c
FB
678##########################################
679# freetype probe
680
04511d53
PG
681cat > $TMPC << EOF
682#include <ft2build.h>
683int main( void ) { return (int) FT_Init_FreeType(0); }
684EOF
685
686freetype2=no
69db4e10 687if test "x$targetos" != "xBeOS" && test "$os2" != "yes"; then
6e023978 688 if test "`which freetype-config`" != ""; then
04511d53 689 if $cc -o $TMPE $TMPC `freetype-config --cflags` `freetype-config --libs` 2> /dev/null ; then
dee076fc 690 freetype2=yes
04511d53 691 fi
dee076fc 692 fi
04511d53
PG
693fi
694
a86b921c
FB
695##########################################
696# SDL probe
697
698cat > $TMPC << EOF
699#include <SDL.h>
31319a8c 700#undef main /* We don't want SDL to override our main() */
a86b921c
FB
701int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
702EOF
703
704sdl_too_old=no
705sdl=no
706if $cc -o $TMPE `sdl-config --cflags` $TMPC `sdl-config --libs` 2> /dev/null ; then
707_sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
708if test "$_sdlversion" -lt 121 ; then
709sdl_too_old=yes
710else
711sdl=yes
712fi
713fi
714
94a3401e
FB
715if test "$sdl" = "no" ; then
716 ffplay=no
717fi
718
c9f97d82 719if test "$small" = "yes"; then
98ca7790 720# CFLAGS=${CFLAGS//-O3/-Os}
553a6284
MN
721 CFLAGS="$CFLAGS -Os"
722fi
723
6063bce7 724if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
0f3cb305
FB
725cat << EOF
726
727Usage: configure [options]
728Options: [defaults in brackets after descriptions]
729
730EOF
731echo "Standard options:"
732echo " --help print this message"
733echo " --prefix=PREFIX install in PREFIX [$prefix]"
0f3cb305 734echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
81e0d0b4 735echo " --enable-vorbis enable vorbis support via libvorbisenc [default=no]"
0fc50e58
ZK
736echo " --enable-faad enable faad support via libfaad [default=no]"
737echo " --enable-faadbin build faad support with runtime linking [default=no]"
0f3cb305 738echo " --enable-win32 enable win32 cross compile"
732d9245 739echo " --enable-mingw32 enable mingw32 native windows compile"
5cbcf02c 740echo " --disable-a52 disable GPL'ed A52 support [default=no]"
0f3cb305 741echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
bba9b16c
MN
742echo " --disable-pp disable GPL'ed post processing support [default=no]"
743echo " --enable-shared-pp use libpostproc.so [default=no]"
0f3cb305 744echo " --enable-shared build shared libraries [default=no]"
bc634f6f
ZK
745echo " --enable-amr_nb enable amr_nb float audio codec"
746echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
0f3cb305
FB
747echo ""
748echo "Advanced options (experts only):"
749echo " --source-path=PATH path of source code [$source_path]"
750echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
751echo " --cc=CC use C compiler CC [$cc]"
4a908fbc 752echo " --make=MAKE use specified make [$make]"
0f3cb305
FB
753echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
754echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
755echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
756echo " --cpu=CPU force cpu to CPU [$cpu]"
a4adb608 757echo " --tune=PROCESSOR tune code for a particular CPU (may fails or misperforms on other CPUs)"
e45a2872 758echo " --powerpc-perf-enable enable performance report on PPC (requires enabling PMC)"
0f3cb305 759echo " --disable-mmx disable mmx usage"
ab6c65f6 760echo " --disable-altivec disable AltiVec usage"
5cbcf02c 761echo " --disable-audio-oss disable OSS audio support [default=no]"
dfdfa47c 762echo " --disable-audio-beos disable BeOS audio support [default=no]"
6063bce7 763echo " --disable-v4l disable video4linux grabbing [default=no]"
8aa3ee32 764echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
5cbcf02c 765echo " --disable-network disable network support [default=no]"
0147f198 766echo " --disable-zlib disable zlib [default=no]"
5cbcf02c 767echo " --disable-simple_idct disable simple IDCT routines [default=no]"
47930f09 768echo " --disable-vhook disable video hooking support"
0f3cb305 769echo " --enable-gprof enable profiling with gprof [$gprof]"
1eb2212e
FB
770echo " --disable-mpegaudio-hp faster (but less accurate)"
771echo " mpegaudio decoding [default=no]"
8154d2e0 772echo " --disable-ffserver disable ffserver build"
a86b921c 773echo " --disable-ffplay disable ffplay build"
1d0d55da 774echo " --disable-risky disables patent encumbered codecs"
553a6284 775echo " --enable-small optimize for size instead of speed"
0f3cb305
FB
776echo ""
777echo "NOTE: The object files are build at the place where configure is launched"
778exit 1
779fi
780
de6d9b64 781echo "Install prefix $prefix"
0f3cb305 782echo "Source path $source_path"
de6d9b64 783echo "C compiler $cc"
4a908fbc 784echo "make $make"
a4adb608 785echo "CPU $cpu ($tune)"
0f3cb305 786echo "Big Endian $bigendian"
e41e8342 787if test $cpu = "x86"; then
de6d9b64 788echo "MMX enabled $mmx"
52b41d7f 789echo "Vector Builtins $builtin_vector"
e41e8342
FB
790fi
791if test $cpu = "mips"; then
d46aba26 792echo "MMI enabled $mmi"
e41e8342
FB
793fi
794if test $cpu = "powerpc"; then
ab6c65f6 795echo "AltiVec enabled $altivec"
e41e8342 796fi
de6d9b64 797echo "gprof enabled $gprof"
0147f198 798echo "zlib enabled $zlib"
a6741398 799echo "mp3lame enabled $mp3lame"
81e0d0b4 800echo "vorbis enabled $vorbis"
445ad18d
ZK
801echo "faad enabled $faad"
802echo "faadbin enabled $faadbin"
5cbcf02c 803echo "a52 support $a52"
57514323 804echo "a52 dlopened $a52bin"
bba9b16c
MN
805echo "pp support $pp"
806echo "shared pp $shared_pp"
47930f09 807echo "Video hooking $vhook"
a86b921c
FB
808echo "SDL support $sdl"
809if test $sdl_too_old = "yes"; then
810echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support"
811fi
1d0d55da 812echo "risky / patent encumbered codecs $risky"
553a6284 813echo "optimize for size $small"
68892110
PG
814
815if test "$vhook" = "yes" ; then
47930f09 816echo "Imlib2 support $imlib2"
04511d53 817echo "freetype support $freetype2"
68892110 818fi
bc634f6f
ZK
819echo "AMR-NB float support" $amr_nb
820echo "AMR-NB fixed support" $amr_nb_fixed
de6d9b64 821
980fc7b8 822echo "Creating config.mak and config.h"
de6d9b64 823
980fc7b8 824echo "# Automatically generated by configure - do not modify" > config.mak
045ed63f 825echo "/* Automatically generated by configure - do not modify */" > $TMPH
de6d9b64 826
980fc7b8 827echo "prefix=$prefix" >> config.mak
4a908fbc 828echo "MAKE=$make" >> config.mak
980fc7b8
FB
829echo "CC=$cc" >> config.mak
830echo "AR=$ar" >> config.mak
be7109c1 831echo "RANLIB=$ranlib" >> config.mak
0f3cb305 832echo "STRIP=$strip" >> config.mak
a9b3f630 833echo "OPTFLAGS=$CFLAGS" >> config.mak
0f3cb305 834echo "LDFLAGS=$LDFLAGS" >> config.mak
4baca069 835echo "FFSLDFLAGS=$FFSLDFLAGS" >> config.mak
e1707f52 836echo "SHFLAGS=$SHFLAGS" >> config.mak
f3ec2d46
SG
837echo "LIBPREF=$LIBPREF" >> config.mak
838echo "LIBSUF=$LIBSUF" >> config.mak
839echo "SLIBPREF=$SLIBPREF" >> config.mak
840echo "SLIBSUF=$SLIBSUF" >> config.mak
6852ac95 841echo "TARGET_OS=$TARGET_OS" >> config.mak
57514323 842if test "$cpu" = "x86" ; then
980fc7b8 843 echo "TARGET_ARCH_X86=yes" >> config.mak
045ed63f 844 echo "#define ARCH_X86 1" >> $TMPH
0f3cb305 845elif test "$cpu" = "armv4l" ; then
6ed7422a 846 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
045ed63f 847 echo "#define ARCH_ARMV4L 1" >> $TMPH
0f3cb305 848elif test "$cpu" = "alpha" ; then
91d1f1a4 849 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
045ed63f 850 echo "#define ARCH_ALPHA 1" >> $TMPH
35fedfc3
PG
851elif test "$cpu" = "sparc64" ; then
852 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
853 echo "#define ARCH_SPARC64 1" >> $TMPH
0f3cb305
FB
854elif test "$cpu" = "powerpc" ; then
855 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
856 echo "#define ARCH_POWERPC 1" >> $TMPH
e45a2872
RD
857 if test "$powerpc_perf" = "yes"; then
858 echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
859 fi
d46aba26
LS
860elif test "$cpu" = "mips" ; then
861 echo "TARGET_ARCH_MIPS=yes" >> config.mak
862 echo "#define ARCH_MIPS 1" >> $TMPH
0f3cb305 863fi
a4adb608 864echo "#define TUNECPU $TUNECPU" >> $TMPH
0f3cb305
FB
865if test "$bigendian" = "yes" ; then
866 echo "WORDS_BIGENDIAN=yes" >> config.mak
867 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
91d1f1a4 868fi
57514323 869if test "$mmx" = "yes" ; then
980fc7b8 870 echo "TARGET_MMX=yes" >> config.mak
045ed63f 871 echo "#define HAVE_MMX 1" >> $TMPH
e82c5a8c 872 echo "#define __CPU__ 586" >> $TMPH
de6d9b64 873fi
52b41d7f
FB
874if test "$builtin_vector" = "yes" ; then
875 echo "TARGET_BUILTIN_VECTOR=yes" >> config.mak
876 echo "#define HAVE_BUILTIN_VECTOR 1" >> $TMPH
877fi
d46aba26
LS
878if test "$mmi" = "yes" ; then
879 echo "TARGET_MMI=yes" >> config.mak
880 echo "#define HAVE_MMI 1" >> $TMPH
881fi
ab6c65f6
BF
882if test "$altivec" = "yes" ; then
883 echo "TARGET_ALTIVEC=yes" >> config.mak
884 echo "#define HAVE_ALTIVEC 1" >> $TMPH
db40a39a
MN
885 echo "// Enable the next line to use the reference C code instead of AltiVec" >> $TMPH
886 echo "// #define ALTIVEC_USE_REFERENCE_C_CODE 1" >> $TMPH
a9a07762
MN
887 if test "$_altivec_h" = "yes" ; then
888 echo "#define HAVE_ALTIVEC_H 1" >> $TMPH
889 else
e67e14d5 890 echo "#undef HAVE_ALTIVEC_H" >> $TMPH
a9a07762 891 fi
ab6c65f6 892fi
57514323 893if test "$gprof" = "yes" ; then
980fc7b8 894 echo "TARGET_GPROF=yes" >> config.mak
045ed63f 895 echo "#define HAVE_GPROF 1" >> $TMPH
de6d9b64 896fi
68892110
PG
897if test "$strptime" = "yes" ; then
898 echo "#define HAVE_STRPTIME 1" >> $TMPH
899else
900 echo "BUILD_STRPTIME=yes" >> config.mak
901fi
902if test "$imlib2" = "yes" ; then
903 echo "HAVE_IMLIB2=yes" >> config.mak
904fi
04511d53
PG
905if test "$freetype2" = "yes" ; then
906 echo "HAVE_FREETYPE2=yes" >> config.mak
907fi
a86b921c
FB
908if test "$sdl" = "yes" ; then
909 echo "CONFIG_SDL=yes" >> config.mak
910 echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
911 echo "SDL_CFLAGS=`sdl-config --cflags`" >> config.mak
912fi
95e2ce4a
MN
913if test "$have_lrintf" = "yes" ; then
914 echo "#define HAVE_LRINTF 1" >> $TMPH
915fi
68892110
PG
916if test "$vhook" = "yes" ; then
917 echo "BUILD_VHOOK=yes" >> config.mak
918 echo "#define HAVE_VHOOK 1" >> $TMPH
9c938e77 919 extralibs="$extralibs $ldl"
68892110 920fi
57514323 921if test "$lshared" = "yes" ; then
0319c531 922 echo "BUILD_SHARED=yes" >> config.mak
5cbcf02c 923 echo "PIC=-fPIC" >> config.mak
0319c531 924fi
ef0bc4c9 925echo "EXTRALIBS=$extralibs" >> config.mak
586bc755 926echo "VERSION=`head $source_path/VERSION`" >>config.mak
0319c531 927echo "" >>config.mak
d771bcae 928# if you do not want to use encoders, disable that.
045ed63f 929echo "#define CONFIG_ENCODERS 1" >> $TMPH
d771bcae
FB
930echo "CONFIG_ENCODERS=yes" >> config.mak
931
932# if you do not want to use decoders, disable that.
045ed63f 933echo "#define CONFIG_DECODERS 1" >> $TMPH
d771bcae
FB
934echo "CONFIG_DECODERS=yes" >> config.mak
935
5cbcf02c
FB
936# AC3
937if test "$a52" = "yes" ; then
938 echo "#define CONFIG_AC3 1" >> $TMPH
939 echo "CONFIG_AC3=yes" >> config.mak
d771bcae 940
5cbcf02c
FB
941 if test "$a52bin" = "yes" ; then
942 echo "#define CONFIG_A52BIN 1" >> $TMPH
943 echo "CONFIG_A52BIN=yes" >> config.mak
944 fi
945fi
946
bba9b16c
MN
947# PP
948if test "$pp" = "yes" ; then
949 echo "#define CONFIG_PP 1" >> $TMPH
950 echo "CONFIG_PP=yes" >> config.mak
951
952 if test "$shared_pp" = "yes" ; then
953 echo "#define SHARED_PP 1" >> $TMPH
954 echo "SHARED_PP=yes" >> config.mak
955 fi
956fi
957
1eb2212e
FB
958# mpeg audio high precision mode
959if test "$mpegaudio_hp" = "yes" ; then
960 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
961fi
962
5cbcf02c
FB
963if test "$v4l" = "yes" ; then
964 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
965 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
966fi
967
8aa3ee32
MK
968if test "$dv1394" = "yes" ; then
969 echo "#define CONFIG_DV1394 1" >> $TMPH
970 echo "CONFIG_DV1394=yes" >> config.mak
971fi
972
adbc0510
PG
973if test "$dlopen" = "yes" ; then
974 echo "#define CONFIG_HAVE_DLOPEN 1" >> $TMPH
975fi
976
977if test "$dlfcn" = "yes" ; then
978 echo "#define CONFIG_HAVE_DLFCN 1" >> $TMPH
979fi
980
5cbcf02c
FB
981if test "$audio_oss" = "yes" ; then
982 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
983 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
57514323
ZK
984fi
985
dfdfa47c
FR
986if test "$audio_beos" = "yes" ; then
987 echo "#define CONFIG_AUDIO_BEOS 1" >> $TMPH
988 echo "CONFIG_AUDIO_BEOS=yes" >> config.mak
989fi
990
5cbcf02c
FB
991if test "$network" = "yes" ; then
992 echo "#define CONFIG_NETWORK 1" >> $TMPH
993 echo "CONFIG_NETWORK=yes" >> config.mak
6ed7422a 994fi
daf8e955 995
0147f198
FR
996if test "$zlib" = "yes" ; then
997 echo "#define CONFIG_ZLIB 1" >> $TMPH
998 echo "CONFIG_ZLIB=yes" >> config.mak
999fi
1000
57514323 1001if test "$mp3lame" = "yes" ; then
045ed63f 1002 echo "#define CONFIG_MP3LAME 1" >> $TMPH
a6741398
J
1003 echo "CONFIG_MP3LAME=yes" >> config.mak
1004fi
1005
81e0d0b4
MH
1006if test "$vorbis" = "yes" ; then
1007 echo "#define CONFIG_VORBIS 1" >> $TMPH
1008 echo "CONFIG_VORBIS=yes" >> config.mak
1009fi
1010
0fc50e58
ZK
1011if test "$faad" = "yes" ; then
1012 echo "#define CONFIG_FAAD 1" >> $TMPH
1013 echo "CONFIG_FAAD=yes" >> config.mak
1014fi
1015
1016if test "$faadbin" = "yes" ; then
1017 echo "#define CONFIG_FAADBIN 1" >> $TMPH
445ad18d 1018 echo "CONFIG_FAADBIN=yes" >> config.mak
0fc50e58
ZK
1019fi
1020
57514323 1021if test "$win32" = "yes" ; then
045ed63f 1022 echo "#define CONFIG_WIN32 1" >> $TMPH
daf8e955
FB
1023 echo "CONFIG_WIN32=yes" >> config.mak
1024fi
3d204385 1025
732d9245
BE
1026if test "$mingw32" = "yes" ; then
1027 echo "#define CONFIG_WIN32 1" >> $TMPH
1028 echo "CONFIG_WIN32=yes" >> config.mak
1029 echo "#define __MINGW32__ 1" >> $TMPH
1030 echo "__MINGW32__=1" >> config.mak
1031fi
1032
3f027ca7
FB
1033if test "$cygwin" = "yes" ; then
1034 # setup correct exesuffix
1035 echo "CONFIG_WIN32=yes" >> config.mak
1036fi
1037
f3ec2d46
SG
1038if test "$os2" = "yes" ; then
1039 echo "#define CONFIG_OS2 1" >> $TMPH
1040 echo "CONFIG_OS2=yes" >> config.mak
1041fi
1042
6e023978
RS
1043if test "$TARGET_OS" = "SunOS" ; then
1044 echo "#define CONFIG_SUNOS 1" >> $TMPH
1045fi
1046
90cee0c3
MN
1047if test "$darwin" = "yes"; then
1048 echo "#define CONFIG_DARWIN 1" >> $TMPH
1049 echo "CONFIG_DARWIN=yes" >> config.mak
1050fi
1051
57514323 1052if test "$_malloc_h" = "yes" ; then
045ed63f 1053 echo "#define HAVE_MALLOC_H 1" >> $TMPH
3d204385 1054else
045ed63f 1055 echo "#undef HAVE_MALLOC_H" >> $TMPH
3d204385
NK
1056fi
1057
57514323 1058if test "$_memalign" = "yes" ; then
045ed63f
ZK
1059 echo "#define HAVE_MEMALIGN 1" >> $TMPH
1060else
1061 echo "#undef HAVE_MEMALIGN" >> $TMPH
1062fi
1063
26b35efb
FR
1064if test "$netserver" = "yes" ; then
1065 echo "#define CONFIG_BEOS_NETSERVER 1" >> $TMPH
1066 echo "CONFIG_BEOS_NETSERVER=yes" >> config.mak
1067fi
1068
4baca069
PG
1069if test "$need_inet_aton" = "yes" ; then
1070 echo "NEED_INET_ATON=yes" >> config.mak
1071fi
1072
57514323 1073if test "$simpleidct" = "yes" ; then
045ed63f
ZK
1074 echo "#define SIMPLE_IDCT 1" >> $TMPH
1075fi
1076
8154d2e0
FB
1077if test "$ffserver" = "yes" ; then
1078 echo "#define CONFIG_FFSERVER 1" >> $TMPH
1079 echo "CONFIG_FFSERVER=yes" >> config.mak
1080fi
1081
a86b921c
FB
1082if test "$ffplay" = "yes" ; then
1083 echo "CONFIG_FFPLAY=yes" >> config.mak
1084fi
1085
1d0d55da
MN
1086if test "$risky" = "yes" ; then
1087 echo "#define CONFIG_RISKY 1" >> $TMPH
1088 echo "CONFIG_RISKY=yes" >> config.mak
1089fi
1090
c13e1abd
FH
1091echo "#define restrict $_restrict" >> $TMPH
1092
0f3cb305
FB
1093# build tree in object directory if source path is different from current one
1094if test "$source_path_used" = "yes" ; then
a382b927 1095 DIRS="libavformat libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
5f6b58de
MR
1096 libavcodec/ppc libavcodec/liba52 libavcodec/mlib libavcodec/libpostproc tests vhook"
1097 FILES="Makefile libavformat/Makefile libavcodec/Makefile libavcodec/libpostproc/Makefile tests/Makefile vhook/Makefile"
0f3cb305
FB
1098 for dir in $DIRS ; do
1099 mkdir -p $dir
1100 done
1101 for f in $FILES ; do
1102 ln -sf $source_path/$f $f
1103 done
1104fi
1105echo "SRC_PATH=$source_path" >> config.mak
1106
891f64b3 1107if test "$amr_nb" = "yes" ; then
1108 echo "#define AMR_NB 1" >> $TMPH
1109 echo "AMR_NB=yes" >> config.mak
1110 echo
bc634f6f
ZK
1111if test "$amr_nb_fixed" = "yes" ; then
1112 echo "AMR_NB_FIXED=yes" >> config.mak
1113 echo "#define AMR_NB_FIXED 1" >> $TMPH
1114 echo "AMR NB FIXED POINT NOTICE! Make sure you have downloaded TS26.073 "
1115 echo "REL-5 version 5.1.0 from "
891f64b3 1116 echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26073-510.zip"
1117 echo "and extracted src to libavcodec/amr"
bc634f6f
ZK
1118 echo "You must also add -DMMS_IO and remove -pedantic-errors to/from CFLAGS in libavcodec/amr/makefile."
1119 echo "i.e. CFLAGS = -Wall -I. \$(CFLAGS_\$(MODE)) -D\$(VAD) -DMMS_IO"
1120 echo
1121else
1122 echo "AMR NB FLOAT NOTICE ! Make sure you have downloaded TS26.104"
1123 echo "REL-5 V5.1.0 from "
1124 echo "http://www.3gpp.org/ftp/Specs/latest/Rel-5/26_series/26104-510.zip"
1125 echo "and extracted the source to libavcodec/amr_float"
891f64b3 1126 echo
1127fi
1128
bc634f6f
ZK
1129fi
1130
a7c02e25 1131diff $TMPH config.h >/dev/null 2>&1
045ed63f
ZK
1132if test $? -ne 0 ; then
1133 mv -f $TMPH config.h
3d204385 1134else
045ed63f 1135 echo "config.h is unchanged"
3d204385
NK
1136fi
1137
f3ec2d46 1138rm -f $TMPO $TMPC $TMPE $TMPS $TMPH