diff --git a/Makefile.am b/Makefile.am
index 5f2257dc673c72a6f773bc2f5a5b90fca24e743c..ee26134b60948d56fe9354336533f273851505a5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,7 +21,7 @@
 # $Id$
 ###########################################################################
 
-ACLOCAL_AMFLAGS = -I .
+ACLOCAL_AMFLAGS = -I m4
 
 AUTOMAKE_OPTIONS = foreign
 
diff --git a/ares/Makefile.am b/ares/Makefile.am
index b265703d0ce6986a2e34a7970eb6d59140538a0a..2c01c6c07c10ceaf6a5ae8f1fcd119c8f1a07407 100644
--- a/ares/Makefile.am
+++ b/ares/Makefile.am
@@ -1,4 +1,4 @@
-ACLOCAL_AMFLAGS = -I .
+ACLOCAL_AMFLAGS = -I m4
 
 AUTOMAKE_OPTIONS = foreign
 
diff --git a/ares/buildconf b/ares/buildconf
index ed3f81d1e29e8abc4262008d76b8e6583f1c1398..434a308fddf4bd566a1641ac0e3e5277101b0e23 100755
--- a/ares/buildconf
+++ b/ares/buildconf
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 ${LIBTOOLIZE:-libtoolize} --copy --automake --force
-ACLOCAL_FLAGS="-I . $ACLOCAL_FLAGS"
+ACLOCAL_FLAGS="-I m4 $ACLOCAL_FLAGS"
 ${ACLOCAL:-aclocal} $ACLOCAL_FLAGS
 ${AUTOHEADER:-autoheader}
 ${AUTOCONF:-autoconf}
diff --git a/ares/reentrant.m4 b/ares/m4/reentrant.m4
similarity index 100%
rename from ares/reentrant.m4
rename to ares/m4/reentrant.m4
diff --git a/buildconf b/buildconf
index 9fc0c5709633a1bea4c9a48e028eed61dd3576a6..b0ef8ee5aa28ed1263c228f71d60019769b9fbd7 100755
--- a/buildconf
+++ b/buildconf
@@ -209,7 +209,7 @@ PERL=`findtool ${PERL:-perl}`
 echo "buildconf: running libtoolize"
 $libtoolize --copy --automake --force || die "The libtoolize command failed"
 echo "buildconf: running aclocal"
-ACLOCAL_FLAGS="-I . $ACLOCAL_FLAGS"
+ACLOCAL_FLAGS="-I m4 $ACLOCAL_FLAGS"
 ${ACLOCAL:-aclocal} $ACLOCAL_FLAGS || die "The aclocal command line failed"
 if test -n "$PERL"; then
   echo "buildconf: running aclocal hack to convert all mv to mv -f"
diff --git a/reentrant.m4 b/m4/reentrant.m4
similarity index 100%
rename from reentrant.m4
rename to m4/reentrant.m4