1#!/bin/sh 2 3# Check if the passed in (CAPABILITY_WORD) matches a value found in the 4# current hwcap aux vector. 5 6# return '0' to indicate the capability was found. 7# return '1' for not found, or any other error condition. 8 9CAPABILITY_WORD=$1 10 11# SANITY CHECK Begin: 12# These are potential hwcap values as found in the glibc dl-procinfo.c 13# sources as of July 2015. 14P_HWCAP_1=" vsx arch_2_06 power6x dfp pa6t arch_2_05 ic_snoop smt booke" 15P_HWCAP_2=" cellbe power5+ power5 power4 notb efpdouble efpsingle spe" 16P_HWCAP_3=" ucache 4xxmac mmu fpu altivec ppc601 ppc64 ppc32 " 17P_HWCAP2_1=" tar isel ebb dscr htm arch_2_07 arch_3_00 " 18CAPABILITY_FOUND="no" 19for POTENTIAL_CAP in $P_HWCAP_1 $P_HWCAP_2 $P_HWCAP_3 $P_HWCAP2_1 ; do 20 if [ "x$CAPABILITY_WORD" = "x$POTENTIAL_CAP" ]; then 21 CAPABILITY_FOUND="yes" 22 break 23 fi 24done 25if [ x$CAPABILITY_FOUND = "xno" ]; then 26 echo "Warning: did not find $CAPABILITY_WORD in the potential capabilities list." 27 echo " LD_SHOW_AUXV=1 /bin/true | grep ^AT_HWCAP " 28 echo " Double-check that the input value [$CAPABILITY_WORD] is valid." 29fi 30# SANITY CHECK End 31 32# Capability Check Begin: 33LD_SHOW_AUXV=1 /bin/true | grep ^AT_HWCAP | grep -w $CAPABILITY_WORD 2>&1 > /dev/null 34if [ "$?" -eq "0" ]; then 35 #echo "found the capability" 36 exit 0 37elif [ "$?" -eq "2" ]; then 38 # echo "grep failure" 39 exit 1 40else 41 #echo "did not find the capability" 42 exit 1 43fi 44 45