diff --git a/doc/C/jhbuild.xml b/doc/C/jhbuild.xml
index bb39aa8..6208364 100644
--- a/doc/C/jhbuild.xml
+++ b/doc/C/jhbuild.xml
@@ -1778,6 +1778,14 @@ libgnomecanvas is missing branch definition for gnome-2-20
 	    it.</simpara>
 	  </listitem>
 	</varlistentry>
+	<varlistentry id="cfg-use-autoreconf">
+	  <term><varname>use_autoreconf</varname></term>
+	  <listitem>
+	    <simpara>A boolean value: when <constant>True</constant>, <command>autogen.sh</command>
+	    scripts are ignored and <command>autoreconf</command> is run instead. The
+	    <sgmltag class="attribute">autogen-sh</sgmltag> attribute is still honored if set.
+	  </listitem>
+	</varlistentry>
       </variablelist>
     </section>
 
@@ -1812,9 +1820,10 @@ libgnomecanvas is missing branch definition for gnome-2-20
 	    end of an environment variable can have unexpected
 	    consequences).</para>
 	    <para>This function has special handling for the
-	    <envar>ACLOCAL_FLAGS</envar> environment variable, which
-	    expects paths to be listed in the form <literal>-I
-	    <replaceable>pathname</replaceable></literal>.</para>
+	    <envar>ACLOCAL</envar> and <envvar>ACLOCAL_FLAGS</envvar> environment variables, which
+	    expect paths to be listed in the form <literal>-I
+	    <replaceable>pathname</replaceable></literal> (and in the case of 
+	    <envvar>ACLOCAL</envvar>, prefixed by <literal>aclocal</literal>).</para>
 	  </listitem>
 	</varlistentry>
 	<varlistentry>
@@ -2187,7 +2196,7 @@ libgnomecanvas is missing branch definition for gnome-2-20
 	module has no <command>autogen.sh</command> script
 	equivalent. In that case, JHBuild will run <command>autoreconf
 	-i</command>, followed by the proper
-	<command>configure</command>.
+	<command>configure</command>. Note that if the
 
 	<sgmltag class="attribute">skip-autogen</sgmltag> chooses whether
 	or not to run autogen.sh, it is a boolean with an extra
diff --git a/jhbuild/commands/sanitycheck.py b/jhbuild/commands/sanitycheck.py
index 306c168..600f47b 100644
--- a/jhbuild/commands/sanitycheck.py
+++ b/jhbuild/commands/sanitycheck.py
@@ -28,8 +28,8 @@ from jhbuild.errors import UsageError, FatalError
 def get_aclocal_path(version):
     data = get_output(['aclocal-%s' % version, '--print-ac-dir'])
     path = [data[:-1]]
-    env = os.environ.get('ACLOCAL_FLAGS', '').split()
-    i = 0
+    env = os.environ.get('ACLOCAL', '').split()
+    i = 1
     while i < len(env):
         if env[i] == '-I':
             path.append(env[i+1])
diff --git a/jhbuild/config.py b/jhbuild/config.py
index 47cad26..188a285 100644
--- a/jhbuild/config.py
+++ b/jhbuild/config.py
@@ -64,14 +64,19 @@ def prependpath(envvar, path):
 
 def addpath(envvar, path):
     '''Adds a path to an environment variable.'''
-    # special case ACLOCAL_FLAGS
-    if envvar in [ 'ACLOCAL_FLAGS' ]:
+
+    # special case ACLOCAL/ACLOCAL_FLAGS
+    if envvar in [ 'ACLOCAL', 'ACLOCAL_FLAGS' ] :
         if sys.platform.startswith('win'):
             path = jhbuild.utils.subprocess_win32.fix_path_for_msys(path)
 
-        envval = os.environ.get(envvar, '-I %s' % path)
-        parts = ['-I', path] + envval.split()
-        i = 2
+        # Always set both vars, the worst that can happen is redundant path entries. To do the Right
+        # Thing we need to access config.use_autoreconf.
+        envvar = 'ACLOCAL'
+        envval = os.environ.get(envvar, 'aclocal -I %s' % path)
+        parts = ['aclocal', '-I', path] + envval.split()[1:]
+        i = 3
+
         while i < len(parts)-1:
             if parts[i] == '-I':
                 # check if "-I parts[i]" comes earlier
@@ -84,6 +89,9 @@ def addpath(envvar, path):
             else:
                 i += 1
         envval = ' '.join(parts)
+
+        os.environ['ACLOCAL_FLAGS'] = ' '.join(parts[1:])
+
     elif envvar in [ 'LDFLAGS', 'CFLAGS', 'CXXFLAGS' ]:
         if sys.platform.startswith('win'):
             path = jhbuild.utils.subprocess_win32.fix_path_for_msys(path)
@@ -354,14 +362,14 @@ class Config:
         xcursordir = os.path.join(self.prefix, 'share', 'icons')
         addpath('XCURSOR_PATH', xcursordir)
 
-        # ACLOCAL_FLAGS
+        # ACLOCAL
         aclocaldir = os.path.join(self.prefix, 'share', 'aclocal')
         if not os.path.exists(aclocaldir):
             try:
                 os.makedirs(aclocaldir)
             except:
                 raise FatalError(_("Can't create %s directory") % aclocaldir)
-        addpath('ACLOCAL_FLAGS', aclocaldir)
+        addpath('ACLOCAL', aclocaldir)
 
         # PERL5LIB
         perl5lib = os.path.join(self.prefix, 'lib', 'perl5')
diff --git a/tests/tests.py b/tests/tests.py
index 4a2e28e..2d82b21 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -655,7 +655,7 @@ class EndToEndTest(unittest.TestCase):
         self.assertEquals(proc.wait(), 0)
 
     # Won't pass under stock MSYS because pkgconfig isn't installed in base
-    # path. Will work if you set ACLOCAL_FLAGS, PATH and PKG_CONFIG_PATH to
+    # path. Will work if you set ACLOCAL, PATH and PKG_CONFIG_PATH to
     # a prefix where pkg-config is installed.
     def test_autotools_with_libtool(self):
         config = self.make_config()
