annotate configure @ 256:7520e2260097

- added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane - since no-execstack handling is now in build, remove .note.GNU-stack section markers (were of limites use, anyways, b/c unportable or implemented inconsistently across platforms) - some ToDo, etc. updates
author Tassilo Philipp
date Sat, 20 May 2017 00:02:59 +0200
parents 5cfe4322c500
children 8bb4618c18d8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 #!/bin/sh
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2
256
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
3 usage() {
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 cat <<EOF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 usage: $0 --<option>=<value> <var>=<value> ..
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 --prefix=<dir>
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 --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
9 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
10 targets
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 --sdk=<version> Mac OS X/iOS SDK version (e.g. '6.1' or '10.9.3')
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 Tested iOS SDK versions: 4.3, 6.1, 8.1
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 --sdkroot=<dir>
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15 Useful variables CC, CXX, CFLAGS, CXXFLAGS, etc..
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 EOF
256
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
18 }
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
19
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
20 C=Makefile.config
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
21
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
22 # get full path to this file (portable way), and set where to build
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
23 SRCTOP="`cd \`dirname "$0"\` && pwd`"
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
24 BLDTOP="$PWD"
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
25
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
26
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
27 printf "# auto-generated by $0\n" >$C
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
28
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
29 while [ $# -gt 0 ]; do
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
30 X=$1
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
31 shift 1
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
32 case $X in
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
33 # Shell common:
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
34 --help|-h|-?)
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
35 usage
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 exit 1
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38 # GNU Compatibility:
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39 --prefix=*)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40 PREFIX=`printf -- "${X}" | cut -c 10-`
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42 --target=*)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43 TARGET=`printf -- "${X}" | cut -c 10-`
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 --sdk=*)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46 SDK=`printf -- "${X}" | cut -c 7-`
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
48 --sdkroot=*)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
49 SDKROOT=`printf -- "${X}" | cut -c 11-`
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 # Environment variables:
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 [A-Za-z_]*=*)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
53 printf "${X}\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54 k=`printf "${X}" | cut -d = -f 1`
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55 v=`printf "${X}" | cut -d = -f 2`
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 export $k="$v"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
57 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58 # Others fail:
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59 *)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60 printf "error: invalid option ${X}\n" >&2
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61 exit 1
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
62 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
63 esac
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
64 done
256
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
65
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
66 printf "PREFIX=${PREFIX:=/usr/local}\n" >>$C
256
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
67
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
68 case ${TARGET:=`uname`} in
253
5cfe4322c500 - improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents: 222
diff changeset
69 Linux|GNU/kFreeBSD)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
70 if [ -z "${CFLAGS}" ]; then
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
71 printf "CFLAGS=-fPIC\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
72 fi
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
73 printf "LDLIBS=-lm -ldl\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
74 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
75 OpenBSD)
253
5cfe4322c500 - improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents: 222
diff changeset
76 if [ -z "${CFLAGS}" ]; then
5cfe4322c500 - improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents: 222
diff changeset
77 # dl_iterate_phdr() got introduced in 3.7, so for older versions force DL_DLADDR_TO_LIBPATH
5cfe4322c500 - improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents: 222
diff changeset
78 if (uname -r | grep '^\([0-2]\.\|3\.[0-6]\)' > /dev/null); then
5cfe4322c500 - improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents: 222
diff changeset
79 printf "CFLAGS=-fPIC -DDL_DLADDR_TO_LIBPATH\n" >>$C
5cfe4322c500 - improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents: 222
diff changeset
80 else
5cfe4322c500 - improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents: 222
diff changeset
81 printf "CFLAGS=-fPIC\n" >>$C
5cfe4322c500 - improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents: 222
diff changeset
82 fi
5cfe4322c500 - improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents: 222
diff changeset
83 fi
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
84 printf "LDLIBS=-lm\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
85 ;;
253
5cfe4322c500 - improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents: 222
diff changeset
86 NetBSD|DragonFly)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
87 if [ -z "${CFLAGS}" ]; then
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
88 printf "CFLAGS=-fPIC\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
89 fi
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
90 printf "LDLIBS=-lm\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
91 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
92 FreeBSD)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
93 if [ -z "${CFLAGS}" ]; then
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
94 printf "CFLAGS=-fPIC\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
95 fi
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
96 printf "LDLIBS=-lm\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
97 printf "RM=rm -f\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
98 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
99 MacOSX|Darwin)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
100 # if Apple's libtool (not to be confused with GNU's) is available, which is according to libtool(1) "with -static [...] intended
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
101 # 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
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
102 # intentionally used, and fall back to using 'ar rs' (the equivalent to 'libtool -static'), for compatibility:
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
103 if libtool -V >/dev/null 2>/dev/null; then # Apple's libtool has -V for version, which GNU does not.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
104 printf "AR=libtool\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
105 printf "ARFLAGS=-static -o\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
106 else
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
107 printf "AR=ar\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
108 printf "ARFLAGS=rs\n" >>$C # 's' is crucial for universal binary archives
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
109 fi
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
110 if [ `uname -n` = 'iPhone' ]; then # building on iPhone itself, uname yields Darwin (gcc setup for current/correct arch)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
111 printf "CC=gcc\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
112 elif [ -z ${SDK} ]; then
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
113 case `sw_vers -productVersion` in
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
114 10.4.*)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
115 ARCHS="-arch ppc -arch i386 -arch x86_64"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
116 ;;
5
52deacbdd2b1 - fix from MoarVM team and Tobi Leich for osx configure
cslag
parents: 0
diff changeset
117 10.5.*)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
118 ARCHS="-arch i386 -arch x86_64 -arch ppc"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
119 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
120 10.6.*)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
121 ARCHS="-arch i386 -arch x86_64"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
122 ;;
222
700c67984c08 - fix to configure for universal binary support for >= macos el capitan
Tassilo Philipp
parents: 170
diff changeset
123 10.[789].*|10.1?.*|10.1?)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
124 ARCHS="-arch x86_64 -arch i386"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
125 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
126 esac
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
127 printf "ASFLAGS=${ARCHS}\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
128 printf "CFLAGS=${ARCHS}\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
129 printf "CXXFLAGS=${ARCHS}\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
130 else
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
131 if [ -z ${SDKROOT} ]; then
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
132 SDKROOT="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${SDK}.sdk"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
133 fi
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
134 printf "CFLAGS=-isysroot ${SDKROOT}\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
135 printf "CXXFLAGS=-isysroot ${SDKROOT}\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
136 fi
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
137 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
138 iPhoneOS|iOS)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
139 if [ -z ${SDKROOT} ]; then
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
140 SDKROOT="`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDK}.sdk"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
141 fi
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
142 if [ -z "${ARCHS}" ]; then
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
143 case "${SDK}" in
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
144 [45].*)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
145 ARCHS="-arch armv6"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
146 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
147 [67].*)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
148 ARCHS="-arch armv7"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
149 ;;
53
e2519fb5f88d configure fixes for iOS 9
Daniel Adler <dadler@dyncall.org>
parents: 30
diff changeset
150 [89].*)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
151 ARCHS="-arch armv7 -arch arm64"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
152 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
153 esac
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
154 fi
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
155 printf "ARFLAGS=rs\n" >>$C # 's' is crucial for universal binary archives
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
156 printf "ASFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
157 printf "CFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
158 printf "CXXFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
159 printf "LDFLAGS=-Wl,-syslibroot ${SDKROOT}\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
160 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
161 iPhoneSimulator)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
162 if [ -z ${SDKROOT} ]; then
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
163 SDKROOT="`xcode-select -print-path`/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDK}.sdk"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
164 fi
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
165 ARCHS="-arch i386"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
166 printf "ASFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
167 printf "CFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
168 printf "CXXFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
169 printf "LDFLAGS=-Wl,-syslibroot ${SDKROOT}\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
170 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
171 SunOS)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
172 # open distributions often don't come with default cc and CC, check for common alternatives.
170
ee0de14d5da0 - fixed configure on SunOS
cslag
parents: 66
diff changeset
173 printf "CC=` (which cc gcc clang ) | grep -v '^no ' | head -1`\n" >>$C
ee0de14d5da0 - fixed configure on SunOS
cslag
parents: 66
diff changeset
174 printf "CXX=`(which CC g++ clang++) | grep -v '^no ' | head -1`\n" >>$C # C++ compiler traditionally named CC
ee0de14d5da0 - fixed configure on SunOS
cslag
parents: 66
diff changeset
175 printf "CCC=\${CXX}\n" >>$C # Sun make's rules use CCC for c++ compiler
253
5cfe4322c500 - improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents: 222
diff changeset
176 printf "LDLIBS=-lm -ldl\n" >>$C
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
177 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
178 Minix)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
179 printf "CC=gcc\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
180 printf "CXX=g++\n">>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
181 printf "AR=ar\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
182 ;;
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
183 PSP)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
184 SDKROOT="`psp-config --pspsdk-path`"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
185 printf "CC=psp-gcc\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
186 printf "CXX=psp-gcc\n">>$C # don't use psp-g++, buggy
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
187 printf "AR=psp-ar\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
188 printf "CFLAGS=-I${SDKROOT}/include/\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
189 printf "CXXFLAGS=-I${SDKROOT}/include/\n" >>$C
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
190 # Pulling in dyncall libs below is a hack, for some reason psp-ld is super-picky about order.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
191 # Use your C lib of choice, from the PSPSDK, or...
256
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
192 #printf "LDLIBS=-L${SDKROOT}/lib/ -L${SRCTOP}/dyncall -L${SRCTOP}/dyncallback -ldyncall_s -ldyncallback_s -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lstdc++ -lpsplibc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser \n" >>$C
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
193 # ... newlib.
256
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
194 printf "LDLIBS=-L${SDKROOT}/lib/ -L${SRCTOP}/dyncall -L${SRCTOP}/dyncallback -ldyncall_s -ldyncallback_s -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lstdc++ -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser \n" >>$C
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
195 ;;
30
c16bc7736bb4 - added configure (only sh-version) option to display list of settable targets
cslag
parents: 5
diff changeset
196 ?)
c16bc7736bb4 - added configure (only sh-version) option to display list of settable targets
cslag
parents: 5
diff changeset
197 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
198 exit 0
c16bc7736bb4 - added configure (only sh-version) option to display list of settable targets
cslag
parents: 5
diff changeset
199 ;;
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
200 esac
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
201
256
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
202
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
203 # Assure objects not asking for an execstack (or binary that links dyncall might end
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
204 # up with one, for no reason).
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
205
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
206 # We run our .s and .S files through $CC. GCC and others (annoyingly) assume without
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
207 # being told explicitly that an executable stack may be required for those.
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
208 # Trying to specify this per source via .section .note.GNU-stack,"",... turned out to
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
209 # be not consistently implemented across our supported platforms and toolchains, and
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
210 # thus not being portable (on some platforms even resulting in the opposite, the mere
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
211 # presence of this section, no matter the flags, creating an rwx stack).
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
212 # So, let's set the needed build flags by running a few tests, if we find any that
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
213 # work.
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
214
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
215 #determine_asflags() {
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
216 # AS_PROG=".global main\nmain:\n"
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
217 # echo "${AS_PROG}" | cc -xassembler -o rwxtest.d.out -
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
218 # echo "${AS_PROG}.section .note.GNU-stack,\"\"" | cc -xassembler -o rwxtest.s.out -
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
219 # echo "${AS_PROG}" | cc -xassembler -o rwxtest.f.out -Wa,--noexecstack -
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
220
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
221 # @@@ find solution for platforms without objdump
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
222 RWXTESTBIN="$BLDTOP/rwxtest.out" # @@@ put this maybe all in Makefile.generic? out of source builds?
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
223 STACKFLAGS=`make -f - <<MAKEFILE
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
224 include $C
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
225 t:
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
226 @(echo .global main;echo main:) | \\\${CC} -xassembler -o "$RWXTESTBIN" -Wa,--noexecstack -
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
227 @(which objdump && objdump -p "$RWXTESTBIN") | grep -A1 STACK | sed '1d;s/^.*flags //' | awk '{print \\\$1}'
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
228 MAKEFILE
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
229 `
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
230 rm "$RWXTESTBIN" 2>/dev/null
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
231 if [ "$STACKFLAGS" = "rw-" ]; then
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
232 # platforms differe here, so set them all
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
233 printf "ASFLAGS=-Wa,--noexecstack\n" >>$C # common on GNU
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
234 printf "ACFLAGS=-Wa,--noexecstack\n" >>$C # specifically for .S.o
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
235 printf "AFLAGS=--noexecstack\n" >>$C # for direct assembler invocation
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
236 fi
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
237
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
238 #if echo ".global main\nmain:\n" | cc -xassembler -o rwxtest.f.out -Wa,--noexecstack -
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
239 #(which objdump && objdump -p rwxtest.f.out || echo stack flags lookup_err) | grep -i -A1 stack | grep 'flags.*' | sed 's/^.*flags //'
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
240 #}
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
241
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
242 #printf "ACFLAGS=-Wa,--noexecstack\n" >>$C
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
243 #printf "AFLAGS=--noexecstack\n" >>$C
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
244
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
245
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
246 # Generate all makefiles needed
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
247
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
248 FILES=`( cd $SRCTOP ; find . -name "Makefile.generic" )`
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
249 for FILE in $FILES ; do
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
250 SRCFILE="$SRCTOP/$FILE"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
251 BLDFILE="$BLDTOP/$FILE"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
252 SRCDIR=`dirname $SRCFILE`
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
253 BLDDIR=`dirname $BLDFILE`
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
254 mkdir -p "$BLDDIR"
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
255 cat <<EOF >$BLDDIR/Makefile
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
256 VPATH = $SRCDIR
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
257 include $BLDTOP/Makefile.config
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
258 include \${VPATH}/Makefile.generic
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
259 EOF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
260 done
256
7520e2260097 - added to configure some detection on how to compile .s/.S with --noexecstack (or similar), as compilers' defaults are often insane
Tassilo Philipp
parents: 253
diff changeset
261