diff --git a/auto-config-update-aarch64.diff b/auto-config-update-aarch64.diff
new file mode 100644
index 0000000..cd5571e
--- /dev/null
+++ b/auto-config-update-aarch64.diff
@@ -0,0 +1,27 @@
+Index: build/parseBuildInstallClean.c
+===================================================================
+--- build/parseBuildInstallClean.c.orig
++++ build/parseBuildInstallClean.c
+@@ -46,7 +46,21 @@ int parseBuildInstallClean(rpmSpec spec,
+     } else if (rc < 0) {
+ 	goto exit;
+     }
+-    
++
++    if (parsePart == PART_BUILD) {
++        char* buf = strdup(
++            "ref=/usr/lib/rpm\n"
++            "for s in guess sub; do\n"
++            "    for c in $(find -maxdepth 3 -name \"config.$s\"); do\n"
++            "         grep -q config-patches@ $c || continue\n"
++            "         grep -q aarch64 $c || install -m 755 $ref/config.$s $c\n"
++            "     done\n"
++            "done\n"
++        );
++        appendLineStringBuf(*sbp, buf);
++        free(buf);
++    }
++
+     while (! (nextPart = isPart(spec->line))) {
+ 	appendStringBuf(*sbp, spec->line);
+ 	if ((rc = readLine(spec, STRIP_NOTHING)) > 0) {
diff --git a/rpm.changes b/rpm.changes
index 3930040..e41248c 100644
--- a/rpm.changes
+++ b/rpm.changes
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Mon Apr 22 22:00:14 UTC 2013 - dmueller@suse.com
+
+- add auto-config-update-aarch64.diff:
+ * optionally automatically update config.guess/sub during build 
+
 -------------------------------------------------------------------
 Fri Apr  5 18:47:53 UTC 2013 - dmueller@suse.com
 
diff --git a/rpm.spec b/rpm.spec
index 70df009..73763b4 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -60,6 +60,7 @@ Source9:        sysconfig.services-rpm
 Source10:       beecrypt-4.1.2.tar.bz2
 Source11:       db-4.8.30.tar.bz2
 Source12:       baselibs.conf
+Source6464:     auto-config-update-aarch64.diff
 Patch1:         beecrypt-4.1.2.diff
 Patch2:         db.diff
 # quilt patches start here
@@ -136,6 +137,11 @@ Patch79:        helperenv.diff
 Patch80:        config-guess-sub-update.diff
 Patch81:        debugedit-aarch64.diff
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+%ifarch aarch64
+%global auto_config_guess_update 1
+%else
+%global auto_config_guess_update 0
+%endif
 #
 # avoid bootstrapping problem
 %define _binary_payload w9.bzdio
@@ -223,6 +229,9 @@ rm -f rpmdb/db.h
 %patch -P 60 -P 61 -P 62 -P 63 -P 64 -P 65 -P 66 -P 67 -P 68 -P 69
 %patch -P 70 -P 71 -P 72 -P 73 -P 74 -P 75 -P 76 -P 77 -P 78 -P 79
 %patch -P 80 -P 81
+%if %auto_config_guess_update
+patch -p0 < %{S:6464}
+%endif
 cp config.guess config.sub db/dist/
 cp config.guess config.sub beecrypt/
 #chmod 755 scripts/find-supplements{,.ksyms}
@@ -339,6 +348,10 @@ for i in /usr/share/automake-*/*; do
   fi
 done
 popd
+%if %auto_config_guess_update
+install -m 755 config.guess %{buildroot}/usr/lib/rpm
+install -m 755 config.sub %{buildroot}/usr/lib/rpm
+%endif
 gzip -9 CHANGES
 rm -rf %{buildroot}/%{_libdir}/python%{py_ver}
 rm -f %{buildroot}%{_libdir}/*.la