Mercurial > pub > dyncall > dyncall
annotate configure @ 146:0ab08c1541f0
- fixed armhf ellipsis calls, were ignoring spill area
- minor cleanups for consistency
- todo update
author | cslag |
---|---|
date | Thu, 08 Sep 2016 23:00:45 +0200 |
parents | 988f7587e4d4 |
children | ee0de14d5da0 |
rev | line source |
---|---|
0 | 1 #!/bin/sh |
2 C=Makefile.config | |
3 | |
4 # get full path | |
5 case $0 in | |
6 /*) | |
7 FULL=$0 | |
8 ;; | |
9 *) | |
10 FULL=$PWD/$0 | |
11 ;; | |
12 esac | |
13 | |
14 printf "# auto-generated by $0\n" >$C | |
15 while [ $# -gt 0 ]; do | |
16 X=$1 | |
17 shift 1 | |
18 # Shell common: | |
19 case $X in | |
20 --help|-h|-?) | |
21 cat <<EOF | |
22 usage: $0 --<option>=<value> <var>=<value> .. | |
23 | |
24 --prefix=<dir> | |
25 --target=<platform> uname/special targets: MacOSX,iOS,iPhoneSimulator | |
30
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
26 use "?" to get a list of explicitly specifiable |
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
27 targets |
0 | 28 --sdk=<version> Mac OS X/iOS SDK version (e.g. '6.1' or '10.9.3') |
29 Tested iOS SDK versions: 4.3, 6.1, 8.1 | |
30 --sdkroot=<dir> | |
31 | |
32 Useful variables CC, CXX, CFLAGS, CXXFLAGS, etc.. | |
33 | |
34 EOF | |
35 exit 1 | |
36 ;; | |
37 # GNU Compatibility: | |
38 --prefix=*) | |
39 PREFIX=`printf -- "${X}" | cut -c 10-` | |
40 ;; | |
41 --target=*) | |
42 TARGET=`printf -- "${X}" | cut -c 10-` | |
43 ;; | |
44 --sdk=*) | |
45 SDK=`printf -- "${X}" | cut -c 7-` | |
46 ;; | |
47 --sdkroot=*) | |
48 SDKROOT=`printf -- "${X}" | cut -c 11-` | |
49 ;; | |
50 # Environment variables: | |
51 [A-Za-z_]*=*) | |
52 printf "${X}\n" >>$C | |
53 k=`printf "${X}" | cut -d = -f 1` | |
54 v=`printf "${X}" | cut -d = -f 2` | |
55 export $k="$v" | |
56 ;; | |
57 # Others fail: | |
58 *) | |
59 printf "error: invalid option ${X}\n" >&2 | |
60 exit 1 | |
61 ;; | |
62 esac | |
63 done | |
64 printf "PREFIX=${PREFIX:=/usr/local}\n" >>$C | |
65 case ${TARGET:=`uname`} in | |
66 Linux) | |
67 if [ -z "${CFLAGS}" ]; then | |
68 printf "CFLAGS=-fPIC\n" >>$C | |
69 fi | |
70 printf "LDLIBS=-lm -ldl\n" >>$C | |
71 ;; | |
72 OpenBSD) | |
73 printf "LDLIBS=-lm\n" >>$C | |
74 ;; | |
75 DragonFly|NetBSD) | |
76 if [ -z "${CFLAGS}" ]; then | |
77 printf "CFLAGS=-fPIC\n" >>$C | |
78 fi | |
79 printf "LDLIBS=-lm\n" >>$C | |
80 ;; | |
81 FreeBSD) | |
82 if [ -z "${CFLAGS}" ]; then | |
83 printf "CFLAGS=-fPIC\n" >>$C | |
84 fi | |
85 printf "LDLIBS=-lm\n" >>$C | |
86 printf "RM=rm -f\n" >>$C | |
87 ;; | |
56
2cccd38e5e4d
- added -lm in GNU/kFreeBSD config, to build all tests out of the box
cslag
parents:
53
diff
changeset
|
88 GNU/kFreeBSD) |
57 | 89 if [ -z "${CFLAGS}" ]; then |
90 printf "CFLAGS=-fPIC\n" >>$C | |
91 fi | |
92 printf "LDLIBS=-lm -ldl\n" >>$C | |
56
2cccd38e5e4d
- added -lm in GNU/kFreeBSD config, to build all tests out of the box
cslag
parents:
53
diff
changeset
|
93 ;; |
0 | 94 MacOSX|Darwin) |
95 # if Apple's libtool (not to be confused with GNU's) is available, which is according to libtool(1) "with -static [...] intended | |
96 # to replace ar(5) and ranlib", use it - if it is shadowed by some install of GNU's libtool assume that a foreign environment is | |
97 # intentionally used, and fall back to using 'ar rs' (the equivalent to 'libtool -static'), for compatibility: | |
98 if libtool -V >/dev/null 2>/dev/null; then # Apple's libtool has -V for version, which GNU does not. | |
99 printf "AR=libtool\n" >>$C | |
100 printf "ARFLAGS=-static -o\n" >>$C | |
101 else | |
102 printf "AR=ar\n" >>$C | |
103 printf "ARFLAGS=rs\n" >>$C # 's' is crucial for universal binary archives | |
104 fi | |
105 if [ `uname -n` = 'iPhone' ]; then # building on iPhone itself, uname yields Darwin (gcc setup for current/correct arch) | |
106 printf "CC=gcc\n" >>$C | |
107 elif [ -z ${SDK} ]; then | |
108 case `sw_vers -productVersion` in | |
109 10.4.*) | |
110 ARCHS="-arch ppc -arch i386 -arch x86_64" | |
111 ;; | |
5
52deacbdd2b1
- fix from MoarVM team and Tobi Leich for osx configure
cslag
parents:
0
diff
changeset
|
112 10.5.*) |
0 | 113 ARCHS="-arch i386 -arch x86_64 -arch ppc" |
114 ;; | |
115 10.6.*) | |
116 ARCHS="-arch i386 -arch x86_64" | |
117 ;; | |
66
988f7587e4d4
fix for universal binary build on OS X > 10.10
Daniel Adler <dadler@dyncall.org>
parents:
57
diff
changeset
|
118 10.1?.*) |
0 | 119 ARCHS="-arch x86_64 -arch i386" |
120 ;; | |
121 10.[789].*) | |
122 ARCHS="-arch x86_64 -arch i386" | |
123 ;; | |
124 esac | |
125 printf "ASFLAGS=${ARCHS}\n" >>$C | |
126 printf "CFLAGS=${ARCHS}\n" >>$C | |
127 printf "CXXFLAGS=${ARCHS}\n" >>$C | |
128 else | |
129 if [ -z ${SDKROOT} ]; then | |
130 SDKROOT="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${SDK}.sdk" | |
131 fi | |
132 printf "CFLAGS=-isysroot ${SDKROOT}\n" >>$C | |
133 printf "CXXFLAGS=-isysroot ${SDKROOT}\n" >>$C | |
134 fi | |
135 ;; | |
136 iPhoneOS|iOS) | |
137 if [ -z ${SDKROOT} ]; then | |
138 SDKROOT="`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDK}.sdk" | |
139 fi | |
140 if [ -z "${ARCHS}" ]; then | |
141 case "${SDK}" in | |
142 [45].*) | |
143 ARCHS="-arch armv6" | |
144 ;; | |
145 [67].*) | |
146 ARCHS="-arch armv7" | |
147 ;; | |
53 | 148 [89].*) |
0 | 149 ARCHS="-arch armv7 -arch arm64" |
150 ;; | |
151 esac | |
152 fi | |
153 printf "ARFLAGS=rs\n" >>$C # 's' is crucial for universal binary archives | |
154 printf "ASFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
155 printf "CFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
156 printf "CXXFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
157 printf "LDFLAGS=-Wl,-syslibroot ${SDKROOT}\n" >>$C | |
158 ;; | |
159 iPhoneSimulator) | |
160 if [ -z ${SDKROOT} ]; then | |
161 SDKROOT="`xcode-select -print-path`/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDK}.sdk" | |
162 fi | |
163 ARCHS="-arch i386" | |
164 printf "ASFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
165 printf "CFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
166 printf "CXXFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
167 printf "LDFLAGS=-Wl,-syslibroot ${SDKROOT}\n" >>$C | |
168 ;; | |
169 SunOS) | |
170 # open distributions often don't come with default cc and CC, check for common alternatives. | |
171 printf "CC=` (which cc || which gcc || which clang ) | grep -v '^no '`\n" >>$C | |
172 printf "CXX=`(which CC || which g++ || which clang++) | grep -v '^no '`\n" >>$C # C++ compiler traditionally named CC | |
173 printf "CCC=${CXX}\n" >>$C # Sun make's rules use CCC for c++ compiler | |
174 printf "LDLIBS=-lm\n" >>$C | |
175 ;; | |
176 Minix) | |
177 printf "CC=gcc\n" >>$C | |
178 printf "CXX=g++\n">>$C | |
179 printf "AR=ar\n" >>$C | |
180 ;; | |
181 PSP) | |
182 SDKROOT="`psp-config --pspsdk-path`" | |
183 printf "CC=psp-gcc\n" >>$C | |
184 printf "CXX=psp-gcc\n">>$C # don't use psp-g++, buggy | |
185 printf "AR=psp-ar\n" >>$C | |
186 printf "CFLAGS=-I${SDKROOT}/include/\n" >>$C | |
187 printf "CXXFLAGS=-I${SDKROOT}/include/\n" >>$C | |
188 # Pulling in dyncall libs below is a hack, for some reason psp-ld is super-picky about order. | |
189 # Use your C lib of choice, from the PSPSDK, or... | |
190 #printf "LDLIBS=-L${SDKROOT}/lib/ -L`dirname ${FULL}`/dyncall -L`dirname ${FULL}`/dyncallback -ldyncall_s -ldyncallback_s -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lstdc++ -lpsplibc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser \n" >>$C | |
191 # ... newlib. | |
192 printf "LDLIBS=-L${SDKROOT}/lib/ -L`dirname ${FULL}`/dyncall -L`dirname ${FULL}`/dyncallback -ldyncall_s -ldyncallback_s -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lstdc++ -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser \n" >>$C | |
193 ;; | |
30
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
194 ?) |
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
195 cat $0 | awk '/^esac$/{b=0}/^ [A-Za-z0-9|]+\)/{if(b==1) print substr($1,1,length($1)-1)}BEGIN{b=0}/^case.*TARGET.*uname.*in$/{b=1}' | tr '|' '\n' |
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
196 exit 0 |
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
197 ;; |
0 | 198 esac |
199 | |
200 BLDTOP="$PWD" | |
201 SRCTOP=`dirname ${FULL}` | |
202 | |
203 FILES=`( cd $SRCTOP ; find . -name "Makefile.generic" )` | |
204 for FILE in $FILES ; do | |
205 SRCFILE="$SRCTOP/$FILE" | |
206 BLDFILE="$BLDTOP/$FILE" | |
207 SRCDIR=`dirname $SRCFILE` | |
208 BLDDIR=`dirname $BLDFILE` | |
209 mkdir -p "$BLDDIR" | |
210 cat <<EOF >$BLDDIR/Makefile | |
211 VPATH = $SRCDIR | |
212 include $BLDTOP/Makefile.config | |
213 include \${VPATH}/Makefile.generic | |
214 EOF | |
215 done |