]> granicus.if.org Git - strace/commitdiff
powerpc: enhance 32/64bit detection
authorAnton Blanchard <anton@samba.org>
Thu, 11 Jul 2013 02:03:57 +0000 (12:03 +1000)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 12 Jul 2013 14:34:12 +0000 (14:34 +0000)
We were using uname to determine if userspace was 32 or 64bit.
This fails when we have a 64bit kernel and a 32bit userspace.

* configure.ac (powerpc*): Similar to x86, use a runtime test
to determine if we are 32 or 64bit.

Signed-off-by: Anton Blanchard <anton@samba.org>
configure.ac

index 03e49fef6b07092d3e00465aff95d6da0e9d83f5..b3b62e883234c6d99ae4111a3a7811882f0a907e 100644 (file)
@@ -54,7 +54,11 @@ alpha*)
 powerpc*)
        arch=powerpc
        AC_DEFINE([POWERPC], 1, [Define for the PowerPC architecture.])
-       if test $host_cpu = powerpc64; then
+       AC_TRY_COMPILE(
+[#ifndef __LP64__
+# error 32 bit
+#endif], [], ppc_bits=64, ppc_bits=32)
+       if test "$ppc_bits" = "64"; then
                AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
        fi
        ;;