72d4c0
diff -uNr rpm-4.9.0-orig//lib/rpmrc.c rpm-4.9.0/lib/rpmrc.c
72d4c0
--- rpm-4.9.0-orig//lib/rpmrc.c	2011-08-05 12:23:04.000000000 -0500
72d4c0
+++ rpm-4.9.0/lib/rpmrc.c	2011-08-05 12:25:13.000000000 -0500
72d4c0
@@ -732,6 +732,56 @@
72d4c0
 }
72d4c0
 #endif
72d4c0
 
72d4c0
+#if defined(__linux__) && defined(__arm__)
72d4c0
+static int has_neon()
72d4c0
+{
72d4c0
+        char buffer[4096], *p;
72d4c0
+        int fd = open("/proc/cpuinfo", O_RDONLY);
72d4c0
+        if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
72d4c0
+                rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n"));
72d4c0
+                close(fd);
72d4c0
+                return 0;
72d4c0
+        }
72d4c0
+        close(fd);
72d4c0
+
72d4c0
+        p = strstr(buffer, "Features");
72d4c0
+        p = strtok(p, "\n");
72d4c0
+        p = strstr(p, "neon");
72d4c0
+        p = strtok(p, " ");
72d4c0
+        if (p == NULL) {
72d4c0
+                rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'Features' line\n"));
72d4c0
+                return 0;
72d4c0
+        } else if (strcmp(p, "neon") == 0) {
72d4c0
+                return 1;
72d4c0
+        }
72d4c0
+        return 0;
72d4c0
+}
72d4c0
+
72d4c0
+static int has_hfp()
72d4c0
+{
72d4c0
+        char buffer[4096], *p;
72d4c0
+        int fd = open("/proc/cpuinfo", O_RDONLY);
72d4c0
+        if (read(fd, &buffer, sizeof(buffer) - 1) == -1) {
72d4c0
+                rpmlog(RPMLOG_WARNING, _("read(/proc/cpuinfo) failed\n"));
72d4c0
+                close(fd);
72d4c0
+                return 0;
72d4c0
+        }
72d4c0
+        close(fd);
72d4c0
+
72d4c0
+        p = strstr(buffer, "Features");
72d4c0
+        p = strtok(p, "\n");
72d4c0
+        p = strstr(p, "vfpv3");
72d4c0
+        p = strtok(p, " ");
72d4c0
+        if (p == NULL) {
72d4c0
+                rpmlog(RPMLOG_WARNING, _("/proc/cpuinfo has no 'Features' line\n"));
72d4c0
+                return 0;
72d4c0
+        } else if (strcmp(p, "vfpv3") == 0) {
72d4c0
+                return 1;
72d4c0
+        }
72d4c0
+        return 0;
72d4c0
+}
72d4c0
+#endif
72d4c0
+
72d4c0
 
72d4c0
 #	if defined(__linux__) && defined(__i386__)
72d4c0
 #include <setjmp.h>
72d4c0
@@ -1157,6 +1207,22 @@
72d4c0
 	}
72d4c0
 #	endif	/* sparc*-linux */
72d4c0
 
72d4c0
+#	if defined(__linux__) && defined(__arm__)
72d4c0
+	{
72d4c0
+	    if (strcmp(un.machine, "armv7l") == 0 ) {
72d4c0
+	        if (has_neon() && has_hfp())
72d4c0
+                    strcpy(un.machine, "armv7hnl");
72d4c0
+                else if (has_hfp())
72d4c0
+                    strcpy(un.machine, "armv7hl");
72d4c0
+	    } else if (strcmp(un.machine, "armv6l") == 0 ) {
72d4c0
+	        if (has_neon() && has_hfp())
72d4c0
+                    strcpy(un.machine, "armv6hnl");
72d4c0
+                else if (has_hfp())
72d4c0
+                    strcpy(un.machine, "armv6hl");
72d4c0
+	    }
72d4c0
+	}
72d4c0
+#	endif	/* arm*-linux */
72d4c0
+
72d4c0
 #	if defined(__GNUC__) && defined(__alpha__)
72d4c0
 	{
72d4c0
 	    unsigned long amask, implver;
72d4c0