bitcoin/bitcoin — pull request #2943 by theuni (2013-08-27 03:26:49+00:00)
Title: Autotools buildsystem

Continuation of https://github.com/bitcoin/bitcoin/pull/2805.

Changes since Round 2:

Rebased on current master
Big cleanups
Added protoc/libprotobuf support
Added win32 installer make target
Added Gitian descriptors

I could use some help with the following items:
- Documenting windows/osx/mingw build. They should all be working, but I don't currently have a windows/osx environment for testing. Documentation is a rather large job for this merge, as it requires a pretty extensive overhaul. For the most part, the build docs can be thrown away and replaced by a single procedure, with the exception of platform-specific dependencies setup. There is no longer any need for a distinction between gui/non-gui build procedures.
- Fix gitian autotools timestamp loop. In order for the resulting tarball to be deterministic, faketime must be used during 'make dist'. Unfortunately, this sends automake into a loop. It eventually breaks out, but it's very annoying.

I've briefly updated the documentation for unix. Sadly, my macbook busted last weekend (should be fixed in ~1wk), So I was not able to add the osx dmg build target as I had intended, nor the documentation for building on osx.

Is anyone willing to help me out with the above?

--

Here is the final go at an Autotools build system replacement. It is meant to be a drop-in replacement for the current system(s), providing the same features with no net changes. It can also live side-by-side with the old system while sharing the same build-related variables in order to facilitate a smooth transition.

I hope the benefits are obvious enough: A single/shared build procedure, portability, ease of packaging, ease for downstreams, ease for repository maintainers, cross-compilation, etc. I don't vouch for Autotools in any way, in fact, this configure.am is downright ugly (mainly just because of mingw though), but it's portable and well-established.

This does away with the need for qmake, as the Makefile is capable of generating everything it needs in a portable way.

Building from CLI:
For Linux, assuming the dependencies have been met, the build procedure looks like this:
```
./autogen.sh
./configure
make
```
Same for OS X, but the pkg-config path needs to be hooked up from macports first:
```
echo "/opt/local/share/aclocal" | sudo tee -a /usr/share/aclocal/dirlist
```

For mingw it's the same, but you will need to provide lots of paths in the form of:
```
./autogen.sh
export STAGING=/path/to/extracted/libs
./configure CPPFLAGS=-I$STAGING LDFLAGS=-L$STAGING --prefix=$STAGING --host=i586-mingw32msvc --with-qt-bindir=$STAGING/host/bin --with-qt-plugindir=$STAGING/plugins --with-qt-incdir=$STAGING --with-boost=$STAGING --with-protoc-bindir=$STAGING/host/bin
make
```
In addition, there are helpers for qt and boost to help with finding some locations.
Use ./configure --help to see the available options.

Native windows built is untested, as I don't have a windows environment at my disposal.

'make check' will run the unit tests and print the results.

I've done my best to avoid adding any new behavior or features, and I would much prefer to aim for feature-parity before making any improvements.