3 # GDC -- D front-end for GCC
4 # Copyright (C) 2004 David Friedman
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 target_cpu
=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
22 target_vendor
=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
23 target_os
=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
25 d_target_os
=`echo $target_os | sed 's/^\([A-Za-z_]+\)/\1/'`
26 case "$d_target_os" in
27 aix
*) d_os_versym
=aix
; d_unix
=1 ;;
29 cygwin
*) d_os_versym
=cygwin
; d_unix
=1 ;;
30 darwin
*) d_os_versym
=darwin
; d_unix
=1 ;;
32 *freebsd
*) d_os_versym
=freebsd
; d_unix
=1 ;;
33 linux
*) d_os_versym
=linux
; d_unix
=1 ;;
34 mingw32
*) d_os_versym
=Win32
; d_windows
=1 ;;
35 pe
*) case "$target" in
36 *-skyos*-*) d_os_versym
=skyos
; d_unix
=1 ;;
39 skyos
*) d_os_versym
=skyos
; d_unix
=1 ;; # Doesn't actually work because SkyOS uses i386-skyos-pe
40 solaris
*) d_os_versym
=solaris
; d_unix
=1 ;;
41 sysv3
*) d_os_versym
=sysv3
; d_unix
=1 ;;
42 sysv4
*) d_os_versym
=sysv4
; d_unix
=1 ;;
44 *bsd
*) d_os_versym
=bsd
; d_unix
=1 ;;
46 *) d_os_versym
="$d_target_os"
50 i
*86 | x86_64
) gdc_target_cpu
=x86
;;
51 parisc
* | hppa
*) gdc_target_cpu
=hppa
;;
52 *ppc
* | powerpc
*) gdc_target_cpu
=ppc
;;
53 *) gdc_target_cpu
="$target_cpu"
56 case "$gdc_target_cpu" in
57 alpha
*) d_cpu_versym64
=Alpha
;;
58 arm
*) d_cpu_versym
=ARM
;;
59 hppa
) d_cpu_versym
=HPPA
; d_cpu_versym64
=HPPA64
;;
60 ia64
*) d_cpu_versym64
=IA64
;;
61 mips
*) d_cpu_versym
=MIPS
; d_cpu_versym64
=MIPS64
;;
62 ppc
) d_cpu_versym
=PPC
; d_cpu_versym64
=PPC64
;;
63 s390
*) d_cpu_versym
=S390
; d_cpu_versym64
=S390X
;;
64 sh
*) d_cpu_versym
=SH
; d_cpu_versym64
=SH64
;;
65 sparc
*) d_cpu_versym
=SPARC
; d_cpu_versym64
=SPARC64
;;
66 x86
) d_cpu_versym
=X86
; d_cpu_versym64
=X86_64
;;
69 if test -n "$d_cpu_versym"; then
70 echo "#define D_CPU_VERSYM \"$d_cpu_versym\""
72 if test -n "$d_cpu_versym64"; then
73 echo "#define D_CPU_VERSYM64 \"$d_cpu_versym64\""
75 if test -n "$d_os_versym"; then
76 echo "#define D_OS_VERSYM \"$d_os_versym\""