Requirements:
-------------
* make and a C and C++ compiler
* optionally libjpeg v6 or later
* optionally Qt5 for building qv4l2

Building:
---------

If you checked out the source repository you need to install the autotools
environment and gettext first.

The autotools/gettext should be updated to the version that are shipped
on your distro. This can be done by running:
	$ ./bootstrap.sh

Then you need to configure any any desired options with:
	$ ./configure

You can get a summary of possible configurations via the --help option.
If used without arguments, it will set the install prefix to /usr/local/.

After configuration you need to start the build process with:
	$ make

Installing:
-----------

To install it at the prefix configured by ./configure, do, as root:
	# make install

Note that v4l-utils' "make install" supports DESTDIR for installing into
a build root for example:
	# make install DESTDIR=/mnt/sysimage

Cross Compiling:
----------------

Cross compiling has been tested with the Code Sourcery and Linaro ARM Linux
toolchain.

To cross compile with the Code Sourcery toolchain run the following commands:

export PATH=/opt/arm-2009q3/bin:$PATH
export PKG_CONFIG_LIBDIR=/path/to/cross/root/lib
./configure --host=arm-none-linux-gnueabi --without-jpeg
make

To cross compile with the Linaro toolchain run the following commands:

export PATH=/opt/gcc-linaro-arm-linux-gnueabihf-2012.09-20120921_linux/bin:$PATH
export PKG_CONFIG_LIBDIR=/path/to/cross/root/lib
./configure --host=arm-linux-gnueabihf --without-jpeg
make

Building static binaries:
-------------------------

There are two options in building static binaries: either fully static or
dynamically linking to system shared libraries while statically linking
libraries that are a part of v4l-utils.

In either case, building static binaries requires telling pkg-config the
static libraries will be needed, and telling configure to disable building
of shared libraries. This way system libraries will still be linked
dynamically:

	$ PKG_CONFIG="pkg-config --static" ./configure --disable-shared

Fully static binares can be built by further setting LDFLAGS for the
configure:

	$ PKG_CONFIG="pkg-config --static" LDFLAGS="--static -static" \
	  ./configure --disable-shared

Note that this requires static variants of all the libraries needed for
linking which may not be available in all systems.

Android Cross Compiling and Installing:
----------------

v4l-utils will only build using the complete AOSP source tree, because of the
stlport dependency.

List of v4l-utils that supply an Android.mk makefile:
* utils/v4l2-compliance
* utils/v4l2-ctl
* utils/v4l2-dbg

To cross compile an utility you must first configure the shell with Android's
envsetup.sh to add the mm alias, before running lunch to select your target
device.

cd /path/to/aosp
source build/envsetup.sh
lunch
cd /path/to/v4l-utils
cd <utility>
mm

Output binary will be located in the Android out directory, below the
target/product/<name>/system/bin/<v4l-utils executable name> path.

The binary executable can be pushed to the target Android device using
adb push <v4l-utils executable> /system/bin
