grep -q $FLAG <<< $CPU_FLAGS
return $?
}
+
+check_supported_target() {
+ local FLAGS
+ if [ "$1" = "via-c7" ]; then
+ FLAGS="sse sse2 pni"
+ elif [ "$1" = "via-c3" ]; then
+ FLAGS="3dnow"
+ fi
+ for j in $FLAGS; do
+ if ! check_cpu $j; then
+ echo "Your system doesn't support needed cpu feature \"$j\" to build target $1." >&2
+ return 1
+ fi
+ done
+ return 0
+}
+
+check_supported_targets() {
+ for i in ${1-$POSSIBLE_TARGETS}; do
+ check_supported_target $i 2>/dev/null
+ [ "$?" -eq "0" ] && echo -n "$i "
+ done
+ echo # new line
+}
# Checking CPU features #
##############################################################################
- CHECK_CPU=""
- if [ 'via-c7' = $TARGET ]; then
- CHECK_CPU="sse sse2 pni"
- elif [ 'via-c3' = $TARGET ]; then
- CHECK_CPU="3dnow"
- fi
-
- for flag in $CHECK_CPU; do
- check_cpu $flag || \
- exiterror "Your system doesn't support needed cpu feature \"$flag\" to build target $TARGET."
- done
+ check_supported_target $TARGET || \
+ exiterror "Your host doesn't have all needed cpu features for building \"$TARGET\""
##############################################################################
# Building Linux From Scratch system configuration #