Some autoconf portability improvements
Description of Patch
While hacking on Motion on OSX and OpenBSD
I have had to adjust configure.in to make fewer assumptions about the host system.
This patch makes Motion more functional on OSX and OpenBSD
machines and should make the configure script more able to automatically handle other OSs and distributions.
I have tested this patch on OpenBSD
(4.6, i386), MacOSX
(10.6, x86_64), and Linux (Debian 6 "Squeeze", i386).
The patch is broken into three parts, which probably need to be applied in order:
- configtweaks-defs makes better use of the config.h file for communicating configuration results to the program
- configtweaks-portability is the main part of the patch, and consists of more accurate tests for a number of system features. Where an existing autoconf test existed, I used that instead of relying on OS defines. In other places I changed autoconf to test for the feature itself instead of relying on a (necessarily incomplete and often outdated) knowledge of which OSs have which features.
- configtweaks-v4l12 allows Motion to use the V4L2 interface even on systems that don't have V4L1, such as OpenBSD.
Installation of Patch
Download the patch file and apply it to the source code in the usual way. (This patch is against the svn head, r523, and probably won't apply cleanly to the last released version.) Apply -defs, then -portability, then -v4l12.
You will need to rerun 'autoheader' (to update config.h.in) and 'autoconf' (to regenerate configure).
Then re-build Motion and test the patch.
Change History of Patch
Version 1 of the patch is a fairly straightforward patch to the configure machinery: explicitly tests for some system features instead of guessing; uses the uint32_t typedef if available; moves some defines from the command line to config.h.
Version 2 of the patch incorporates everything in version 1, but I discovered that OpenBSD
currently incudes a v4l2-compatible /dev/video (but no v4l1-compatible interfaces). So I added the ability to enable V4L1
independently, even on BSD systems. This involved some more elaborate changes to configure.in. I'm not completely sure my changes will interact well with the FreeBSD
bktr and PWCBSD support, so hopefully someone can test that (as well as the Linux support; I've compiled this on a Linux system but I do not have a Linux box with a webcam attached so I haven't run it there).
- 3.0 Updated to apply cleanly to r517; work around an incompatibility in /bin/sh's echo builtin on MacOSX
- 4.0 Updated to apply cleanly to r523. Split the patch into three parts for clarity. Fixed some problems discovered testing it on Debian.
Please can you create a new patch againts current SVN or GIT version ?
- 30 Oct 2011
Very useful patch, wish it worked on r550
- 21 Jan 2012
would be interested to test, am using motion on wheezy, but would like to trial on os x 10.8.2
is it possible to provide a fork, or source to build?
I don't have recent experience with applying patches,
pages are dated 2005 which is a concern.
- 11 Jan 2013
Is there a chance that these patches can be updated to work with the current source? Also, is there a reason they haven't been pulled into git yet?
- 24 Apr 2014