checksum update cuz of build change 4620->4621
[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"
16TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
17TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
18
de6d9b64
FB
19# default parameters
20prefix="/usr/local"
0f3cb305 21cross_prefix=""
de6d9b64
FB
22cc="gcc"
23ar="ar"
4a908fbc 24make="make"
0f3cb305 25strip="strip"
de6d9b64 26cpu=`uname -m`
0f3cb305 27mmx="default"
de6d9b64 28case "$cpu" in
ef0bc4c9 29 i386|i486|i586|i686|i86pc|BePC)
de6d9b64 30 cpu="x86"
de6d9b64 31 ;;
6ed7422a
FB
32 armv4l)
33 cpu="armv4l"
6ed7422a 34 ;;
91d1f1a4
NK
35 alpha)
36 cpu="alpha"
91d1f1a4 37 ;;
90cee0c3
MN
38 "Power Macintosh")
39 cpu="powerpc"
40 ;;
de6d9b64 41 *)
0f3cb305 42 cpu="unknown"
de6d9b64
FB
43 ;;
44esac
45gprof="no"
5cbcf02c
FB
46v4l="yes"
47audio_oss="yes"
48network="yes"
0147f198 49zlib="yes"
a6741398 50mp3lame="no"
5cbcf02c 51a52="yes"
57514323 52a52bin="no"
daf8e955 53win32="no"
83286d2a 54lshared="no"
ef0bc4c9 55extralibs="-lm"
c02dbee1 56simpleidct="yes"
0f3cb305 57bigendian="no"
68892110 58vhook="no"
1eb2212e 59mpegaudio_hp="yes"
e1707f52 60SHFLAGS=-shared
ef0bc4c9
FR
61
62# OS specific
63targetos=`uname -s`
64case $targetos in
65BeOS)
66prefix="/boot/home/config"
67# helps building libavcodec
e1707f52
MN
68CFLAGS="-O3 -DPIC -fomit-frame-pointer"
69SHFLAGS=-nostart
70# disable linux things
71audio_oss="no"
5cbcf02c 72v4l="no"
ef0bc4c9
FR
73# no need for libm, but the inet stuff
74# Check for BONE
75if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
76extralibs="-lbind -lsocket"
77else
78echo "Not sure building for net_server will succeed... good luck."
79extralibs="-lsocket"
80fi ;;
4a908fbc 81BSD/OS)
5cbcf02c 82v4l="no"
6063bce7 83audio_oss="yes"
4a908fbc
AB
84extralibs="-lpoll -lgnugetopt -lm"
85make="gmake"
86;;
90cee0c3
MN
87Darwin)
88v4l="no"
89audio_oss="no"
90CFLAGS="-no-cpp-precomp -pipe -O3 -fomit-frame-pointer"
91SHFLAGS=-dynamic
92extralibs=""
93darwin=yes
94;;
ef0bc4c9
FR
95*) ;;
96esac
de6d9b64 97
0f3cb305
FB
98# find source path
99# XXX: we assume an absolute path is given when launching configure,
100# except in './configure' case.
101source_path=${0%configure}
102source_path=${source_path%/}
103source_path_used="yes"
104if test -z "$source_path" -o "$source_path" = "." ; then
105 source_path=`pwd`
106 source_path_used="no"
de6d9b64
FB
107fi
108
68892110
PG
109cat > $TMPC << EOF
110#include <dlfcn.h>
111int main( void ) { return (int) dlopen("foo", 0); }
112EOF
113
114if $cc -o $TMPO $TMPC -ldl 2> /dev/null ; then
115: vhook=yes
116fi
117
118cat > $TMPC << EOF
119#include <X11/Xlib.h>
120#include <Imlib2.h>
121int main( void ) { return (int) imlib_load_font("foo"); }
122EOF
123
124imlib2=no
125if $cc -o $TMPO $TMPC -lImlib2 2> /dev/null ; then
126imlib2=yes
127fi
128
de6d9b64
FB
129for opt do
130 case "$opt" in
131 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
132 ;;
0f3cb305
FB
133 --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
134 ;;
135 --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
136 ;;
de6d9b64
FB
137 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
138 ;;
4a908fbc
AB
139 --make=*) make=`echo $opt | cut -d '=' -f 2`
140 ;;
0f3cb305
FB
141 --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
142 ;;
143 --extra-ldflags=*) LDFLAGS=${opt#--extra-ldflags=}
144 ;;
145 --extra-libs=*) extralibs=${opt#--extra-libs=}
146 ;;
de6d9b64
FB
147 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
148 ;;
149 --disable-mmx) mmx="no"
150 ;;
151 --enable-gprof) gprof="yes"
152 ;;
5cbcf02c
FB
153 --disable-v4l) v4l="no"
154 ;;
155 --disable-audio-oss) audio_oss="no"
156 ;;
157 --disable-network) network="no"
158 ;;
0147f198
FR
159 --disable-zlib) zlib="no"
160 ;;
5cbcf02c 161 --disable-a52) a52="no"
6ed7422a 162 ;;
57514323
ZK
163 --enable-a52bin) a52bin="yes" ; extralibs="-ldl $extralibs"
164 ;;
a6741398
J
165 --enable-mp3lame) mp3lame="yes"
166 ;;
68892110
PG
167 --disable-vhook) vhook="no"
168 ;;
c02dbee1 169 --disable-simple_idct) simpleidct="no"
045ed63f 170 ;;
daf8e955
FB
171 --enable-win32) win32="yes"
172 ;;
83286d2a 173 --enable-shared) lshared="yes"
0319c531 174 ;;
1eb2212e
FB
175 --disable-mpegaudio-hp) mpegaudio_hp="no"
176 ;;
de6d9b64
FB
177 esac
178done
179
0f3cb305
FB
180# compute mmx state
181if test $mmx = "default"; then
182 if test $cpu = "x86"; then
183 mmx="yes"
184 else
185 mmx="no"
186 fi
187fi
188
daf8e955
FB
189# Checking for CFLAGS
190if test -z "$CFLAGS"; then
29482cb4 191 CFLAGS="-O3"
daf8e955
FB
192fi
193
57514323 194if test "$win32" = "yes" ; then
daf8e955 195 cross_prefix="i386-mingw32msvc-"
5cbcf02c
FB
196 v4l="no"
197 audio_oss="no"
198 network="no"
daf8e955
FB
199fi
200
0f3cb305
FB
201cc="${cross_prefix}${cc}"
202ar="${cross_prefix}${ar}"
203strip="${cross_prefix}${strip}"
204
3d204385 205# ---
a3999908
MN
206# big/little endian test
207cat > $TMPC << EOF
208#include <inttypes.h>
209int main(int argc, char ** argv){
210 volatile uint32_t i=0x01234567;
211 return (*((uint8_t*)(&i))) == 0x67;
212}
213EOF
214
215if $cc -o $TMPO $TMPC 2>/dev/null ; then
216$TMPO && bigendian="yes"
217else
218echo big/little test failed
219fi
220
221# ---
3d204385
NK
222# check availability of some header files
223
224cat > $TMPC << EOF
225#include <malloc.h>
226int main( void ) { return 0; }
227EOF
228
229_memalign=no
230_malloc_h=no
231if $cc -o $TMPO $TMPC 2> /dev/null ; then
232_malloc_h=yes
233_memalign=yes
234# check for memalign - atmos
235cat > $TMPC << EOF
236#include <malloc.h>
237int main ( void ) {
238char *string = NULL;
239string = memalign(64, sizeof(char));
240return 0;
241}
242EOF
243$cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
244fi
245
68892110
PG
246cat > $TMPC << EOF
247#define _GNU_SOURCE
248#include <time.h>
249int main( void ) { return *strptime("", "", 0); }
250EOF
251
252strptime=no
253if $cc -o $TMPO $TMPC 2> /dev/null ; then
254 strptime=yes
255fi
256
0147f198
FR
257if test "$zlib" = "yes"; then
258# check for zlib - mmu_man
259cat > $TMPC << EOF
260#include <zlib.h>
261int main ( void ) {
262if (zlibVersion() != ZLIB_VERSION)
263 puts("zlib version differs !!!");
264 return 1;
265return 0;
266}
267EOF
268$cc -o $TMPO $TMPC -lz 2> /dev/null || zlib="no"
269# $TMPO 2> /dev/null > /dev/null || zlib="no"
270# XXX: more tests needed - runtime test
271fi
272if test "$zlib" = "yes"; then
273extralibs="$extralibs -lz"
274fi
275
c13e1abd
FH
276_restrict=
277for restrict_keyword in restrict __restrict__ __restrict; do
278 echo "void foo(char * $restrict_keyword p);" > $TMPC
279 if $cc -c -o $TMPO $TMPC 2> /dev/null; then
280 _restrict=$restrict_keyword
281 break;
282 fi
283done
284
6063bce7 285if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
0f3cb305
FB
286cat << EOF
287
288Usage: configure [options]
289Options: [defaults in brackets after descriptions]
290
291EOF
292echo "Standard options:"
293echo " --help print this message"
294echo " --prefix=PREFIX install in PREFIX [$prefix]"
0f3cb305
FB
295echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
296echo " --enable-win32 enable win32 cross compile"
5cbcf02c 297echo " --disable-a52 disable GPL'ed A52 support [default=no]"
0f3cb305
FB
298echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
299echo " --enable-shared build shared libraries [default=no]"
300echo ""
301echo "Advanced options (experts only):"
302echo " --source-path=PATH path of source code [$source_path]"
303echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
304echo " --cc=CC use C compiler CC [$cc]"
4a908fbc 305echo " --make=MAKE use specified make [$make]"
0f3cb305
FB
306echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
307echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
308echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
309echo " --cpu=CPU force cpu to CPU [$cpu]"
310echo " --disable-mmx disable mmx usage"
5cbcf02c 311echo " --disable-audio-oss disable OSS audio support [default=no]"
6063bce7 312echo " --disable-v4l disable video4linux grabbing [default=no]"
5cbcf02c 313echo " --disable-network disable network support [default=no]"
0147f198 314echo " --disable-zlib disable zlib [default=no]"
5cbcf02c 315echo " --disable-simple_idct disable simple IDCT routines [default=no]"
68892110 316# echo " --disable-vhook disable video hooking support"
0f3cb305 317echo " --enable-gprof enable profiling with gprof [$gprof]"
1eb2212e
FB
318echo " --disable-mpegaudio-hp faster (but less accurate)"
319echo " mpegaudio decoding [default=no]"
0f3cb305
FB
320echo ""
321echo "NOTE: The object files are build at the place where configure is launched"
322exit 1
323fi
324
de6d9b64 325echo "Install prefix $prefix"
0f3cb305 326echo "Source path $source_path"
de6d9b64 327echo "C compiler $cc"
4a908fbc 328echo "make $make"
de6d9b64 329echo "CPU $cpu"
0f3cb305 330echo "Big Endian $bigendian"
de6d9b64
FB
331echo "MMX enabled $mmx"
332echo "gprof enabled $gprof"
0147f198 333echo "zlib enabled $zlib"
a6741398 334echo "mp3lame enabled $mp3lame"
5cbcf02c 335echo "a52 support $a52"
57514323 336echo "a52 dlopened $a52bin"
68892110
PG
337# echo "Video hooking $vhook"
338
339if test "$vhook" = "yes" ; then
340: echo "Imlib2 support $imlib2"
341fi
de6d9b64 342
980fc7b8 343echo "Creating config.mak and config.h"
de6d9b64 344
980fc7b8 345echo "# Automatically generated by configure - do not modify" > config.mak
045ed63f 346echo "/* Automatically generated by configure - do not modify */" > $TMPH
de6d9b64 347
980fc7b8 348echo "prefix=$prefix" >> config.mak
4a908fbc 349echo "MAKE=$make" >> config.mak
980fc7b8
FB
350echo "CC=$cc" >> config.mak
351echo "AR=$ar" >> config.mak
0f3cb305 352echo "STRIP=$strip" >> config.mak
a9b3f630 353echo "OPTFLAGS=$CFLAGS" >> config.mak
0f3cb305 354echo "LDFLAGS=$LDFLAGS" >> config.mak
e1707f52 355echo "SHFLAGS=$SHFLAGS" >> config.mak
57514323 356if test "$cpu" = "x86" ; then
980fc7b8 357 echo "TARGET_ARCH_X86=yes" >> config.mak
045ed63f 358 echo "#define ARCH_X86 1" >> $TMPH
0f3cb305 359elif test "$cpu" = "armv4l" ; then
6ed7422a 360 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
045ed63f 361 echo "#define ARCH_ARMV4L 1" >> $TMPH
0f3cb305 362elif test "$cpu" = "alpha" ; then
91d1f1a4 363 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
045ed63f 364 echo "#define ARCH_ALPHA 1" >> $TMPH
0f3cb305
FB
365elif test "$cpu" = "powerpc" ; then
366 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
367 echo "#define ARCH_POWERPC 1" >> $TMPH
368fi
369if test "$bigendian" = "yes" ; then
370 echo "WORDS_BIGENDIAN=yes" >> config.mak
371 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
91d1f1a4 372fi
57514323 373if test "$mmx" = "yes" ; then
980fc7b8 374 echo "TARGET_MMX=yes" >> config.mak
045ed63f 375 echo "#define HAVE_MMX 1" >> $TMPH
de6d9b64 376fi
57514323 377if test "$gprof" = "yes" ; then
980fc7b8 378 echo "TARGET_GPROF=yes" >> config.mak
045ed63f 379 echo "#define HAVE_GPROF 1" >> $TMPH
de6d9b64 380fi
68892110
PG
381if test "$strptime" = "yes" ; then
382 echo "#define HAVE_STRPTIME 1" >> $TMPH
383else
384 echo "BUILD_STRPTIME=yes" >> config.mak
385fi
386if test "$imlib2" = "yes" ; then
387 echo "HAVE_IMLIB2=yes" >> config.mak
388fi
389if test "$vhook" = "yes" ; then
390 echo "BUILD_VHOOK=yes" >> config.mak
391 echo "#define HAVE_VHOOK 1" >> $TMPH
392 extralibs="$extralibs -ldl"
393fi
57514323 394if test "$lshared" = "yes" ; then
0319c531 395 echo "BUILD_SHARED=yes" >> config.mak
5cbcf02c 396 echo "PIC=-fPIC" >> config.mak
0319c531 397fi
ef0bc4c9 398echo "EXTRALIBS=$extralibs" >> config.mak
0319c531 399echo -n "VERSION=" >>config.mak
0f3cb305 400head $source_path/VERSION >>config.mak
0319c531 401echo "" >>config.mak
d771bcae 402# if you do not want to use encoders, disable that.
045ed63f 403echo "#define CONFIG_ENCODERS 1" >> $TMPH
d771bcae
FB
404echo "CONFIG_ENCODERS=yes" >> config.mak
405
406# if you do not want to use decoders, disable that.
045ed63f 407echo "#define CONFIG_DECODERS 1" >> $TMPH
d771bcae
FB
408echo "CONFIG_DECODERS=yes" >> config.mak
409
5cbcf02c
FB
410# AC3
411if test "$a52" = "yes" ; then
412 echo "#define CONFIG_AC3 1" >> $TMPH
413 echo "CONFIG_AC3=yes" >> config.mak
d771bcae 414
5cbcf02c
FB
415 if test "$a52bin" = "yes" ; then
416 echo "#define CONFIG_A52BIN 1" >> $TMPH
417 echo "CONFIG_A52BIN=yes" >> config.mak
418 fi
419fi
420
1eb2212e
FB
421# mpeg audio high precision mode
422if test "$mpegaudio_hp" = "yes" ; then
423 echo "#define CONFIG_MPEGAUDIO_HP 1" >> $TMPH
424fi
425
5cbcf02c
FB
426if test "$v4l" = "yes" ; then
427 echo "#define CONFIG_VIDEO4LINUX 1" >> $TMPH
428 echo "CONFIG_VIDEO4LINUX=yes" >> config.mak
429fi
430
431if test "$audio_oss" = "yes" ; then
432 echo "#define CONFIG_AUDIO_OSS 1" >> $TMPH
433 echo "CONFIG_AUDIO_OSS=yes" >> config.mak
57514323
ZK
434fi
435
5cbcf02c
FB
436if test "$network" = "yes" ; then
437 echo "#define CONFIG_NETWORK 1" >> $TMPH
438 echo "CONFIG_NETWORK=yes" >> config.mak
6ed7422a 439fi
daf8e955 440
0147f198
FR
441if test "$zlib" = "yes" ; then
442 echo "#define CONFIG_ZLIB 1" >> $TMPH
443 echo "CONFIG_ZLIB=yes" >> config.mak
444fi
445
57514323 446if test "$mp3lame" = "yes" ; then
045ed63f 447 echo "#define CONFIG_MP3LAME 1" >> $TMPH
a6741398
J
448 echo "CONFIG_MP3LAME=yes" >> config.mak
449fi
450
57514323 451if test "$win32" = "yes" ; then
045ed63f 452 echo "#define CONFIG_WIN32 1" >> $TMPH
daf8e955
FB
453 echo "CONFIG_WIN32=yes" >> config.mak
454fi
3d204385 455
90cee0c3
MN
456if test "$darwin" = "yes"; then
457 echo "#define CONFIG_DARWIN 1" >> $TMPH
458 echo "CONFIG_DARWIN=yes" >> config.mak
459fi
460
57514323 461if test "$_malloc_h" = "yes" ; then
045ed63f 462 echo "#define HAVE_MALLOC_H 1" >> $TMPH
3d204385 463else
045ed63f 464 echo "#undef HAVE_MALLOC_H" >> $TMPH
3d204385
NK
465fi
466
57514323 467if test "$_memalign" = "yes" ; then
045ed63f
ZK
468 echo "#define HAVE_MEMALIGN 1" >> $TMPH
469else
470 echo "#undef HAVE_MEMALIGN" >> $TMPH
471fi
472
57514323 473if test "$simpleidct" = "yes" ; then
045ed63f
ZK
474 echo "#define SIMPLE_IDCT 1" >> $TMPH
475fi
476
c13e1abd
FH
477echo "#define restrict $_restrict" >> $TMPH
478
0f3cb305
FB
479# build tree in object directory if source path is different from current one
480if test "$source_path_used" = "yes" ; then
481 DIRS="libav libavcodec libavcodec/alpha libavcodec/armv4l libavcodec/i386 \
59925ef2 482 libavcodec/ppc libavcodec/liba52 libavcodec/mlib tests"
0f3cb305
FB
483 FILES="Makefile libav/Makefile libavcodec/Makefile tests/Makefile"
484 for dir in $DIRS ; do
485 mkdir -p $dir
486 done
487 for f in $FILES ; do
488 ln -sf $source_path/$f $f
489 done
490fi
491echo "SRC_PATH=$source_path" >> config.mak
492
a7c02e25 493diff $TMPH config.h >/dev/null 2>&1
045ed63f
ZK
494if test $? -ne 0 ; then
495 mv -f $TMPH config.h
3d204385 496else
045ed63f 497 echo "config.h is unchanged"
3d204385
NK
498fi
499
045ed63f 500rm -f $TMPO $TMPC $TMPS $TMPH