]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
Added some new functions to check hosts cpu capabilities.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 12 Nov 2008 23:19:57 +0000 (00:19 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 12 Nov 2008 23:19:57 +0000 (00:19 +0100)
tools/make-check
tools/make-include
tools/make-interactive

index 4a750793dd1c9ddc056e3fca92db3895f78973f7..bc473dc0160bd7d33144c3f7cef03b67c5d30527 100644 (file)
@@ -191,3 +191,27 @@ check_cpu() {
        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
+}
index a6eb006eb00c32b8f7b111fa4c31548f1df338b1..4559928f56da4a13778739246336000f52d33262 100644 (file)
@@ -433,17 +433,8 @@ prepareenv() {
        # 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                           #
index ac6c7de9755de227ca5c10d3c9c4b68342ca882c..05b68b639aed1a424bdd0e888ee2135ba1a7dc35 100644 (file)
@@ -184,6 +184,9 @@ check)
                sanity)
                        check_sanity $3
                        ;;
+               target*)
+                       check_supported_targets
+                       ;;
                *)
                        usage
                        ;;