#!/bin/sh

USE_MMX=1
USE_DV=0
USE_FIREWIRE=0

for ac_option
do
case "$ac_option" in
	--no-mmx)
		USE_MMX=0
		;;

	--use-firewire)
		USE_FIREWIRE=1
		;;

	--use-dv)
		USE_DV=1
		;;

	-h | --help | -help)
	cat << EOF
Options:
	--no-mmx           Compile quicktime with no MMX support.
	--use-dv           Enable DV support
	--use-firewire     Enable firewire support
EOF
		exit 0
		;;

	*)
		;;
esac
done

echo "Configuring libquicktime"
echo "MMX:      ${USE_MMX}"
echo "DV:       ${USE_DV}"
echo "Firewire: ${USE_FIREWIRE}"
echo " > global_config"

cat > global_config << EOF
# DO NOT EDIT.  EDIT ./configure INSTEAD AND RERUN IT.
USE_MMX = $USE_MMX
USE_DV = $USE_DV
USE_FIREWIRE = $USE_FIREWIRE
EOF

if test -z "$CFLAGS" -a `uname --machine` != alpha; then
	echo >> global_config "CFLAGS = -O2 -fomit-frame-pointer -malign-loops=2 -malign-jumps=2 -malign-functions=2 -march=i486 -I/usr/local/include"
fi

echo >> global_config "CFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"

if test $USE_DV = 1; then
echo >> global_config "CFLAGS += -DHAVE_DV -Ilibdv"
fi

if test $USE_FIREWIRE = 1; then
echo >> global_config "CFLAGS += -DHAVE_FIREWIRE"
fi

cat >> global_config << EOF
CFLAGS += -I. \$(shell glib-config --cflags)
export CFLAGS
CC = gcc
EOF
