LEFT | RIGHT |
1 // Copyright 2012 The Go Authors. All rights reserved. | 1 // Copyright 2012 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // These #ifdefs are being used as a substitute for | 5 // These #ifdefs are being used as a substitute for |
6 // build configuration, so that on any system, this | 6 // build configuration, so that on any system, this |
7 // tool can be built with the local equivalent of | 7 // tool can be built with the local equivalent of |
8 // cc *.c | 8 // cc *.c |
9 // | 9 // |
10 #ifndef WIN32 | 10 #ifndef WIN32 |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 gohostos = "freebsd"; | 681 gohostos = "freebsd"; |
682 #elif defined(__FreeBSD_kernel__) | 682 #elif defined(__FreeBSD_kernel__) |
683 // detect debian/kFreeBSD.· | 683 // detect debian/kFreeBSD.· |
684 // http://wiki.debian.org/Debian_GNU/kFreeBSD_FAQ#Q._How_do_I_detect_kfr
eebsd_with_preprocessor_directives_in_a_C_program.3F | 684 // http://wiki.debian.org/Debian_GNU/kFreeBSD_FAQ#Q._How_do_I_detect_kfr
eebsd_with_preprocessor_directives_in_a_C_program.3F |
685 gohostos = "freebsd";··· | 685 gohostos = "freebsd";··· |
686 #elif defined(__OpenBSD__) | 686 #elif defined(__OpenBSD__) |
687 gohostos = "openbsd"; | 687 gohostos = "openbsd"; |
688 #elif defined(__NetBSD__) | 688 #elif defined(__NetBSD__) |
689 gohostos = "netbsd"; | 689 gohostos = "netbsd"; |
690 #elif defined(__sun) && defined(__SVR4) | 690 #elif defined(__sun) && defined(__SVR4) |
691 » gohostos = "sunos"; | 691 » gohostos = "solaris"; |
692 » // Even on 64-bit platform, sunos uname -m prints i86pc. | 692 » // Even on 64-bit platform, solaris uname -m prints i86pc. |
693 run(&b, nil, 0, "isainfo", "-n", nil); | 693 run(&b, nil, 0, "isainfo", "-n", nil); |
694 if(contains(bstr(&b), "amd64")) | 694 if(contains(bstr(&b), "amd64")) |
695 gohostarch = "amd64"; | 695 gohostarch = "amd64"; |
696 if(contains(bstr(&b), "i386")) | 696 if(contains(bstr(&b), "i386")) |
697 gohostarch = "386"; | 697 gohostarch = "386"; |
698 #else | 698 #else |
699 » if(gohostos == nil) | 699 » fatal("unknown operating system"); |
700 » » fatal("unknown operating system: %s", u.sysname); | |
701 #endif | 700 #endif |
702 | 701 |
703 if(gohostarch == nil) { | 702 if(gohostarch == nil) { |
704 if(uname(&u) < 0) | 703 if(uname(&u) < 0) |
705 fatal("uname: %s", strerror(errno)); | 704 fatal("uname: %s", strerror(errno)); |
706 if(contains(u.machine, "x86_64") || contains(u.machine, "amd64")
) | 705 if(contains(u.machine, "x86_64") || contains(u.machine, "amd64")
) |
707 gohostarch = "amd64"; | 706 gohostarch = "amd64"; |
708 else if(hassuffix(u.machine, "86")) | 707 else if(hassuffix(u.machine, "86")) |
709 gohostarch = "386"; | 708 gohostarch = "386"; |
710 else if(contains(u.machine, "arm")) | 709 else if(contains(u.machine, "arm")) |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 cansse2(void) | 834 cansse2(void) |
836 { | 835 { |
837 int info[4]; | 836 int info[4]; |
838 ········ | 837 ········ |
839 __cpuid(info, 1); | 838 __cpuid(info, 1); |
840 return (info[3] & (1<<26)) != 0; // SSE2 | 839 return (info[3] & (1<<26)) != 0; // SSE2 |
841 } | 840 } |
842 | 841 |
843 #endif // PLAN9 | 842 #endif // PLAN9 |
844 #endif // __WINDOWS__ | 843 #endif // __WINDOWS__ |
LEFT | RIGHT |