2 # Copyright 1999-2011 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
6 # Openssl doesn't play along nicely with cross-compiling
7 # like autotools based projects, so let's teach it new tricks.
9 # Review the bundled 'config' script to see why kind of targets
10 # we can pass to the 'Configure' script.
14 if [[ $1 == "test" ]] ; then
16 "arm-gentoo-linux-uclibc |linux-generic32 -DL_ENDIAN" \
17 "armv5b-linux-gnu |linux-armv4 -DB_ENDIAN" \
18 "x86_64-pc-linux-gnu |linux-x86_64" \
19 "alphaev56-unknown-linux-gnu |linux-alpha+bwx-gcc" \
20 "i686-pc-linux-gnu |linux-elf" \
21 "whatever-gentoo-freebsdX.Y |BSD-generic32" \
22 "i686-gentoo-freebsdX.Y |BSD-x86-elf" \
23 "sparc64-alpha-freebsdX.Y |BSD-sparc64" \
24 "ia64-gentoo-freebsd5.99234 |BSD-ia64" \
25 "x86_64-gentoo-freebsdX.Y |BSD-x86_64" \
26 "hppa64-aldsF-linux-gnu5.3 |linux-generic32 -DB_ENDIAN" \
27 "powerpc-gentOO-linux-uclibc |linux-ppc" \
28 "powerpc64-unk-linux-gnu |linux-ppc64" \
29 "x86_64-apple-darwinX |darwin64-x86_64-cc" \
30 "powerpc64-apple-darwinX |darwin64-ppc-cc" \
31 "i686-apple-darwinX |darwin-i386-cc" \
32 "i386-apple-darwinX |darwin-i386-cc" \
33 "powerpc-apple-darwinX |darwin-ppc-cc" \
34 "i586-pc-winnt |winnt-parity" \
35 "s390-ibm-linux-gnu |linux-generic32 -DB_ENDIAN" \
36 "s390x-linux-gnu |linux-s390x" \
40 ret_got=$(CHOST=${CHOST} "$0")
42 if [[ ${ret_want} == "${ret_got}" ]] ; then
46 echo -e "\twanted: ${ret_want}"
47 echo -e "\twe got: ${ret_got}"
52 [[ -z ${CHOST} && -n $1 ]] && CHOST=$1
55 # Detect the operating system
57 *-aix*) system="aix";;
58 *-darwin*) system="darwin";;
59 *-freebsd*) system="BSD";;
60 *-hpux*) system="hpux";;
61 *-linux*) system="linux";;
62 *-solaris*) system="solaris";;
63 *-winnt*) system="winnt";;
64 x86_64-*-mingw*) system="mingw64";;
65 *mingw*) system="mingw";;
72 if [[ ${CC} == "ccc" ]] ; then
79 chost_machine=${CHOST%%-*}
82 case ${chost_machine}:${ABI} in
83 alphaev56*) machine=alpha+bwx-${compiler};;
84 alphaev[678]*)machine=alpha+bwx-${compiler};;
85 alpha*) machine=alpha-${compiler};;
86 armv[4-9]*b*) machine="armv4 -DB_ENDIAN";;
87 armv[4-9]*) machine="armv4 -DL_ENDIAN";;
88 arm*b*) machine="generic32 -DB_ENDIAN";;
89 arm*) machine="generic32 -DL_ENDIAN";;
90 avr*) machine="generic32 -DL_ENDIAN";;
91 bfin*) machine="generic32 -DL_ENDIAN";;
92 # hppa64*) machine=parisc64;;
93 hppa*) machine="generic32 -DB_ENDIAN";;
95 x86_64*:x86) machine=elf;;
97 m68*) machine="generic32 -DB_ENDIAN";;
98 mips*el*) machine="generic32 -DL_ENDIAN";;
99 mips*) machine="generic32 -DB_ENDIAN";;
100 powerpc64*) machine=ppc64;;
101 powerpc*) machine=ppc;;
102 # sh64*) machine=elf;;
103 sh*b*) machine="generic32 -DB_ENDIAN";;
104 sh*) machine="generic32 -DL_ENDIAN";;
105 sparc*v7*) machine="generic32 -DB_ENDIAN";;
106 sparc64*) machine=sparcv9;;
107 sparc*) machine=sparcv8;;
108 s390x*) machine=s390x;;
109 s390*) machine="generic32 -DB_ENDIAN";;
110 x86_64*:x32) machine=x32;;
111 x86_64*) machine=x86_64;;
115 case ${chost_machine} in
116 alpha*) machine=generic64;;
117 i[6-9]86*) machine=x86-elf;;
118 ia64*) machine=ia64;;
119 sparc64*) machine=sparc64;;
120 x86_64*) machine=x86_64;;
121 *) machine=generic32;;
128 case ${chost_machine} in
129 powerpc64) machine=ppc-cc; system=${system}64;;
130 powerpc) machine=ppc-cc;;
131 i?86*) machine=i386-cc;;
132 x86_64) machine=x86_64-cc; system=${system}64;;
136 case ${chost_machine} in
137 ia64) machine=ia64-${compiler} ;;
141 case ${chost_machine} in
142 i386) machine=x86-${compiler} ;;
143 x86_64*) machine=x86_64-${compiler}; system=${system}64;;
144 sparcv9*) machine=sparcv9-${compiler}; system=${system}64;;
145 sparc*) machine=sparcv8-${compiler};;
152 # special case ... no xxx-yyy style name
158 # If we have something, show it
159 [[ -n ${machine} ]] && echo ${system}-${machine}