gethostbyname: check for libnsl (Solaris support)

Add a check to "configure" to see whether -lnsl is needed for programs
that are using gethostbyname().  This change also adds the file
"compat/check_ghbn.c", which configure uses to perform its check.
configure: check for -Wl,-rpath (Solaris support)

Add a check to "configure" to see whether -Wl,-rpath can be used without
--enable-new-dtags.  Solaris needs the former and doesn't know about the
latter.
install: check for non-SysV version (Solaris support)

Solaris ships a program called "install" in /usr/sbin, which performs a
task that's fairly similar to the GNU and BSD "install" programs but
which uses very different command line arguments.  In particular, if it
is invoked without "-c", "-f", or "-n", it will search the target
directory for a file with the same name as the one being installed, and
it will only install the file if it finds a matching name.  More
excitingly, if it doesn't find a match, it will look in /bin, /usr/bin,
/etc, /lib, and /usr/lib and try to do the same there.

The standard workaround for this is to use GNU install.
It is available via the standard Solaris packaging system (in
"file/gnu-coreutils"), and installs itself as /usr/bin/ginstall.

This patch adds a check to "configure" to see if "install" behaves in a
way that's compatible with GNU and BSD install, and if not, it uses a
program called "ginstall" instead.  It also modifies "configure" to set
the $(INSTALL) variable, and changes various Makefiles to use it.
gen-version-script: parse Solaris "nm" output (Solaris support)

The output of "nm" on Solaris is substantially different from that on
Linux, and the current version of gen-version-script is tied to the
Linux "nm" output.  This patch separates the parts of "nm" processing
which are dependent on the output format into a couple shell functions,
and makes another shell function to use the appropriate version of
"c++filt" to demangle symbols.  It also modifies lib/Makefile.local
to pass the generated symbol table correctly to the Solaris linker.
debugger.c: correct return type from getppid() (Solaris support)

Cast the return value of getppid() to "int" from "pid_t" in debugger.c,
since it is being passed to sprintf("%d"), which wants an "int"
argument.  On Solaris, "pid_t" is a "long" for 32-bit programs.
Makefile.local: dependecies compiler flags (Solaris Studio support)

Adds check to "configure" to see whether '-MD -MP -MF' or '-xMD -xMF'
should be used. The change also makes it possible to set the DEPFLAGS
from environment variable similarly to for example CFLAGS.
Replace GNU extension ##__VA_ARGS__ by portable substitution

If you have macro
 #define eprintf(format, ...) fprintf (stderr, format, ##__VA_ARGS__)
the extension '##' removes preceeding comma ',' if __VA_ARGS__ is empty.
This is however not portable.

The fix uses portable solution described by Richard Hansen:
http://stackoverflow.com/questions/5588855/standard-alternative-to-gccs-va-args-trick
notmuch-new: use talloc_asprintf instead of asprintf

asprintf itself is not available on Solaris 10 FCS
lib/database.cc: fix declaration and definition discrepancy (Solaris Studio support)

lib/notmuch.h defines all the function in extern "C" { ... } block,
while lib/database.cc does not. This causes problems during linking
because notmuch_database_upgrade is exported in "C" linkage while
notmuch-new.o expects it in "C++" linkage
lib/gen-version-script.sh: standard compliance
lib/Makefile.local: solaris linker has -z defs
lib/gen-version-script.sh: Do not list "FILE" type symbols

Solaris binaries may contain symbols like those:

[1]     |         0|       0|FILE |LOCL |0    |ABS    |getdelim.c

gen-version-script.sh included them into notmuch.sym and the symbols
were then missing during linking.
lib/Makefile.local: Building static and dynamic library broken

Symlink creation
Makefile.local: Use compat helpers when linking notmuch client
lib/Makefile.local: solaris linker fixes
configure: add /usr/ucb/install as an alternative to install and ginstall
lib/Makefile.local: Use util modules when building static library
Test fixes
Add dtach binaries to the repo
set /usr/gnu/bin and dtach path for the tests