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-gtk build GTK+ interface"
14 echo " --enable-pthread enables multithreaded encoding"
15 echo " --enable-debug adds -g, doesn't strip"
16 echo " --enable-gprof adds -pg, doesn't strip"
17 echo " --enable-visualize enables visualization (X11 only)"
18 echo " --enable-pic build position-independent code"
19 echo " --enable-shared build libx264.so"
20 echo " --extra-asflags=EASFLAGS add EASFLAGS to ASFLAGS"
21 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS"
22 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS"
29 cat > conftest.c << EOF
31 int main () { $3 return 0; }
33 $CC $CFLAGS $LDFLAGS $2 conftest.c -o conftest 2>$DEVNULL
35 rm -f conftest.c conftest*
39 rm -f config.h config.mak x264.pc
42 exec_prefix='${prefix}'
43 bindir='${exec_prefix}/bin'
44 libdir='${exec_prefix}/lib'
45 includedir='${prefix}/include'
60 CFLAGS="-Wall -I. -D__X264__"
73 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
77 CFLAGS="$CFLAGS -falign-loops=16"
78 LDFLAGS="$LDFLAGS -lm -lmx"
82 LDFLAGS="$LDFLAGS -lm"
86 LDFLAGS="$LDFLAGS -lm"
90 CFLAGS="$CFLAGS -I/usr/X11R6/include"
91 LDFLAGS="$LDFLAGS -lm"
95 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
96 LDFLAGS="$LDFLAGS -lm"
100 CFLAGS="$CFLAGS -mno-cygwin"
101 LDFLAGS="$LDFLAGS -mno-cygwin"
112 CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
113 LDFLAGS="$LDFLAGS -lm"
117 echo "Unknown system $UNAMES, edit the configure"
124 i386|i486|i586|i686|BePC)
126 CFLAGS="$CFLAGS -DHAVE_MMXEXT -DHAVE_SSE2"
129 if [ "$SYS" = MACOSX ]; then
130 ASFLAGS="$ASFLAGS -f macho -DPREFIX"
131 elif [ "$SYS" = CYGWIN -o "$SYS" = MINGW ]; then
132 ASFLAGS="$ASFLAGS -f win32 -DPREFIX"
133 elif [ "$SYS" = NETBSD ]; then
134 ASFLAGS="$ASFLAGS -f aoutb"
136 ASFLAGS="$ASFLAGS -f elf"
141 CFLAGS="$CFLAGS -DHAVE_MMXEXT -DHAVE_SSE2"
143 ASFLAGS="-f elf -m amd64"
145 "Power Macintosh"|ppc|ppc64)
149 CFLAGS="$CFLAGS -faltivec -fastf -mcpu=G4"
151 CFLAGS="$CFLAGS -maltivec -mabi=altivec"
154 sun4m|sun4d|sparc|sparc64)
159 CFLAGS="$CFLAGS -mcpu=ultrasparc"
160 LDFLAGS="$LDFLAGS -mcpu=ultrasparc"
162 ASFLAGS="-xarch=v8plusa"
186 echo "Unknown platform $UNAMEM, edit the configure"
191 CFLAGS="$CFLAGS -DARCH_$ARCH -DSYS_$SYS"
202 exec_prefix="$optarg"
216 --disable-avis-input)
222 --disable-mp4-output)
226 ASFLAGS="$ASFLAGS ${opt#--extra-asflags=}"
229 CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
230 VFW_CFLAGS="${opt#--extra-cflags=}"
233 LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
234 VFW_LDFLAGS="${opt#--extra-ldflags=}"
247 LDFLAGS="$LDFLAGS -pg"
267 if [ $ARCH = "X86_64" -o $ARCH = "PPC" -o $ARCH = "ALPHA" ] ; then
272 LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
273 CFLAGS="$CFLAGS -DVISUALIZE=1"
277 echo "Unknown option $opt, ignored"
282 # autodetect options that weren't forced nor disabled
284 if test "$pthread" = "auto" ; then
291 cc_check pthread.h -lpthread && pthread="yes"
295 if test "$pthread" = "yes" ; then
296 CFLAGS="$CFLAGS -DHAVE_PTHREAD"
300 *) LDFLAGS="$LDFLAGS -lpthread"
305 MP4_LDFLAGS="-lgpac_static"
306 if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
307 MP4_LDFLAGS="$MP4_LDFLAGS -lwinmm"
309 if [ "$mp4_output" = "auto" ] ; then
311 cc_check gpac/isomedia.h "$MP4_LDFLAGS" && mp4_output="yes"
313 if [ "$mp4_output" = "yes" ] ; then
314 echo "#define MP4_OUTPUT" >> config.h
315 LDFLAGS="$LDFLAGS $MP4_LDFLAGS"
318 if [ "$avis_input" = "auto" ] ; then
319 if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
325 if [ "$avis_input" = "yes" ] ; then
326 echo "#define AVIS_INPUT" >> config.h
327 LDFLAGS="$LDFLAGS -lvfw32"
330 if [ "$pic" = "yes" ] ; then
331 CFLAGS="$CFLAGS -fPIC"
332 ASFLAGS="$ASFLAGS -D__PIC__"
335 if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
336 CFLAGS="$CFLAGS -s -fomit-frame-pointer"
337 LDFLAGS="$LDFLAGS -s"
338 VFW_LDFLAGS="$VFW_LDFLAGS -s"
341 if [ "$debug" = "yes" ]; then
342 CFLAGS="-O1 -g $CFLAGS"
344 CFLAGS="-O4 -ffast-math $CFLAGS"
347 if cc_check "stdio.h" "" "fseeko(stdin,0,0);" ; then
348 echo "#define fseek fseeko" >> config.h
349 echo "#define ftell ftello" >> config.h
350 elif cc_check "stdio.h" "" "fseeko64(stdin,0,0);" ; then
351 echo "#define fseek fseeko64" >> config.h
352 echo "#define ftell ftello64" >> config.h
355 # generate config files
357 cat > config.mak << EOF
359 exec_prefix=$exec_prefix
362 includedir=$includedir
374 HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG
378 echo -n 'CONFIGURE_ARGS=' >> config.mak
380 echo -n " '$A'" >> config.mak
382 echo '' >> config.mak
384 cp config.mak gtk/config.mak
386 if [ "$vfw" = "yes" ]; then
387 rm -f vfw/build/cygwin/config.mak
388 cat > vfw/build/cygwin/config.mak << EOF
392 echo "default: x264vfw.dll" >> config.mak
395 if [ "$shared" = "yes" ]; then
396 API=`grep '#define X264_BUILD' < x264.h | cut -f 3 -d ' '`
397 echo "SONAME=libx264.so.$API" >> config.mak
398 echo 'default: $(SONAME)' >> config.mak
399 if [ "$gtk" = "yes" ]; then
400 echo "SONAMEGTK=libx264gtk.so.$API" >> gtk/config.mak
404 if [ "$gtk" = "yes" ]; then
405 echo 'default: libx264gtk.a' >> config.mak
406 echo 'install: install-gtk' >> config.mak
411 pclibs="-L$libdir -lx264"
412 if test "$pthread" = "yes" ; then
416 *) pclibs="$pclibs -lpthread"
423 exec_prefix=$exec_prefix
425 includedir=$includedir
428 Description: H.264 (MPEG4 AVC) encoder library
429 Version: $(grep POINTVER < config.h | sed -e 's/.* "//; s/".*//')
431 Cflags: -I$includedir
435 echo "Platform: $ARCH"
437 echo "avis input: $avis_input"
438 echo "mp4 output: $mp4_output"
439 echo "pthread: $pthread"
445 echo "shared: $shared"
446 echo "visualize: $vis"
448 echo "You can run 'make' or 'make fprofiled' now."