1# BEGIN LICENSE BLOCK 2# Version: CMPL 1.1 3# 4# The contents of this file are subject to the Cisco-style Mozilla Public 5# License Version 1.1 (the "License"); you may not use this file except 6# in compliance with the License. You may obtain a copy of the License 7# at www.eclipse-clp.org/license. 8# 9# Software distributed under the License is distributed on an "AS IS" 10# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 11# the License for the specific language governing rights and limitations 12# under the License. 13# 14# The Original Code is The ECLiPSe Constraint Logic Programming System. 15# The Initial Developer of the Original Code is Cisco Systems, Inc. 16# Portions created by the Initial Developer are 17# Copyright (C) 2006 Cisco Systems, Inc. All Rights Reserved. 18# 19# Contributor(s): 20# 21# END LICENSE BLOCK 22# 23# $Id: eclipse_arch.tcl,v 1.6 2015/05/02 17:22:34 jschimpf Exp $ 24# 25# compute the ECLiPSe architecture name using Tcl primitives 26# 27 28proc ec_arch {} { 29 global tcl_platform tcl_version 30 switch -glob $tcl_platform(os) { 31 Windows* { 32 if { $tcl_version >= 8.5} { 33 # use pointerSize if possible - wordSize returns 4 34 if { $tcl_platform(pointerSize) == 8 } { return x86_64_nt } 35 } elseif { $tcl_platform(wordSize) == 8 } { return x86_64_nt } 36 37 return i386_nt 38 } 39 SunOS { 40 switch -glob $tcl_platform(osVersion) { 41 4.* { return sun4 } 42 5.* { 43 switch -glob $tcl_platform(machine) { 44 sun4* { return sparc_sunos5 } 45 i86pc { 46 # This requires tcl8.4 or later: 47 switch -glob $tcl_platform(wordSize) { 48 4 { return i386_sunos5 } 49 8 { return x86_64_sunos5 } 50 } 51 } 52 } 53 } 54 } 55 } 56 Linux { 57 switch -glob $tcl_platform(machine) { 58 alpha { return alpha_linux } 59 armv7* { return armv7_linux } 60 x86_64 { 61 switch -glob $tcl_platform(wordSize) { 62 4 { return i386_linux } 63 8 { return x86_64_linux } 64 } 65 } 66 i?86 { return i386_linux } 67 } 68 } 69 Darwin { 70 switch -glob $tcl_platform(machine) { 71 Power* { return ppc_macosx } 72 i?86 { 73 # This requires tcl8.4 or later: 74 switch -glob $tcl_platform(wordSize) { 75 4 { return i386_macosx } 76 8 { # 32 bit kernel 77 return x86_64_macosx 78 } 79 } 80 } 81 x86_64 { # 64 bit kernel 82 return x86_64_macosx 83} 84 } 85 } 86 } 87 error "Platform $tcl_platform(os) $tcl_platform(osVersion) ($tcl_platform(machine)) not supported" 88} 89 90# returns the platform that Tk is running under. The tricky part is that 91# MacOS X can be using either the native Aqua or X11, and unfortunately 92# there is apparently no way to tell before Tk 8.4 (winfo server . crashes 93# under Aqua!) 94proc ec_tk_platform {} { 95 global tcl_platform 96 97 switch $tcl_platform(platform) { 98 unix { 99 if {[info tclversion] >= 8.4} { 100 return unix_[tk windowingsystem] 101 } else { 102 # Tk < 8.4 does not have tk windowingsystem 103 if {$tcl_platform(os) == "Darwin"} { 104 return unix_acqua ;# just assume it is acqua 105 } else { 106 return unix_x11 107 } 108 } 109 } 110 windows { 111 return windows 112 } 113 } 114}