2 # Copyright 1999-2014 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 "alpha-linux-gnu |linux-alpha-gcc" \
20 "alphaev56-unknown-linux-gnu |linux-alpha+bwx-gcc" \
21 "i686-pc-linux-gnu |linux-elf" \
22 "whatever-gentoo-freebsdX.Y |BSD-generic32" \
23 "i686-gentoo-freebsdX.Y |BSD-x86-elf" \
24 "sparc64-alpha-freebsdX.Y |BSD-sparc64" \
25 "ia64-gentoo-freebsd5.99234 |BSD-ia64" \
26 "x86_64-gentoo-freebsdX.Y |BSD-x86_64" \
27 "hppa64-aldsF-linux-gnu5.3 |linux-generic32 -DB_ENDIAN" \
28 "powerpc-gentOO-linux-uclibc |linux-ppc" \
29 "powerpc64-unk-linux-gnu |linux-ppc64" \
30 "x86_64-apple-darwinX |darwin64-x86_64-cc" \
31 "powerpc64-apple-darwinX |darwin64-ppc-cc" \
32 "i686-apple-darwinX |darwin-i386-cc" \
33 "i386-apple-darwinX |darwin-i386-cc" \
34 "powerpc-apple-darwinX |darwin-ppc-cc" \
35 "i586-pc-winnt |winnt-parity" \
36 "s390-ibm-linux-gnu |linux-generic32 -DB_ENDIAN" \
37 "s390x-linux-gnu |linux64-s390x" \
41 ret_got=$(CHOST=${CHOST} "$0")
43 if [[ ${ret_want} == "${ret_got}" ]] ; then
47 echo -e "\twanted: ${ret_want}"
48 echo -e "\twe got: ${ret_got}"
53 [[ -z ${CHOST} && -n $1 ]] && CHOST=$1
56 # Detect the operating system
58 *-aix*) system="aix";;
59 *-darwin*) system="darwin";;
60 *-freebsd*) system="BSD";;
61 *-hpux*) system="hpux";;
62 *-linux*) system="linux";;
63 *-solaris*) system="solaris";;
64 *-winnt*) system="winnt";;
65 x86_64-*-mingw*) system="mingw64";;
66 *mingw*) system="mingw";;
73 if [[ ${CC} == "ccc" ]] ; then
80 chost_machine=${CHOST%%-*}
83 case ${chost_machine}:${ABI} in
84 aarch64*be) machine="generic64 -DB_ENDIAN";;
85 aarch64*) machine="generic64 -DL_ENDIAN";;
87 alphaev[678]*)machine=alpha+bwx-${compiler};;
88 alpha*) machine=alpha-${compiler};;
89 armv[4-9]*b*) machine="armv4 -DB_ENDIAN";;
90 armv[4-9]*) machine="armv4 -DL_ENDIAN";;
91 arm*b*) machine="generic32 -DB_ENDIAN";;
92 arm*) machine="generic32 -DL_ENDIAN";;
93 avr*) machine="generic32 -DL_ENDIAN";;
94 bfin*) machine="generic32 -DL_ENDIAN";;
95 # hppa64*) machine=parisc64;;
96 hppa*) machine="generic32 -DB_ENDIAN";;
98 x86_64*:x86) machine=elf;;
100 m68*) machine="generic32 -DB_ENDIAN";;
101 mips*el*) machine="generic32 -DL_ENDIAN";;
102 mips*) machine="generic32 -DB_ENDIAN";;
103 powerpc64*le) machine="generic64 -DL_ENDIAN";;
104 powerpc64*) machine=ppc64;;
105 powerpc*le) machine="generic32 -DL_ENDIAN";;
106 powerpc*) machine=ppc;;
107 # sh64*) machine=elf;;
108 sh*b*) machine="generic32 -DB_ENDIAN";;
109 sh*) machine="generic32 -DL_ENDIAN";;
110 sparc*v7*) machine="generic32 -DB_ENDIAN";;
111 sparc64*) machine=sparcv9;;
112 sparc*) machine=sparcv8;;
113 s390x*) machine=s390x system=linux64;;
114 s390*) machine="generic32 -DB_ENDIAN";;
115 x86_64*:x32) machine=x32;;
116 x86_64*) machine=x86_64;;
120 case ${chost_machine} in
121 alpha*) machine=generic64;;
122 i[6-9]86*) machine=x86-elf;;
123 ia64*) machine=ia64;;
124 sparc64*) machine=sparc64;;
125 x86_64*) machine=x86_64;;
126 *) machine=generic32;;
133 case ${chost_machine} in
134 powerpc64) machine=ppc-cc; system=${system}64;;
135 powerpc) machine=ppc-cc;;
136 i?86*) machine=i386-cc;;
137 x86_64) machine=x86_64-cc; system=${system}64;;
141 case ${chost_machine} in
142 ia64) machine=ia64-${compiler} ;;
146 case ${chost_machine} in
147 i386) machine=x86-${compiler} ;;
148 x86_64*) machine=x86_64-${compiler}; system=${system}64;;
149 sparcv9*) machine=sparcv9-${compiler}; system=${system}64;;
150 sparc*) machine=sparcv8-${compiler};;
157 # special case ... no xxx-yyy style name
163 # If we have something, show it
164 [[ -n ${machine} ]] && echo ${system}-${machine}