[QA] Remove executable bit from files, bug 550434.
[gentoo.git] / dev-libs / openssl / files / gentoo.config-1.0.0
1 #!/usr/bin/env bash
2 # Copyright 1999-2011 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                 "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" \
37         ;do
38                 CHOST=${c/|*}
39                 ret_want=${c/*|}
40                 ret_got=$(CHOST=${CHOST} "$0")
41
42                 if [[ ${ret_want} == "${ret_got}" ]] ; then
43                         echo "PASS: ${CHOST}"
44                 else
45                         echo "FAIL: ${CHOST}"
46                         echo -e "\twanted: ${ret_want}"
47                         echo -e "\twe got: ${ret_got}"
48                 fi
49         done
50         exit 0
51 fi
52 [[ -z ${CHOST} && -n $1 ]] && CHOST=$1
53
54
55 # Detect the operating system
56 case ${CHOST} in
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";;
66         *)               exit 0;;
67 esac
68
69
70 # Compiler munging
71 compiler="gcc"
72 if [[ ${CC} == "ccc" ]] ; then
73         compiler=${CC}
74 fi
75
76
77 # Detect target arch
78 machine=""
79 chost_machine=${CHOST%%-*}
80 case ${system} in
81 linux)
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";;
94                 i[0-9]86*|\
95                 x86_64*:x86)  machine=elf;;
96                 ia64*)        machine=ia64;;
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;;
112         esac
113         ;;
114 BSD)
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;;
122         esac
123         ;;
124 aix)
125         machine=${compiler}
126         ;;
127 darwin)
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;;
133         esac
134         ;;
135 hpux)
136         case ${chost_machine} in
137                 ia64)   machine=ia64-${compiler} ;;
138         esac
139         ;;
140 solaris)
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};;
146         esac
147         ;;
148 winnt)
149         machine=parity
150         ;;
151 mingw*)
152         # special case ... no xxx-yyy style name
153         echo ${system}
154         ;;
155 esac
156
157
158 # If we have something, show it
159 [[ -n ${machine} ]] && echo ${system}-${machine}