[QA] Remove executable bit from files, bug 550434.
[gentoo.git] / dev-libs / openssl / files / gentoo.config-1.0.1
1 #!/usr/bin/env bash
2 # Copyright 1999-2014 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # $Id$
5 #
6 # Openssl doesn't play along nicely with cross-compiling
7 # like autotools based projects, so let's teach it new tricks.
8 #
9 # Review the bundled 'config' script to see why kind of targets
10 # we can pass to the 'Configure' script.
11
12
13 # Testing routines
14 if [[ $1 == "test" ]] ; then
15         for c in \
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" \
38         ;do
39                 CHOST=${c/|*}
40                 ret_want=${c/*|}
41                 ret_got=$(CHOST=${CHOST} "$0")
42
43                 if [[ ${ret_want} == "${ret_got}" ]] ; then
44                         echo "PASS: ${CHOST}"
45                 else
46                         echo "FAIL: ${CHOST}"
47                         echo -e "\twanted: ${ret_want}"
48                         echo -e "\twe got: ${ret_got}"
49                 fi
50         done
51         exit 0
52 fi
53 [[ -z ${CHOST} && -n $1 ]] && CHOST=$1
54
55
56 # Detect the operating system
57 case ${CHOST} in
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";;
67         *)               exit 0;;
68 esac
69
70
71 # Compiler munging
72 compiler="gcc"
73 if [[ ${CC} == "ccc" ]] ; then
74         compiler=${CC}
75 fi
76
77
78 # Detect target arch
79 machine=""
80 chost_machine=${CHOST%%-*}
81 case ${system} in
82 linux)
83         case ${chost_machine}:${ABI} in
84                 aarch64*be)   machine="generic64 -DB_ENDIAN";;
85                 aarch64*)     machine="generic64 -DL_ENDIAN";;
86                 alphaev56*|\
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";;
97                 i[0-9]86*|\
98                 x86_64*:x86)  machine=elf;;
99                 ia64*)        machine=ia64;;
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;;
117         esac
118         ;;
119 BSD)
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;;
127         esac
128         ;;
129 aix)
130         machine=${compiler}
131         ;;
132 darwin)
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;;
138         esac
139         ;;
140 hpux)
141         case ${chost_machine} in
142                 ia64)   machine=ia64-${compiler} ;;
143         esac
144         ;;
145 solaris)
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};;
151         esac
152         ;;
153 winnt)
154         machine=parity
155         ;;
156 mingw*)
157         # special case ... no xxx-yyy style name
158         echo ${system}
159         ;;
160 esac
161
162
163 # If we have something, show it
164 [[ -n ${machine} ]] && echo ${system}-${machine}