]> granicus.if.org Git - sysstat/commitdiff
Portable way to detect 64 bit OS in configure script
authorPeter Schiffer <pschiffe@redhat.com>
Wed, 11 Feb 2015 18:21:12 +0000 (19:21 +0100)
committerPeter Schiffer <pschiffe@redhat.com>
Wed, 11 Feb 2015 18:21:12 +0000 (19:21 +0100)
Different architectures have different format of /proc/cpuinfo and also, only
i386 and x86_64 archs support cpu flags. Using "getconf LONG_BIT" command it's
possible to detect 64 bit OS on multiple different architectures. This patch was
successfully tested on i386, x86_64, s390x, ppc64 and aarch64 archs.

configure.in

index 8e3214cdfd44355c18b9b7bb0100e31c2728b6ea..a1de35532fabcbea841328327d4361d61c99ff99 100644 (file)
@@ -210,9 +210,8 @@ fi
 
 SADC_DIR=$AuxPrefix/lib
 if test -d $AuxPrefix/lib64; then
-   # Look for lm (long mode) flag to know if CPU is 64 bit
-   grep " lm " /proc/cpuinfo >/dev/null 2>&1
-   if test $? = 0; then
+   # Verify that this OS is really 64 bit
+   if test $(getconf LONG_BIT) = 64; then
       SADC_DIR=$AuxPrefix/lib64
    fi
 fi