--- bin/aclocal.in
+++ bin/aclocal.in
@@ -68,8 +68,8 @@
 # ACLOCAL_PATH environment variable, and reset with the '--system-acdir'
 # option.
 my @user_includes = ();
-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION);
-my @system_includes = ('@datadir@/aclocal');
+my @automake_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal-' . $APIVERSION);
+my @system_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal');
+my @conan_includes = uniq(split(/:/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""));
-
 # Whether we should copy M4 file in $user_includes[0].
 my $install = 0;
@@ -451,6 +451,6 @@
     }
   scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes);
   scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes);
+  scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes);
-
   # Construct a new function that does the searching.  We use a
   # function (instead of just evaluating $search in the loop) so that
