Statistics
| Branch: | Revision:

ffmpeg / configure @ 57514323

History | View | Annotate | Download (6.19 KB)

1
#!/bin/sh
2

    
3
TMPC="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
4
TMPO="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
5
TMPS="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
6
TMPH="ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
7

    
8
if test ! -z "$TMPDIR" ; then
9
	TMPC="${TMPDIR}/${TMPC}"
10
	TMPCPP="${TMPDIR}/${TMPCPP}"
11
	TMPO="${TMPDIR}/${TMPO}"
12
	TMPS="${TMPDIR}/${TMPS}"
13
	TMPH="${TMPDIR}/${TMPH}"
14
elif test ! -z "$TEMPDIR" ; then
15
	TMPC="${TEMPDIR}/${TMPC}"
16
	TMPCPP="${TEMPDIR}/${TMPCPP}"
17
	TMPO="${TEMPDIR}/${TMPO}"
18
	TMPS="${TEMPDIR}/${TMPS}"
19
	TMPH="${TEMPDIR}/${TMPH}"
20
else
21
	TMPC="/tmp/${TMPC}"
22
	TMPCPP="/tmp/${TMPCPP}"
23
	TMPO="/tmp/${TMPO}"
24
	TMPS="/tmp/${TMPS}"
25
	TMPH="/tmp/${TMPH}"
26
fi
27

    
28
# default parameters
29
prefix="/usr/local"
30
cc="gcc"
31
ar="ar"
32
cpu=`uname -m`
33
case "$cpu" in
34
  i386|i486|i586|i686|i86pc|BePC)
35
    cpu="x86"
36
    mmx="yes"
37
  ;;
38
  armv4l)
39
    cpu="armv4l"
40
    mmx="no"
41
  ;;
42
  alpha)
43
    cpu="alpha"
44
    mmx="no"
45
  ;;
46
  *)
47
    mmx="no"
48
  ;;
49
esac
50
gprof="no"
51
grab="yes"
52
mp3lame="no"
53
a52bin="no"
54
win32="no"
55
extralibs="-lm"
56

    
57
# OS specific
58
targetos=`uname -s`
59
case $targetos in
60
BeOS)
61
prefix="/boot/home/config"
62
# helps building libavcodec
63
grab="no"
64
CFLAGS="-O2 -DPIC"
65
# no need for libm, but the inet stuff
66
# Check for BONE
67
if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
68
extralibs="-lbind -lsocket"
69
else
70
echo "Not sure building for net_server will succeed... good luck."
71
extralibs="-lsocket"
72
fi ;;
73
*) ;;
74
esac
75

    
76
if test "$1" = "-h" -o "$1" = "--help" ; then
77
cat << EOF
78

    
79
Usage: configure [options]
80
Options: [defaults in brackets after descriptions]
81

    
82
  --help                  print this message
83
EOF
84
echo "  --prefix=PREFIX         install in PREFIX [$prefix]"
85
echo "  --cc=CC                 use C compiler CC [$cc]"
86
echo "  --cpu=CPU               force cpu to CPU  [$cpu]"
87
echo "  --disable-mmx           disable mmx usage"
88
echo "  --enable-gprof          enable profiling with gprof [$gprof]"
89
echo "  --disable-grab          disable audio/video grabbing code"
90
echo "  --enable-simple_idct    use simple IDCT routines [default=no]"
91
echo "  --enable-mp3lame        enable mp3 encoding via libmp3lame [default=no]"
92
echo "  --enable-win32          enable win32 cross compile"
93
echo "  --enable-a52bin         open liba52.so.0 at runtime [default=no]"
94
echo "  --enable-shared         build shared libraries [default=no]"
95
exit 1
96
fi
97

    
98
lshared=no
99
for opt do
100
  case "$opt" in
101
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
102
  ;;
103
  --cc=*) cc=`echo $opt | cut -d '=' -f 2`
104
  ;;
105
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
106
  ;;
107
  --disable-mmx) mmx="no"
108
  ;;
109
  --enable-gprof) gprof="yes"
110
  ;;
111
  --disable-grab) grab="no"
112
  ;;
113
  --enable-a52bin) a52bin="yes" ; extralibs="-ldl $extralibs"
114
  ;;
115
  --enable-mp3lame) mp3lame="yes"
116
  ;;
117
  --enable-simple_idct) simpleidct="yes"
118
  ;;
119
  --enable-win32) win32="yes"
120
  ;;
121
  --enable-shared=*) lshared=`echo $opt | cut -d '=' -f 2`
122
  ;;
123
  esac
124
done
125

    
126
# Checking for CFLAGS
127
if test -z "$CFLAGS"; then
128
    CFLAGS="-O2"
129
fi
130

    
131
if test "$win32" = "yes" ; then
132
    cross_prefix="i386-mingw32msvc-"
133
    cc="${cross_prefix}gcc"
134
    ar="${cross_prefix}ar"
135
    grab="no"
