Commits

Anonymous committed 46b89e0

fix L1 detection on OSX x86

Comments (0)

Files changed (1)

m4/ax_cache_size.m4

 	sysctl_exe=/sbin/sysctl
       fi
       if test -n "$sysctl_exe"; then
-	if test -z "$ax_l2_size" ; then
-          sysctl_out= `$sysctl_exe -n hw.l2cachesize 2>/dev/null`;
-          if test -z "$sysctl_out"; then
-            sysctl_out=0;
+	if test -z "$ax_l2_size" -o "$ax_l2_size" = "0"; then
+          sysctl_out=`$sysctl_exe -n hw.l2cachesize 2>/dev/null`;
+          if test ! -z "$sysctl_out"; then
+            ax_l2_size=$(($sysctl_out / 1024))
           fi;
-	  ax_l2_size=$(($sysctl_out / 1024))
+	  
 	fi
-	if test -z "$ax_l1_size" ; then
-          sysctl_out= `$sysctl_exe -n hw.l1dcachesize 2>/dev/null`;
-          if test -z "$sysctl_out"; then
-            sysctl_out=0;
+	if test -z "$ax_l1_size" -o "$ax_l1_size" = "0" ; then
+          sysctl_out=`$sysctl_exe -n hw.l1dcachesize 2>/dev/null`;
+          if test ! -z "$sysctl_out"; then
+  	    ax_l1_size=$(($sysctl_out / 1024))
           fi;
-	  ax_l1_size=$(($sysctl_out / 1024))
 	fi
-	if test -z "$ax_l1_size" ; then
-          sysctl_out= `$sysctl_exe -n hw.l1cachesize 2>/dev/null`;
-          if test -z "$sysctl_out"; then
-            sysctl_out=0;
+	if test -z "$ax_l1_size" -o "ax_l1_size" = "0" ; then
+          sysctl_out=`$sysctl_exe -n hw.l1cachesize 2>/dev/null`;
+          if test ! -z "$sysctl_out"; then
+             ax_l1_size=$(($sysctl_out / 1024))            
           fi;
-	  ax_l1_size=$(($sysctl_out / 1024))
         fi
       fi
     fi