* Updated with new stream configuration items
[libav.git] / configure
CommitLineData
de6d9b64
FB
1#!/bin/sh
2
3d204385
NK
3TMPC="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
4TMPO="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
5TMPS="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
045ed63f 6TMPH="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
3d204385 7
57514323 8if test ! -z "$TMPDIR" ; then
3d204385
NK
9 TMPC="${TMPDIR}/${TMPC}"
10 TMPCPP="${TMPDIR}/${TMPCPP}"
11 TMPO="${TMPDIR}/${TMPO}"
12 TMPS="${TMPDIR}/${TMPS}"
045ed63f 13 TMPH="${TMPDIR}/${TMPH}"
57514323 14elif test ! -z "$TEMPDIR" ; then
3d204385
NK
15 TMPC="${TEMPDIR}/${TMPC}"
16 TMPCPP="${TEMPDIR}/${TMPCPP}"
17 TMPO="${TEMPDIR}/${TMPO}"
18 TMPS="${TEMPDIR}/${TMPS}"
045ed63f 19 TMPH="${TEMPDIR}/${TMPH}"
3d204385
NK
20else
21 TMPC="/tmp/${TMPC}"
22 TMPCPP="/tmp/${TMPCPP}"
23 TMPO="/tmp/${TMPO}"
24 TMPS="/tmp/${TMPS}"
045ed63f 25 TMPH="/tmp/${TMPH}"
3d204385
NK
26fi
27
de6d9b64
FB
28# default parameters
29prefix="/usr/local"
30cc="gcc"
31ar="ar"
32cpu=`uname -m`
33case "$cpu" in
ef0bc4c9 34 i386|i486|i586|i686|i86pc|BePC)
de6d9b64
FB
35 cpu="x86"
36 mmx="yes"
37 ;;
6ed7422a
FB
38 armv4l)
39 cpu="armv4l"
40 mmx="no"
41 ;;
91d1f1a4
NK
42 alpha)
43 cpu="alpha"
44 mmx="no"
45 ;;
de6d9b64
FB
46 *)
47 mmx="no"
48 ;;
49esac
50gprof="no"
6ed7422a 51grab="yes"
a6741398 52mp3lame="no"
57514323 53a52bin="no"
daf8e955 54win32="no"
ef0bc4c9 55extralibs="-lm"
c02dbee1 56simpleidct="yes"
ef0bc4c9
FR
57
58# OS specific
59targetos=`uname -s`
60case $targetos in
61BeOS)
62prefix="/boot/home/config"
63# helps building libavcodec
64grab="no"
65CFLAGS="-O2 -DPIC"
66# no need for libm, but the inet stuff
67# Check for BONE
68if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
69extralibs="-lbind -lsocket"
70else
71echo "Not sure building for net_server will succeed... good luck."
72extralibs="-lsocket"
73fi ;;
74*) ;;
75esac
de6d9b64 76
57514323 77if test "$1" = "-h" -o "$1" = "--help" ; then
de6d9b64
FB
78cat << EOF
79
80Usage: configure [options]
81Options: [defaults in brackets after descriptions]
82
83 --help print this message
84EOF
85echo " --prefix=PREFIX install in PREFIX [$prefix]"
86echo " --cc=CC use C compiler CC [$cc]"
87echo " --cpu=CPU force cpu to CPU [$cpu]"
88echo " --disable-mmx disable mmx usage"
89echo " --enable-gprof enable profiling with gprof [$gprof]"
6ed7422a 90echo " --disable-grab disable audio/video grabbing code"
c02dbee1 91echo " --disable-simple_idct disable simple IDCT routines [default=no]"
57514323 92echo " --enable-mp3lame enable mp3 encoding via libmp3lame [default=no]"
daf8e955 93echo " --enable-win32 enable win32 cross compile"
57514323 94echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
0319c531 95echo " --enable-shared build shared libraries [default=no]"
de6d9b64
FB
96exit 1
97fi
98
0319c531 99lshared=no
de6d9b64
FB
100for opt do
101 case "$opt" in
102 --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
103 ;;
104 --cc=*) cc=`echo $opt | cut -d '=' -f 2`
105 ;;
106 --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
107 ;;
108 --disable-mmx) mmx="no"
109 ;;
110 --enable-gprof) gprof="yes"
111 ;;
6ed7422a
FB
112 --disable-grab) grab="no"
113 ;;
57514323
ZK
114 --enable-a52bin) a52bin="yes" ; extralibs="-ldl $extralibs"
115 ;;
a6741398
J
116 --enable-mp3lame) mp3lame="yes"
117 ;;
c02dbee1 118 --disable-simple_idct) simpleidct="no"
045ed63f 119 ;;
daf8e955
FB
120 --enable-win32) win32="yes"
121 ;;
0319c531
NK
122 --enable-shared=*) lshared=`echo $opt | cut -d '=' -f 2`
123 ;;
de6d9b64
FB
124 esac
125done
126
daf8e955
FB
127# Checking for CFLAGS
128if test -z "$CFLAGS"; then
129 CFLAGS="-O2"
130fi
131
57514323 132if test "$win32" = "yes" ; then
daf8e955
FB
133 cross_prefix="i386-mingw32msvc-"
134 cc="${cross_prefix}gcc"
135 ar="${cross_prefix}ar"
136 grab="no"
137fi
138
3d204385
NK
139# ---
140# check availability of some header files
141
142cat > $TMPC << EOF
143#include <malloc.h>
144int main( void ) { return 0; }
145EOF
146
147_memalign=no
148_malloc_h=no
149if $cc -o $TMPO $TMPC 2> /dev/null ; then
150_malloc_h=yes
151_memalign=yes
152# check for memalign - atmos
153cat > $TMPC << EOF
154#include <malloc.h>
155int main ( void ) {
156char *string = NULL;
157string = memalign(64, sizeof(char));
158return 0;
159}
160EOF
161$cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
162fi
163
de6d9b64
FB
164echo "Install prefix $prefix"
165echo "C compiler $cc"
166echo "CPU $cpu"
167echo "MMX enabled $mmx"
168echo "gprof enabled $gprof"
6ed7422a 169echo "grab enabled $grab"
a6741398 170echo "mp3lame enabled $mp3lame"
57514323 171echo "a52 dlopened $a52bin"
de6d9b64 172
980fc7b8 173echo "Creating config.mak and config.h"
de6d9b64 174
980fc7b8 175echo "# Automatically generated by configure - do not modify" > config.mak
045ed63f 176echo "/* Automatically generated by configure - do not modify */" > $TMPH
de6d9b64 177
980fc7b8 178echo "prefix=$prefix" >> config.mak
2cc8ae96 179echo "MAKE=make" >> config.mak
980fc7b8
FB
180echo "CC=$cc" >> config.mak
181echo "AR=$ar" >> config.mak
a9b3f630 182echo "OPTFLAGS=$CFLAGS" >> config.mak
57514323 183if test "$cpu" = "x86" ; then
980fc7b8 184 echo "TARGET_ARCH_X86=yes" >> config.mak
045ed63f 185 echo "#define ARCH_X86 1" >> $TMPH
de6d9b64 186fi
57514323 187if test "$cpu" = "armv4l" ; then
6ed7422a 188 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
045ed63f 189 echo "#define ARCH_ARMV4L 1" >> $TMPH
6ed7422a 190fi
57514323 191if test "$cpu" = "alpha" ; then
91d1f1a4 192 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
045ed63f 193 echo "#define ARCH_ALPHA 1" >> $TMPH
91d1f1a4 194fi
57514323 195if test "$mmx" = "yes" ; then
980fc7b8 196 echo "TARGET_MMX=yes" >> config.mak
045ed63f 197 echo "#define HAVE_MMX 1" >> $TMPH
de6d9b64 198fi
57514323 199if test "$gprof" = "yes" ; then
980fc7b8 200 echo "TARGET_GPROF=yes" >> config.mak
045ed63f 201 echo "#define HAVE_GPROF 1" >> $TMPH
de6d9b64 202fi
57514323 203if test "$lshared" = "yes" ; then
0319c531
NK
204 echo "BUILD_SHARED=yes" >> config.mak
205else
206 echo "BUILD_SHARED=no" >> config.mak
207fi
ef0bc4c9 208echo "EXTRALIBS=$extralibs" >> config.mak
0319c531
NK
209echo -n "VERSION=" >>config.mak
210head VERSION >>config.mak
211echo "" >>config.mak
d771bcae 212# if you do not want to use encoders, disable that.
045ed63f 213echo "#define CONFIG_ENCODERS 1" >> $TMPH
d771bcae
FB
214echo "CONFIG_ENCODERS=yes" >> config.mak
215
216# if you do not want to use decoders, disable that.
045ed63f 217echo "#define CONFIG_DECODERS 1" >> $TMPH
d771bcae
FB
218echo "CONFIG_DECODERS=yes" >> config.mak
219
d2b7bcd2 220# special AC3 stuff in case you already have it
d771bcae 221# without libavcodec.
045ed63f 222echo "#define CONFIG_AC3 1" >> $TMPH
d771bcae
FB
223echo "CONFIG_AC3=yes" >> config.mak
224
57514323
ZK
225if test "$a52bin" = "yes" ; then
226 echo "#define CONFIG_A52BIN 1" >> $TMPH
227 echo "CONFIG_A52BIN=yes" >> config.mak
228else
229 echo "CONFIG_A52BIN=no" >> config.mak
230fi
231
232if test "$grab" = "yes" ; then
045ed63f 233 echo "#define CONFIG_GRAB 1" >> $TMPH
6ed7422a
FB
234 echo "CONFIG_GRAB=yes" >> config.mak
235fi
daf8e955 236
57514323 237if test "$mp3lame" = "yes" ; then
045ed63f 238 echo "#define CONFIG_MP3LAME 1" >> $TMPH
a6741398
J
239 echo "CONFIG_MP3LAME=yes" >> config.mak
240fi
241
57514323 242if test "$win32" = "yes" ; then
045ed63f 243 echo "#define CONFIG_WIN32 1" >> $TMPH
daf8e955
FB
244 echo "CONFIG_WIN32=yes" >> config.mak
245fi
3d204385 246
57514323 247if test "$_malloc_h" = "yes" ; then
045ed63f 248 echo "#define HAVE_MALLOC_H 1" >> $TMPH
3d204385 249else
045ed63f 250 echo "#undef HAVE_MALLOC_H" >> $TMPH
3d204385
NK
251fi
252
57514323 253if test "$_memalign" = "yes" ; then
045ed63f
ZK
254 echo "#define HAVE_MEMALIGN 1" >> $TMPH
255else
256 echo "#undef HAVE_MEMALIGN" >> $TMPH
257fi
258
57514323 259if test "$simpleidct" = "yes" ; then
045ed63f
ZK
260 echo "#define SIMPLE_IDCT 1" >> $TMPH
261fi
262
a7c02e25 263diff $TMPH config.h >/dev/null 2>&1
045ed63f
ZK
264if test $? -ne 0 ; then
265 mv -f $TMPH config.h
3d204385 266else
045ed63f 267 echo "config.h is unchanged"
3d204385
NK
268fi
269
045ed63f 270rm -f $TMPO $TMPC $TMPS $TMPH