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 " --enable-pic build position-independent code"
18 echo " --enable-shared build libx264.so"
19 echo " --extra-asflags=EASFLAGS add EASFLAGS to ASFLAGS"
20 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS"
21 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS"
28 cat > conftest.c << EOF
30 int main () { $3 return 0; }
32 $CC $CFLAGS $LDFLAGS $2 conftest.c -o conftest 2>$DEVNULL
34 rm -f conftest.c conftest*
38 rm -f config.h config.mak x264.pc
41 exec_prefix='${prefix}'
42 bindir='${exec_prefix}/bin'
43 libdir='${exec_prefix}/lib'
44 includedir='${prefix}/include'
58 CFLAGS="-Wall -I. -O4 -ffast-math -D__X264__"
71 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
75 CFLAGS="$CFLAGS -falign-loops=16"
76 LDFLAGS="$LDFLAGS -lm -lmx"
80 LDFLAGS="$LDFLAGS -lm"
84 LDFLAGS="$LDFLAGS -lm"
88 CFLAGS="$CFLAGS -I/usr/X11R6/include"
89 LDFLAGS="$LDFLAGS -lm"
93 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
94 LDFLAGS="$LDFLAGS -lm"
98 CFLAGS="$CFLAGS -mno-cygwin"
99 LDFLAGS="$LDFLAGS -mno-cygwin"
110 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
111 LDFLAGS="$LDFLAGS -lm"
115 echo "Unknown system $UNAMES, edit the configure"
122 i386|i486|i586|i686|BePC)
124 CFLAGS="$CFLAGS -DHAVE_MMXEXT -DHAVE_SSE2"
127 if [ "$SYS" = MACOSX ]; then
128 ASFLAGS="$ASFLAGS -f macho -DPREFIX"
129 elif [ "$SYS" = CYGWIN -o "$SYS" = MINGW ]; then
130 ASFLAGS="$ASFLAGS -f win32 -DPREFIX"
131 elif [ "$SYS" = NETBSD ]; then
132 ASFLAGS="$ASFLAGS -f aoutb"
134 ASFLAGS="$ASFLAGS -f elf"
139 CFLAGS="$CFLAGS -DHAVE_MMXEXT -DHAVE_SSE2"
141 ASFLAGS="-f elf -m amd64"
143 "Power Macintosh"|ppc|ppc64)
147 CFLAGS="$CFLAGS -faltivec -fastf -mcpu=G4"
149 CFLAGS="$CFLAGS -maltivec -mabi=altivec"
152 sun4m|sun4d|sparc|sparc64)
157 CFLAGS="$CFLAGS -mcpu=ultrasparc"
158 LDFLAGS="$LDFLAGS -mcpu=ultrasparc"
160 ASFLAGS="-xarch=v8plusa"
184 echo "Unknown platform $UNAMEM, edit the configure"
189 CFLAGS="$CFLAGS -DARCH_$ARCH -DSYS_$SYS"
200 exec_prefix="$optarg"
214 --disable-avis-input)
220 --disable-mp4-output)
224 ASFLAGS="$ASFLAGS ${opt#--extra-asflags=}"
227 CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
228 VFW_CFLAGS="${opt#--extra-cflags=}"
231 LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
232 VFW_LDFLAGS="${opt#--extra-ldflags=}"
246 LDFLAGS="$LDFLAGS -pg"
260 if [ $ARCH = "X86_64" -o $ARCH = "PPC" -o $ARCH = "ALPHA" ] ; then
265 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
266 CFLAGS="$CFLAGS -DVISUALIZE=1"
270 echo "Unknown option $opt, ignored"
275 # autodetect options that weren't forced nor disabled
277 if test "$pthread" = "auto" ; then
284 cc_check pthread.h -lpthread && pthread="yes"
288 if test "$pthread" = "yes" ; then
289 CFLAGS="$CFLAGS -DHAVE_PTHREAD"
293 *) LDFLAGS="$LDFLAGS -lpthread"
298 MP4_LDFLAGS="-lgpac_static"
299 if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
300 MP4_LDFLAGS="$MP4_LDFLAGS -lwinmm"
302 if [ "$mp4_output" = "auto" ] ; then
304 cc_check gpac/isomedia.h "$MP4_LDFLAGS" && mp4_output="yes"
306 if [ "$mp4_output" = "yes" ] ; then
307 echo "#define MP4_OUTPUT" >> config.h
308 LDFLAGS="$LDFLAGS $MP4_LDFLAGS"
311 if [ "$avis_input" = "auto" ] ; then
312 if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
318 if [ "$avis_input" = "yes" ] ; then
319 echo "#define AVIS_INPUT" >> config.h
320 LDFLAGS="$LDFLAGS -lvfw32"
323 if [ "$pic" = "yes" ] ; then
324 CFLAGS="$CFLAGS -fPIC"
325 ASFLAGS="$ASFLAGS -D__PIC__"
328 if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
329 CFLAGS="$CFLAGS -s -fomit-frame-pointer"
330 LDFLAGS="$LDFLAGS -s"
331 VFW_LDFLAGS="$VFW_LDFLAGS -s"
334 if cc_check "stdio.h" "" "fseeko(stdin,0,0);" ; then
335 echo "#define fseek fseeko" >> config.h
336 echo "#define ftell ftello" >> config.h
337 elif cc_check "stdio.h" "" "fseeko64(stdin,0,0);" ; then
338 echo "#define fseek fseeko64" >> config.h
339 echo "#define ftell ftello64" >> config.h
342 # generate config files
344 cat > config.mak << EOF
346 exec_prefix=$exec_prefix
349 includedir=$includedir
360 HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG
364 echo -n 'CONFIGURE_ARGS=' >> config.mak
366 echo -n " '$A'" >> config.mak
368 echo '' >> config.mak
370 cp config.mak gtk/config.mak
372 if [ "$vfw" = "yes" ]; then
373 rm -f vfw/build/cygwin/config.mak
374 cat > vfw/build/cygwin/config.mak << EOF
378 echo "default: x264vfw.dll" >> config.mak
381 if [ "$shared" = "yes" ]; then
382 API=`grep '#define X264_BUILD' < x264.h | cut -f 3 -d ' '`
383 echo "SONAME=libx264.so.$API" >> config.mak
384 echo 'default: $(SONAME)' >> config.mak
389 pclibs="-L$libdir -lx264"
390 if test "$pthread" = "yes" ; then
394 *) pclibs="$pclibs -lpthread"
401 exec_prefix=$exec_prefix
403 includedir=$includedir
406 Description: H.264 (MPEG4 AVC) encoder library
407 Version: $(grep POINTVER < config.h | sed -e 's/.* "//; s/".*//')
409 Cflags: -I$includedir
413 echo "Platform: $ARCH"
415 echo "avis input: $avis_input"
416 echo "mp4 output: $mp4_output"
417 echo "pthread: $pthread"
422 echo "shared: $shared"
423 echo "visualize: $vis"
425 echo "You can run 'make' or 'make fprofiled' now."