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
@@ -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>
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)
