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