Repository: spack/spack

Issue:
mrbayes weird dependency resolution - requires second attempt to succeed 
First install of `mrbayes` fails because it lacks `autoconf` at install. After second attempt it succeeds to install `autoconf` and `mrbayes`


Discussion:
This is what I get the first time I run the installation:
```console
==> '/home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/libtool-2.4.6-qejqffffrzzu2uqeyip5lxsx72oqbxa7/bin/libtoolize'
libtoolize: putting auxiliary files in '.'.
libtoolize: linking file './ltmain.sh'
libtoolize: You should add the contents of the following files to 'aclocal.m4':
libtoolize:   '/home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/libtool-2.4.6-qejqffffrzzu2uqeyip5lxsx72oqbxa7/share/aclocal/libtool.m4'
libtoolize:   '/home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/libtool-2.4.6-qejqffffrzzu2uqeyip5lxsx72oqbxa7/share/aclocal/ltoptions.m4'
libtoolize:   '/home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/libtool-2.4.6-qejqffffrzzu2uqeyip5lxsx72oqbxa7/share/aclocal/ltsugar.m4'
libtoolize:   '/home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/libtool-2.4.6-qejqffffrzzu2uqeyip5lxsx72oqbxa7/share/aclocal/ltversion.m4'
libtoolize:   '/home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/libtool-2.4.6-qejqffffrzzu2uqeyip5lxsx72oqbxa7/share/aclocal/lt~obsolete.m4'
libtoolize: Remember to add 'LT_INIT' to configure.in.
libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.in,
libtoolize: and rerunning libtoolize and aclocal.
libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
==> '/home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/automake-1.15.1-mmzkmb6wbegqdi6yovvvm7ehqqsdfweo/bin/aclocal'
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
==> '/home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/autoconf-2.69-xbmhpt4kpc2wh4fdesxjimtuequ4tg7n/bin/autoreconf' '-ivf' '-I' '/home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/pkgconf-1.3.10-he3o4n5ultrldtkx2fp7atf6yqhlp7ad/share/aclocal'
autoreconf: Entering directory `.'
autoreconf: configure.in: not using Gettext
autoreconf: running: aclocal -I /home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/pkgconf-1.3.10-he3o4n5ultrldtkx2fp7atf6yqhlp7ad/share/aclocal --force 
aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'
autoreconf: configure.in: tracing
autoreconf: configure.in: not using Libtool
autoreconf: running: /home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/autoconf-2.69-xbmhpt4kpc2wh4fdesxjimtuequ4tg7n/bin/autoconf --include=/home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/pkgconf-1.3.10-he3o4n5ultrldtkx2fp7atf6yqhlp7ad/share/aclocal --force
autoreconf: running: /home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/autoconf-2.69-xbmhpt4kpc2wh4fdesxjimtuequ4tg7n/bin/autoheader --include=/home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/pkgconf-1.3.10-he3o4n5ultrldtkx2fp7atf6yqhlp7ad/share/aclocal --force
autoheader: warning: missing template: BEAGLE_ENABLED
autoheader: Use AC_DEFINE([BEAGLE_ENABLED], [], [Description])
autoheader: warning: missing template: COMPLETIONMATCHES
autoheader: warning: missing template: MPI_ENABLED
autoheader: warning: missing template: SSE_ENABLED
autoheader: warning: missing template: THREADS_ENABLED
autoheader: warning: missing template: UNIX_VERSION
autoheader: warning: missing template: _64BIT
autoreconf: /home/mculpo/PycharmProjects/spack/opt/spack/linux-ubuntu14.04-x86_64/gcc-4.8/autoconf-2.69-xbmhpt4kpc2wh4fdesxjimtuequ4tg7n/bin/autoheader failed with exit status: 1
```
The second time it "works" because configure gets generated despite the errors. 

Imo it's very likely that the `autotools` related files need to be cleaned up a bit, but I see this more as a problem of `mrbayes` codebase than as a failure in Spack. Pingin @akthoma to see what she thinks.
I had noticed and mentioned this in the original PR for mrbayes (#4757), but it was merged anyways. I actually just looked at this last week, but could not get it to install on the first try (I must admit I did not try very hard since I knew this was an issue, though). I agree--it definitely seems like a mrbayes failure rather than a spack failure. I'll take a look at it now to see if I can figure anything out.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/mrbayes/package.py b/var/spack/repos/builtin/packages/mrbayes/package.py
--- a/var/spack/repos/builtin/packages/mrbayes/package.py
+++ b/var/spack/repos/builtin/packages/mrbayes/package.py
@@ -32,9 +32,10 @@ class Mrbayes(AutotoolsPackage):
        of model parameters."""
 
     homepage = "http://mrbayes.sourceforge.net"
-    url      = "https://downloads.sourceforge.net/project/mrbayes/mrbayes/3.2.6/mrbayes-3.2.6.tar.gz"
+    url      = "https://github.com/NBISweden/MrBayes"
 
-    version('3.2.6', '95f9822f24be47b976bf87540b55d1fe')
+    version('2017-11-22', commit='8a9adb11bcc538cb95d91d57568dff383f924503',
+            git='https://github.com/NBISweden/MrBayes.git')
 
     variant('mpi', default=True, description='Enable MPI parallel support')
     variant('beagle', default=True, description='Enable BEAGLE library for speed benefits')
@@ -48,8 +49,6 @@ class Mrbayes(AutotoolsPackage):
     depends_on('libbeagle', when='+beagle')
     depends_on('mpi', when='+mpi')
 
-    configure_directory = 'src'
-
     def configure_args(self):
         args = []
         if '~beagle' in self.spec:


Test patch: