3 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
5 echo "Usage: ./configure [options]"
7 echo "available options:"
9 echo " --help print this message"
10 echo " --enable-avis-input enables avisynth input (win32 only)"
11 echo " --enable-mp4-output enables mp4 output (using gpac)"
12 echo " --enable-vfw compiles the VfW frontend"
13 echo " --enable-pthread enables multithreaded encoding"
14 echo " --enable-debug adds -g, doesn't strip"
15 echo " --enable-gprof adds -pg, doesn't strip"
16 echo " --enable-visualize enables visualization (X11 only)"
17 echo " --extra-asflags=EASFLAGS add EASFLAGS to ASFLAGS"
18 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS"
19 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS"
26 cat > conftest.c << EOF
28 int main () { return 0; }
30 $CC $CFLAGS $LDFLAGS $2 conftest.c -o $DEVNULL 2>$DEVNULL
37 exec_prefix='${prefix}'
38 bindir='${exec_prefix}/bin'
39 libdir='${exec_prefix}/lib'
40 includedir='${prefix}/include'
52 CFLAGS="-Wall -I. -O4 -ffast-math -D__X264__"
65 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
69 CFLAGS="$CFLAGS -falign-loops=16"
70 LDFLAGS="$LDFLAGS -lm -lmx"
74 LDFLAGS="$LDFLAGS -lm"
78 LDFLAGS="$LDFLAGS -lm"
82 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
83 LDFLAGS="$LDFLAGS -lm"
87 CFLAGS="$CFLAGS -mno-cygwin"
88 LDFLAGS="$LDFLAGS -mno-cygwin"
89 ASFLAGS="-f win32 -DPREFIX"
96 ASFLAGS="-f win32 -DPREFIX"
103 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
104 LDFLAGS="$LDFLAGS -lm"
108 echo "Unknown system $UNAMES, edit the configure"
115 i386|i486|i586|i686|BePC)
117 CFLAGS="$CFLAGS -DHAVE_MMXEXT -DHAVE_SSE2"
121 CFLAGS="$CFLAGS -DHAVE_MMXEXT -DHAVE_SSE2"
123 ASFLAGS="-f elf -m amd64"
125 "Power Macintosh"|ppc)
129 CFLAGS="$CFLAGS -faltivec"
131 CFLAGS="$CFLAGS -maltivec -mabi=altivec"
134 sun4m|sun4d|sparc|sparc64)
139 CFLAGS="$CFLAGS -mcpu=ultrasparc"
140 LDFLAGS="$LDFLAGS -mcpu=ultrasparc"
142 ASFLAGS="-xarch=v8plusa"
166 echo "Unknown platform $UNAMEM, edit the configure"
171 CFLAGS="$CFLAGS -DARCH_$ARCH -DSYS_$SYS"
182 exec_prefix="$optarg"
196 --disable-avis-input)
202 --disable-mp4-output)
206 ASFLAGS="$ASFLAGS ${opt#--extra-asflags=}"
209 CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
210 VFW_CFLAGS="${opt#--extra-cflags=}"
213 LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
214 VFW_LDFLAGS="${opt#--extra-ldflags=}"
228 LDFLAGS="$LDFLAGS -pg"
238 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
239 CFLAGS="$CFLAGS -DVISUALIZE=1"
243 echo "Unknown option $opt, ignored"
248 # autodetect options that weren't forced nor disabled
250 if test "$pthread" = "auto" ; then
257 cc_check pthread.h -lpthread && pthread="yes"
261 if test "$pthread" = "yes" ; then
262 CFLAGS="$CFLAGS -DHAVE_PTHREAD=1"
266 *) LDFLAGS="$LDFLAGS -lpthread"
271 MP4_LDFLAGS="-lgpac_static"
272 if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
273 MP4_LDFLAGS="$MP4_LDFLAGS -lwinmm"
275 if [ "$mp4_output" = "auto" ] ; then
277 cc_check gpac/isomedia.h "$MP4_LDFLAGS" && mp4_output="yes"
279 if [ "$mp4_output" = "yes" ] ; then
280 CFLAGS="$CFLAGS -DMP4_OUTPUT"
281 LDFLAGS="$LDFLAGS $MP4_LDFLAGS"
284 if [ "$avis_input" = "auto" ] ; then
285 if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
291 if [ "$avis_input" = "yes" ] ; then
292 CFLAGS="$CFLAGS -DAVIS_INPUT"
293 LDFLAGS="$LDFLAGS -lvfw32"
296 if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
297 CFLAGS="$CFLAGS -s -fomit-frame-pointer"
298 LDFLAGS="$LDFLAGS -s"
299 VFW_LDFLAGS="$VFW_LDFLAGS -s"
302 # generate config files
305 cat > config.mak << EOF
307 exec_prefix=$exec_prefix
310 includedir=$includedir
321 HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG
326 if [ "$vfw" = "yes" ]; then
327 rm -f vfw/build/cygwin/config.mak
328 cat > vfw/build/cygwin/config.mak << EOF
332 echo "default: x264vfw.dll" >> config.mak
340 exec_prefix=$exec_prefix
342 includedir=$includedir
345 Description: H.264 (MPEG4 AVC) encoder library
346 Version: $(grep POINTVER < config.h | sed -e 's/.* "//; s/".*//')
347 Libs: -L$libdir -lx264
348 Cflags: -I$includedir
352 echo "Platform: $ARCH"
354 echo "avis input: $avis_input"
355 echo "mp4 output: $mp4_output"
356 echo "pthread: $pthread"
360 echo "visualize: $vis"
362 echo "You can run 'make' or 'make fprofiled' now."