diff --git a/build/autoconf/lustre-build.m4 b/build/autoconf/lustre-build.m4
index e8a546b75e94fff72efa61e9ed3d1cb6d3044b28..2a1b1d005d3fb3d76f6ec5a301e28c22c0125112 100644
--- a/build/autoconf/lustre-build.m4
+++ b/build/autoconf/lustre-build.m4
@@ -317,6 +317,16 @@ if test $ac_cv_sizeof_unsigned_long_long != 8 ; then
         AC_MSG_ERROR([** we assume that sizeof(long long) == 8.  Tell phil@clusterfs.com])
 fi
 
+AC_MSG_CHECKING([if $CC accepts -m64])
+CFLAGS_save="$CFLAGS"
+CFLAGS="-m64 $CFLAGS"
+AC_TRY_COMPILE([],[],[
+	AC_MSG_RESULT([yes])
+],[
+	AC_MSG_RESULT([no])
+	CFLAGS="$CFLAGS_save"
+])
+
 CPPFLAGS="-I\$(top_srcdir)/lustre/include -I\$(top_srcdir)/portals/include $CPPFLAGS"
 
 LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"