136
fi
137

    
138
# ---
139
# check availability of some header files
140

    
141
cat > $TMPC << EOF
142
#include <malloc.h>
143
int main( void ) { return 0; }
144
EOF
145

    
146
_memalign=no
147
_malloc_h=no
148
if $cc -o $TMPO $TMPC 2> /dev/null ; then
149
_malloc_h=yes
150
_memalign=yes
151
# check for memalign - atmos
152
cat > $TMPC << EOF
153
#include <malloc.h>
154
int main ( void ) {
155
char *string = NULL;
156
string = memalign(64, sizeof(char));
157
return 0;
158
}
159
EOF
160
$cc -o $TMPO $TMPC 2> /dev/null || _memalign=no
161
fi
162

    
163
echo "Install prefix   $prefix"
164
echo "C compiler       $cc"
165
echo "CPU              $cpu"
166
echo "MMX enabled      $mmx"
167
echo "gprof enabled    $gprof"
168
echo "grab enabled     $grab"
169
echo "mp3lame enabled  $mp3lame"
170
echo "a52 dlopened     $a52bin"
171

    
172
echo "Creating config.mak and config.h"
173

    
174
echo "# Automatically generated by configure - do not modify" > config.mak
175
echo "/* Automatically generated by configure - do not modify */" > $TMPH
176

    
177
echo "prefix=$prefix" >> config.mak
178
echo "MAKE=make" >> config.mak
179
echo "CC=$cc" >> config.mak
180
echo "AR=$ar" >> config.mak
181
echo "OPTFLAGS=$CFLAGS" >> config.mak
182
if test "$cpu" = "x86" ; then
183
  echo "TARGET_ARCH_X86=yes" >> config.mak
184
  echo "#define ARCH_X86 1" >> $TMPH
185
fi
186
if test "$cpu" = "armv4l" ; then
187
  echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
188
  echo "#define ARCH_ARMV4L 1" >> $TMPH
189
fi
190
if test "$cpu" = "alpha" ; then
191
  echo "TARGET_ARCH_ALPHA=yes" >> config.mak
192
  echo "#define ARCH_ALPHA 1" >> $TMPH
193
fi
194
if test "$mmx" = "yes" ; then
195
  echo "TARGET_MMX=yes" >> config.mak
196
  echo "#define HAVE_MMX 1" >> $TMPH
197
fi
198
if test "$gprof" = "yes" ; then
199
  echo "TARGET_GPROF=yes" >> config.mak
200
  echo "#define HAVE_GPROF 1" >> $TMPH
201
fi
202
if test "$lshared" = "yes" ; then
203
  echo "BUILD_SHARED=yes" >> config.mak
204
else
205
  echo "BUILD_SHARED=no" >> config.mak
206
fi
207
echo "EXTRALIBS=$extralibs" >> config.mak
208
echo -n "VERSION=" >>config.mak
209
head VERSION >>config.mak
210
echo "" >>config.mak
211
# if you do not want to use encoders, disable that.
212
echo "#define CONFIG_ENCODERS 1" >> $TMPH
213
echo "CONFIG_ENCODERS=yes" >> config.mak
214

    
215
# if you do not want to use decoders, disable that.
216
echo "#define CONFIG_DECODERS 1" >> $TMPH
217
echo "CONFIG_DECODERS=yes" >> config.mak
218

    
219
# special AC3 stuff in case you already have it
220
# without libavcodec.
221
echo "#define CONFIG_AC3 1" >> $TMPH
222
echo "CONFIG_AC3=yes" >> config.mak
223

    
224
if test "$a52bin" = "yes" ; then
225
  echo "#define CONFIG_A52BIN 1" >> $TMPH
226
  echo "CONFIG_A52BIN=yes" >> config.mak
227
else
228
  echo "CONFIG_A52BIN=no" >> config.mak
229
fi
230

    
231
if test "$grab" = "yes" ; then
232
  echo "#define CONFIG_GRAB 1" >> $TMPH
233
  echo "CONFIG_GRAB=yes" >> config.mak
234
fi
235

    
236
if test "$mp3lame" = "yes" ; then
237
  echo "#define CONFIG_MP3LAME 1" >> $TMPH
238
  echo "CONFIG_MP3LAME=yes" >> config.mak
239
fi
240

    
241
if test "$win32" = "yes" ; then
242
  echo "#define CONFIG_WIN32 1" >> $TMPH
243
  echo "CONFIG_WIN32=yes" >> config.mak
244
fi
245

    
246
if test "$_malloc_h" = "yes" ; then
247
  echo "#define HAVE_MALLOC_H 1" >> $TMPH
248
else
249
  echo "#undef  HAVE_MALLOC_H" >> $TMPH
250
fi
251

    
252
if test "$_memalign" = "yes" ; then
253
  echo "#define HAVE_MEMALIGN 1" >> $TMPH
254
else
255
  echo "#undef  HAVE_MEMALIGN" >> $TMPH
256
fi
257

    
258
if test "$simpleidct" = "yes" ; then
259
  echo "#define SIMPLE_IDCT 1" >> $TMPH
260
fi
261

    
262
diff $TMPH config.h >/dev/null 2>&1
263
if test $? -ne 0 ; then
264
	mv -f $TMPH config.h
265
else
266
	echo "config.h is unchanged"
267
fi
268

    
269
rm -f $TMPO $TMPC $TMPS $TMPH