| 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 |
|
| 9 |
CAPABILITY_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. |
| 14 |
P_HWCAP_1=" vsx arch_2_06 power6x dfp pa6t arch_2_05 ic_snoop smt booke" |
| 15 |
P_HWCAP_2=" cellbe power5+ power5 power4 notb efpdouble efpsingle spe" |
| 16 |
P_HWCAP_3=" ucache 4xxmac mmu fpu altivec ppc601 ppc64 ppc32 " |
| 17 |
P_HWCAP2_1=" tar isel ebb dscr htm arch_2_07 arch_3_00 " |
| 18 |
# Additional entries as of ... future |
| 19 |
P_HWCAP2_2=" arch_3_1 mma " |
| 20 |
CAPABILITY_FOUND="no" |
| 21 |
for POTENTIAL_CAP in $P_HWCAP_1 $P_HWCAP_2 $P_HWCAP_3 $P_HWCAP2_1 $P_HWCAP2_2 ; do |
| 22 |
if [ "x$CAPABILITY_WORD" = "x$POTENTIAL_CAP" ]; then |
| 23 |
CAPABILITY_FOUND="yes" |
| 24 |
break |
| 25 |
fi |
| 26 |
done |
| 27 |
if [ x$CAPABILITY_FOUND = "xno" ]; then |
| 28 |
echo "Warning: did not find $CAPABILITY_WORD in the potential capabilities list." |
| 29 |
echo " LD_SHOW_AUXV=1 /bin/true | grep ^AT_HWCAP " |
| 30 |
echo " Double-check that the input value [$CAPABILITY_WORD] is valid." |
| 31 |
fi |
| 32 |
# SANITY CHECK End |
| 33 |
|
| 34 |
# Capability Check Begin: |
| 35 |
LD_SHOW_AUXV=1 /bin/true | grep ^AT_HWCAP | grep -w $CAPABILITY_WORD 2>&1 > /dev/null |
| 36 |
if [ "$?" -eq "0" ]; then |
| 37 |
#echo "found the capability" |
| 38 |
exit 0 |
| 39 |
elif [ "$?" -eq "2" ]; then |
| 40 |
# echo "grep failure" |
| 41 |
exit 1 |
| 42 |
else |
| 43 |
#echo "did not find the capability" |
| 44 |
exit 1 |
| 45 |
fi |
| 46 |
|