Mercurial > pub > dyncall > dyncall
annotate configure @ 520:bb4933eab7d6
- call_suite_aggrs: makefile fix
| author | Tassilo Philipp |
|---|---|
| date | Mon, 11 Apr 2022 22:49:04 +0200 |
| parents | 09aaa2e774cd |
| children | fe31a2e3ac90 |
| rev | line source |
|---|---|
| 0 | 1 #!/bin/sh |
| 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 | 4 cat <<EOF |
| 5 usage: $0 --<option>=<value> <var>=<value> .. | |
| 6 | |
| 7 --prefix=<dir> | |
| 326 | 8 --target=<platform> uname/special targets: macos,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 | 11 --sdk=<version> Mac OS X/iOS SDK version (e.g. '6.1' or '10.9.3') |
| 12 Tested iOS SDK versions: 4.3, 6.1, 8.1 | |
| 13 --sdkroot=<dir> | |
| 14 | |
| 15 Useful variables CC, CXX, CFLAGS, CXXFLAGS, etc.. | |
| 16 | |
| 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 | 36 exit 1 |
| 37 ;; | |
| 38 # GNU Compatibility: | |
| 39 --prefix=*) | |
| 40 PREFIX=`printf -- "${X}" | cut -c 10-` | |
| 41 ;; | |
| 42 --target=*) | |
| 43 TARGET=`printf -- "${X}" | cut -c 10-` | |
| 44 ;; | |
| 45 --sdk=*) | |
| 46 SDK=`printf -- "${X}" | cut -c 7-` | |
| 47 ;; | |
| 48 --sdkroot=*) | |
| 49 SDKROOT=`printf -- "${X}" | cut -c 11-` | |
| 50 ;; | |
| 51 # Environment variables: | |
| 52 [A-Za-z_]*=*) | |
| 53 printf "${X}\n" >>$C | |
| 54 k=`printf "${X}" | cut -d = -f 1` | |
| 55 v=`printf "${X}" | cut -d = -f 2` | |
| 56 export $k="$v" | |
| 57 ;; | |
| 58 # Others fail: | |
| 59 *) | |
| 60 printf "error: invalid option ${X}\n" >&2 | |
| 61 exit 1 | |
| 62 ;; | |
| 63 esac | |
| 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 | 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 | 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 | 70 if [ -z "${CFLAGS}" ]; then |
| 71 printf "CFLAGS=-fPIC\n" >>$C | |
| 72 fi | |
| 73 printf "LDLIBS=-lm -ldl\n" >>$C | |
| 74 ;; | |
| 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 | 84 printf "LDLIBS=-lm\n" >>$C |
| 85 ;; | |
|
253
5cfe4322c500
- improved support for older OS versions for dynloads dlGetLibraryPath
Tassilo Philipp
parents:
222
diff
changeset
|
86 NetBSD|DragonFly) |
| 0 | 87 if [ -z "${CFLAGS}" ]; then |
| 88 printf "CFLAGS=-fPIC\n" >>$C | |
| 89 fi | |
| 90 printf "LDLIBS=-lm\n" >>$C | |
| 91 ;; | |
| 92 FreeBSD) | |
| 93 if [ -z "${CFLAGS}" ]; then | |
|
298
b69f328cdfe6
- simpler ./configure check if freebsd/mips platform is hard-float
Tassilo Philipp
parents:
296
diff
changeset
|
94 if [ `uname -m` = "mips" ] && make -V MACHINE_ARCH | grep 'hf$' >/dev/null 2>&1; then |
| 326 | 95 # FBSD12-CURRENT/mipshf needs to be told explicitly to use -mhard-float (at least as of may 2018) |
|
296
e6bd998b0308
- FBSD12-CURRENT/mipshf needs to be told explicitly to use -mhard_float (at least as of may 2018)
Tassilo Philipp
parents:
294
diff
changeset
|
96 printf "CFLAGS=-fPIC -mhard-float\n" >>$C |
|
e6bd998b0308
- FBSD12-CURRENT/mipshf needs to be told explicitly to use -mhard_float (at least as of may 2018)
Tassilo Philipp
parents:
294
diff
changeset
|
97 else |
|
e6bd998b0308
- FBSD12-CURRENT/mipshf needs to be told explicitly to use -mhard_float (at least as of may 2018)
Tassilo Philipp
parents:
294
diff
changeset
|
98 printf "CFLAGS=-fPIC\n" >>$C |
|
e6bd998b0308
- FBSD12-CURRENT/mipshf needs to be told explicitly to use -mhard_float (at least as of may 2018)
Tassilo Philipp
parents:
294
diff
changeset
|
99 fi |
| 0 | 100 fi |
| 101 printf "LDLIBS=-lm\n" >>$C | |
| 102 printf "RM=rm -f\n" >>$C | |
| 103 ;; | |
| 326 | 104 MacOSX|macos|Darwin) |
| 0 | 105 # if Apple's libtool (not to be confused with GNU's) is available, which is according to libtool(1) "with -static [...] intended |
| 106 # 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 | |
| 107 # intentionally used, and fall back to using 'ar rs' (the equivalent to 'libtool -static'), for compatibility: | |
| 108 if libtool -V >/dev/null 2>/dev/null; then # Apple's libtool has -V for version, which GNU does not. | |
| 109 printf "AR=libtool\n" >>$C | |
| 110 printf "ARFLAGS=-static -o\n" >>$C | |
| 111 else | |
| 112 printf "AR=ar\n" >>$C | |
| 113 printf "ARFLAGS=rs\n" >>$C # 's' is crucial for universal binary archives | |
| 114 fi | |
| 115 if [ `uname -n` = 'iPhone' ]; then # building on iPhone itself, uname yields Darwin (gcc setup for current/correct arch) | |
| 116 printf "CC=gcc\n" >>$C | |
| 117 elif [ -z ${SDK} ]; then | |
| 118 case `sw_vers -productVersion` in | |
|
307
d2c8ea3ef2ed
better MacOS Mojave support in ./configure (Mojave dropped i386 builds)
Tassilo Philipp
parents:
298
diff
changeset
|
119 10.4.*) # == tiger (10.4.*) |
| 0 | 120 ARCHS="-arch ppc -arch i386 -arch x86_64" |
| 121 ;; | |
|
307
d2c8ea3ef2ed
better MacOS Mojave support in ./configure (Mojave dropped i386 builds)
Tassilo Philipp
parents:
298
diff
changeset
|
122 10.5.*) # == leopard (10.5.*) |
| 0 | 123 ARCHS="-arch i386 -arch x86_64 -arch ppc" |
| 124 ;; | |
|
307
d2c8ea3ef2ed
better MacOS Mojave support in ./configure (Mojave dropped i386 builds)
Tassilo Philipp
parents:
298
diff
changeset
|
125 10.6.*) # == snow leopard (10.6.*) |
|
d2c8ea3ef2ed
better MacOS Mojave support in ./configure (Mojave dropped i386 builds)
Tassilo Philipp
parents:
298
diff
changeset
|
126 ARCHS="-arch i386 -arch x86_64" # no more ppc |
| 0 | 127 ;; |
|
307
d2c8ea3ef2ed
better MacOS Mojave support in ./configure (Mojave dropped i386 builds)
Tassilo Philipp
parents:
298
diff
changeset
|
128 10.[789].*|10.1[0123].*|10.1[0123]) # >= lion (10.7.*), <= high sierra (10.13.*) |
| 0 | 129 ARCHS="-arch x86_64 -arch i386" |
| 130 ;; | |
|
307
d2c8ea3ef2ed
better MacOS Mojave support in ./configure (Mojave dropped i386 builds)
Tassilo Philipp
parents:
298
diff
changeset
|
131 10.1?.*|10.1?) # >= mojave (10.14.*) |
|
d2c8ea3ef2ed
better MacOS Mojave support in ./configure (Mojave dropped i386 builds)
Tassilo Philipp
parents:
298
diff
changeset
|
132 ARCHS="-arch x86_64" # mojave is final os to run x86 code, but removed build support for it |
|
d2c8ea3ef2ed
better MacOS Mojave support in ./configure (Mojave dropped i386 builds)
Tassilo Philipp
parents:
298
diff
changeset
|
133 ;; |
| 0 | 134 esac |
| 135 printf "ASFLAGS=${ARCHS}\n" >>$C | |
| 136 printf "CFLAGS=${ARCHS}\n" >>$C | |
| 137 printf "CXXFLAGS=${ARCHS}\n" >>$C | |
| 138 else | |
| 139 if [ -z ${SDKROOT} ]; then | |
| 140 SDKROOT="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${SDK}.sdk" | |
| 141 fi | |
| 142 printf "CFLAGS=-isysroot ${SDKROOT}\n" >>$C | |
| 143 printf "CXXFLAGS=-isysroot ${SDKROOT}\n" >>$C | |
| 144 fi | |
| 145 ;; | |
| 146 iPhoneOS|iOS) | |
| 147 if [ -z ${SDKROOT} ]; then | |
| 148 SDKROOT="`xcode-select -print-path`/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS${SDK}.sdk" | |
| 149 fi | |
| 150 if [ -z "${ARCHS}" ]; then | |
| 151 case "${SDK}" in | |
| 152 [45].*) | |
| 153 ARCHS="-arch armv6" | |
| 154 ;; | |
| 155 [67].*) | |
| 156 ARCHS="-arch armv7" | |
| 157 ;; | |
|
294
1032015f77ee
- ./configure arch detection support for newer iOS SDK versions (10+)
Tassilo Philipp
parents:
267
diff
changeset
|
158 [89].*|1[0-9].*) |
| 0 | 159 ARCHS="-arch armv7 -arch arm64" |
| 160 ;; | |
| 161 esac | |
| 162 fi | |
| 163 printf "ARFLAGS=rs\n" >>$C # 's' is crucial for universal binary archives | |
| 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 iPhoneSimulator) | |
| 170 if [ -z ${SDKROOT} ]; then | |
| 171 SDKROOT="`xcode-select -print-path`/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator${SDK}.sdk" | |
| 172 fi | |
| 173 ARCHS="-arch i386" | |
| 174 printf "ASFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
| 175 printf "CFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
| 176 printf "CXXFLAGS=${ARCHS} -isysroot ${SDKROOT}\n" >>$C | |
| 177 printf "LDFLAGS=-Wl,-syslibroot ${SDKROOT}\n" >>$C | |
| 178 ;; | |
| 179 SunOS) | |
| 180 # open distributions often don't come with default cc and CC, check for common alternatives. | |
| 170 | 181 printf "CC=` (which cc gcc clang ) | grep -v '^no ' | head -1`\n" >>$C |
| 182 printf "CXX=`(which CC g++ clang++) | grep -v '^no ' | head -1`\n" >>$C # C++ compiler traditionally named CC | |
| 183 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
|
184 printf "LDLIBS=-lm -ldl\n" >>$C |
| 0 | 185 ;; |
| 186 Minix) | |
| 187 printf "CC=gcc\n" >>$C | |
| 188 printf "CXX=g++\n">>$C | |
| 189 printf "AR=ar\n" >>$C | |
| 190 ;; | |
| 191 PSP) | |
| 192 SDKROOT="`psp-config --pspsdk-path`" | |
| 193 printf "CC=psp-gcc\n" >>$C | |
| 194 printf "CXX=psp-gcc\n">>$C # don't use psp-g++, buggy | |
| 195 printf "AR=psp-ar\n" >>$C | |
| 196 printf "CFLAGS=-I${SDKROOT}/include/\n" >>$C | |
| 197 printf "CXXFLAGS=-I${SDKROOT}/include/\n" >>$C | |
| 198 # Pulling in dyncall libs below is a hack, for some reason psp-ld is super-picky about order. | |
| 199 # 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
|
200 #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 | 201 # ... 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
|
202 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 | 203 ;; |
|
30
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
204 ?) |
|
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
205 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
|
206 exit 0 |
|
c16bc7736bb4
- added configure (only sh-version) option to display list of settable targets
cslag
parents:
5
diff
changeset
|
207 ;; |
| 0 | 208 esac |
| 209 | |
|
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
|
210 |
|
267
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
211 # removed, b/c platform support not consistent and ELF flags checked often not having any result |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
212 # |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
213 ## Assure objects not asking for an execstack (or binary that links dyncall might end |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
214 ## up with one, for no reason). |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
215 # |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
216 ## .s.o/.S.o rules often use ${CC} which then invokes the tools needed. GCC and |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
217 ## others might (annoyingly) assume that an executable stack may be required for |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
218 ## those sources, if not told explicitly that it isn't. |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
219 ## Neither specifying this per source (e.g. via .section .note.GNU-stack,"",...), nor |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
220 ## per toolchain flags (e.g. as' --noexecstack) turned out to be portable across our |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
221 ## supported platforms, toolchains, and different versions of the latter (some even |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
222 ## producing the opposite result). |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
223 ## Find needed build flags by running a few tests; use default if none result in "rw-". |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
224 # |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
225 #RWXTESTPREFIX="rwxtest" # @@@ put this maybe all in Makefile.generic? out of source builds? |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
226 #for s in S s ; do ( |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
227 # cd "$BLDTOP" |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
228 # # asm test file, with main and _main for portability. |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
229 # (echo '.text';(echo '.globl main';echo 'main:') | sed 'p;s/m/_m/') > $RWXTESTPREFIX.$s |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
230 # |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
231 # # Check var to be used, which depends on inference rules of this platform. E.g. ASFLAGS is only common on GNU, and |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
232 # # on some other platforms only CFLAGS is the only one used, others use AFLAGS with cc and thus need -Wa,... Check |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
233 # # makes use of the config written so far, so use '+=' to not overwrite vars. |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
234 # for f in "" "ASFLAGS+=-Wa,--noexecstack" "ACFLAGS+=-Wa,--noexecstack" "AFLAGS+=--noexecstack" "AFLAGS+=-Wa,--noexecstack" "CFLAGS+=-Wa,--noexecstack"; do |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
235 # # dummy makefile triggering inference rules, reflecting dyncall's build |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
236 # make -f - <<MAKEFILE |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
237 #include $C |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
238 #$f |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
239 ## Force dependency via .o, to avoid .[sS].out rules that might be set - also set command as not all platforms set .o.out |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
240 #$RWXTESTPREFIX.out: $RWXTESTPREFIX.o |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
241 # \${CC} \${CFLAGS} \${LDFLAGS} $RWXTESTPREFIX.o \${LDLIBS} -o $RWXTESTPREFIX.out |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
242 #MAKEFILE |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
243 # |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
244 # # Check what stack of a built test binary would result in. |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
245 ## @@@ add xxd hexdump based versions for when objdump is not available; also check for those if we deal with ELF files |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
246 ## @@@ maybe also limit to ELF files |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
247 # STACKFLAGS=`(which objdump && objdump -p $RWXTESTPREFIX.out) | sed -e '/STACK/bx' -e 'd' -e ':x' -e 'N' -e 's/^.*flags[ \t]\([^ \t]*\).*/\1/'` |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
248 # rm $RWXTESTPREFIX.out $RWXTESTPREFIX.o |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
249 # if [ "$STACKFLAGS" = "rw-" ]; then |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
250 # printf "$f\n" |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
251 # break |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
252 # fi |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
253 # |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
254 # done |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
255 # |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
256 # rm $RWXTESTPREFIX.$s |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
257 # |
|
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
258 #) done 2>&1 | grep '^[ASC]\+FLAGS.*noexecstack$' | uniq >>$C |
|
258
943c182692e2
- configure: noexecstack flag check/search now reflecting what dyncall build needs/does
Tassilo Philipp
parents:
257
diff
changeset
|
259 |
|
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
|
260 |
|
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 |
|
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
|
262 # Generate all makefiles needed |
| 0 | 263 |
| 264 FILES=`( cd $SRCTOP ; find . -name "Makefile.generic" )` | |
| 265 for FILE in $FILES ; do | |
| 266 SRCFILE="$SRCTOP/$FILE" | |
| 267 BLDFILE="$BLDTOP/$FILE" | |
| 268 SRCDIR=`dirname $SRCFILE` | |
| 269 BLDDIR=`dirname $BLDFILE` | |
| 270 mkdir -p "$BLDDIR" | |
| 271 cat <<EOF >$BLDDIR/Makefile | |
| 272 VPATH = $SRCDIR | |
| 273 include $BLDTOP/Makefile.config | |
| 274 include \${VPATH}/Makefile.generic | |
| 275 EOF | |
| 276 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
|
277 |
|
267
f8fe0f87b7c1
- removed configure-based checks for using --noexecstack / -Wa,--noexecstack in make A{S,C,}FLAGS variables, b/c inconsistent behaviour across platforms and often unusable, b/c:
Tassilo Philipp
parents:
266
diff
changeset
|
278 echo "Configuration written to $C" |
|
258
943c182692e2
- configure: noexecstack flag check/search now reflecting what dyncall build needs/does
Tassilo Philipp
parents:
257
diff
changeset
|
279 |
